Skip to content

Commit

Permalink
[improvement](inverted index) Disable the use of skipping write index…
Browse files Browse the repository at this point in the history
… on load (apache#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 <luennng@gmail.com>
  • Loading branch information
2 people authored and ByteYue committed May 15, 2024
1 parent aec704c commit c513051
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ public void analyze(Analyzer analyzer) throws AnalysisException {
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")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,8 @@ public static Boolean analyzeSkipWriteIndexOnLoad(Map<String, String> properties
}
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2492,8 +2492,7 @@ private void createOlapTable(Database db, CreateTableStmt stmt) throws UserExcep
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c513051

Please sign in to comment.