This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new f44660db1a [chore](merge-on-write) disable single replica load and 
compaction for mow table (#22188)
f44660db1a is described below

commit f44660db1a194c11db25d3f0a0d5c1cd2eeee2ce
Author: Xin Liao <[email protected]>
AuthorDate: Tue Jul 25 22:05:22 2023 +0800

    [chore](merge-on-write) disable single replica load and compaction for mow 
table (#22188)
---
 .../org/apache/doris/datasource/InternalCatalog.java | 20 ++++++++++++--------
 .../java/org/apache/doris/planner/OlapTableSink.java |  6 ++++++
 .../unique_with_mow_p0/test_create_table.groovy      | 20 ++++++++++++++++++++
 3 files changed, 38 insertions(+), 8 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
index 8422758089..fd95fe37a1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
@@ -1978,14 +1978,6 @@ public class InternalCatalog implements 
CatalogIf<Database> {
         // use light schema change optimization
         olapTable.setDisableAutoCompaction(disableAutoCompaction);
 
-        boolean enableSingleReplicaCompaction = false;
-        try {
-            enableSingleReplicaCompaction = 
PropertyAnalyzer.analyzeEnableSingleReplicaCompaction(properties);
-        } catch (AnalysisException e) {
-            throw new DdlException(e.getMessage());
-        }
-        
olapTable.setEnableSingleReplicaCompaction(enableSingleReplicaCompaction);
-
         // get storage format
         TStorageFormat storageFormat = TStorageFormat.V2; // default is 
segment v2
         try {
@@ -2019,6 +2011,18 @@ public class InternalCatalog implements 
CatalogIf<Database> {
         }
         olapTable.setEnableUniqueKeyMergeOnWrite(enableUniqueKeyMergeOnWrite);
 
+        boolean enableSingleReplicaCompaction = false;
+        try {
+            enableSingleReplicaCompaction = 
PropertyAnalyzer.analyzeEnableSingleReplicaCompaction(properties);
+        } catch (AnalysisException e) {
+            throw new DdlException(e.getMessage());
+        }
+        if (enableUniqueKeyMergeOnWrite && enableSingleReplicaCompaction) {
+            throw new 
DdlException(PropertyAnalyzer.PROPERTIES_ENABLE_SINGLE_REPLICA_COMPACTION
+                    + " property is not supported for merge-on-write table");
+        }
+        
olapTable.setEnableSingleReplicaCompaction(enableSingleReplicaCompaction);
+
         // analyze bloom filter columns
         Set<String> bfColumns = null;
         double bfFpp = 0;
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java 
b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java
index 411fb548fa..0bc30f978a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java
@@ -146,6 +146,12 @@ public class OlapTableSink extends DataSink {
             singleReplicaLoad = false;
             LOG.warn("Single replica load not supported by TStorageFormat.V1. 
table: {}", dstTable.getName());
         }
+        if (dstTable.getEnableUniqueKeyMergeOnWrite()) {
+            singleReplicaLoad = false;
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Single replica load not supported by merge-on-write 
table: {}", dstTable.getName());
+            }
+        }
     }
 
     public void setPartialUpdateInputColumns(boolean isPartialUpdate, 
HashSet<String> columns) {
diff --git a/regression-test/suites/unique_with_mow_p0/test_create_table.groovy 
b/regression-test/suites/unique_with_mow_p0/test_create_table.groovy
index 5326672db2..0336beb7c0 100644
--- a/regression-test/suites/unique_with_mow_p0/test_create_table.groovy
+++ b/regression-test/suites/unique_with_mow_p0/test_create_table.groovy
@@ -94,4 +94,24 @@ suite("test_create_table") {
         """
         exception "enable_unique_key_merge_on_write property only support 
unique key table"
     }
+
+    // unique table with enable_unique_key_merge_on_write  and 
enable_single_replica_compaction property
+    test {
+        sql """
+            CREATE TABLE `$tableName` (
+                    `c_custkey` int(11) NOT NULL COMMENT "",
+                    `c_name` varchar(26) NOT NULL COMMENT "",
+                    `c_address` varchar(41) NOT NULL COMMENT "",
+                    `c_city` varchar(11) NOT NULL COMMENT ""
+            )
+            UNIQUE KEY (`c_custkey`)
+            DISTRIBUTED BY HASH(`c_custkey`) BUCKETS 1
+            PROPERTIES (
+                    "replication_num" = "1",
+                    "enable_unique_key_merge_on_write" = "true",
+                    "enable_single_replica_compaction" = "true"
+             );
+        """
+        exception "enable_single_replica_compaction property is not supported 
for merge-on-write table"
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to