Skip to content

Commit

Permalink
[fix](protocol) CLIENT_MULTI_STATEMENTS not used actually (#39308) (#…
Browse files Browse the repository at this point in the history
…39370)

pick #39308 to branch-2.1
  • Loading branch information
cambyzju authored Aug 15, 2024
1 parent 1accde9 commit 265bf9d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
11 changes: 11 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ public class MysqlChannel implements BytesChannel {
// mysql flag CLIENT_DEPRECATE_EOF
private boolean clientDeprecatedEOF;

// mysql flag CLIENT_MULTI_STATEMENTS
private boolean clientMultiStatements;

private ConnectContext context;

protected MysqlChannel() {
Expand All @@ -95,6 +98,14 @@ public boolean clientDeprecatedEOF() {
return clientDeprecatedEOF;
}

public void setClientMultiStatements() {
clientMultiStatements = true;
}

public boolean clientMultiStatements() {
return clientMultiStatements;
}

public MysqlChannel(StreamConnection connection, ConnectContext context) {
Preconditions.checkNotNull(connection);
this.sequenceId = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ public static boolean negotiate(ConnectContext context) throws IOException {
if (capability.isDeprecatedEOF()) {
context.getMysqlChannel().setClientDeprecatedEOF();
}

// we do not save client capability to context, so here we save CLIENT_MULTI_STATEMENTS to MysqlChannel
if (capability.isClientMultiStatements()) {
context.getMysqlChannel().setClientMultiStatements();
}

MysqlAuthPacket authPacket = new MysqlAuthPacket();
if (!authPacket.readFrom(handshakeResponse)) {
ErrorReport.report(ErrorCode.ERR_NOT_SUPPORTED_AUTH_MODE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public void executeQuery(MysqlCommand mysqlCommand, String originStmt) throws Ex
// when client not request CLIENT_MULTI_STATEMENTS, mysql treat all query as
// single statement. Doris treat it with multi statement, but only return
// the last statement result.
if (getConnectContext().getCapability().isClientMultiStatements()) {
if (getConnectContext().getMysqlChannel().clientMultiStatements()) {
finalizeCommand();
}
}
Expand Down

0 comments on commit 265bf9d

Please sign in to comment.