This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 9f0122f36b [fix][alter table property] fix alter table property failed
(#22791)
9f0122f36b is described below
commit 9f0122f36b16c89acf82f390261745f74ceb5e50
Author: Chenyang Sun <[email protected]>
AuthorDate: Thu Aug 10 17:12:42 2023 +0800
[fix][alter table property] fix alter table property failed (#22791)
---
.../main/java/org/apache/doris/alter/SchemaChangeHandler.java | 11 ++++++-----
.../src/main/java/org/apache/doris/catalog/TableProperty.java | 4 ++++
.../compaction/test_table_level_compaction_policy.groovy | 11 +++++++++++
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
index df7fdc81c0..61865df13a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
@@ -2166,16 +2166,17 @@ public class SchemaChangeHandler extends AlterHandler {
.get(PropertyAnalyzer.PROPERTIES_TIME_SERIES_COMPACTION_TIME_THRESHOLD_SECONDS)));
}
+ if (isInMemory < 0 && storagePolicyId < 0 && compactionPolicy == null
&& timeSeriesCompactionConfig.isEmpty()
+ &&
!properties.containsKey(PropertyAnalyzer.PROPERTIES_IS_BEING_SYNCED)) {
+ LOG.info("Properties already up-to-date");
+ return;
+ }
+
for (Partition partition : partitions) {
updatePartitionProperties(db, olapTable.getName(),
partition.getName(), storagePolicyId, isInMemory,
null, compactionPolicy,
timeSeriesCompactionConfig);
}
- if (isInMemory < 0 && storagePolicyId < 0 && compactionPolicy == null
&& timeSeriesCompactionConfig.isEmpty()) {
- LOG.info("Properties already up-to-date");
- return;
- }
-
olapTable.writeLockOrDdlException();
try {
Env.getCurrentEnv().modifyTableProperties(db, olapTable,
properties);
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 c8b6cdb53e..a264332753 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
@@ -124,6 +124,10 @@ public class TableProperty implements Writable {
buildInMemory();
buildStoragePolicy();
buildIsBeingSynced();
+ buildCompactionPolicy();
+ buildTimeSeriesCompactionGoalSizeMbytes();
+ buildTimeSeriesCompactionFileCountThreshold();
+ buildTimeSeriesCompactionTimeThresholdSeconds();
break;
default:
break;
diff --git
a/regression-test/suites/compaction/test_table_level_compaction_policy.groovy
b/regression-test/suites/compaction/test_table_level_compaction_policy.groovy
index f2df7fe9bb..5bb33eebf2 100644
---
a/regression-test/suites/compaction/test_table_level_compaction_policy.groovy
+++
b/regression-test/suites/compaction/test_table_level_compaction_policy.groovy
@@ -38,6 +38,8 @@ suite("test_table_level_compaction_policy") {
"time_series_compaction_time_threshold_seconds" = "86400"
);
"""
+ sql """sync"""
+
def showResult1 = sql """show create table ${tableName}"""
logger.info("${showResult1}")
assertTrue(showResult1.toString().containsIgnoreCase('"compaction_policy"
= "time_series"'))
@@ -48,6 +50,7 @@ suite("test_table_level_compaction_policy") {
sql """
alter table ${tableName} set
("time_series_compaction_goal_size_mbytes" = "1024")
"""
+ sql """sync"""
def showResult2 = sql """show create table ${tableName}"""
logger.info("${showResult2}")
@@ -56,6 +59,7 @@ suite("test_table_level_compaction_policy") {
sql """
alter table ${tableName} set
("time_series_compaction_file_count_threshold" = "6000")
"""
+ sql """sync"""
def showResult3 = sql """show create table ${tableName}"""
logger.info("${showResult3}")
@@ -64,12 +68,14 @@ suite("test_table_level_compaction_policy") {
sql """
alter table ${tableName} set
("time_series_compaction_time_threshold_seconds" = "3000")
"""
+ sql """sync"""
def showResult4 = sql """show create table ${tableName}"""
logger.info("${showResult4}")
assertTrue(showResult4.toString().containsIgnoreCase('"time_series_compaction_time_threshold_seconds"
= "3000"'))
sql """ DROP TABLE IF EXISTS ${tableName} """
+ sql """sync"""
sql """
CREATE TABLE ${tableName} (
@@ -84,11 +90,14 @@ suite("test_table_level_compaction_policy") {
"replication_num" = "1"
);
"""
+ sql """sync"""
+
def showResult5 = sql """show create table ${tableName}"""
logger.info("${showResult5}")
assertFalse(showResult5.toString().containsIgnoreCase('"compaction_policy"'))
sql """ DROP TABLE IF EXISTS ${tableName} """
+ sql """sync"""
test {
sql """
@@ -197,6 +206,7 @@ suite("test_table_level_compaction_policy") {
"replication_num" = "1"
);
"""
+ sql """sync"""
sql """
alter table ${tableName} set ("compaction_policy" = "ok")
@@ -204,4 +214,5 @@ suite("test_table_level_compaction_policy") {
exception "Table compaction policy only support for time_series or
size_based"
}
sql """ DROP TABLE IF EXISTS ${tableName} """
+ sql """sync"""
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]