From 4300fdce431a44c23c453dce6eb7452e1b1e0aa4 Mon Sep 17 00:00:00 2001 From: bobhan1 Date: Thu, 14 Dec 2023 19:35:52 +0800 Subject: [PATCH] [feature](merge-on-write) enable merge-on-write by default again (#28105) fix #27188, #28096 --- docs/en/docs/data-table/data-model.md | 8 ++-- .../Create/CREATE-TABLE.md | 6 +++ docs/zh-CN/docs/data-table/data-model.md | 11 ++++-- .../Create/CREATE-TABLE.md | 6 +++ .../doris/analysis/CreateTableStmt.java | 1 + .../java/org/apache/doris/catalog/Env.java | 4 +- .../apache/doris/catalog/TableProperty.java | 3 ++ .../doris/common/util/PropertyAnalyzer.java | 9 +++++ .../plans/commands/info/CreateTableInfo.java | 2 +- .../analysis/CreateTableAsSelectStmtTest.java | 1 + .../doris/analysis/CreateTableStmtTest.java | 35 +++++++++++++++++- .../apache/doris/catalog/CreateTableTest.java | 4 +- .../trees/plans/CreateTableCommandTest.java | 4 +- .../unique/test_unique_table.out | 18 ++++----- .../unique/test_unique_table_like.out | 24 ++++++------ .../unique/test_unique_table_new_sequence.out | 14 +++---- .../data/index_p0/test_bitmap_index.out | 10 ++--- ...test_group_commit_interval_ms_property.out | 8 ++-- .../inverted_index_p0/test_bitmap_index.out | 2 +- .../schema_change_p0/test_rename_column.out | Bin 4171 -> 4117 bytes .../schema_change_p0/test_schema_change.out | 6 +-- .../test_uniq_delete_sign_schema_change.out | 20 +++++----- .../test_unsigned_int_compatibility.out | 7 ++-- .../data/update/test_update_unique.out | 6 +-- .../alter_table_add_policy.groovy | 4 +- .../create_table_use_policy.groovy | 5 ++- .../cold_heat_separation/policy/drop.groovy | 4 +- .../test_unique_table_debug_data.groovy | 4 +- .../datetimev1/test_datetimev1_common.groovy | 4 +- .../datev1/test_datev1_common.groovy | 4 +- .../delete_p0/test_delete_on_value.groovy | 2 + .../suites/index_p0/test_bitmap_index.groovy | 2 + .../test_uniq_mv_useless.groovy | 3 +- .../suites/mv_p0/unique/unique.groovy | 3 +- .../varchar_length/varchar_length.groovy | 4 +- .../test_auto_partition_behavior.groovy | 19 +++++----- .../test_alter_table_drop_column.groovy | 4 +- .../cluster_key/test_create_table.groovy | 4 +- .../suites/variant_p0/delete_update.groovy | 3 +- 39 files changed, 183 insertions(+), 95 deletions(-) diff --git a/docs/en/docs/data-table/data-model.md b/docs/en/docs/data-table/data-model.md index 12af334e96..f9225a4dac 100644 --- a/docs/en/docs/data-table/data-model.md +++ b/docs/en/docs/data-table/data-model.md @@ -493,12 +493,14 @@ That is to say, the Merge on Read implementation of the Unique Model is equivale The Merge on Write implementation of the Unique Model is completely different from that of the Aggregate Model. It can deliver better performance in aggregation queries with primary key limitations. -In Doris 1.2.0, as a new feature, Merge on Write is disabled by default, and users can enable it by adding the following property: +In Doris 1.2.0, as a new feature, Merge on Write is disabled by default(before version 2.1), and users can enable it by adding the following property: ``` "enable_unique_key_merge_on_write" = "true" ``` +In Doris 2.1, Merge on Write is enabled by default. + > NOTE: > 1. It is recommended to use version 1.2.4 or above, as this version has fixed some bugs and stability issues. > 2. Add the configuration item "disable_storage_page_cache=false" to the be.conf file. Failure to add this configuration item may have a significant impact on data load performance. @@ -543,8 +545,8 @@ On a Unique table with the Merge on Write option enabled, during the import stag [NOTE] -1. The new Merge on Write implementation is disabled by default, and can only be enabled by specifying a property when creating a new table. -2. The old Merge on Read cannot be seamlessly upgraded to the new implementation (since they have completely different data organization). If you want to switch to the Merge on Write implementation, you need to manually execute `insert into unique-mow- table select * from source table` to load data to new table. +1. The Merge on Write implementation is disabled by default can only be enabled by specifying a property when creating a new table. Before version 2.1, it's disabled by default. Since version 2.1, it's enabled by default. +2. The old Merge on Read cannot be seamlessly upgraded to the Merge on Write implementation (since they have completely different data organization). If you want to switch to the Merge on Write implementation, you need to manually execute `insert into unique-mow-table select * from source table` to load data to new table. 3. The two unique features `delete sign` and `sequence col` of the Unique Model can be used as normal in the new implementation, and their usage remains unchanged. diff --git a/docs/en/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md b/docs/en/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md index 6aa9a4cbbb..df5030462e 100644 --- a/docs/en/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md +++ b/docs/en/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md @@ -383,6 +383,12 @@ Set table properties. The following attributes are currently supported: `"compression"="zstd"` +* `enable_unique_key_merge_on_write` + + Wheather the unique table use merge-on-write implementation. + + The property is disabled by default before version 2.1 and is enabled by default since version 2.1. + * `light_schema_change` Whether to use the Light Schema Change optimization. diff --git a/docs/zh-CN/docs/data-table/data-model.md b/docs/zh-CN/docs/data-table/data-model.md index 3e2b8ed2e6..b2b72bdc11 100644 --- a/docs/zh-CN/docs/data-table/data-model.md +++ b/docs/zh-CN/docs/data-table/data-model.md @@ -416,7 +416,7 @@ mysql> select sum_merge(k2) , group_concat_merge(k3)from aggstate where k1 != 2; 在某些多维分析场景下,用户更关注的是如何保证 Key 的唯一性,即如何获得 Primary Key 唯一性约束。 因此,我们引入了 Unique 数据模型。在1.2版本之前,该模型本质上是聚合模型的一个特例,也是一种简化的表结构表示方式。 -由于聚合模型的实现方式是读时合并(merge on read),因此在一些聚合查询上性能不佳(参考后续章节[聚合模型的局限性](#聚合模型的局限性)的描述), +由于聚合模型的实现方式是读时合并(merge on read),因此在一些聚合查询上性能不佳(参考后续章节[聚合模型的局限性](#聚合模型的局限性)的描述), 在1.2版本我们引入了Unique模型新的实现方式,写时合并(merge on write),通过在写入时做一些额外的工作,实现了最优的查询性能。 写时合并将在未来替换读时合并成为Unique模型的默认实现方式,两者将会短暂的共存一段时间。下面将对两种实现方式分别举例进行说明。 @@ -496,11 +496,14 @@ PROPERTIES ( Unique模型的写时合并实现,与聚合模型就是完全不同的两种模型了,查询性能更接近于duplicate模型,在有主键约束需求的场景上相比聚合模型有较大的查询性能优势,尤其是在聚合查询以及需要用索引过滤大量数据的查询中。 -在 1.2.0 版本中,作为一个新的feature,写时合并默认关闭,用户可以通过添加下面的property来开启 +在 1.2.0 版本中,作为一个新的feature,写时合并默认关闭(2.1 版本之前),用户可以通过添加下面的property来开启 ``` "enable_unique_key_merge_on_write" = "true" ``` + +从 2.1 版本开始,写时合并默认开启。 + > 注意: > 1. 建议使用1.2.4及以上版本,该版本修复了一些bug和稳定性问题 > 2. 在be.conf中添加配置项:disable_storage_page_cache=false。不添加该配置项可能会对数据导入性能产生较大影响 @@ -544,8 +547,8 @@ PROPERTIES ( 所有被标记删除的数据都会在文件级别被过滤掉,读取出来的数据就都是最新的数据,消除掉了读时合并中的数据聚合过程,并且能够在很多情况下支持多种谓词的下推。因此在许多场景都能带来比较大的性能提升,尤其是在有聚合查询的情况下。 【注意】 -1. 新的Merge-on-write实现默认关闭,且只能在建表时通过指定property的方式打开。 -2. 旧的Merge-on-read的实现无法无缝升级到新版本的实现(数据组织方式完全不同),如果需要改为使用写时合并的实现版本,需要手动执行`insert into unique-mow-table select * from source table`. +1. 要使用Merge-on-write实现的unique表,只能在建表时通过指定property的方式打开。在2.1版本之前该属性默认关闭,从2.1版本开始,该属性默认打开。 +2. 旧的Merge-on-read的实现无法无缝升级到Merge-on-write的实现(数据组织方式完全不同),如果需要改为使用写时合并的实现版本,需要手动执行`insert into unique-mow-table select * from source table`. 3. 在Unique模型上独有的delete sign 和 sequence col,在写时合并的新版实现中仍可以正常使用,用法没有变化。 diff --git a/docs/zh-CN/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md b/docs/zh-CN/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md index 6a9c63f8d6..9eba3f809a 100644 --- a/docs/zh-CN/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md +++ b/docs/zh-CN/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE.md @@ -366,6 +366,12 @@ UNIQUE KEY(k1, k2) `"function_column.sequence_type" = 'Date'` +* `enable_unique_key_merge_on_write` + + unique表是否使用merge on write实现。 + + 该属性在 2.1 版本之前默认关闭,从 2.1 版本开始默认开启。 + * `light_schema_change` 是否使用light schema change优化。 diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java index dc6d504aaf..45be7a672d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateTableStmt.java @@ -425,6 +425,7 @@ 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( diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java index b498ccb6a6..3065e92b71 100755 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java @@ -3243,8 +3243,8 @@ public class Env { sb.append(olapTable.getEstimatePartitionSize()).append("\""); } - // unique key table with merge on write - if (olapTable.getKeysType() == KeysType.UNIQUE_KEYS && olapTable.getEnableUniqueKeyMergeOnWrite()) { + // unique key table with merge on write, always print this property for unique table + if (olapTable.getKeysType() == KeysType.UNIQUE_KEYS) { sb.append(",\n\"").append(PropertyAnalyzer.ENABLE_UNIQUE_KEY_MERGE_ON_WRITE).append("\" = \""); sb.append(olapTable.getEnableUniqueKeyMergeOnWrite()).append("\""); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java index dd44dd3868..857833de0c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/TableProperty.java @@ -462,6 +462,9 @@ 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")); 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 279eba12c1..75dc07e915 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 @@ -1281,4 +1281,13 @@ 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 enableUniqueKeyMergeOnWriteIfNotExists(Map 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; + } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateTableInfo.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateTableInfo.java index ea517593f8..87c38dee42 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateTableInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateTableInfo.java @@ -364,7 +364,7 @@ public class CreateTableInfo { if (keysType == KeysType.UNIQUE_KEYS) { isEnableMergeOnWrite = false; if (properties != null) { - // properties = PropertyAnalyzer.enableUniqueKeyMergeOnWriteIfNotExists(properties); + properties = PropertyAnalyzer.enableUniqueKeyMergeOnWriteIfNotExists(properties); // `analyzeXXX` would modify `properties`, which will be used later, // so we just clone a properties map here. try { diff --git a/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableAsSelectStmtTest.java b/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableAsSelectStmtTest.java index 38eb87b057..4c3f8eceb0 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableAsSelectStmtTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableAsSelectStmtTest.java @@ -536,6 +536,7 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService { + "\"min_load_replica_num\" = \"-1\",\n" + "\"is_being_synced\" = \"false\",\n" + "\"storage_format\" = \"V2\",\n" + + "\"enable_unique_key_merge_on_write\" = \"true\",\n" + "\"light_schema_change\" = \"true\",\n" + "\"disable_auto_compaction\" = \"false\",\n" + "\"enable_single_replica_compaction\" = \"false\",\n" diff --git a/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableStmtTest.java b/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableStmtTest.java index 89b30f08a1..3d2eb9c411 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableStmtTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/analysis/CreateTableStmtTest.java @@ -140,8 +140,8 @@ public class CreateTableStmtTest { new KeysDesc(KeysType.UNIQUE_KEYS, colsName), null, new HashDistributionDesc(10, Lists.newArrayList("col1")), properties, null, ""); stmt.analyze(analyzer); - Assert.assertEquals(col3.getAggregateType(), AggregateType.REPLACE); - Assert.assertEquals(col4.getAggregateType(), AggregateType.REPLACE); + Assert.assertEquals(col3.getAggregateType(), AggregateType.NONE); + Assert.assertEquals(col4.getAggregateType(), AggregateType.NONE); // clear cols.remove(col3); cols.remove(col4); @@ -199,6 +199,37 @@ public class CreateTableStmtTest { cols.remove(col4); } + @Test + public void testCreateTableUniqueKeyMoR() throws UserException { + // setup + Map properties = new HashMap<>(); + properties.put(PropertyAnalyzer.ENABLE_UNIQUE_KEY_MERGE_ON_WRITE, "false"); + ColumnDef col3 = new ColumnDef("col3", new TypeDef(ScalarType.createType(PrimitiveType.BIGINT))); + col3.setIsKey(false); + cols.add(col3); + ColumnDef col4 = new ColumnDef("col4", new TypeDef(ScalarType.createType(PrimitiveType.STRING))); + col4.setIsKey(false); + cols.add(col4); + // test merge-on-write + CreateTableStmt stmt1 = new CreateTableStmt(false, false, tblName, cols, "olap", + new KeysDesc(KeysType.UNIQUE_KEYS, colsName), null, + new HashDistributionDesc(10, Lists.newArrayList("col3")), properties, null, ""); + expectedEx.expect(AnalysisException.class); + expectedEx.expectMessage("Distribution column[col3] is not key column"); + stmt1.analyze(analyzer); + + CreateTableStmt stmt2 = new CreateTableStmt(false, false, tblName, cols, "olap", + new KeysDesc(KeysType.UNIQUE_KEYS, colsName), null, + new HashDistributionDesc(10, Lists.newArrayList("col3")), properties, null, ""); + stmt2.analyze(analyzer); + + Assert.assertEquals(col3.getAggregateType(), AggregateType.REPLACE); + Assert.assertEquals(col4.getAggregateType(), AggregateType.REPLACE); + // clear + cols.remove(col3); + cols.remove(col4); + } + @Test public void testCreateTableDuplicateWithoutKeys() throws UserException { // setup diff --git a/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java b/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java index d037219e96..268dd055bb 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/CreateTableTest.java @@ -213,10 +213,10 @@ public class CreateTableTest extends TestWithFeService { Assert.assertTrue(tbl8.getColumn("k1").isKey()); Assert.assertTrue(tbl8.getColumn("k2").isKey()); Assert.assertFalse(tbl8.getColumn("v1").isKey()); - Assert.assertTrue(tbl8.getColumn(Column.SEQUENCE_COL).getAggregationType() == AggregateType.REPLACE); + Assert.assertTrue(tbl8.getColumn(Column.SEQUENCE_COL).getAggregationType() == AggregateType.NONE); OlapTable tbl13 = (OlapTable) db.getTableOrDdlException("tbl13"); - Assert.assertTrue(tbl13.getColumn(Column.SEQUENCE_COL).getAggregationType() == AggregateType.REPLACE); + Assert.assertTrue(tbl13.getColumn(Column.SEQUENCE_COL).getAggregationType() == AggregateType.NONE); Assert.assertTrue(tbl13.getColumn(Column.SEQUENCE_COL).getType() == Type.INT); Assert.assertEquals(tbl13.getSequenceMapCol(), "v1"); } diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/CreateTableCommandTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/CreateTableCommandTest.java index 51bb086ac3..59a02bced3 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/CreateTableCommandTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/CreateTableCommandTest.java @@ -224,10 +224,10 @@ public class CreateTableCommandTest extends TestWithFeService { Assertions.assertTrue(tbl8.getColumn("k1").isKey()); Assertions.assertTrue(tbl8.getColumn("k2").isKey()); Assertions.assertFalse(tbl8.getColumn("v1").isKey()); - Assertions.assertSame(tbl8.getColumn(Column.SEQUENCE_COL).getAggregationType(), AggregateType.REPLACE); + Assertions.assertSame(tbl8.getColumn(Column.SEQUENCE_COL).getAggregationType(), AggregateType.NONE); OlapTable tbl13 = (OlapTable) db.getTableOrDdlException("tbl13"); - Assertions.assertSame(tbl13.getColumn(Column.SEQUENCE_COL).getAggregationType(), AggregateType.REPLACE); + Assertions.assertSame(tbl13.getColumn(Column.SEQUENCE_COL).getAggregationType(), AggregateType.NONE); Assertions.assertSame(tbl13.getColumn(Column.SEQUENCE_COL).getType(), Type.INT); Assertions.assertEquals(tbl13.getSequenceMapCol(), "v1"); } diff --git a/regression-test/data/data_model_p0/unique/test_unique_table.out b/regression-test/data/data_model_p0/unique/test_unique_table.out index 34492bcbcd..50266833ec 100644 --- a/regression-test/data/data_model_p0/unique/test_unique_table.out +++ b/regression-test/data/data_model_p0/unique/test_unique_table.out @@ -4,18 +4,18 @@ -- !desc_uniq_table -- k INT Yes true \N -int_value INT Yes false \N REPLACE -char_value CHAR(10) Yes false \N REPLACE -date_value DATE Yes false \N REPLACE +int_value INT Yes false \N NONE +char_value CHAR(10) Yes false \N NONE +date_value DATE Yes false \N NONE -- !0 -- k1 INT Yes true \N -v1 TINYINT Yes false \N REPLACE -v2 INT Yes false \N REPLACE -v3 INT Yes false \N REPLACE -v4 INT Yes false \N REPLACE -__DORIS_DELETE_SIGN__ TINYINT No false 0 REPLACE -__DORIS_VERSION_COL__ BIGINT No false 0 REPLACE +v1 TINYINT Yes false \N NONE +v2 INT Yes false \N NONE +v3 INT Yes false \N NONE +v4 INT Yes false \N NONE +__DORIS_DELETE_SIGN__ TINYINT No false 0 NONE +__DORIS_VERSION_COL__ BIGINT No false 0 NONE -- !1 -- 1 1 1 1 1 0 2 diff --git a/regression-test/data/data_model_p0/unique/test_unique_table_like.out b/regression-test/data/data_model_p0/unique/test_unique_table_like.out index dd68e453ff..f6e03d26df 100644 --- a/regression-test/data/data_model_p0/unique/test_unique_table_like.out +++ b/regression-test/data/data_model_p0/unique/test_unique_table_like.out @@ -1,19 +1,19 @@ -- This file is automatically generated. You should know what you did if you want to edit this -- !desc_uniq_table -- k INT Yes true \N -int_value INT Yes false \N REPLACE -char_value CHAR(10) Yes false \N REPLACE -date_value DATE Yes false \N REPLACE -__DORIS_DELETE_SIGN__ TINYINT No false 0 REPLACE -__DORIS_VERSION_COL__ BIGINT No false 0 REPLACE -__DORIS_SEQUENCE_COL__ INT Yes false \N REPLACE +int_value INT Yes false \N NONE +char_value CHAR(10) Yes false \N NONE +date_value DATE Yes false \N NONE +__DORIS_DELETE_SIGN__ TINYINT No false 0 NONE +__DORIS_VERSION_COL__ BIGINT No false 0 NONE +__DORIS_SEQUENCE_COL__ INT Yes false \N NONE -- !desc_uniq_table -- k INT Yes true \N -int_value INT Yes false \N REPLACE -char_value CHAR(10) Yes false \N REPLACE -date_value DATE Yes false \N REPLACE -__DORIS_DELETE_SIGN__ TINYINT No false 0 REPLACE -__DORIS_VERSION_COL__ BIGINT No false 0 REPLACE -__DORIS_SEQUENCE_COL__ INT Yes false \N REPLACE +int_value INT Yes false \N NONE +char_value CHAR(10) Yes false \N NONE +date_value DATE Yes false \N NONE +__DORIS_DELETE_SIGN__ TINYINT No false 0 NONE +__DORIS_VERSION_COL__ BIGINT No false 0 NONE +__DORIS_SEQUENCE_COL__ INT Yes false \N NONE diff --git a/regression-test/data/data_model_p0/unique/test_unique_table_new_sequence.out b/regression-test/data/data_model_p0/unique/test_unique_table_new_sequence.out index 5c37168a5e..41479bbcb5 100644 --- a/regression-test/data/data_model_p0/unique/test_unique_table_new_sequence.out +++ b/regression-test/data/data_model_p0/unique/test_unique_table_new_sequence.out @@ -47,13 +47,13 @@ -- !desc -- k1 INT Yes true \N -v1 TINYINT Yes false \N REPLACE -v2 INT Yes false \N REPLACE -v3 INT Yes false \N REPLACE -v4 INT Yes false \N REPLACE -__DORIS_DELETE_SIGN__ TINYINT No false 0 REPLACE -__DORIS_VERSION_COL__ BIGINT No false 0 REPLACE -__DORIS_SEQUENCE_COL__ INT Yes false \N REPLACE +v1 TINYINT Yes false \N NONE +v2 INT Yes false \N NONE +v3 INT Yes false \N NONE +v4 INT Yes false \N NONE +__DORIS_DELETE_SIGN__ TINYINT No false 0 NONE +__DORIS_VERSION_COL__ BIGINT No false 0 NONE +__DORIS_SEQUENCE_COL__ INT Yes false \N NONE -- !1 -- 1 1 1 1 1 0 2 1 diff --git a/regression-test/data/index_p0/test_bitmap_index.out b/regression-test/data/index_p0/test_bitmap_index.out index 13960e6576..216afc7e5f 100644 --- a/regression-test/data/index_p0/test_bitmap_index.out +++ b/regression-test/data/index_p0/test_bitmap_index.out @@ -86,11 +86,11 @@ k8 DATETIME Yes true \N k9 LARGEINT Yes true \N k10 DECIMAL Yes true \N k11 BOOLEAN Yes true \N -k12 DATE Yes false \N REPLACE -k13 DATETIME Yes false \N REPLACE -k14 DATETIME(3) Yes false \N REPLACE -k15 DATETIME(6) Yes false \N REPLACE -v1 INT Yes false \N REPLACE +k12 DATE Yes false \N NONE +k13 DATETIME Yes false \N NONE +k14 DATETIME(3) Yes false \N NONE +k15 DATETIME(6) Yes false \N NONE +v1 INT Yes false \N NONE -- !sql -- default_cluster:regression_test_index_p0.test_bitmap_index_unique index1 k1 BITMAP diff --git a/regression-test/data/insert_p0/test_group_commit_interval_ms_property.out b/regression-test/data/insert_p0/test_group_commit_interval_ms_property.out index 2537f0a4a5..cc592fef27 100644 --- a/regression-test/data/insert_p0/test_group_commit_interval_ms_property.out +++ b/regression-test/data/insert_p0/test_group_commit_interval_ms_property.out @@ -1,13 +1,13 @@ -- This file is automatically generated. You should know what you did if you want to edit this -- !1 -- -test_group_commit_interval_ms_property_tbl_legacy CREATE TABLE `test_group_commit_interval_ms_property_tbl_legacy` (\n `k` BIGINT NULL,\n `v` BIGINT NULL\n) ENGINE=OLAP\nUNIQUE KEY(`k`)\nCOMMENT 'OLAP'\nDISTRIBUTED BY HASH(`v`) BUCKETS 8\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"min_load_replica_num" = "-1",\n"is_being_synced" = "false",\n"storage_format" = "V2",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false",\n"binlog.enable" = "false",\n"binlog.ttl_seconds" = "9223372036854775807",\n"binlog.max_bytes" = "9223372036854775807",\n"binlog.max_history_nums" = "9223372036854775807",\n"enable_single_replica_compaction" = "false",\n"group_commit_interval_ms" = "10000"\n); +test_group_commit_interval_ms_property_tbl_legacy CREATE TABLE `test_group_commit_interval_ms_property_tbl_legacy` (\n `k` BIGINT NULL,\n `v` BIGINT NULL\n) ENGINE=OLAP\nUNIQUE KEY(`k`)\nCOMMENT 'OLAP'\nDISTRIBUTED BY HASH(`v`) BUCKETS 8\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"min_load_replica_num" = "-1",\n"is_being_synced" = "false",\n"storage_format" = "V2",\n"enable_unique_key_merge_on_write" = "false",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false",\n"binlog.enable" = "false",\n"binlog.ttl_seconds" = "9223372036854775807",\n"binlog.max_bytes" = "9223372036854775807",\n"binlog.max_history_nums" = "9223372036854775807",\n"enable_single_replica_compaction" = "false",\n"group_commit_interval_ms" = "10000"\n); -- !2 -- -test_group_commit_interval_ms_property_tbl_legacy CREATE TABLE `test_group_commit_interval_ms_property_tbl_legacy` (\n `k` BIGINT NULL,\n `v` BIGINT NULL\n) ENGINE=OLAP\nUNIQUE KEY(`k`)\nCOMMENT 'OLAP'\nDISTRIBUTED BY HASH(`v`) BUCKETS 8\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"min_load_replica_num" = "-1",\n"is_being_synced" = "false",\n"storage_format" = "V2",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false",\n"binlog.enable" = "false",\n"binlog.ttl_seconds" = "9223372036854775807",\n"binlog.max_bytes" = "9223372036854775807",\n"binlog.max_history_nums" = "9223372036854775807",\n"enable_single_replica_compaction" = "false",\n"group_commit_interval_ms" = "1000"\n); +test_group_commit_interval_ms_property_tbl_legacy CREATE TABLE `test_group_commit_interval_ms_property_tbl_legacy` (\n `k` BIGINT NULL,\n `v` BIGINT NULL\n) ENGINE=OLAP\nUNIQUE KEY(`k`)\nCOMMENT 'OLAP'\nDISTRIBUTED BY HASH(`v`) BUCKETS 8\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"min_load_replica_num" = "-1",\n"is_being_synced" = "false",\n"storage_format" = "V2",\n"enable_unique_key_merge_on_write" = "false",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false",\n"binlog.enable" = "false",\n"binlog.ttl_seconds" = "9223372036854775807",\n"binlog.max_bytes" = "9223372036854775807",\n"binlog.max_history_nums" = "9223372036854775807",\n"enable_single_replica_compaction" = "false",\n"group_commit_interval_ms" = "1000"\n); -- !1 -- -test_group_commit_interval_ms_property_tbl_nereids CREATE TABLE `test_group_commit_interval_ms_property_tbl_nereids` (\n `k` BIGINT NULL,\n `v` BIGINT NULL\n) ENGINE=OLAP\nUNIQUE KEY(`k`)\nCOMMENT 'OLAP'\nDISTRIBUTED BY HASH(`v`) BUCKETS 8\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"min_load_replica_num" = "-1",\n"is_being_synced" = "false",\n"storage_format" = "V2",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false",\n"binlog.enable" = "false",\n"binlog.ttl_seconds" = "9223372036854775807",\n"binlog.max_bytes" = "9223372036854775807",\n"binlog.max_history_nums" = "9223372036854775807",\n"enable_single_replica_compaction" = "false",\n"group_commit_interval_ms" = "10000"\n); +test_group_commit_interval_ms_property_tbl_nereids CREATE TABLE `test_group_commit_interval_ms_property_tbl_nereids` (\n `k` BIGINT NULL,\n `v` BIGINT NULL\n) ENGINE=OLAP\nUNIQUE KEY(`k`)\nCOMMENT 'OLAP'\nDISTRIBUTED BY HASH(`v`) BUCKETS 8\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"min_load_replica_num" = "-1",\n"is_being_synced" = "false",\n"storage_format" = "V2",\n"enable_unique_key_merge_on_write" = "false",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false",\n"binlog.enable" = "false",\n"binlog.ttl_seconds" = "9223372036854775807",\n"binlog.max_bytes" = "9223372036854775807",\n"binlog.max_history_nums" = "9223372036854775807",\n"enable_single_replica_compaction" = "false",\n"group_commit_interval_ms" = "10000"\n); -- !2 -- -test_group_commit_interval_ms_property_tbl_nereids CREATE TABLE `test_group_commit_interval_ms_property_tbl_nereids` (\n `k` BIGINT NULL,\n `v` BIGINT NULL\n) ENGINE=OLAP\nUNIQUE KEY(`k`)\nCOMMENT 'OLAP'\nDISTRIBUTED BY HASH(`v`) BUCKETS 8\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"min_load_replica_num" = "-1",\n"is_being_synced" = "false",\n"storage_format" = "V2",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false",\n"binlog.enable" = "false",\n"binlog.ttl_seconds" = "9223372036854775807",\n"binlog.max_bytes" = "9223372036854775807",\n"binlog.max_history_nums" = "9223372036854775807",\n"enable_single_replica_compaction" = "false",\n"group_commit_interval_ms" = "1000"\n); +test_group_commit_interval_ms_property_tbl_nereids CREATE TABLE `test_group_commit_interval_ms_property_tbl_nereids` (\n `k` BIGINT NULL,\n `v` BIGINT NULL\n) ENGINE=OLAP\nUNIQUE KEY(`k`)\nCOMMENT 'OLAP'\nDISTRIBUTED BY HASH(`v`) BUCKETS 8\nPROPERTIES (\n"replication_allocation" = "tag.location.default: 1",\n"min_load_replica_num" = "-1",\n"is_being_synced" = "false",\n"storage_format" = "V2",\n"enable_unique_key_merge_on_write" = "false",\n"light_schema_change" = "true",\n"disable_auto_compaction" = "false",\n"binlog.enable" = "false",\n"binlog.ttl_seconds" = "9223372036854775807",\n"binlog.max_bytes" = "9223372036854775807",\n"binlog.max_history_nums" = "9223372036854775807",\n"enable_single_replica_compaction" = "false",\n"group_commit_interval_ms" = "1000"\n); diff --git a/regression-test/data/inverted_index_p0/test_bitmap_index.out b/regression-test/data/inverted_index_p0/test_bitmap_index.out index 12e4475c96..1d1caf9c87 100644 --- a/regression-test/data/inverted_index_p0/test_bitmap_index.out +++ b/regression-test/data/inverted_index_p0/test_bitmap_index.out @@ -70,7 +70,7 @@ k8 DATETIME Yes true \N k9 LARGEINT Yes true \N k10 DECIMAL Yes true \N k11 BOOLEAN Yes true \N -v1 INT Yes false \N REPLACE +v1 INT Yes false \N NONE -- !sql -- default_cluster:regression_test_inverted_index_p0.test_bitmap_index_unique index1 k1 BITMAP diff --git a/regression-test/data/schema_change_p0/test_rename_column.out b/regression-test/data/schema_change_p0/test_rename_column.out index c55ccab9e0f0a322555edcc9c5933c84714d16cd..d273f1ce1dbb3f8a8b04b3cf5d3696fe42a76683 100644 GIT binary patch delta 184 zcmX@DFjZlL8Y8oxzu#mXMk_F#!{`X64LGGZ{QUh~xpEULCO2?Ou^DiJxRdR8R9L`_ z4Ln+#1DHgaz^X~m4N|{3h1H%J#K2}PSUiAJ6=IDYj|wZuKCX#z6DRQ;*!+_#h!p^B CGcgDN delta 233 zcmbQLa9Ux58Y5efYk-fV^JGm%D;RS>ha)>g)OB(qpCp_u$E5&gJ94SO*^1o4lY4o@ xCm&$toGiy?w7HV$76ryaU9s7L)t(v3#^X4c3I$G8xO*JARG`9}3pkgu0RYFkK2-n! diff --git a/regression-test/data/schema_change_p0/test_schema_change.out b/regression-test/data/schema_change_p0/test_schema_change.out index 84ee227ec5..43857c0a39 100644 --- a/regression-test/data/schema_change_p0/test_schema_change.out +++ b/regression-test/data/schema_change_p0/test_schema_change.out @@ -2,9 +2,9 @@ -- !desc_uniq_table -- event_day DATE Yes true \N siteid INT Yes true 10 -citycode TEXT Yes false \N REPLACE -username VARCHAR(32) Yes false REPLACE -pv BIGINT Yes false 0 REPLACE +citycode TEXT Yes false \N NONE +username VARCHAR(32) Yes false NONE +pv BIGINT Yes false 0 NONE -- !sql -- 2021-11-01 1 1 用户A 3 diff --git a/regression-test/data/schema_change_p0/test_uniq_delete_sign_schema_change.out b/regression-test/data/schema_change_p0/test_uniq_delete_sign_schema_change.out index bc07e62e29..6cf1255622 100644 --- a/regression-test/data/schema_change_p0/test_uniq_delete_sign_schema_change.out +++ b/regression-test/data/schema_change_p0/test_uniq_delete_sign_schema_change.out @@ -16,12 +16,12 @@ -- !sql -- k1 INT Yes true \N -value1 INT Yes false \N REPLACE -value2 INT Yes false \N REPLACE -value3 INT Yes false \N REPLACE -value4 INT Yes false \N REPLACE -__DORIS_DELETE_SIGN__ TINYINT No false 0 REPLACE -__DORIS_VERSION_COL__ BIGINT No false 0 REPLACE +value1 INT Yes false \N NONE +value2 INT Yes false \N NONE +value3 INT Yes false \N NONE +value4 INT Yes false \N NONE +__DORIS_DELETE_SIGN__ TINYINT No false 0 NONE +__DORIS_VERSION_COL__ BIGINT No false 0 NONE -- !sql -- 1 1 1 1 \N 1 7 @@ -47,10 +47,10 @@ __DORIS_VERSION_COL__ BIGINT No false 0 REPLACE -- !sql -- k1 INT Yes true \N -value2 INT Yes false \N REPLACE -value4 INT Yes false \N REPLACE -__DORIS_DELETE_SIGN__ TINYINT No false 0 REPLACE -__DORIS_VERSION_COL__ BIGINT No false 0 REPLACE +value2 INT Yes false \N NONE +value4 INT Yes false \N NONE +__DORIS_DELETE_SIGN__ TINYINT No false 0 NONE +__DORIS_VERSION_COL__ BIGINT No false 0 NONE -- !sql -- 1 1 \N 1 7 diff --git a/regression-test/data/types_p0/unsigned/test_unsigned_int_compatibility.out b/regression-test/data/types_p0/unsigned/test_unsigned_int_compatibility.out index 0f8cd0f99b..0a3620bc8c 100644 --- a/regression-test/data/types_p0/unsigned/test_unsigned_int_compatibility.out +++ b/regression-test/data/types_p0/unsigned/test_unsigned_int_compatibility.out @@ -2,7 +2,7 @@ -- !desc_tb -- user_id LARGEINT No true \N city VARCHAR(20) Yes true \N -value1 BIGINT Yes false \N REPLACE +value1 BIGINT Yes false \N NONE -- !select_tb -- 1 Beijing 21474836478 @@ -10,9 +10,10 @@ value1 BIGINT Yes false \N REPLACE -- !desc_tb -- user_id LARGEINT No true \N city VARCHAR(20) Yes true \N -value1 BIGINT Yes false \N REPLACE -value2 BIGINT Yes false \N REPLACE +value1 BIGINT Yes false \N NONE +value2 BIGINT Yes false \N NONE -- !select_tb -- 1 Beijing 21474836478 \N 2 Beijing 21474836478 21474836478 + diff --git a/regression-test/data/update/test_update_unique.out b/regression-test/data/update/test_update_unique.out index 051bd679ab..615ee7b07d 100644 --- a/regression-test/data/update/test_update_unique.out +++ b/regression-test/data/update/test_update_unique.out @@ -9,9 +9,9 @@ -- !desc_uniq_table -- k INT Yes true \N -value1 INT Yes false \N REPLACE -value2 INT Yes false \N REPLACE -date_value DATE Yes false \N REPLACE +value1 INT Yes false \N NONE +value2 INT Yes false \N NONE +date_value DATE Yes false \N NONE -- !complex_update -- 1 10 1 1000.0 2000-01-01 diff --git a/regression-test/suites/cold_heat_separation/empty_table_use_policy/alter_table_add_policy.groovy b/regression-test/suites/cold_heat_separation/empty_table_use_policy/alter_table_add_policy.groovy index c4b257953d..471c7f7f44 100644 --- a/regression-test/suites/cold_heat_separation/empty_table_use_policy/alter_table_add_policy.groovy +++ b/regression-test/suites/cold_heat_separation/empty_table_use_policy/alter_table_add_policy.groovy @@ -26,9 +26,11 @@ suite("add_table_policy_by_alter_table") { UNIQUE KEY(k1) DISTRIBUTED BY HASH (k1) BUCKETS 3 PROPERTIES( - "replication_num" = "1" + "replication_num" = "1", + "enable_unique_key_merge_on_write" = "false" ); """ + // storage policy is disabled on mow table assertEquals(create_table_not_have_policy_result.size(), 1); def alter_table_use_not_exist_policy_result = try_sql """ diff --git a/regression-test/suites/cold_heat_separation/empty_table_use_policy/create_table_use_policy.groovy b/regression-test/suites/cold_heat_separation/empty_table_use_policy/create_table_use_policy.groovy index d4e3aa1774..4e2ef09c99 100644 --- a/regression-test/suites/cold_heat_separation/empty_table_use_policy/create_table_use_policy.groovy +++ b/regression-test/suites/cold_heat_separation/empty_table_use_policy/create_table_use_policy.groovy @@ -85,10 +85,11 @@ suite("create_table_use_policy") { DISTRIBUTED BY HASH (k1) BUCKETS 3 PROPERTIES( "storage_policy" = "test_create_table_use_policy", - "replication_num" = "1" + "replication_num" = "1", + "enable_unique_key_merge_on_write" = "false" ); """ - + // storage policy is disabled on mow table assertEquals(create_table_use_created_policy.size(), 1); sql """ diff --git a/regression-test/suites/cold_heat_separation/policy/drop.groovy b/regression-test/suites/cold_heat_separation/policy/drop.groovy index 8157df8f11..20b53d42e0 100644 --- a/regression-test/suites/cold_heat_separation/policy/drop.groovy +++ b/regression-test/suites/cold_heat_separation/policy/drop.groovy @@ -122,9 +122,11 @@ suite("drop_policy") { DISTRIBUTED BY HASH (k1) BUCKETS 3 PROPERTIES( "storage_policy" = "drop_policy_test_has_table_binded", - "replication_num" = "1" + "replication_num" = "1", + "enable_unique_key_merge_on_write" = "false" ); """ + // storage policy is disabled on mow table assertEquals(create_table_use_created_policy.size(), 1); diff --git a/regression-test/suites/data_model_p0/unique/test_unique_table_debug_data.groovy b/regression-test/suites/data_model_p0/unique/test_unique_table_debug_data.groovy index db0c4e4ac7..062e0557be 100644 --- a/regression-test/suites/data_model_p0/unique/test_unique_table_debug_data.groovy +++ b/regression-test/suites/data_model_p0/unique/test_unique_table_debug_data.groovy @@ -34,9 +34,11 @@ suite("test_unique_table_debug_data") { distributed by hash(a) buckets 16 properties( "replication_allocation" = "tag.location.default:1", - "disable_auto_compaction" = "true" + "disable_auto_compaction" = "true", + "enable_unique_key_merge_on_write" = "false" ); """ + // test mor table //BackendId,Cluster,IP,HeartbeatPort,BePort,HttpPort,BrpcPort,LastStartTime,LastHeartbeat,Alive,SystemDecommissioned,ClusterDecommissioned,TabletNum,DataUsedCapacity,AvailCapacity,TotalCapacity,UsedPct,MaxDiskUsedPct,Tag,ErrMsg,Version,Status String[][] backends = sql """ show backends; """ diff --git a/regression-test/suites/datatype_p0/datetimev1/test_datetimev1_common.groovy b/regression-test/suites/datatype_p0/datetimev1/test_datetimev1_common.groovy index 94a2123202..6e674cfbb0 100644 --- a/regression-test/suites/datatype_p0/datetimev1/test_datetimev1_common.groovy +++ b/regression-test/suites/datatype_p0/datetimev1/test_datetimev1_common.groovy @@ -372,13 +372,15 @@ suite("test_datetimev1_common", "nonConcurrent") { """) } + sql """set delete_without_partition=true; """ + sql "sync" run_delete_test(table_dup, "`date_value1` < '2013-01-05 00:00:00'") run_delete_test(table_uniq, "`date_value1` > '2012-06-02'") run_delete_test(table_agg, "`date_key1` = '2013-01-05'") run_delete_test(table_agg, "`date_key1` = '2010-01-05 17:58:59'") run_delete_test(table_dist, "`date_value1` ='2012-06-02'") run_delete_test(table_part, "`date_value1` > '2012-06-02'") - + sql """set delete_without_partition=false; """ sql """ admin set frontend config("enable_date_conversion" = "true"); """ diff --git a/regression-test/suites/datatype_p0/datev1/test_datev1_common.groovy b/regression-test/suites/datatype_p0/datev1/test_datev1_common.groovy index d5713cccd4..230110963b 100644 --- a/regression-test/suites/datatype_p0/datev1/test_datev1_common.groovy +++ b/regression-test/suites/datatype_p0/datev1/test_datev1_common.groovy @@ -371,12 +371,14 @@ suite("test_datev1_common", "nonConcurrent") { """) } + sql """set delete_without_partition=true; """ + sql "sync" run_delete_test(table_dup, "`date_value1` < '2013-01-05'") run_delete_test(table_uniq, "`date_value1` > '2012-06-02'") run_delete_test(table_agg, "`date_key1` = '2013-01-05'") run_delete_test(table_dist, "`date_value1` ='2012-06-02'") run_delete_test(table_part, "`date_value1` > '2012-06-02'") - + sql """set delete_without_partition=false; """ sql """ admin set frontend config("enable_date_conversion" = "true"); """ diff --git a/regression-test/suites/delete_p0/test_delete_on_value.groovy b/regression-test/suites/delete_p0/test_delete_on_value.groovy index 353e3d64f7..98620b299e 100644 --- a/regression-test/suites/delete_p0/test_delete_on_value.groovy +++ b/regression-test/suites/delete_p0/test_delete_on_value.groovy @@ -127,8 +127,10 @@ suite("test_delete_on_value") { DISTRIBUTED BY HASH(`x`) BUCKETS 4 PROPERTIES ( "replication_num" = "1", + "enable_unique_key_merge_on_write" = "false", "function_column.sequence_col" = "z" );""" + // test mor table sql "insert into ${tableName4} values(1,1,10);" sql "insert into ${tableName4} values(1,1,5);" qt_sql "select * from ${tableName4} order by x,y,z;" diff --git a/regression-test/suites/index_p0/test_bitmap_index.groovy b/regression-test/suites/index_p0/test_bitmap_index.groovy index e90c4092c9..e925d14d77 100644 --- a/regression-test/suites/index_p0/test_bitmap_index.groovy +++ b/regression-test/suites/index_p0/test_bitmap_index.groovy @@ -288,11 +288,13 @@ suite("test_bitmap_index") { "replication_allocation" = "tag.location.default: 1", "is_being_synced" = "false", "storage_format" = "V2", + "enable_unique_key_merge_on_write" = "false", "light_schema_change" = "true", "disable_auto_compaction" = "false", "enable_single_replica_compaction" = "false" ); """ + // test mor table sql """ ALTER TABLE ${tbName4} ADD INDEX vid_bitmap_index (vid) USING BITMAP; diff --git a/regression-test/suites/mv_p0/test_mv_useless/test_uniq_mv_useless.groovy b/regression-test/suites/mv_p0/test_mv_useless/test_uniq_mv_useless.groovy index 62d20d73fa..2028936204 100644 --- a/regression-test/suites/mv_p0/test_mv_useless/test_uniq_mv_useless.groovy +++ b/regression-test/suites/mv_p0/test_mv_useless/test_uniq_mv_useless.groovy @@ -31,8 +31,9 @@ suite ("test_uniq_mv_useless") { ) unique key (k1,k2) distributed BY hash(k1) buckets 3 - properties("replication_num" = "1"); + properties("replication_num" = "1", "enable_unique_key_merge_on_write" = "false"); """ + // only mor table can have mv sql "insert into ${testTable} select 1,1,1;" sql "insert into ${testTable} select 2,2,2;" diff --git a/regression-test/suites/mv_p0/unique/unique.groovy b/regression-test/suites/mv_p0/unique/unique.groovy index 473c078529..1cb79e7bec 100644 --- a/regression-test/suites/mv_p0/unique/unique.groovy +++ b/regression-test/suites/mv_p0/unique/unique.groovy @@ -30,8 +30,9 @@ suite ("unique") { ) unique key (k1,k2,k3) distributed BY hash(k1) buckets 3 - properties("replication_num" = "1"); + properties("replication_num" = "1", "enable_unique_key_merge_on_write" = "false"); """ + // only mor table can have mv sql "insert into u_table select 1,1,1,'a';" sql "insert into u_table select 20,2,2,'b';" diff --git a/regression-test/suites/mv_p0/varchar_length/varchar_length.groovy b/regression-test/suites/mv_p0/varchar_length/varchar_length.groovy index 476758dec8..c551ea23b8 100644 --- a/regression-test/suites/mv_p0/varchar_length/varchar_length.groovy +++ b/regression-test/suites/mv_p0/varchar_length/varchar_length.groovy @@ -31,9 +31,11 @@ suite ("varchar_length") { DISTRIBUTED BY HASH(vid) BUCKETS AUTO PROPERTIES ( - "replication_num" = "1" + "replication_num" = "1", + "enable_unique_key_merge_on_write" = "false" ); """ + // only mor table can have mv createMV ("CREATE MATERIALIZED VIEW mv_test as SELECT report_time, vid FROM test1 ORDER BY report_time DESC; ") diff --git a/regression-test/suites/partition_p0/auto_partition/test_auto_partition_behavior.groovy b/regression-test/suites/partition_p0/auto_partition/test_auto_partition_behavior.groovy index df45bf3dac..8784c68839 100644 --- a/regression-test/suites/partition_p0/auto_partition/test_auto_partition_behavior.groovy +++ b/regression-test/suites/partition_p0/auto_partition/test_auto_partition_behavior.groovy @@ -20,7 +20,8 @@ suite("test_auto_partition_behavior") { sql "drop table if exists unique_table" sql """ CREATE TABLE `unique_table` ( - `str` varchar not null + `str` varchar not null, + `dummy` int ) ENGINE=OLAP UNIQUE KEY(`str`) COMMENT 'OLAP' @@ -34,15 +35,15 @@ suite("test_auto_partition_behavior") { ); """ // special characters - sql """ insert into unique_table values (" "), (" "), ("Xxx"), ("xxX"), (" ! "), (" ! ") """ - qt_sql1 """ select *,length(str) from unique_table order by `str` """ + sql """ insert into unique_table values (" ", 1), (" ", 1), ("Xxx", 1), ("xxX", 1), (" ! ", 1), (" ! ", 1) """ + qt_sql1 """ select str,length(str) from unique_table order by `str` """ def result = sql "show partitions from unique_table" assertEquals(result.size(), 6) - sql """ insert into unique_table values (" "), (" "), ("Xxx"), ("xxX"), (" ! "), (" ! ") """ - qt_sql2 """ select *,length(str) from unique_table order by `str` """ + sql """ insert into unique_table values (" ", 1), (" ", 1), ("Xxx", 1), ("xxX", 1), (" ! ", 1), (" ! ", 1) """ + qt_sql2 """ select str,length(str) from unique_table order by `str` """ result = sql "show partitions from unique_table" assertEquals(result.size(), 6) - sql """ insert into unique_table values ("-"), ("--"), ("- -"), (" - ") """ + sql """ insert into unique_table values ("-", 1), ("--", 1), ("- -", 1), (" - ", 1) """ result = sql "show partitions from unique_table" assertEquals(result.size(), 10) // add partition @@ -58,13 +59,13 @@ suite("test_auto_partition_behavior") { sql """ alter table unique_table drop partition ${partition1_name} """ // partition ' ' result = sql "show partitions from unique_table" assertEquals(result.size(), 9) - qt_sql3 """ select *,length(str) from unique_table order by `str` """ + qt_sql3 """ select str,length(str) from unique_table order by `str` """ // modify value sql """ update unique_table set str = "modified" where str in (" ", " ") """ // only " " - qt_sql4 """ select *,length(str) from unique_table where str = ' ' order by `str` """ // modified + qt_sql4 """ select str,length(str) from unique_table where str = ' ' order by `str` """ // modified qt_sql5 """ select count() from unique_table where str = 'modified' """ // crop - qt_sql6 """ select * from unique_table where ((str > ' ! ' || str = 'modified') && str != 'Xxx') order by str """ + qt_sql6 """ select str from unique_table where ((str > ' ! ' || str = 'modified') && str != 'Xxx') order by str """ /// duplicate key table diff --git a/regression-test/suites/schema_change_p0/test_alter_table_drop_column.groovy b/regression-test/suites/schema_change_p0/test_alter_table_drop_column.groovy index 024806c5b9..163f1267aa 100644 --- a/regression-test/suites/schema_change_p0/test_alter_table_drop_column.groovy +++ b/regression-test/suites/schema_change_p0/test_alter_table_drop_column.groovy @@ -33,9 +33,11 @@ suite("test_alter_table_drop_column") { DISTRIBUTED BY HASH(siteid) BUCKETS 1 PROPERTIES ( "replication_num" = "1", - "bloom_filter_columns" = "pv" + "bloom_filter_columns" = "pv", + "enable_unique_key_merge_on_write" = "false" ); """ + // only mor table can use roll up sql "ALTER TABLE ${uniqueTableName} ADD ROLLUP ${uniqueTableRollupName}(`citycode`,`siteid`,`username`,`pv`);" def waitRollupJob = { String tableName /* param */ -> diff --git a/regression-test/suites/unique_with_mow_p0/cluster_key/test_create_table.groovy b/regression-test/suites/unique_with_mow_p0/cluster_key/test_create_table.groovy index 9c515efeb7..fb879131e0 100644 --- a/regression-test/suites/unique_with_mow_p0/cluster_key/test_create_table.groovy +++ b/regression-test/suites/unique_with_mow_p0/cluster_key/test_create_table.groovy @@ -36,9 +36,11 @@ suite("test_create_table") { CLUSTER BY (`c_name`, `c_address`) DISTRIBUTED BY HASH(`c_custkey`) BUCKETS 1 PROPERTIES ( - "replication_num" = "1" + "replication_num" = "1", + "enable_unique_key_merge_on_write" = "false" ); """ + // test mor table exception "Cluster keys only support unique keys table which enabled enable_unique_key_merge_on_write" } diff --git a/regression-test/suites/variant_p0/delete_update.groovy b/regression-test/suites/variant_p0/delete_update.groovy index 14dc0c1a68..e0cfcfa82f 100644 --- a/regression-test/suites/variant_p0/delete_update.groovy +++ b/regression-test/suites/variant_p0/delete_update.groovy @@ -26,8 +26,9 @@ suite("regression_test_variant_delete_and_update", "variant_type"){ ) UNIQUE KEY(`k`) DISTRIBUTED BY HASH(k) BUCKETS 3 - properties("replication_num" = "1"); + properties("replication_num" = "1", "enable_unique_key_merge_on_write" = "false"); """ + // test mor table sql """insert into ${table_name} values (1, '{"a" : 1, "b" : [1], "c": 1.0}')""" sql """insert into ${table_name} values (2, '{"a" : 2, "b" : [1], "c": 2.0}')"""