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


##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java:
##########
@@ -122,6 +126,46 @@ public static BytesBuffer wrap(byte[] array, int offset, 
int length) {
         return new BytesBuffer(ByteBuffer.wrap(array, offset, length));
     }
 
+    public static int maxBufferCapacity() {
+        Integer capacity = maxBufferCapacity;
+        return capacity != null ? capacity : MAX_BUFFER_CAPACITY;
+    }
+
+    public static synchronized void initMaxBufferCapacity(int capacity) {
+        initMaxBufferCapacity(capacity, true);
+    }
+
+    public static synchronized void initMaxBufferCapacity(int capacity,
+                                                          boolean explicit) {
+        E.checkArgument(capacity >= DEFAULT_CAPACITY &&
+                        capacity <= MAX_BUFFER_CAPACITY_UPPER_BOUND,
+                        "Max buffer capacity must be in range [%s, %s], " +
+                        "but got %s",
+                        DEFAULT_CAPACITY, MAX_BUFFER_CAPACITY_UPPER_BOUND,
+                        capacity);
+
+        if (!explicit) {
+            if (maxBufferCapacity == null) {
+                maxBufferCapacity = MAX_BUFFER_CAPACITY;

Review Comment:
   ‼️ **Make the process-wide cap independent of graph load order**
   
   Evidence: the default-path branch now stores `MAX_BUFFER_CAPACITY` when the 
first graph omits `serializer.buffer_max_capacity`, while an explicit graph 
opened first still lets later default graphs inherit the custom cap. That means 
the same set of graph configs can either start or fail depending only on which 
graph file is opened first.
   
   Impact: a valid explicit process-wide serializer cap can be rejected in 
multi-graph deployments after any default-config graph initializes first.
   
   Requested fix: select the single process-wide value before opening 
individual graphs, or let omitted/default graph configs defer initialization 
until an explicit value is seen; add coverage for both 
explicit-first/default-second and default-first/explicit-second ordering.



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