You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ka...@apache.org on 2020/04/20 15:52:54 UTC
[incubator-doris] branch master updated: [Bug][Dynamic
Partition]Fix Bug that dynamic partition properties is not consistent
(#3359)
This is an automated email from the ASF dual-hosted git repository.
kangkaisen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 94b7bb5 [Bug][Dynamic Partition]Fix Bug that dynamic partition properties is not consistent (#3359)
94b7bb5 is described below
commit 94b7bb5ad65bae814700fbe4ed52a467a38334dc
Author: WingC <10...@qq.com>
AuthorDate: Mon Apr 20 23:52:47 2020 +0800
[Bug][Dynamic Partition]Fix Bug that dynamic partition properties is not consistent (#3359)
---
.../java/org/apache/doris/catalog/Catalog.java | 59 +++++++++++-----------
1 file changed, 30 insertions(+), 29 deletions(-)
diff --git a/fe/src/main/java/org/apache/doris/catalog/Catalog.java b/fe/src/main/java/org/apache/doris/catalog/Catalog.java
index 490c202..858399c 100644
--- a/fe/src/main/java/org/apache/doris/catalog/Catalog.java
+++ b/fe/src/main/java/org/apache/doris/catalog/Catalog.java
@@ -5132,6 +5132,7 @@ public class Catalog {
}
public void modifyTableDynamicPartition(Database db, OlapTable table, Map<String, String> properties) throws DdlException {
+ Map<String, String> logProperties = new HashMap<>(properties);
TableProperty tableProperty = table.getTableProperty();
if (tableProperty == null) {
DynamicPartitionUtil.checkAndSetDynamicPartitionProperty(table, properties);
@@ -5144,38 +5145,10 @@ public class Catalog {
DynamicPartitionUtil.registerOrRemoveDynamicPartitionTable(db.getId(), table);
dynamicPartitionScheduler.createOrUpdateRuntimeInfo(
table.getName(), DynamicPartitionScheduler.LAST_UPDATE_TIME, TimeUtils.getCurrentFormatTime());
- ModifyTablePropertyOperationLog info = new ModifyTablePropertyOperationLog(db.getId(), table.getId(), properties);
+ ModifyTablePropertyOperationLog info = new ModifyTablePropertyOperationLog(db.getId(), table.getId(), logProperties);
editLog.logDynamicPartition(info);
}
- public void replayModifyTableProperty(short opCode, ModifyTablePropertyOperationLog info) {
- long dbId = info.getDbId();
- long tableId = info.getTableId();
- Map<String, String> properties = info.getProperties();
-
- Database db = getDb(dbId);
- db.writeLock();
- try {
- OlapTable olapTable = (OlapTable) db.getTable(tableId);
- TableProperty tableProperty = olapTable.getTableProperty();
- if (tableProperty == null) {
- olapTable.setTableProperty(new TableProperty(properties).buildProperty(opCode));
- } else {
- tableProperty.modifyTableProperties(properties);
- tableProperty.buildProperty(opCode);
- }
-
- // need to replay partition info meta
- if (opCode == OperationType.OP_MODIFY_IN_MEMORY) {
- for(Partition partition: olapTable.getPartitions()) {
- olapTable.getPartitionInfo().setIsInMemory(partition.getId(), tableProperty.IsInMemory());
- }
- }
- } finally {
- db.writeUnlock();
- }
- }
-
// The caller need to hold the db write lock
public void modifyTableReplicationNum(Database db, OlapTable table, Map<String, String> properties) {
Preconditions.checkArgument(db.isWriteLockHeldByCurrentThread());
@@ -5210,6 +5183,34 @@ public class Catalog {
editLog.logModifyInMemory(info);
}
+ public void replayModifyTableProperty(short opCode, ModifyTablePropertyOperationLog info) {
+ long dbId = info.getDbId();
+ long tableId = info.getTableId();
+ Map<String, String> properties = info.getProperties();
+
+ Database db = getDb(dbId);
+ db.writeLock();
+ try {
+ OlapTable olapTable = (OlapTable) db.getTable(tableId);
+ TableProperty tableProperty = olapTable.getTableProperty();
+ if (tableProperty == null) {
+ olapTable.setTableProperty(new TableProperty(properties).buildProperty(opCode));
+ } else {
+ tableProperty.modifyTableProperties(properties);
+ tableProperty.buildProperty(opCode);
+ }
+
+ // need to replay partition info meta
+ if (opCode == OperationType.OP_MODIFY_IN_MEMORY) {
+ for(Partition partition: olapTable.getPartitions()) {
+ olapTable.getPartitionInfo().setIsInMemory(partition.getId(), tableProperty.IsInMemory());
+ }
+ }
+ } finally {
+ db.writeUnlock();
+ }
+ }
+
/*
* used for handling AlterClusterStmt
* (for client is the ALTER CLUSTER command).
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org