Repository navigation
Filter offline DataNode URLs and add Java client seed fallback - #18920
Closed
JackieTien97 wants to merge 1 commit into
Closed
JackieTien97 wants to merge 1 commit into
JackieTien97 wants to merge 1 commit into
Conversation
5 tasks done
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.
Superseded by #18921, which uses the branch in
apache/iotdb. The implementation and validation are unchanged.Description
Related to #18633.
SHOW AVAILABLE URLScurrently includesUnknownandStoppedDataNodes. Java SDK auto-discovery puts these addresses into the normal query rotation, so a persistently unreachable node can repeatedly add a connection timeout to otherwise successful queries. This change filters offline nodes on the server and preserves the client's initial addresses as recovery seeds.Rolling restart scenario
A client can discover only nodes 2 and 3 while node 1 is stopped. Node 1 may recover before the next successful discovery refresh, while subsequent connection attempts to the cached nodes fail during maintenance. Filtering the server response alone leaves both business reconnection and background discovery dependent on the same stale list, even though node 1 is reachable again.
The client now tries the discovered endpoints first, then falls back to the initial
nodeUrls. If node 1 was configured as a seed, it remains a recovery candidate after being omitted from a discovery snapshot. A successful business reconnection through a seed requests a prompt background refresh so recovered nodes can re-enter normal routing.Implementation
UnknownandStoppedfromSHOW AVAILABLE URLS, continue excludingRemoving, and retainRunningandReadOnlynodes.SessionConnection.reconnect()andNodesSupplier.run(). Deduplicate addresses within each attempt round and retain the existing bounded business reconnection rounds.Recovery still requires a reachable configured seed when all discovered endpoints fail. The seed fallback requires the updated Java SDK. This change does not add endpoint backoff for nodes that the server reports as
Runningbut that are unreachable from a particular client.Validation
Validated on JDK 17:
ShowAvailableUrlsTaskTesttests. Coverage includes seed recovery, discovered-node priority, empty snapshots, duplicate addresses, bounded retries, caller mutation, refresh coalescing, and concurrent query selection during refresh.SessionSeedNodeFallbackITtests passed on a real 1 ConfigNode / 3 DataNode cluster:testQueriesDuringRollingRestart: Session and SessionPool queries return the expected data before and after each DataNode is stopped and restarted; discovery excludes stopped nodes and restores recovered nodes.testBusinessAndBackgroundRecoveryThroughOmittedSeed: freeze periodic discovery, recover an omitted seed, make the two cached endpoints unavailable (UnknownandStopped), and verify business reconnection with a metadata query and independent background discovery recovery through the seed.mvn test-compile -DskipTestsandmvn test-compile -DskipTests -P with-zh-localepassed.Validation notes: RAT remained enabled; a local excludes file omitted five pre-existing untracked SVG files outside this PR. The rolling-restart test tolerates
IoTDBConnectionExceptiononly when closing stale sessions during cleanup. Query and discovery failures are not ignored; production close behavior is unchanged.This PR has:
Key changed/added classes
ShowAvailableUrlsTask,INodeSupplier,NodesSupplier,SessionConnection,Session,SessionPool,ShowAvailableUrlsTaskTest,SessionSeedNodeFallbackTest, andSessionSeedNodeFallbackIT.