Conversation
Co-authored-by: stdpain <34912776+stdpain@users.noreply.github.com>
Co-authored-by: stdpain <34912776+stdpain@users.noreply.github.com>
Co-authored-by: stdpain <34912776+stdpain@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix improper handling of graceful exits in MySQLReadListener
[BugFix] Fix graceful exit handling in MySQLReadListener to preserve pre-query SQL connections
Jan 14, 2026
Contributor
|
@cursor review |
gengjun-git
previously approved these changes
Jan 15, 2026
|
Contributor
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
Contributor
[FE Incremental Coverage Report]✅ pass : 8 / 8 (100.00%) file detail
|
Contributor
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
trueeyu
approved these changes
Jan 16, 2026
gengjun-git
approved these changes
Jan 16, 2026
Contributor
|
@Mergifyio backport branch-4.0 |
Contributor
|
@Mergifyio backport branch-4.1 |
Contributor
✅ Backports have been createdDetails
|
Contributor
✅ Backports have been createdDetails
|
24 tasks
24 tasks
farhad-celo
pushed a commit
to farhad-celo/starrocks
that referenced
this pull request
Jan 20, 2026
…pre-query SQL connections (StarRocks#67917) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stdpain <34912776+stdpain@users.noreply.github.com> Co-authored-by: stdpain <drfeng08@gmail.com> Signed-off-by: Farhad Shahmohammadi <f.shahmohammadi@celonis.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Why I'm doing:
During graceful exit (leader transfer),
MySQLReadListenerwas terminating all connections after query execution, breaking JDBC clients that send initialization queries likeselect @@query_timeoutbefore actual user queries.What I'm doing:
Added
isTerminated()method with graceful exit awareness:Refactored
handleRequest()to useisTerminated()instead of directterminatedflag check.Added unit tests covering terminated flag, graceful exit scenarios, null safety, and pre-query SQL types (SET statements, connection_id(), query_timeout).
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check:
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
mirror.iscas.ac.cn/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.12/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.12/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.12 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.12/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/starrocks/starrocks/fe/fe-core org.codehaus.plexus.classworlds.launcher.Launcher test-compile -Dtest=MySQLReadListenerTest(dns block)repository.cloudera.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.12/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.12/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.12 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.12/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/starrocks/starrocks/fe/fe-core org.codehaus.plexus.classworlds.launcher.Launcher test-compile -Dtest=MySQLReadListenerTest(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Note
Improves connection termination behavior during leader transfer to avoid dropping JDBC initialization queries.
isTerminated()that returns true ifterminated, false if executor is null, and duringGracefulExitFlag.isGracefulExit()only terminates when last stmt is not pre-query viaSqlUtils.isPreQuerySQLhandleRequest()to useisTerminated()instead of checkingterminateddirectlyselect @@query_timeout,set query_timeout=...,select connection_id())Written by Cursor Bugbot for commit d484e78. This will update automatically on new commits. Configure here.