This is an automated email from the ASF dual-hosted git repository. swuferhong pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/fluss.git
commit dbdef8e704295ab44c10cd417c0ee2678fdbf271 Author: yunhong <[email protected]> AuthorDate: Fri Jul 3 09:27:17 2026 +0800 [common] Limit default max bucket count to 20000 --- .../fluss/client/admin/FlussAdminITCase.java | 38 ++++++++++++++++++++++ .../org/apache/fluss/config/ConfigOptions.java | 8 +++-- website/docs/maintenance/configuration.md | 2 +- 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/fluss-client/src/test/java/org/apache/fluss/client/admin/FlussAdminITCase.java b/fluss-client/src/test/java/org/apache/fluss/client/admin/FlussAdminITCase.java index 3d6b48dfc..18f177b64 100644 --- a/fluss-client/src/test/java/org/apache/fluss/client/admin/FlussAdminITCase.java +++ b/fluss-client/src/test/java/org/apache/fluss/client/admin/FlussAdminITCase.java @@ -83,6 +83,7 @@ import org.apache.fluss.server.log.LogTablet; import org.apache.fluss.server.metadata.ServerInfo; import org.apache.fluss.server.replica.Replica; import org.apache.fluss.server.tablet.TestTabletServerGateway; +import org.apache.fluss.server.testutils.FlussClusterExtension; import org.apache.fluss.server.zk.ZooKeeperClient; import org.apache.fluss.server.zk.data.ServerTags; import org.apache.fluss.types.DataTypeChecks; @@ -1904,6 +1905,43 @@ class FlussAdminITCase extends ClientToServerITCaseBase { .hasMessageContaining("exceeds the maximum limit"); } + @Test + public void testDefaultBucketLimitForNonPartitionedTable() throws Exception { + assertThat(ConfigOptions.MAX_BUCKET_NUM.defaultValue()).isEqualTo(20000); + + FlussClusterExtension defaultLimitCluster = + FlussClusterExtension.builder().setNumOfTabletServers(1).build(); + defaultLimitCluster.start(); + + try (Connection connection = + ConnectionFactory.createConnection(defaultLimitCluster.getClientConfig()); + Admin defaultLimitAdmin = connection.getAdmin()) { + String dbName = "test_default_bucket_limit_db"; + TablePath tablePath = TablePath.of(dbName, "test_too_many_buckets_by_default"); + TableDescriptor nonPartitionedTable = + TableDescriptor.builder() + .schema( + Schema.newBuilder() + .column("id", DataTypes.STRING()) + .column("name", DataTypes.STRING()) + .build()) + .distributedBy(30000, "id") + .build(); + + defaultLimitAdmin.createDatabase(dbName, DatabaseDescriptor.EMPTY, false).get(); + assertThatThrownBy( + () -> + defaultLimitAdmin + .createTable(tablePath, nonPartitionedTable, false) + .get()) + .cause() + .isInstanceOf(TooManyBucketsException.class) + .hasMessageContaining("Bucket count 30000 exceeds the maximum limit 20000."); + } finally { + defaultLimitCluster.close(); + } + } + /** Test that creating a table with system columns throws InvalidTableException. */ @Test public void testSystemsColumns() throws Exception { diff --git a/fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java b/fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java index 2d97ebab5..f3acc8279 100644 --- a/fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java +++ b/fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java @@ -290,10 +290,12 @@ public class ConfigOptions { public static final ConfigOption<Integer> MAX_BUCKET_NUM = key("max.bucket.num") .intType() - .defaultValue(128000) + .defaultValue(20000) .withDescription( - "The maximum number of buckets that can be created for a table." - + "The default value is 128000"); + "The maximum number of buckets that can be created for a table. " + + "The default value is 20000. " + + "This default is capped to reduce the risk that the table assignment znode exceeds " + + "ZooKeeper's packet size limit."); /** * The network address and port the server binds to for accepting connections. diff --git a/website/docs/maintenance/configuration.md b/website/docs/maintenance/configuration.md index 39e38a4c8..55601246b 100644 --- a/website/docs/maintenance/configuration.md +++ b/website/docs/maintenance/configuration.md @@ -46,7 +46,7 @@ during the Fluss cluster working. | allow.create.log.tables | Boolean | true | Whether to allow creation of log tables. When set to false, attempts to create log tables (tables without primary key) will be rejected. The default value is true. [...] | allow.create.kv.tables | Boolean | true | Whether to allow creation of kv tables (primary key tables). When set to false, attempts to create kv tables (tables with primary key) will be rejected. The default value is true. [...] | max.partition.num | Integer | 1000 | Limits the maximum number of partitions that can be created for a partitioned table to avoid creating too many partitions. [...] -| max.bucket.num | Integer | 128000 | The maximum number of buckets that can be created for a table. The default value is 128000. [...] +| max.bucket.num | Integer | 20000 | The maximum number of buckets that can be created for a table. The default value is 20000. This default is capped to reduce the risk that the table assignment znode exceeds ZooKeeper's packet size limit. [...] | acl.notification.expiration-time | Duration | 15min | The duration for which ACL notifications are valid before they expire. This configuration determines the time window during which an ACL notification is considered active. After this duration, the notification will no longer be valid and will b [...] | authorizer.enabled | Boolean | false | Specifies whether to enable the authorization feature. If enabled, access control is enforced based on the authorization rules defined in the configuration. If disabled, all operations and resources are accessible to all users. [...] | authorizer.type | String | default | Specifies the type of authorizer to be used for access control. This value corresponds to the identifier of the authorization plugin. The default value is `default`, which indicates the built-in authorizer implementation. Custom authorizers can [...]
