This is an automated email from the ASF dual-hosted git repository.
imbajin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hugegraph.git
The following commit(s) were added to refs/heads/master by this push:
new 5ddeb0331 feat(server) : make buffer max capacity configurable (#3049)
5ddeb0331 is described below
commit 5ddeb0331cae92e63266de21a4e35552e5b36fa3
Author: legendpei <[email protected]>
AuthorDate: Mon Jun 15 14:01:10 2026 +0800
feat(server) : make buffer max capacity configurable (#3049)
Move BytesBuffer.initMaxBufferCapacity() and other process-wide static
config initializations before LockUtil.init() so that validation failures
(e.g. invalid or conflicting serializer.buffer_max_capacity) cannot leave
orphaned lock groups in LockManager, which would block subsequent graph
load attempts without a process restart.
🤖 Generated with [Qoder][https://qoder.com]
---
.../org/apache/hugegraph/StandardHugeGraph.java | 12 +-
.../hugegraph/backend/serializer/BytesBuffer.java | 60 ++++-
.../org/apache/hugegraph/config/CoreOptions.java | 10 +
.../java/org/apache/hugegraph/util/LZ4Util.java | 2 +-
.../static/conf/graphs/hstore.properties.template | 2 +
.../static/conf/graphs/hugegraph.properties | 2 +
.../hugegraph/unit/serializer/BytesBufferTest.java | 268 +++++++++++++++++++++
7 files changed, 345 insertions(+), 11 deletions(-)
diff --git
a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java
b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java
index f8f24ab62..aaacb799c 100644
---
a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java
+++
b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java
@@ -48,6 +48,7 @@ import org.apache.hugegraph.backend.id.IdGenerator;
import org.apache.hugegraph.backend.id.SnowflakeIdGenerator;
import org.apache.hugegraph.backend.query.Query;
import org.apache.hugegraph.backend.serializer.AbstractSerializer;
+import org.apache.hugegraph.backend.serializer.BytesBuffer;
import org.apache.hugegraph.backend.serializer.SerializerFactory;
import org.apache.hugegraph.backend.store.BackendFeatures;
import org.apache.hugegraph.backend.store.BackendProviderFactory;
@@ -231,8 +232,13 @@ public class StandardHugeGraph implements HugeGraph {
this.readMode = GraphReadMode.OLTP_ONLY;
this.schedulerType = config.get(CoreOptions.SCHEDULER_TYPE);
- LockUtil.init(this.spaceGraphName());
-
+ // Init process-wide static configs before lock, so that validation
+ // failures won't leave stale lock groups in LockManager.
+ boolean explicitBufferCapacity = config.containsKey(
+ CoreOptions.SERIALIZER_BUFFER_MAX_CAPACITY.name());
+ BytesBuffer.initMaxBufferCapacity(
+ config.get(CoreOptions.SERIALIZER_BUFFER_MAX_CAPACITY),
+ explicitBufferCapacity);
MemoryManager.setMemoryMode(
MemoryManager.MemoryMode.fromValue(config.get(CoreOptions.MEMORY_MODE)));
MemoryManager.setMaxMemoryCapacityInBytes(config.get(CoreOptions.MAX_MEMORY_CAPACITY));
@@ -240,6 +246,8 @@ public class StandardHugeGraph implements HugeGraph {
config.get(CoreOptions.ONE_QUERY_MAX_MEMORY_CAPACITY));
RoundUtil.setAlignment(config.get(CoreOptions.MEMORY_ALIGNMENT));
+ LockUtil.init(this.spaceGraphName());
+
try {
this.storeProvider = this.loadStoreProvider();
} catch (Exception e) {
diff --git
a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java
b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java
index fb5234767..faf150829 100644
---
a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java
+++
b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/serializer/BytesBuffer.java
@@ -77,12 +77,15 @@ public final class BytesBuffer extends OutputStream {
public static final int DEFAULT_CAPACITY = 64;
public static final int MAX_BUFFER_CAPACITY = 128 * 1024 * 1024; // 128M
+ public static final int MAX_BUFFER_CAPACITY_UPPER_BOUND = (int) Bytes.GB;
public static final int BUF_EDGE_ID = 128;
public static final int BUF_PROPERTY = 64;
public static final byte[] BYTES_EMPTY = new byte[0];
+ private static volatile Integer maxBufferCapacity;
+
private ByteBuffer buffer;
private final boolean resize;
@@ -91,10 +94,11 @@ public final class BytesBuffer extends OutputStream {
}
public BytesBuffer(int capacity) {
- if (capacity > MAX_BUFFER_CAPACITY) {
+ int maxCapacity = maxBufferCapacity();
+ if (capacity > maxCapacity) {
E.checkArgument(false,
"Capacity %s exceeds max buffer capacity: %s",
- capacity, MAX_BUFFER_CAPACITY);
+ capacity, maxCapacity);
}
this.buffer = ByteBuffer.allocate(capacity);
this.resize = true;
@@ -122,6 +126,43 @@ public final class BytesBuffer extends OutputStream {
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) {
+ return;
+ }
+
+ if (maxBufferCapacity == null) {
+ maxBufferCapacity = capacity;
+ return;
+ }
+
+ if (maxBufferCapacity == capacity) {
+ return;
+ }
+
+ throw new IllegalArgumentException(String.format(
+ "The process-wide serializer buffer max capacity has been " +
+ "initialized to %s, but got conflicting value %s",
+ maxBufferCapacity, capacity));
+ }
+
public ByteBuffer asByteBuffer() {
return this.buffer;
}
@@ -173,14 +214,18 @@ public final class BytesBuffer extends OutputStream {
E.checkState(false, "Can't resize for wrapped buffer");
}
- // Extra capacity as buffer
- int newCapacity = size + this.buffer.limit() + DEFAULT_CAPACITY;
- if (newCapacity > MAX_BUFFER_CAPACITY) {
+ int maxCapacity = maxBufferCapacity();
+ long requiredCapacity = (long) this.buffer.position() + size;
+ if (requiredCapacity > maxCapacity) {
E.checkArgument(false,
"Capacity %s exceeds max buffer capacity: %s",
- newCapacity, MAX_BUFFER_CAPACITY);
+ requiredCapacity, maxCapacity);
}
- ByteBuffer newBuffer = ByteBuffer.allocate(newCapacity);
+
+ // Extra capacity as buffer
+ long newCapacity = Math.min(requiredCapacity + DEFAULT_CAPACITY,
+ maxCapacity);
+ ByteBuffer newBuffer = ByteBuffer.allocate((int) newCapacity);
this.buffer.flip();
newBuffer.put(this.buffer);
this.buffer = newBuffer;
@@ -318,7 +363,6 @@ public final class BytesBuffer extends OutputStream {
public BytesBuffer writeBigBytes(byte[] bytes) {
if (bytes.length > BLOB_LEN_MAX) {
- // TODO: note the max blob size should be 128MB (due to
MAX_BUFFER_CAPACITY)
E.checkArgument(false,
"The max length of bytes is %s, but got %s",
BLOB_LEN_MAX, bytes.length);
diff --git
a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java
b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java
index ba4d4a1c0..07109580a 100644
---
a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java
+++
b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java
@@ -18,6 +18,7 @@
package org.apache.hugegraph.config;
import org.apache.hugegraph.backend.query.Query;
+import org.apache.hugegraph.backend.serializer.BytesBuffer;
import org.apache.hugegraph.backend.tx.GraphTransaction;
import org.apache.hugegraph.type.define.CollectionType;
import org.apache.hugegraph.util.Bytes;
@@ -79,6 +80,15 @@ public class CoreOptions extends OptionHolder {
disallowEmpty(),
"text"
);
+ public static final ConfigOption<Integer> SERIALIZER_BUFFER_MAX_CAPACITY =
+ new ConfigOption<>(
+ "serializer.buffer_max_capacity",
+ "The process-wide max capacity of one serialization " +
+ "buffer in bytes.",
+ rangeInt(BytesBuffer.DEFAULT_CAPACITY,
+ BytesBuffer.MAX_BUFFER_CAPACITY_UPPER_BOUND),
+ BytesBuffer.MAX_BUFFER_CAPACITY
+ );
public static final ConfigOption<Boolean> RAFT_MODE =
new ConfigOption<>(
"raft.mode",
diff --git
a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/LZ4Util.java
b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/LZ4Util.java
index 041afee7b..44de9c60f 100644
---
a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/LZ4Util.java
+++
b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/LZ4Util.java
@@ -64,7 +64,7 @@ public class LZ4Util {
LZ4FastDecompressor decompressor = factory.fastDecompressor();
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
int initBufferSize = Math.min(Math.round(bytes.length * ratio),
- BytesBuffer.MAX_BUFFER_CAPACITY);
+ BytesBuffer.maxBufferCapacity());
BytesBuffer buf = new BytesBuffer(initBufferSize);
LZ4BlockInputStream lzInput = new LZ4BlockInputStream(bais,
decompressor);
int count;
diff --git
a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hstore.properties.template
b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hstore.properties.template
index d3834baf5..f627b6202 100644
---
a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hstore.properties.template
+++
b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hstore.properties.template
@@ -24,6 +24,8 @@ edge.cache_type=l2
# version before 1.7.0 of apache hugegraph for your application.
backend=hstore
serializer=binary
+# The process-wide max capacity of one serialization buffer in bytes
+#serializer.buffer_max_capacity=134217728
store=hugegraph
diff --git
a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties
b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties
index b77cacb2d..bc15c39b3 100644
---
a/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties
+++
b/hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties
@@ -23,6 +23,8 @@ edge.cache_type=l2
# if you want to use Cassandra/MySql/PG... as backend, please use version <
1.7.0
backend=rocksdb
serializer=binary
+# The process-wide max capacity of one serialization buffer in bytes
+#serializer.buffer_max_capacity=134217728
store=hugegraph
diff --git
a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BytesBufferTest.java
b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BytesBufferTest.java
index fb25a5b25..8d82a7c6c 100644
---
a/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BytesBufferTest.java
+++
b/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/serializer/BytesBufferTest.java
@@ -18,6 +18,7 @@
package org.apache.hugegraph.unit.serializer;
import java.awt.Point;
+import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Iterator;
@@ -27,10 +28,14 @@ import java.util.Set;
import java.util.TimeZone;
import java.util.UUID;
+import org.apache.hugegraph.HugeFactory;
+import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.backend.id.IdGenerator;
import org.apache.hugegraph.backend.id.IdGenerator.UuidId;
import org.apache.hugegraph.backend.serializer.BytesBuffer;
+import org.apache.hugegraph.config.CoreOptions;
+import org.apache.hugegraph.config.HugeConfig;
import org.apache.hugegraph.schema.PropertyKey;
import org.apache.hugegraph.testutil.Assert;
import org.apache.hugegraph.type.define.Cardinality;
@@ -38,6 +43,9 @@ import org.apache.hugegraph.type.define.DataType;
import org.apache.hugegraph.unit.BaseUnitTest;
import org.apache.hugegraph.unit.FakeObjects;
import org.apache.hugegraph.util.Blob;
+import org.apache.hugegraph.util.LZ4Util;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
import com.google.common.collect.ImmutableList;
@@ -45,6 +53,22 @@ import com.google.common.collect.ImmutableSet;
public class BytesBufferTest extends BaseUnitTest {
+ @Before
+ public void setUp() throws Exception {
+ resetMaxBufferCapacity();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ resetMaxBufferCapacity();
+ }
+
+ private static void resetMaxBufferCapacity() throws Exception {
+ Field field = BytesBuffer.class.getDeclaredField("maxBufferCapacity");
+ field.setAccessible(true);
+ field.set(null, null);
+ }
+
@Test
public void testAllocate() {
Assert.assertEquals(0, BytesBuffer.allocate(0).array().length);
@@ -69,6 +93,250 @@ public class BytesBufferTest extends BaseUnitTest {
buf0.bytes());
}
+ @Test
+ public void testAllocateWithMaxBufferCapacity() {
+ Assert.assertEquals(BytesBuffer.MAX_BUFFER_CAPACITY,
+ BytesBuffer.maxBufferCapacity());
+
+ BytesBuffer.initMaxBufferCapacity(128);
+ Assert.assertEquals(128, BytesBuffer.maxBufferCapacity());
+ BytesBuffer.initMaxBufferCapacity(128);
+ Assert.assertEquals(128, BytesBuffer.maxBufferCapacity());
+ Assert.assertEquals(128, BytesBuffer.allocate(128).array().length);
+
+ Assert.assertThrows(IllegalArgumentException.class, () -> {
+ BytesBuffer.allocate(129);
+ }, e -> {
+ Assert.assertContains("Capacity 129 exceeds max buffer " +
+ "capacity: 128",
+ e.getMessage());
+ });
+ }
+
+ @Test
+ public void testResizeWithMaxBufferCapacity() {
+ BytesBuffer.initMaxBufferCapacity(128);
+ BytesBuffer buffer = BytesBuffer.allocate(64);
+ buffer.write(new byte[64]);
+ buffer.write((byte) 1);
+ Assert.assertEquals(65, buffer.bytes().length);
+ Assert.assertEquals(128, buffer.array().length);
+
+ buffer.write(new byte[63]);
+
+ Assert.assertThrows(IllegalArgumentException.class, () -> {
+ buffer.write((byte) 1);
+ }, e -> {
+ Assert.assertContains("Capacity 129 exceeds max buffer " +
+ "capacity: 128",
+ e.getMessage());
+ });
+ }
+
+ @Test
+ public void testResizeCappedAtMaxBufferCapacity() {
+ BytesBuffer.initMaxBufferCapacity(128);
+
+ // Allocate small buffer and fill it completely
+ BytesBuffer buffer = BytesBuffer.allocate(64);
+ buffer.write(new byte[64]);
+
+ // Writing 2 more bytes triggers resize:
+ // requiredCapacity = 64 + 2 = 66
+ // naive newCapacity = 66 + DEFAULT_CAPACITY(64) = 130
+ // Math.min(130, maxCapacity=128) = 128, capped
+ buffer.write(new byte[2]);
+ Assert.assertEquals(128, buffer.array().length);
+ Assert.assertEquals(66, buffer.bytes().length);
+
+ // Buffer now at capacity 128, position 66, remaining 62.
+ // Fill remaining space, should succeed without resize.
+ buffer.write(new byte[62]);
+ Assert.assertEquals(128, buffer.bytes().length);
+
+ // One more byte exceeds the max, should throw.
+ Assert.assertThrows(IllegalArgumentException.class, () -> {
+ buffer.write((byte) 1);
+ }, e -> {
+ Assert.assertContains("Capacity 129 exceeds max buffer " +
+ "capacity: 128",
+ e.getMessage());
+ });
+ }
+
+ @Test
+ public void testSetMaxBufferCapacityWithInvalidValue() {
+ Assert.assertThrows(IllegalArgumentException.class, () -> {
+ BytesBuffer.initMaxBufferCapacity(
+ BytesBuffer.DEFAULT_CAPACITY - 1);
+ }, e -> {
+ Assert.assertContains("Max buffer capacity must be in range",
+ e.getMessage());
+ });
+
+ Assert.assertThrows(IllegalArgumentException.class, () -> {
+ BytesBuffer.initMaxBufferCapacity(
+ BytesBuffer.MAX_BUFFER_CAPACITY_UPPER_BOUND + 1);
+ }, e -> {
+ Assert.assertContains("Max buffer capacity must be in range",
+ e.getMessage());
+ });
+ }
+
+ @Test
+ public void testSetMaxBufferCapacityAtUpperBound() {
+ BytesBuffer.initMaxBufferCapacity(
+ BytesBuffer.MAX_BUFFER_CAPACITY_UPPER_BOUND);
+ Assert.assertEquals(BytesBuffer.MAX_BUFFER_CAPACITY_UPPER_BOUND,
+ BytesBuffer.maxBufferCapacity());
+ }
+
+ @Test
+ public void testDefaultMaxBufferCapacityDefersExplicitInit() {
+ BytesBuffer.initMaxBufferCapacity(BytesBuffer.MAX_BUFFER_CAPACITY,
+ false);
+ Assert.assertEquals(BytesBuffer.MAX_BUFFER_CAPACITY,
+ BytesBuffer.maxBufferCapacity());
+
+ BytesBuffer.initMaxBufferCapacity(256);
+ Assert.assertEquals(256,
+ BytesBuffer.maxBufferCapacity());
+ }
+
+ @Test
+ public void testLZ4DecompressWithMaxBufferCapacity() {
+ byte[] bytes = genBytes(256);
+ BytesBuffer compressed = LZ4Util.compress(bytes, 64);
+
+ BytesBuffer.initMaxBufferCapacity(128);
+
+ Assert.assertThrows(IllegalArgumentException.class, () -> {
+ LZ4Util.decompress(compressed.bytes(), 64);
+ }, e -> {
+ Assert.assertContains("exceeds max buffer capacity: 128",
+ e.getMessage());
+ });
+ }
+
+ @Test
+ public void testLZ4DecompressSucceedsWithCustomMaxBufferCapacity() {
+ byte[] bytes = genBytes(64);
+ BytesBuffer compressed = LZ4Util.compress(bytes, 64);
+
+ // Set a custom max that is large enough for the decompressed data
+ BytesBuffer.initMaxBufferCapacity(256);
+
+ BytesBuffer decompressed = LZ4Util.decompress(compressed.bytes(), 64);
+ // Verify the custom cap is active and decompression succeeded
+ Assert.assertEquals(256, BytesBuffer.maxBufferCapacity());
+ Assert.assertArrayEquals(bytes, decompressed.bytes());
+ }
+
+ @Test
+ public void testMaxBufferCapacityFromGraphConfig() throws Exception {
+ HugeConfig config = FakeObjects.newConfig();
+ config.setProperty(CoreOptions.STORE.name(), "buffer_capacity");
+ config.setProperty(CoreOptions.SERIALIZER_BUFFER_MAX_CAPACITY.name(),
+ 256);
+
+ HugeGraph graph = HugeFactory.open(config);
+ try {
+ Assert.assertEquals(256, BytesBuffer.maxBufferCapacity());
+ } finally {
+ graph.close();
+ }
+ }
+
+ @Test
+ public void testMaxBufferCapacityRejectsConflictingGraphConfig()
+ throws Exception {
+ HugeConfig config1 = FakeObjects.newConfig();
+ config1.setProperty(CoreOptions.STORE.name(), "buffer_capacity_1");
+ config1.setProperty(CoreOptions.SERIALIZER_BUFFER_MAX_CAPACITY.name(),
+ 256);
+
+ HugeGraph graph1 = HugeFactory.open(config1);
+ try {
+ Assert.assertEquals(256, BytesBuffer.maxBufferCapacity());
+
+ HugeConfig config2 = FakeObjects.newConfig();
+ config2.setProperty(CoreOptions.STORE.name(),
+ "buffer_capacity_2");
+ config2.setProperty(
+ CoreOptions.SERIALIZER_BUFFER_MAX_CAPACITY.name(), 512);
+
+ Assert.assertThrows(IllegalArgumentException.class, () -> {
+ HugeFactory.open(config2);
+ }, e -> {
+ Assert.assertContains("process-wide serializer buffer max " +
+ "capacity has been initialized to 256",
+ e.getMessage());
+ Assert.assertContains("conflicting value 512",
+ e.getMessage());
+ });
+ Assert.assertEquals(256, BytesBuffer.maxBufferCapacity());
+ } finally {
+ graph1.close();
+ }
+ }
+
+ @Test
+ public void testMaxBufferCapacityInheritsProcessWideValue()
+ throws Exception {
+ HugeConfig config1 = FakeObjects.newConfig();
+ config1.setProperty(CoreOptions.STORE.name(), "buffer_inherit_1");
+ config1.setProperty(CoreOptions.SERIALIZER_BUFFER_MAX_CAPACITY.name(),
+ 256);
+
+ HugeGraph graph1 = HugeFactory.open(config1);
+ try {
+ Assert.assertEquals(256, BytesBuffer.maxBufferCapacity());
+
+ // Second graph omits SERIALIZER_BUFFER_MAX_CAPACITY, so it
+ // receives the default value and should inherit the process-wide
+ // cap (256) instead of throwing a conflict error.
+ HugeConfig config2 = FakeObjects.newConfig();
+ config2.setProperty(CoreOptions.STORE.name(), "buffer_inherit_2");
+
+ HugeGraph graph2 = HugeFactory.open(config2);
+ try {
+ Assert.assertEquals(256, BytesBuffer.maxBufferCapacity());
+ } finally {
+ graph2.close();
+ }
+ } finally {
+ graph1.close();
+ }
+ }
+
+ @Test
+ public void testMaxBufferCapacityDefersToExplicitConfigAfterDefaultGraph()
+ throws Exception {
+ HugeConfig config1 = FakeObjects.newConfig();
+ config1.setProperty(CoreOptions.STORE.name(), "buffer_default_first");
+
+ HugeGraph graph1 = HugeFactory.open(config1);
+ try {
+ Assert.assertEquals(BytesBuffer.MAX_BUFFER_CAPACITY,
+ BytesBuffer.maxBufferCapacity());
+
+ HugeConfig config2 = FakeObjects.newConfig();
+ config2.setProperty(CoreOptions.STORE.name(),
+ "buffer_custom_second");
+ config2.setProperty(
+ CoreOptions.SERIALIZER_BUFFER_MAX_CAPACITY.name(), 256);
+
+ HugeGraph graph2 = HugeFactory.open(config2);
+ try {
+ Assert.assertEquals(256, BytesBuffer.maxBufferCapacity());
+ } finally {
+ graph2.close();
+ }
+ } finally {
+ graph1.close();
+ }
+ }
+
@Test
public void testWrap() {
BytesBuffer buf4 = BytesBuffer.wrap(new byte[]{1, 2, 3, 4});