From 536ba9d37d590de502821052c163c0b770da8e71 Mon Sep 17 00:00:00 2001 From: JackyYangPassion Date: Mon, 12 Aug 2024 20:07:00 +0800 Subject: [PATCH 1/2] enable JRaft MaxBodySize config --- .../main/java/org/apache/hugegraph/store/PartitionEngine.java | 1 + .../apache/hugegraph/store/options/HgStoreEngineOptions.java | 4 ++++ .../main/java/org/apache/hugegraph/store/node/AppConfig.java | 2 ++ .../apache/hugegraph/store/node/grpc/HgStoreNodeService.java | 1 + 4 files changed, 8 insertions(+) diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/PartitionEngine.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/PartitionEngine.java index 11538478cc..ee65162f7c 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/PartitionEngine.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/PartitionEngine.java @@ -249,6 +249,7 @@ public LogStorage createLogStorage(final String uri, final RaftOptions raftOptio raftOptions.setMaxReplicatorInflightMsgs( options.getRaftOptions().getMaxReplicatorInflightMsgs()); raftOptions.setMaxByteCountPerRpc(1024 * 1024); + raftOptions.setMaxBodySize(options.getRaftOptions().getMaxBodySize()); nodeOptions.setEnableMetrics(true); final PeerId serverId = JRaftUtils.getPeerId(options.getRaftAddress()); diff --git a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/options/HgStoreEngineOptions.java b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/options/HgStoreEngineOptions.java index 18d145fb40..c315d3440e 100644 --- a/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/options/HgStoreEngineOptions.java +++ b/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/options/HgStoreEngineOptions.java @@ -99,6 +99,10 @@ public static class RaftOptions { * The maximum number of entries in AppendEntriesRequest */ private int maxEntriesSize = 256; + /** + * The maximum byte size of AppendEntriesRequest + */ + private int maxBodySize = 512 * 1024; /** * Raft cluster data backlog occurs, rate limiting wait time in milliseconds. **/ diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppConfig.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppConfig.java index c656912235..114ff68e03 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppConfig.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppConfig.java @@ -184,6 +184,8 @@ public class Raft { private int maxReplicatorInflightMsgs; @Value("${raft.maxEntriesSize:256}") private int maxEntriesSize; + @Value("${raft.maxBodySize: 512 * 1024}") + private int maxBodySize; } diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeService.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeService.java index 6c88555160..e99d7d24a6 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeService.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/grpc/HgStoreNodeService.java @@ -101,6 +101,7 @@ public void init() { setMaxSegmentFileSize(appConfig.getRaft().getMaxSegmentFileSize()); setMaxReplicatorInflightMsgs(appConfig.getRaft().getMaxReplicatorInflightMsgs()); setMaxEntriesSize(appConfig.getRaft().getMaxEntriesSize()); + setMaxBodySize(appConfig.getRaft().getMaxBodySize()); }}); setFakePdOptions(new FakePdOptions() {{ setStoreList(appConfig.getFakePdConfig().getStoreList()); From 1c12163fbfa9b1e9214d7655e6f853752aff9cb8 Mon Sep 17 00:00:00 2001 From: VGalaxies Date: Sun, 18 Aug 2024 11:55:19 +0800 Subject: [PATCH 2/2] fixup Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.apache.hugegraph.store.node.AppConfig$Raft': Unsatisfied dependency expressed through field 'maxBodySize'; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "512*1024" --- .../java/org/apache/hugegraph/store/node/AppConfig.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppConfig.java b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppConfig.java index 114ff68e03..9920d9238f 100644 --- a/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppConfig.java +++ b/hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppConfig.java @@ -172,11 +172,11 @@ public class Raft { private int snapshotInterval; @Value("${raft.disruptorBufferSize:0}") private int disruptorBufferSize; - @Value("${raft.max-log-file-size: 50000000000}") + @Value("${raft.max-log-file-size:50000000000}") private long maxLogFileSize; - @Value("${ave-logEntry-size-ratio : 0.95}") + @Value("${ave-logEntry-size-ratio:0.95}") private double aveLogEntrySizeRation; - @Value("${raft.useRocksDBSegmentLogStorage: true}") + @Value("${raft.useRocksDBSegmentLogStorage:true}") private boolean useRocksDBSegmentLogStorage; @Value("${raft.maxSegmentFileSize:67108864}") private int maxSegmentFileSize; @@ -184,7 +184,7 @@ public class Raft { private int maxReplicatorInflightMsgs; @Value("${raft.maxEntriesSize:256}") private int maxEntriesSize; - @Value("${raft.maxBodySize: 512 * 1024}") + @Value("${raft.maxBodySize:524288}") private int maxBodySize; }