[JDBC] Respect interrupt while waiting for engine launch#7527
Open
ruanwenjun wants to merge 3 commits into
Open
[JDBC] Respect interrupt while waiting for engine launch#7527ruanwenjun wants to merge 3 commits into
ruanwenjun wants to merge 3 commits into
Conversation
Member
Author
Contributor
|
LGTM |
Contributor
|
LGTM 👍 Just a nit (non-blocking): isInterrupted(Throwable) and the test's hasCause(...) both hand-roll a cause-chain walk. Since commons-lang3 is already a dependency here (this file already imports StringUtils/ClassUtils from it), we could reuse ExceptionUtils and drop both helpers: // import org.apache.commons.lang3.exception.ExceptionUtils;
ExceptionUtils.indexOfType(e, InterruptedException.class) >= 0Same semantics, ~20 fewer lines, removes the duplicated logic between main and test. |
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 are the changes needed?
JDBC clients can block inside
KyuubiConnectionconstruction while waiting for engine launch. If the caller cancels that connection attempt withThread.interrupt(), the wait loop previously kept polling and the caller still had no returnedConnectionobject to close.This patch makes the launch wait path honor interruption by converting it to a typed JDBC exception,
KyuubiInterruptedException. The interrupt status is intentionally consumed before the exception reaches the caller, and comments explain that the caller receives the typed exception while the current thread is not interrupted.The patch also keeps
SQLExceptionsubclasses intact whenKyuubiDataSourcecreates a connection, so callers can distinguish the interrupted launch path.How was this patch tested?
./build/mvn -pl kyuubi-hive-jdbc -am spotless:apply./build/mvn -pl kyuubi-hive-jdbc -am -Dtest=KyuubiConnectionTest,KyuubiStatementTest,TestJdbcDriver,TestKyuubiPreparedStatement,UtilsTest,ZooKeeperHiveClientHelperTest -DwildcardSuites=none testgit diff --checkAlso attempted
dev/reformat, but the full repo reformat is blocked in this local environment because Spotless expectsblack 22.3.0while the installed executable isblack 25.1.0.Was this patch authored or co-authored using generative AI tooling?
Assisted-by: OpenAI Codex: GPT-5