hello-stephen commented on code in PR #71334: URL: https://github.com/apache/doris/pull/71334#discussion_r4780622312
########## regression-test/suites/clone_p0/test_clone_multi_analyzer_index_ids.groovy: ########## @@ -0,0 +1,103 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import org.apache.doris.regression.suite.ClusterOptions +import org.apache.doris.regression.util.NodeType + +// An incremental clone must keep the ids of two inverted indexes on one column. +suite('test_clone_multi_analyzer_index_ids', 'docker') { + def options = new ClusterOptions() + options.feConfigs += [ + 'disable_tablet_scheduler=true', + 'tablet_checker_interval_ms=500', + 'schedule_batch_size=1000', + 'schedule_slot_num_per_hdd_path=1000', + ] + options.beConfigs += [ + 'report_tablet_interval_seconds=1', + ] + + options.enableDebugPoints() + options.cloudMode = false + docker(options) { + def injectName = 'TxnManager.prepare_txn.random_failed' + def be = sql_return_maparray('show backends').get(0) + def addInject = { -> + GetDebugPoint().enableDebugPoint(be.Host, be.HttpPort as int, NodeType.BE, injectName, [percent:1.0]) + } + def deleteInject = { -> + GetDebugPoint().disableDebugPoint(be.Host, be.HttpPort as int, NodeType.BE, injectName) + } + def lostReplica = { -> + sql_return_maparray('show tablets from clone_multi_analyzer').find { + it.BackendId.toLong().equals(be.BackendId.toLong()) + } + } + + sql """CREATE INVERTED INDEX ANALYZER IF NOT EXISTS clone_std_analyzer + PROPERTIES ("tokenizer" = "standard", "token_filter" = "lowercase")""" + sql """CREATE INVERTED INDEX ANALYZER IF NOT EXISTS clone_kw_analyzer + PROPERTIES ("tokenizer" = "keyword", "token_filter" = "lowercase")""" + sleep(10000) Review Comment: [P3] Wait for both analyzers to reach the backends Each BE learns about new analyzer policies through a separate ten-second report cycle followed by an asynchronous push. A report just before the second CREATE can leave the policy missing when the first INSERT opens its index writers. If that happens on the selected BE, it can miss version 2 before fault injection and fail the repair setup assertions. Use a bounded readiness check for both analyzers on every participating BE before the first INSERT. ########## regression-test/suites/clone_p0/test_clone_multi_analyzer_index_ids.groovy: ########## @@ -0,0 +1,103 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import org.apache.doris.regression.suite.ClusterOptions +import org.apache.doris.regression.util.NodeType + +// An incremental clone must keep the ids of two inverted indexes on one column. +suite('test_clone_multi_analyzer_index_ids', 'docker') { + def options = new ClusterOptions() + options.feConfigs += [ + 'disable_tablet_scheduler=true', + 'tablet_checker_interval_ms=500', + 'schedule_batch_size=1000', + 'schedule_slot_num_per_hdd_path=1000', + ] + options.beConfigs += [ + 'report_tablet_interval_seconds=1', + ] + + options.enableDebugPoints() + options.cloudMode = false + docker(options) { + def injectName = 'TxnManager.prepare_txn.random_failed' + def be = sql_return_maparray('show backends').get(0) + def addInject = { -> + GetDebugPoint().enableDebugPoint(be.Host, be.HttpPort as int, NodeType.BE, injectName, [percent:1.0]) + } + def deleteInject = { -> + GetDebugPoint().disableDebugPoint(be.Host, be.HttpPort as int, NodeType.BE, injectName) + } + def lostReplica = { -> + sql_return_maparray('show tablets from clone_multi_analyzer').find { + it.BackendId.toLong().equals(be.BackendId.toLong()) + } + } + + sql """CREATE INVERTED INDEX ANALYZER IF NOT EXISTS clone_std_analyzer + PROPERTIES ("tokenizer" = "standard", "token_filter" = "lowercase")""" + sql """CREATE INVERTED INDEX ANALYZER IF NOT EXISTS clone_kw_analyzer + PROPERTIES ("tokenizer" = "keyword", "token_filter" = "lowercase")""" + sleep(10000) + + sql """ + CREATE TABLE clone_multi_analyzer ( + k INT, + txt STRING, + INDEX idx_std (txt) USING INVERTED PROPERTIES("analyzer" = "clone_std_analyzer"), + INDEX idx_kw (txt) USING INVERTED PROPERTIES("analyzer" = "clone_kw_analyzer") + ) DUPLICATE KEY(k) DISTRIBUTED BY HASH(k) BUCKETS 1 PROPERTIES ( + "disable_auto_compaction" = "true" + ) + """ + + sql "INSERT INTO clone_multi_analyzer VALUES (1, 'alice')" + + // The first backend misses versions 3 and 4, which an incremental clone fills later. + addInject() + sql "INSERT INTO clone_multi_analyzer VALUES (2, 'alice cooper')" + sql "INSERT INTO clone_multi_analyzer VALUES (3, 'bob')" + deleteInject() + sql "INSERT INTO clone_multi_analyzer VALUES (4, 'Alice')" + + sleep(5000) + def replica = lostReplica() + assertNotNull(replica) + assertEquals(2, replica.Version.toInteger()) + assertEquals(4, replica.LstFailedVersion.toInteger()) + + setFeConfig('disable_tablet_scheduler', false) + awaitUntil(60) { + replica = lostReplica() + replica.Version.toInteger() == 5 && replica.LstFailedVersion.toInteger() == -1 + } + + def checkEveryReplica = { -> + for (int i = 0; i < 3; i++) { + sql "SET use_fix_replica = ${i}" Review Comment: [P3] Disable SQL result caching for the replica checks Once the table has passed the default 30-second cache quiet period, ordinal 0 can populate the SQL cache from a healthy replica. Changing `use_fix_replica` leaves the cache key and eligibility the same, so the later queries can replay those rows without scanning the repaired replica. Set `enable_sql_cache = false` for the regression session before the replica loop. ########## regression-test/suites/clone_p0/test_clone_multi_analyzer_index_ids.groovy: ########## @@ -0,0 +1,103 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import org.apache.doris.regression.suite.ClusterOptions +import org.apache.doris.regression.util.NodeType + +// An incremental clone must keep the ids of two inverted indexes on one column. +suite('test_clone_multi_analyzer_index_ids', 'docker') { + def options = new ClusterOptions() + options.feConfigs += [ + 'disable_tablet_scheduler=true', + 'tablet_checker_interval_ms=500', + 'schedule_batch_size=1000', + 'schedule_slot_num_per_hdd_path=1000', + ] + options.beConfigs += [ + 'report_tablet_interval_seconds=1', + ] + + options.enableDebugPoints() + options.cloudMode = false + docker(options) { + def injectName = 'TxnManager.prepare_txn.random_failed' + def be = sql_return_maparray('show backends').get(0) + def addInject = { -> + GetDebugPoint().enableDebugPoint(be.Host, be.HttpPort as int, NodeType.BE, injectName, [percent:1.0]) + } + def deleteInject = { -> + GetDebugPoint().disableDebugPoint(be.Host, be.HttpPort as int, NodeType.BE, injectName) + } + def lostReplica = { -> + sql_return_maparray('show tablets from clone_multi_analyzer').find { + it.BackendId.toLong().equals(be.BackendId.toLong()) + } + } + + sql """CREATE INVERTED INDEX ANALYZER IF NOT EXISTS clone_std_analyzer + PROPERTIES ("tokenizer" = "standard", "token_filter" = "lowercase")""" + sql """CREATE INVERTED INDEX ANALYZER IF NOT EXISTS clone_kw_analyzer + PROPERTIES ("tokenizer" = "keyword", "token_filter" = "lowercase")""" + sleep(10000) + + sql """ + CREATE TABLE clone_multi_analyzer ( + k INT, + txt STRING, + INDEX idx_std (txt) USING INVERTED PROPERTIES("analyzer" = "clone_std_analyzer"), + INDEX idx_kw (txt) USING INVERTED PROPERTIES("analyzer" = "clone_kw_analyzer") + ) DUPLICATE KEY(k) DISTRIBUTED BY HASH(k) BUCKETS 1 PROPERTIES ( + "disable_auto_compaction" = "true" + ) + """ + + sql "INSERT INTO clone_multi_analyzer VALUES (1, 'alice')" + + // The first backend misses versions 3 and 4, which an incremental clone fills later. + addInject() + sql "INSERT INTO clone_multi_analyzer VALUES (2, 'alice cooper')" + sql "INSERT INTO clone_multi_analyzer VALUES (3, 'bob')" + deleteInject() + sql "INSERT INTO clone_multi_analyzer VALUES (4, 'Alice')" + + sleep(5000) + def replica = lostReplica() + assertNotNull(replica) + assertEquals(2, replica.Version.toInteger()) + assertEquals(4, replica.LstFailedVersion.toInteger()) + + setFeConfig('disable_tablet_scheduler', false) + awaitUntil(60) { + replica = lostReplica() + replica.Version.toInteger() == 5 && replica.LstFailedVersion.toInteger() == -1 + } + + def checkEveryReplica = { -> + for (int i = 0; i < 3; i++) { + sql "SET use_fix_replica = ${i}" + order_qt_std "SELECT k FROM clone_multi_analyzer WHERE txt MATCH 'alice' USING ANALYZER clone_std_analyzer" + order_qt_kw "SELECT k FROM clone_multi_analyzer WHERE txt MATCH 'alice' USING ANALYZER clone_kw_analyzer" + } + sql "SET use_fix_replica = -1" + } + checkEveryReplica() + + // Compaction merges the cloned rowsets with local ones on the lost replica. + trigger_and_wait_compaction('clone_multi_analyzer', 'cumulative') Review Comment: [P2] Verify that the repaired replica actually compacts The four tiny rowsets at versions 2–5 are below both default size-based cumulative compaction thresholds (five deltas or 64 MiB). The BE returns `E-2000` and `trigger_and_wait_compaction` explicitly skips replicas with that result, so the second MATCH pass can succeed with the original rowsets. Give the test enough eligible input and assert that a merged rowset covering the repaired versions appears on the injected BE before repeating the queries. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
