Skip to content

Commit

Permalink
[opt](auto bucket) add fe config autobucket_max_buckets (#33842)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaokang authored Apr 19, 2024
1 parent c60a49b commit b9952bc
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2365,12 +2365,18 @@ public class Config extends ConfigBase {
})
public static long analyze_record_limit = 20000;

@ConfField(description = {
@ConfField(mutable = true, description = {
"Auto Buckets中最小的buckets数目",
"min buckets of auto bucket"
})
public static int autobucket_min_buckets = 1;

@ConfField(mutable = true, description = {
"Auto Buckets中最大的buckets数目",
"max buckets of auto bucket"
})
public static int autobucket_max_buckets = 128;

@ConfField(description = {"Arrow Flight Server中所有用户token的缓存上限,超过后LRU淘汰,默认值为512, "
+ "并强制限制小于 qe_max_connection/2, 避免`Reach limit of connections`, "
+ "因为arrow flight sql是无状态的协议,连接通常不会主动断开,"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.doris.catalog.DiskInfo;
import org.apache.doris.catalog.DiskInfo.DiskState;
import org.apache.doris.catalog.Env;
import org.apache.doris.common.Config;
import org.apache.doris.system.Backend;
import org.apache.doris.system.SystemInfoService;

Expand Down Expand Up @@ -85,7 +86,7 @@ private static int convertParitionSizeToBucketsNum(long partitionSize) {
public static int getBucketsNum(long partitionSize) {
int bucketsNumByPartitionSize = convertParitionSizeToBucketsNum(partitionSize);
int bucketsNumByBE = getBucketsNumByBEDisks();
int bucketsNum = Math.min(128, Math.min(bucketsNumByPartitionSize, bucketsNumByBE));
int bucketsNum = Math.min(Config.autobucket_max_buckets, Math.min(bucketsNumByPartitionSize, bucketsNumByBE));
int beNum = getBENum();
logger.debug("AutoBucketsUtil: bucketsNumByPartitionSize {}, bucketsNumByBE {}, bucketsNum {}, beNum {}",
bucketsNumByPartitionSize, bucketsNumByBE, bucketsNum, beNum);
Expand Down
33 changes: 29 additions & 4 deletions regression-test/suites/autobucket/test_autobucket.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ suite("test_autobucket") {

sql "drop table if exists autobucket_test"


// set min to 5
sql "ADMIN SET FRONTEND CONFIG ('autobucket_min_buckets' = '5')"
sql "drop table if exists autobucket_test_min_buckets"
result = sql """
CREATE TABLE `autobucket_test_min_buckets` (
Expand All @@ -55,11 +56,35 @@ suite("test_autobucket") {
)
"""

default_min_buckets = 1 // in Config.java
result = sql "show partitions from autobucket_test_min_buckets"
logger.info("${result}")
// XXX: buckets at pos(8), next maybe impl by sql meta
assertEquals(Integer.valueOf(result.get(0).get(8)), default_min_buckets)

assertEquals(Integer.valueOf(result.get(0).get(8)), 5)
// set back to default
sql "ADMIN SET FRONTEND CONFIG ('autobucket_min_buckets' = '1')"
sql "drop table if exists autobucket_test_min_buckets"

// set max to 4
sql "ADMIN SET FRONTEND CONFIG ('autobucket_max_buckets' = '4')"
sql "drop table if exists autobucket_test_max_buckets"
result = sql """
CREATE TABLE `autobucket_test_max_buckets` (
`user_id` largeint(40) NOT NULL
) ENGINE=OLAP
DUPLICATE KEY(`user_id`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`user_id`) BUCKETS AUTO
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"estimate_partition_size" = "100000G"
)
"""

result = sql "show partitions from autobucket_test_max_buckets"
logger.info("${result}")
// XXX: buckets at pos(8), next maybe impl by sql meta
assertEquals(Integer.valueOf(result.get(0).get(8)), 4)
// set back to default
sql "ADMIN SET FRONTEND CONFIG ('autobucket_max_buckets' = '128')"
sql "drop table if exists autobucket_test_max_buckets"
}

0 comments on commit b9952bc

Please sign in to comment.