This is an automated email from the ASF dual-hosted git repository.
jianliangqi pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new ed78d99d4a3 [fix](regression)Fix unstable compaction related cases
(#46920) (#47002)
ed78d99d4a3 is described below
commit ed78d99d4a3827354a289c7cde7b10ee7db13a80
Author: qiye <[email protected]>
AuthorDate: Wed Jan 15 14:25:30 2025 +0800
[fix](regression)Fix unstable compaction related cases (#46920) (#47002)
bp #46920
---
regression-test/plugins/plugin_compaction.groovy | 10 ++++---
...st_skip_index_compaction_fault_injection.groovy | 4 +--
..._index_change_with_cumulative_compaction.groovy | 33 +++++++++++++---------
3 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/regression-test/plugins/plugin_compaction.groovy
b/regression-test/plugins/plugin_compaction.groovy
index eaefa9a10d3..45dd99a97a3 100644
--- a/regression-test/plugins/plugin_compaction.groovy
+++ b/regression-test/plugins/plugin_compaction.groovy
@@ -57,8 +57,7 @@ Suite.metaClass.be_run_full_compaction_by_table_id = { String
ip, String port, S
}
logger.info("Added 'be_run_full_compaction' function to Suite")
-
-Suite.metaClass.trigger_and_wait_compaction = { String table_name, String
compaction_type, int timeout_seconds=300 ->
+Suite.metaClass.trigger_and_wait_compaction = { String table_name, String
compaction_type, int timeout_seconds=300, String[] ignored_errors=[] ->
if (!(compaction_type in ["cumulative", "base", "full"])) {
throw new IllegalArgumentException("invalid compaction type:
${compaction_type}, supported types: cumulative, base, full")
}
@@ -102,12 +101,15 @@ Suite.metaClass.trigger_and_wait_compaction = { String
table_name, String compac
assert exit_code == 0: "trigger compaction failed, exit code:
${exit_code}, stdout: ${stdout}, stderr: ${stderr}"
def trigger_status = parseJson(stdout.trim())
if (trigger_status.status.toLowerCase() != "success") {
- if (trigger_status.status.toLowerCase() == "already_exist") {
+ def status_lower = trigger_status.status.toLowerCase()
+ if (status_lower == "already_exist") {
triggered_tablets.add(tablet) // compaction already in queue,
treat it as successfully triggered
} else if (!auto_compaction_disabled) {
// ignore the error if auto compaction enabled
- } else if (trigger_status.status.contains("E-2000")) {
+ } else if (status_lower.contains("e-2000")) {
// ignore this tablet compaction.
+ } else if (ignored_errors.any { error ->
status_lower.contains(error.toLowerCase()) }) {
+ // ignore this tablet compaction if the error is in the
ignored_errors list
} else {
throw new Exception("trigger compaction failed, be host:
${be_host}, tablet id: ${tablet.TabletId}, status: ${trigger_status.status}")
}
diff --git
a/regression-test/suites/fault_injection_p0/test_skip_index_compaction_fault_injection.groovy
b/regression-test/suites/fault_injection_p0/test_skip_index_compaction_fault_injection.groovy
index b63aeec2bbd..8b030a83094 100644
---
a/regression-test/suites/fault_injection_p0/test_skip_index_compaction_fault_injection.groovy
+++
b/regression-test/suites/fault_injection_p0/test_skip_index_compaction_fault_injection.groovy
@@ -135,13 +135,13 @@ suite("test_skip_index_compaction_fault_injection",
"nonConcurrent") {
assert (rowsetCount == 11 * replicaNum)
// first
- trigger_and_wait_compaction(tableName, "full")
+ trigger_and_wait_compaction(tableName, "full", 300, new String[]{"e-6010"})
rowsetCount = get_rowset_count.call(tablets);
assert (rowsetCount == 11 * replicaNum)
// second
- trigger_and_wait_compaction(tableName, "full")
+ trigger_and_wait_compaction(tableName, "full", 300, new String[]{"e-6010"})
rowsetCount = get_rowset_count.call(tablets);
if (isCloudMode) {
diff --git
a/regression-test/suites/inverted_index_p0/index_change/test_index_change_with_cumulative_compaction.groovy
b/regression-test/suites/inverted_index_p0/index_change/test_index_change_with_cumulative_compaction.groovy
index ce12d1ede0c..4276edfdedf 100644
---
a/regression-test/suites/inverted_index_p0/index_change/test_index_change_with_cumulative_compaction.groovy
+++
b/regression-test/suites/inverted_index_p0/index_change/test_index_change_with_cumulative_compaction.groovy
@@ -40,21 +40,25 @@ suite("test_index_change_with_cumulative_compaction",
"nonConcurrent") {
assertTrue(useTime <= OpTimeout, "wait_for_latest_op_on_table_finish
timeout")
}
- def trigger_compaction_with_retry = {table_name, compaction_type =
"cumulative", max_retries = 10, delay_ms = 2000 ->
- def retry_count = 0
- while (true) {
- try {
- trigger_and_wait_compaction(table_name, compaction_type)
- return // Success
- } catch (Exception e) {
- retry_count++
- if (retry_count >= max_retries) {
- throw new Exception("Failed to complete ${compaction_type}
compaction after ${max_retries} attempts", e)
+ def wait_for_build_index_on_partition_finish = { table_name, OpTimeout ->
+ for(int t = delta_time; t <= OpTimeout; t += delta_time){
+ alter_res = sql """SHOW BUILD INDEX WHERE TableName =
"${table_name}";"""
+ def expected_finished_num = alter_res.size();
+ def finished_num = 0;
+ for (int i = 0; i < expected_finished_num; i++) {
+ logger.info(table_name + " build index job state: " +
alter_res[i][7] + i)
+ if (alter_res[i][7] == "FINISHED") {
+ ++finished_num;
}
- logger.warn("Compaction attempt ${retry_count} failed:
${e.getMessage()}")
- Thread.sleep(delay_ms)
}
+ if (finished_num == expected_finished_num) {
+ logger.info(table_name + " all build index jobs finished,
detail: " + alter_res)
+ break
+ }
+ useTime = t
+ sleep(delta_time)
}
+ assertTrue(useTime <= OpTimeout,
"wait_for_latest_build_index_on_partition_finish timeout")
}
try {
@@ -162,12 +166,15 @@ suite("test_index_change_with_cumulative_compaction",
"nonConcurrent") {
// build index
if (!isCloudMode()) {
sql "build index idx_user_id on ${tableName}"
+ wait_for_build_index_on_partition_finish(tableName, timeout)
sql "build index idx_date on ${tableName}"
+ wait_for_build_index_on_partition_finish(tableName, timeout)
sql "build index idx_city on ${tableName}"
+ wait_for_build_index_on_partition_finish(tableName, timeout)
}
// trigger compactions for all tablets in ${tableName}
- trigger_compaction_with_retry(tableName, "cumulative")
+ trigger_and_wait_compaction(tableName, "cumulative")
int rowCount = 0
for (def tablet in tablets) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]