Revert "[feature](merge-on-write) enable merge-on-write by default (#27188)" (#28096)

This reverts commit 00c8bab84de8154052f9d323800b436cd0ad36e5.
This commit is contained in:
yiguolei
2023-12-07 11:31:36 +08:00
committed by GitHub
parent 3a7a8bb107
commit 8c79b86f5b
31 changed files with 40 additions and 122 deletions

View File

@ -423,7 +423,6 @@ public class CreateTableStmt extends DdlStmt {
if (keysDesc.getKeysType() == KeysType.UNIQUE_KEYS) {
enableUniqueKeyMergeOnWrite = false;
if (properties != null) {
properties = PropertyAnalyzer.enableUniqueKeyMergeOnWriteIfNotExists(properties);
// `analyzeXXX` would modify `properties`, which will be used later,
// so we just clone a properties map here.
enableUniqueKeyMergeOnWrite = PropertyAnalyzer.analyzeUniqueKeyMergeOnWrite(

View File

@ -3215,8 +3215,8 @@ public class Env {
sb.append(olapTable.getEstimatePartitionSize()).append("\"");
}
// unique key table with merge on write, always print this property for unique table
if (olapTable.getKeysType() == KeysType.UNIQUE_KEYS) {
// unique key table with merge on write
if (olapTable.getKeysType() == KeysType.UNIQUE_KEYS && olapTable.getEnableUniqueKeyMergeOnWrite()) {
sb.append(",\n\"").append(PropertyAnalyzer.ENABLE_UNIQUE_KEY_MERGE_ON_WRITE).append("\" = \"");
sb.append(olapTable.getEnableUniqueKeyMergeOnWrite()).append("\"");
}

View File

@ -461,9 +461,6 @@ public class TableProperty implements Writable {
properties.put(PropertyAnalyzer.ENABLE_UNIQUE_KEY_MERGE_ON_WRITE, Boolean.toString(enable));
}
// In order to ensure that unique tables without the `enable_unique_key_merge_on_write` property specified
// before version 2.1 still maintain the merge-on-read implementation after the upgrade, we will keep
// the default value here as false.
public boolean getEnableUniqueKeyMergeOnWrite() {
return Boolean.parseBoolean(properties.getOrDefault(
PropertyAnalyzer.ENABLE_UNIQUE_KEY_MERGE_ON_WRITE, "false"));

View File

@ -1280,13 +1280,4 @@ public class PropertyAnalyzer {
return properties;
}
// Since we can't change the default value of the property `enable_unique_key_merge_on_write`
// due to backward compatibility, we just explicitly set the value of this property to `true` if
// the user doesn't specify the property in `CreateTableStmt`/`CreateTableInfo`
public static Map<String, String> enableUniqueKeyMergeOnWriteIfNotExists(Map<String, String> properties) {
if (properties != null && properties.get(PropertyAnalyzer.ENABLE_UNIQUE_KEY_MERGE_ON_WRITE) == null) {
properties.put(PropertyAnalyzer.ENABLE_UNIQUE_KEY_MERGE_ON_WRITE, "true");
}
return properties;
}
}

View File

@ -264,10 +264,6 @@ public class CreateTableInfo {
+ " set 'true' when create olap table by default.");
}
if (keysType.equals(KeysType.UNIQUE_KEYS)) {
properties = PropertyAnalyzer.enableUniqueKeyMergeOnWriteIfNotExists(properties);
}
if (properties != null && properties.containsKey(PropertyAnalyzer.ENABLE_UNIQUE_KEY_MERGE_ON_WRITE)) {
if (!keysType.equals(KeysType.UNIQUE_KEYS)) {
throw new AnalysisException(PropertyAnalyzer.ENABLE_UNIQUE_KEY_MERGE_ON_WRITE