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


##########
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java:
##########
@@ -2937,6 +2941,19 @@ private void loadAddedGraph(String graphName) {
         }
     }
 
+    private <T> void graphSpaceRemoveHandler(T response) {
+        for (String name : 
this.metaManager.extractGraphSpacesFromResponse(response)) {
+            GraphSpace current = this.metaManager.graphSpace(name);
+            if (current == null) {
+                this.graphSpaces.remove(name);
+            } else {
+                // A delayed REMOVE must refresh the recreated space rather 
than retain its old cache.
+                this.graphSpaces.put(name, current);

Review Comment:
   [P2] Prevent delayed removal from overwriting a newer graph-space update
   
   At reviewed head 8a966aad162f2113e76f6d4f0f3ad626c5215145, this handler can 
read metadata with max_graph_number=100, then a concurrent PUT can 
persist/cache max_graph_number=10, before this unconditional put restores the 
old snapshot. Subsequent createGraph() calls use that cached object and 
tryOfferGraph(), so this Server can admit graphs beyond the newly lowered 
graph-count limit, not merely display an old value. graphSpace() reloads only 
on a cache miss, and no graph-space add/update listener repairs the stale 
present entry.
   
   Please sequence refresh with local mutations/publication or use a 
version-aware invalidation strategy, with a deterministic test pausing after 
the metadata read while a PUT completes. Identity-only compare-and-replace is 
insufficient because PUT mutates the cached GraphSpace in place.
   
   Evidence boundary: independently cross-checked static interleaving, not a 
live multi-Server reproduction. This does not claim that the cache write 
directly changes already-applied PD storage or Kubernetes quotas.
   
   Source: 
https://github.com/apache/hugegraph/blob/8a966aad162f2113e76f6d4f0f3ad626c5215145/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java#L2944-L2954



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