imbajin commented on code in PR #3329:
URL: https://github.com/apache/hugegraph/pull/3329#discussion_r4286860611
##########
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java:
##########
@@ -2627,41 +2845,66 @@ private <T> void graphAddHandler(T response) {
continue;
}
LOG.info("Accept graph add signal from etcd for {}", graphName);
- if (this.graphs.containsKey(graphName) ||
- this.creatingGraphs.contains(graphName)) {
- this.creatingGraphs.remove(graphName);
- continue;
+ HugeGraph retryOwner = null;
+ synchronized (this) {
+ HugeGraph owner = (HugeGraph) this.graphs.get(graphName);
+ boolean retryPeerCleanup = owner != null &&
this.failedPeerRemovals.contains(owner);
+ if (this.creatingGraphs.remove(graphName) &&
!retryPeerCleanup) {
+ // The acknowledgement of local creation is not a
replacement ADD.
+ continue;
+ }
+ if (owner != null) {
+ // Independent key watches can deliver a replacement ADD
before the old REMOVE.
+ this.pendingGraphAdds.add(graphName);
Review Comment:
Confirmed. A duplicate foreign ADD can remain pending behind a healthy local
owner, and replaying it during reload repopulates the map before the empty-map
wait.
Reload now consumes the pending marker after successfully removing that
owner and lets its existing metadata reload restore the graph. Ordinary drops
and peer removal still replay replacement ADDs. This adds no manager state,
lock or retry.
The two-graph regression reproduced the reload timeout before the fix and
passes after it, including fresh owners and Gremlin bindings. The existing peer
ADD-before-REMOVE regression, related lifecycle tests, full Java 17 compilation
and independent final review also pass. Current-head remote CI remains separate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]