[chore](merge-on-write) disable single replica load and compaction for mow table (#22188)

This commit is contained in:
Xin Liao
2023-07-25 22:05:22 +08:00
committed by GitHub
parent 5c8eda8685
commit f44660db1a
3 changed files with 38 additions and 8 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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"
}
}