Skip to content

Commit b899677

Browse files
luoyuxiaLiebing
authored andcommitted
fix zk limit
1 parent ded35d2 commit b899677

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,15 @@ public class ConfigOptions {
572572
+ "This allows each ZooKeeper client instance to load its own configuration file, "
573573
+ "instead of relying on shared JVM-level environment settings. "
574574
+ "This enables fine-grained control over ZooKeeper client behavior.");
575+
576+
public static final ConfigOption<Integer> ZOOKEEPER_MAX_BUFFER_SIZE =
577+
key("zookeeper.client.max-buffer-size")
578+
.intType()
579+
.defaultValue(100 * 1024 * 1024) // 100MB
580+
.withDescription(
581+
"The maximum buffer size (in bytes) for ZooKeeper client. "
582+
+ "This corresponds to the jute.maxbuffer property. "
583+
+ "Default is 100MB to match the RPC frame length limit.");
575584
// ------------------------------------------------------------------------
576585
// ConfigOptions for Log
577586
// ------------------------------------------------------------------------

fluss-server/src/main/java/org/apache/fluss/server/zk/ZooKeeperUtils.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,13 @@ public static ZooKeeperClient startZookeeperClient(
104104
new SessionConnectionStateErrorPolicy());
105105
}
106106

107+
// Configure ZKClientConfig with jute.maxbuffer
108+
ZKClientConfig zkClientConfig;
107109
Optional<String> configPath =
108110
configuration.getOptional(ConfigOptions.ZOOKEEPER_CONFIG_PATH);
109111
if (configPath.isPresent()) {
110112
try {
111-
ZKClientConfig zkClientConfig = new ZKClientConfig(configPath.get());
112-
curatorFrameworkBuilder.zkClientConfig(zkClientConfig);
113+
zkClientConfig = new ZKClientConfig(configPath.get());
113114
} catch (QuorumPeerConfig.ConfigException e) {
114115
LOG.warn("Fail to load zookeeper client config from path {}", configPath.get(), e);
115116
throw new RuntimeException(
@@ -118,7 +119,15 @@ public static ZooKeeperClient startZookeeperClient(
118119
configPath.get()),
119120
e);
120121
}
122+
} else {
123+
zkClientConfig = new ZKClientConfig();
121124
}
125+
126+
// Set jute.maxbuffer to match RPC frame length limit
127+
int maxBufferSize = configuration.getInt(ConfigOptions.ZOOKEEPER_MAX_BUFFER_SIZE);
128+
zkClientConfig.setProperty("jute.maxbuffer", String.valueOf(maxBufferSize));
129+
LOG.debug("Set ZooKeeper jute.maxbuffer to {} bytes", maxBufferSize);
130+
curatorFrameworkBuilder.zkClientConfig(zkClientConfig);
122131
return new ZooKeeperClient(
123132
startZookeeperClient(curatorFrameworkBuilder, fatalErrorHandler), configuration);
124133
}

0 commit comments

Comments
 (0)