Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/zh-CN/docs/admin-manual/config/fe-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2313,3 +2313,14 @@ load 标签清理器将每隔 `label_clean_interval_second` 运行一次以清
是否可以动态配置:true

是否为 Master FE 节点独有的配置项:true


### max_replica_count_when_schema_change

OlapTable在做schema change时,允许的最大副本数,副本数过大会导致FE OOM。

默认值:100000

是否可以动态配置:true

是否为 Master FE 节点独有的配置项:true
20 changes: 20 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/alter/AlterHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.doris.catalog.Replica;
import org.apache.doris.catalog.Table;
import org.apache.doris.catalog.Tablet;
import org.apache.doris.common.Config;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.FeConstants;
import org.apache.doris.common.MetaNotFoundException;
Expand Down Expand Up @@ -253,4 +254,23 @@ public void replayAlterJobV2(AlterJobV2 alterJob) {
existingJob.replay(alterJob);
}
}

/**
* there will be OOM if there are too many replicas of the table when schema change.
*/
protected void checkReplicaCount(OlapTable olapTable) throws DdlException {
olapTable.readLock();
try {
long replicaCount = olapTable.getReplicaCount();
long maxReplicaCount = Config.max_replica_count_when_schema_change;
if (replicaCount > maxReplicaCount) {
String msg = String.format("%s have %d replicas reach %d limit when schema change.",
olapTable.getName(), replicaCount, maxReplicaCount);
LOG.warn(msg);
throw new DdlException(msg);
}
} finally {
olapTable.readUnlock();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public void processCreateMaterializedView(CreateMaterializedViewStmt addMVClause
*/
public void processBatchAddRollup(List<AlterClause> alterClauses, Database db, OlapTable olapTable)
throws DdlException, AnalysisException {
checkReplicaCount(olapTable);
Map<String, RollupJobV2> rollupNameJobMap = new LinkedHashMap<>();
// save job id for log
Set<Long> logJobIdSet = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,7 @@ private void createJob(long dbId, OlapTable olapTable, Map<Long, LinkedList<Colu
throw new DdlException("Table[" + olapTable.getName() + "]'s is doing ROLLUP job");
}

checkReplicaCount(olapTable);
// for now table's state can only be NORMAL
Preconditions.checkState(olapTable.getState() == OlapTableState.NORMAL, olapTable.getState().name());

Expand Down
8 changes: 8 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/common/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -1831,4 +1831,12 @@ public class Config extends ConfigBase {
*/
@ConfField(mutable = true, masterOnly = false)
public static long hive_metastore_client_timeout_second = 10;

/**
* if table has too many replicas, Fe occur oom when schema change.
* 10W replicas is a reasonable value for testing.
*/
@ConfField(mutable = true, masterOnly = true)
public static long max_replica_count_when_schema_change = 100000;
}