[Enhancement](load) add timer and partitions number limit (#26549)

add timer and partitions number limit
This commit is contained in:
zclllyybb
2023-11-08 11:22:40 +08:00
committed by GitHub
parent c93c8f6105
commit 47ba4aaf30
7 changed files with 44 additions and 7 deletions

View File

@ -964,6 +964,10 @@ public class OlapTable extends Table {
return partition;
}
public int getPartitionNum() {
return idToPartition.size();
}
// get all partitions except temp partitions
public Collection<Partition> getPartitions() {
return idToPartition.values();

View File

@ -3295,6 +3295,19 @@ public class FrontendServiceImpl implements FrontendService.Iface {
return result;
}
// check partition's number limit.
int partitionNum = olapTable.getPartitionNum() + addPartitionClauseMap.size();
if (partitionNum > Config.max_auto_partition_num) {
olapTable.writeUnlock();
String errorMessage = String.format(
"create partition failed. partition numbers %d will exceed limit variable max_auto_partition_num%d",
partitionNum, Config.max_auto_partition_num);
LOG.warn(errorMessage);
errorStatus.setErrorMsgs(Lists.newArrayList(errorMessage));
result.setStatus(errorStatus);
return result;
}
for (AddPartitionClause addPartitionClause : addPartitionClauseMap.values()) {
try {
// here maybe check and limit created partitions num