[client] Introduce dedicated client.lookup.close-timeout config option#3774
Open
XuQianJin-Stars wants to merge 1 commit into
Open
[client] Introduce dedicated client.lookup.close-timeout config option#3774XuQianJin-Stars wants to merge 1 commit into
XuQianJin-Stars wants to merge 1 commit into
Conversation
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.
Purpose
LookupClient#close(Duration timeout)already accepts aDurationparameter,but the only caller in
FlussConnection#close()was hard-codingDuration.ofMillis(Long.MAX_VALUE)to let pending lookup requests drain.That hard-coded value is undesirable in K8s / graceful-shutdown scenarios
where the client must finish within a bounded budget (e.g. before SIGTERM
SIGKILL grace period elapses), and it is also harder to tune per-deployment.
This PR introduces a dedicated, user-tunable config option
client.lookup.close-timeoutand wires it through the only existing caller,while keeping the public
LookupClient#close(Duration)signature intact sothat no downstream code is broken.
Linked issue: N/A (usability / K8s shutdown observability improvement)
Brief change log
ConfigOption<Duration> CLIENT_LOOKUP_CLOSE_TIMEOUT(
client.lookup.close-timeout) influss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java,with default value
Long.MAX_VALUE(preserves previous behavior) and ajavadoc-style description explaining the K8s / SIGTERM use case.
FlussConnection#close()influss-client/src/main/java/org/apache/fluss/client/FlussConnection.java:read the new option from the connection's
Configurationand pass it tolookupClient.close(...)instead of the hard-codedDuration.ofMillis(Long.MAX_VALUE). The previous comment is updated toreflect the new behavior.
LookupClient#close(Duration)itself — its publicsignature is preserved, so existing direct callers keep working.
fluss-client/src/test/java/org/apache/fluss/client/lookup/LookupClientCloseTest.javacovering 5 close-timeout scenarios (see Tests).
Tests
LookupClientCloseTest#testCloseWithVeryShortTimeoutReturnsNormally— closesa fresh
LookupClientwithDuration.ofMillis(1); asserts no exception isthrown and no
InterruptedExceptionleaks.LookupClientCloseTest#testCloseWithZeroTimeoutReturnsNormally— closeswith
Duration.ZERO; verifies the API tolerates a zero-duration close.LookupClientCloseTest#testCloseWithLargeTimeoutReturnsNormally— closeswith
Duration.ofSeconds(5); sanity check for the normal happy-pathduration.
LookupClientCloseTest#testCloseIsIdempotent— closes the same clienttwice in a row; verifies the second call also returns without error.
LookupClientCloseTest#testDefaultCloseTimeoutConfigValue— asserts thedefault value of
CLIENT_LOOKUP_CLOSE_TIMEOUTisDuration.ofMillis(Long.MAX_VALUE), locking in backwards compatibility.All 5 tests are unit tests (no real cluster required); they build a
LookupClientvia aTestingMetadataUpdater. Pre-existingfluss-clienttests are unaffected — no regression observed locally.API and Format
LookupClient#close(Duration)keepsthe same signature.
AGENTS.md §8 Configuration Patterns:
durationType(),explicit
defaultValue(...), javadocwithDescription(...),hierarchical key
client.lookup.close-timeout.mvn spotless:applyclean.var, noOptional.isEmpty, noList.of.assertThat(...).isEqualTo(...)/assertThatCode(...).doesNotThrowAnyException()).[client] Introduce dedicated client.lookup.close-timeout config optionfollows the<component>prefix convention../mvnw clean install -DskipTests -T 32passes locally on JDK11.0.23-kona.Documentation
withDescriptionalready documents the K8sSIGTERM use case, so it will be picked up by the doc generator
(
./mvnw -pl fluss-docgen verify) automatically.config reference entry.