imbajin commented on code in PR #3329:
URL: https://github.com/apache/hugegraph/pull/3329#discussion_r4274522884


##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java:
##########
@@ -1133,9 +1141,46 @@ public Transaction tx() {
         return this.tx;
     }
 
+    private static Throwable collectCloseFailure(Throwable first, Throwable 
next) {

Review Comment:
   Fixed in 
[f40317095](https://github.com/hugegraph/hugegraph/commit/f40317095603bb8914ca975df346187651e31edf).
 `StandardHugeGraph`, `RaftBackendStoreProvider` and `RaftContext` now use the 
shared `core.util.CloseFailure` collector. It preserves fatal-error priority, 
throwable identity and cause/suppression-cycle avoidance; the complete graph 
lifecycle regression class passes with the existing native fatal and 
nested-cause controls.



##########
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java:
##########
@@ -2274,53 +2376,70 @@ public void dropGraph(String graphSpace, String name, 
boolean clear) {
                              "Retry deletion after owners exit, or restart to 
resume task admission",
                              graphName);
             }
+            // Cleanup failure must precede metadata removal and destructive 
clear.
+            this.unregisterRpcServices(g);
             this.removingGraphs.add(graphName);
             try {
                 this.metaManager.removeGraphConfig(graphSpace, name);
                 this.metaManager.notifyGraphRemove(graphSpace, name);
             } catch (Exception e) {
+                // No backend clear has started; retain RPC for the same open 
local owner.
+                synchronized (this) {
+                    if (this.graphs.get(graphName) == g && !g.closed()) {
+                        try {
+                            this.registerRpcServices(g);
+                        } catch (RuntimeException | Error restoration) {
+                            if (e != restoration) {
+                                e.addSuppressed(restoration);
+                            }
+                        }
+                    }
+                }
                 throw new HugeException(
-                        "Failed to remove graph config of '%s'", name, e);
+                        "Failed to remove graph config of '%s'", e, name);
             }
 
             g.clearBackend();
-            try {
-                g.close();
-            } catch (Exception e) {
-                if (!g.closed()) {
-                    throw new HugeException("Failed to close graph '%s', 
please retry later", e, graphName);
+            synchronized (this) {
+                if (this.graphs.get(graphName) == g) {
+                    this.clearedGraphs.put(graphName, g);
                 }
-                LOG.warn("Failed to close graph", e);
             }
         }
-        GraphSpace gs = this.graphSpace(graphSpace);
-        if (!grpcThread) {
-            gs.recycleGraph();
-            LOG.info("The graph_number_used successfully decreased to {} " +
-                     "of graph space: {} for graph: {}",
-                     gs.graphNumberUsed(), gs.name(), name);
-            this.metaManager.updateGraphSpaceConfig(graphSpace, gs);
-        }
-        // Let gremlin server and rest server context remove graph
-        LOG.info("Notify remove graph {} by GRAPH_DROP event", name);
-        Graph graph = this.graphs.get(graphName);
-        if (graph != null) {
-            try {
-                graph.close();
-            } catch (Exception e) {
-                if (!((HugeGraph) graph).closed()) {
-                    throw new HugeException("Failed to close graph '%s', 
please retry later", e, graphName);
+        try {
+            g.close();
+        } catch (Exception failure) {
+            // Logical closed does not certify native release; keep this owner 
until close succeeds.
+            throw new HugeException("Failed to close graph '%s', please retry 
later", failure, graphName);

Review Comment:
   Fixed in 
[f40317095](https://github.com/hugegraph/hugegraph/commit/f40317095603bb8914ca975df346187651e31edf).
 A failed non-clearing peer removal retains its exact owner, and the next 
same-name ADD retries that owner's cleanup before loading the latest 
configuration. Received ADD intent also survives ADD-before-REMOVE delivery 
while the old owner is healthy. Native handler regressions cover repeated 
cleanup failure, missing metadata, automatic replacement publication and 
Gremlin bindings, and preservation of replacement data after a late old DROP. 
No background retry is introduced.



-- 
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]

Reply via email to