Skip to content

Commit

Permalink
session var
Browse files Browse the repository at this point in the history
  • Loading branch information
eldenmoon committed Apr 30, 2024
1 parent b50987f commit 798a9e0
Showing 1 changed file with 35 additions and 29 deletions.
64 changes: 35 additions & 29 deletions fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,39 @@ private void handleFieldList() throws IOException {
ctx.getState().setEof();
}

private void handleServerSidePreparedStmt(MysqlCommand command) {
// handle server prepared command
// reference https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_command_phase_ps.html
switch (command) {
case COM_STMT_EXECUTE:
handleExecute();
break;
case COM_STMT_CLOSE:
handleStmtClose();
break;
case COM_STMT_RESET:
handleStmtReset();
break;
case COM_STMT_PREPARE:
ctx.initTracer("trace");
Span rootSpan = ctx.getTracer().spanBuilder("handleQuery").setNoParent().startSpan();
try (Scope scope = rootSpan.makeCurrent()) {
handleQuery(command);
} catch (Exception e) {
rootSpan.recordException(e);
throw e;
} finally {
rootSpan.end();
}
break;
default:
ctx.getState().setError(ErrorCode.ERR_UNKNOWN_COM_ERROR,
"Unsupported command(" + command + ")");
LOG.warn("Unsupported command(" + command + ")");
return;
}
}

private void dispatch() throws IOException {
int code = packetBuf.get();
MysqlCommand command = MysqlCommand.fromCode(code);
Expand Down Expand Up @@ -590,35 +623,8 @@ private void dispatch() throws IOException {
break;
default:
if (ctx.getSessionVariable().enableServeSidePreparedStatement) {
// handle server prepared command
// reference https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_command_phase_ps.html
switch (command) {
case COM_STMT_EXECUTE:
handleExecute();
break;
case COM_STMT_CLOSE:
handleStmtClose();
break;
case COM_STMT_RESET:
handleStmtReset();
break;
case COM_STMT_PREPARE:
ctx.initTracer("trace");
Span rootSpan = ctx.getTracer().spanBuilder("handleQuery").setNoParent().startSpan();
try (Scope scope = rootSpan.makeCurrent()) {
handleQuery(command);
} catch (Exception e) {
rootSpan.recordException(e);
throw e;
} finally {
rootSpan.end();
}
break;
default:
ctx.getState().setError(ErrorCode.ERR_UNKNOWN_COM_ERROR, "Unsupported command(" + command + ")");
LOG.warn("Unsupported command(" + command + ")");
break;
}
handleServerSidePreparedStmt(command);
break;
}
ctx.getState().setError(ErrorCode.ERR_UNKNOWN_COM_ERROR, "Unsupported command(" + command + ")");
LOG.warn("Unsupported command(" + command + ")");
Expand Down

0 comments on commit 798a9e0

Please sign in to comment.