This is an automated email from the ASF dual-hosted git repository.
jianliangqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new c76f3099a3f [fix](regression)Fix unstable compaction related cases
(#46920)
c76f3099a3f is described below
commit c76f3099a3fdabef5b7ded7450181f5e787cecb1
Author: qiye <[email protected]>
AuthorDate: Wed Jan 15 10:18:39 2025 +0800
[fix](regression)Fix unstable compaction related cases (#46920)
Related PR: #45761
Problem Summary:
1. Added `wait_for_build_index_on_partition_finish` calls to ensure
indexes are built before triggering compaction.
2. When we do index compaction fault injection test, compaction status
`e-6010` is expected sometimes. Added an `ignored_errors` parameter to
the `trigger_and_wait_compaction` method, allowing specific errors to be
ignored during compaction.
---
regression-test/plugins/plugin_compaction.groovy | 13 +++++----
...st_skip_index_compaction_fault_injection.groovy | 4 +--
..._index_change_with_cumulative_compaction.groovy | 33 +++++++++++++---------
3 files changed, 29 insertions(+), 21 deletions(-)
diff --git a/regression-test/plugins/plugin_compaction.groovy
b/regression-test/plugins/plugin_compaction.groovy
index 074505470d5..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,14 +101,16 @@ 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 {
+ } 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}")
}
} else {
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]