You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/06/15 10:41:22 UTC
[GitHub] [incubator-doris] EmmyMiao87 commented on a change in pull request #5751: [Replica][Config] Add max/min replica config for create/alter table
EmmyMiao87 commented on a change in pull request #5751:
URL: https://github.com/apache/incubator-doris/pull/5751#discussion_r651667417
##########
File path: fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
##########
@@ -3631,6 +3631,9 @@ private void createOlapTable(Database db, CreateTableStmt stmt) throws DdlExcept
boolean isReplicationNumSet = properties != null && properties.containsKey(PropertyAnalyzer.PROPERTIES_REPLICATION_NUM);
replicationNum = PropertyAnalyzer.analyzeReplicationNum(properties, replicationNum);
if (isReplicationNumSet) {
+ if (replicationNum < Config.min_replica_num || replicationNum > Config.max_replica_num) {
Review comment:
same as above.
##########
File path: fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
##########
@@ -1637,6 +1637,11 @@ public void process(List<AlterClause> alterClauses, String clusterName, Database
return;
} else if (properties.containsKey("default." + PropertyAnalyzer.PROPERTIES_REPLICATION_NUM)) {
Preconditions.checkNotNull(properties.get(PropertyAnalyzer.PROPERTIES_REPLICATION_NUM));
+ short replicaNum = Short.parseShort(properties.getOrDefault(PropertyAnalyzer.PROPERTIES_REPLICATION_NUM,
Review comment:
The maximum number of copies should be the number of be not be the max Integer
##########
File path: fe/fe-core/src/main/java/org/apache/doris/common/Config.java
##########
@@ -1396,4 +1396,12 @@
*/
@ConfField(mutable = true, masterOnly = true)
public static int max_dynamic_partition_num = 500;
+
+ /**
+ * min/max replica number limit
+ */
+ @ConfField(mutable = true)
Review comment:
The minimum and maximum values should not be a configuration, but a hard-coded constant.
##########
File path: fe/fe-core/src/main/java/org/apache/doris/common/util/DynamicPartitionUtil.java
##########
@@ -187,8 +187,9 @@ private static void checkReplicationNum(String val) throws DdlException {
throw new DdlException("Invalid properties: " + DynamicPartitionProperty.REPLICATION_NUM);
}
try {
- if (Integer.parseInt(val) <= 0) {
- ErrorReport.reportDdlException(ErrorCode.ERROR_DYNAMIC_PARTITION_REPLICATION_NUM_ZERO);
+ if (Integer.parseInt(val) < Config.min_replica_num || Integer.parseInt(val) > Config.max_replica_num) {
Review comment:
same as above
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org