Skip to content

Commit

Permalink
[BugFix] Fix an issue When connection failed, CloseListener was not e…
Browse files Browse the repository at this point in the history
…xecuted. (#46164)

Why I'm doing:
When MysqlProto. SendResponsePacket executed failed, CloseListener is not registered, then connectionMap unable to remove the connection

Signed-off-by: edwinhzhang <[email protected]>
(cherry picked from commit 25ae3ad)

# Conflicts:
#	fe/fe-core/src/main/java/com/starrocks/mysql/nio/AcceptListener.java
  • Loading branch information
zhangheihei authored and mergify[bot] committed May 26, 2024
1 parent 411c8b8 commit 2320490
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,17 @@ public void handleEvent(AcceptingChannel<StreamConnection> channel) {
if (!MysqlProto.negotiate(context)) {
throw new AfterConnectedException("mysql negotiate failed");
}
<<<<<<< HEAD
Pair<Boolean, String> result = connectScheduler.registerConnection(context);
if (result.first) {
MysqlProto.sendResponsePacket(context);
=======
Pair<Boolean, String> registerResult = connectScheduler.registerConnection(context);
if (registerResult.first) {
>>>>>>> 25ae3ad80e ([BugFix] Fix an issue When connection failed, CloseListener was not executed. (#46164))
connection.setCloseListener(
streamConnection -> connectScheduler.unregisterConnection(context));
MysqlProto.sendResponsePacket(context);
} else {
context.getState().setError(result.second);
MysqlProto.sendResponsePacket(context);
Expand Down

0 comments on commit 2320490

Please sign in to comment.