fix(pd): keep KvClient watches alive after reconnect failures - #3157
fix(pd): keep KvClient watches alive after reconnect failures#3157contrueCT wants to merge 2 commits into
Conversation
imbajin
left a comment
There was a problem hiding this comment.
Blocking: yes. Summary: The reconnect implementation has critical identity and failure-propagation risks that can silently stop watches and invalidate existing locks; permanent callback errors also retry without termination. Evidence: static review of KvClient.java and AbstractClient.java at head 772b3a5, with exact server lock/watch handling cross-checked.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3157 +/- ##
============================================
- Coverage 39.23% 38.34% -0.89%
- Complexity 264 424 +160
============================================
Files 771 771
Lines 65938 66024 +86
Branches 8759 8778 +19
============================================
- Hits 25872 25320 -552
- Misses 37310 37970 +660
+ Partials 2756 2734 -22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
imbajin
left a comment
There was a problem hiding this comment.
Blocking: yes. Summary: The current head addresses the previously reported watch reconnect, lock identity, terminal-error retry, and stale-observer issues; focused validation passes, but coverage checks remain failed and independent review evidence is incomplete. Evidence: mvn -pl hugegraph-pd/hg-pd-test -am -Dtest=KvClientTest -DfailIfNoTests=false test (18/18 passed), git diff --check passed; codecov/project and codecov/patch failed.
Purpose of the PR
KvClientpreviously retried a failed watch only once. If that reconnect also failed, thewatch stopped permanently, and unexpected stream completion did not trigger recovery.
The reconnect path also exposed a lifecycle issue:
AbstractClient.resetStub()invoked thevirtual
close()method, so transport initialization on aKvClientdispatched toKvClient.close()and marked the whole client closed.Main Changes
AbstractClienttransport cleanup from the overridable client lifecycle close.onError,Leader_Changed, and unexpectedonCompletedwith a fixed delay until thewatch recovers or the client closes.
KvClient.close()is called.changes, completion, deduplication, stale observers, prefix semantics, and close behavior.
This PR does not add event replay, protocol revisions, PD Server changes, or the Server-side
reconciliation tracked by #3151. Events emitted while a watch is disconnected are still not
replayed.
Verifying these changes
mvn -q -o test -pl hugegraph-pd/hg-pd-test -am -Dtest=KvClientTest -DfailIfNoTests=false -Drat.skip=true -Djacoco.skip=true(12 tests, 0 failures/errors)mvn -q -o package -pl hugegraph-pd -am -DskipTests -Dmaven.javadoc.skip=true -Drat.skip=true -Djacoco.skip=truemvn -q -o -f hugegraph-pd/hg-pd-client/pom.xml apache-rat:checkmvn -q -o -f hugegraph-pd/hg-pd-test/pom.xml apache-rat:checkThe full local PD suite was also attempted. The common suite passed 83/83 and the core suite
passed 89/91 with 2 skipped. The client suite could not complete without a local PD service at
127.0.0.1:8686(4 failures and 5 errors reported connection refused), which prevented the restsuite from executing in that Maven run.
Repository-wide RAT is not a valid signal in this checkout because pre-existing ignored
.upgrade-artifactsfiles produce 68 unrelated unapproved-license entries; RAT passes for bothchanged modules.
Does this PR potentially affect the following parts?
Documentation Status
Doc - TODODoc - DoneDoc - No Need