Skip to content

Commit

Permalink
[Enhancement] Make default bucket num at least 16 when table is unpar…
Browse files Browse the repository at this point in the history
…titioned (backport #47005) (#47105)

Signed-off-by: meegoo <[email protected]>
Co-authored-by: meegoo <[email protected]>
  • Loading branch information
mergify[bot] and meegoo authored Jun 17, 2024
1 parent c908f92 commit d9d3ed7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,11 @@ public static int calAvgBucketNumOfRecentPartitions(OlapTable olapTable, int rec

if (olapTable.getPartitions().size() < recentPartitionNum || !enableAutoTabletDistribution) {
bucketNum = CatalogUtils.calBucketNumAccordingToBackends();
// If table is not partitioned, the bucketNum should be at least DEFAULT_UNPARTITIONED_TABLE_BUCKET_NUM
if (!olapTable.getPartitionInfo().isPartitioned()) {
bucketNum = bucketNum > FeConstants.DEFAULT_UNPARTITIONED_TABLE_BUCKET_NUM ?
bucketNum : FeConstants.DEFAULT_UNPARTITIONED_TABLE_BUCKET_NUM;
}
return bucketNum;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public class FeConstants {
// Max counter num of TOP K function
public static final int MAX_COUNTER_NUM_OF_TOP_K = 100000;

public static final int DEFAULT_UNPARTITIONED_TABLE_BUCKET_NUM = 16;

public static final String DOCUMENT_SHOW_ALTER =
"https://docs.starrocks.io/docs/sql-reference/sql-statements/data-manipulation/SHOW_ALTER";
public static final String DOCUMENT_SHOW_ALTER_MATERIALIZED_VIEW =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.starrocks.catalog.OlapTable;
import com.starrocks.catalog.Partition;
import com.starrocks.common.Config;
import com.starrocks.common.FeConstants;
import com.starrocks.pseudocluster.PseudoCluster;
import com.starrocks.server.GlobalStateMgr;
import org.jetbrains.annotations.TestOnly;
Expand Down Expand Up @@ -89,8 +90,8 @@ public void testCTASAutoTablet() throws Exception {
} finally {
db.readUnlock();
}
Assert.assertEquals(bucketNum1, 6);
Assert.assertEquals(bucketNum2, 6);
Assert.assertEquals(bucketNum3, 6);
Assert.assertEquals(bucketNum1, FeConstants.DEFAULT_UNPARTITIONED_TABLE_BUCKET_NUM);
Assert.assertEquals(bucketNum2, FeConstants.DEFAULT_UNPARTITIONED_TABLE_BUCKET_NUM);
Assert.assertEquals(bucketNum3, FeConstants.DEFAULT_UNPARTITIONED_TABLE_BUCKET_NUM);
}
}

0 comments on commit d9d3ed7

Please sign in to comment.