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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit b6409f5584107db86ad9c3b09dde556663c6532a
Author: qiye <jianliang5...@gmail.com>
AuthorDate: Mon May 13 15:27:51 2024 +0800

    [improvement](inverted index) Disable the use of skipping write index on 
load (#34719)
    
    When `skip_write_index_on_load` is turned on, users will get an error when 
querying for the latest data(not compacted), giving them a bad experience. And 
we can use `inverted_index_ram_dir_enable = true` and 
`inverted_index_storage_format=V2` to reduce IO and CPU consumption. So we 
disable it now.
    
    1. Disable setting `skip_write_index_on_load` to `true` in create table 
stmt.
    2. Disable setting `skip_write_index_on_load` to `true` in alter table 
properties stmt. You can still alter `skip_write_index_on_load` to `false`.
    
    Co-authored-by: Luennng <luen...@gmail.com>
---
 .../java/org/apache/doris/analysis/ModifyTablePropertiesClause.java  | 5 +++++
 .../src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java | 3 ++-
 .../src/main/java/org/apache/doris/datasource/InternalCatalog.java   | 3 +--
 regression-test/suites/datatype_p0/scalar_types/load.groovy          | 2 +-
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/ModifyTablePropertiesClause.java
 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ModifyTablePropertiesClause.java
index c2bc7bc7d0d..e0aa994c6d3 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/ModifyTablePropertiesClause.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ModifyTablePropertiesClause.java
@@ -240,6 +240,11 @@ public class ModifyTablePropertiesClause extends 
AlterTableClause {
             this.needTableStable = false;
             this.opType = AlterOpType.MODIFY_TABLE_PROPERTY_SYNC;
         } else if 
(properties.containsKey(PropertyAnalyzer.PROPERTIES_SKIP_WRITE_INDEX_ON_LOAD)) {
+            if 
(properties.get(PropertyAnalyzer.PROPERTIES_SKIP_WRITE_INDEX_ON_LOAD).equalsIgnoreCase("true"))
 {
+                throw new AnalysisException(
+                    "Property "
+                    + PropertyAnalyzer.PROPERTIES_SKIP_WRITE_INDEX_ON_LOAD + " 
is forbidden now");
+            }
             if 
(!properties.get(PropertyAnalyzer.PROPERTIES_SKIP_WRITE_INDEX_ON_LOAD).equalsIgnoreCase("true")
                     && !properties.get(PropertyAnalyzer
                                                 
.PROPERTIES_SKIP_WRITE_INDEX_ON_LOAD).equalsIgnoreCase("false")) {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java
index ba4434349cb..07236da2ee3 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/common/util/PropertyAnalyzer.java
@@ -705,7 +705,8 @@ public class PropertyAnalyzer {
         }
         properties.remove(PROPERTIES_SKIP_WRITE_INDEX_ON_LOAD);
         if (value.equalsIgnoreCase("true")) {
-            return true;
+            throw new AnalysisException("Property " + 
PROPERTIES_SKIP_WRITE_INDEX_ON_LOAD
+                    + " is forbidden now.");
         } else if (value.equalsIgnoreCase("false")) {
             return false;
         }
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 ee3b6ee9651..41ef985f17f 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
@@ -2405,8 +2405,7 @@ public class InternalCatalog implements 
CatalogIf<Database> {
         olapTable.setStoreRowColumn(storeRowColumn);
 
         // set skip inverted index on load
-        boolean skipWriteIndexOnLoad = 
PropertyAnalyzer.analyzeBooleanProp(properties,
-                PropertyAnalyzer.PROPERTIES_SKIP_WRITE_INDEX_ON_LOAD, false);
+        boolean skipWriteIndexOnLoad = 
PropertyAnalyzer.analyzeSkipWriteIndexOnLoad(properties);
         olapTable.setSkipWriteIndexOnLoad(skipWriteIndexOnLoad);
 
         boolean isMutable = PropertyAnalyzer.analyzeBooleanProp(properties, 
PropertyAnalyzer.PROPERTIES_MUTABLE, true);
diff --git a/regression-test/suites/datatype_p0/scalar_types/load.groovy 
b/regression-test/suites/datatype_p0/scalar_types/load.groovy
index 91cd4eb1f1f..4c7c7ee9366 100644
--- a/regression-test/suites/datatype_p0/scalar_types/load.groovy
+++ b/regression-test/suites/datatype_p0/scalar_types/load.groovy
@@ -448,7 +448,7 @@ suite("test_scalar_types_load", "p0") {
         DUPLICATE KEY(`k1`)
         COMMENT 'OLAP'
         DISTRIBUTED BY HASH(`k1`) BUCKETS 10
-        PROPERTIES("replication_num" = "1", "skip_write_index_on_load" = 
"true");
+        PROPERTIES("replication_num" = "1", "skip_write_index_on_load" = 
"false");
         """
 
     // insert data into dup table with index


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to