airborne12 commented on code in PR #71334: URL: https://github.com/apache/doris/pull/71334#discussion_r4780857588
########## 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: Confirmed. In the earlier run the cumulative trigger returned `[E-2000]_input_rowsets is empty`, so nothing was merged. Fixed in ac99b0c8b37: the suite now runs full compaction and asserts that the repaired replica holds a single `[0-5]` rowset before it queries the replicas again. The suite passes locally on the fixed build, and the generated `.out` is unchanged. ########## 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: Confirmed: `enable_sql_cache` defaults to true, and `use_fix_replica` is not one of the session variables in the SQL cache key. Fixed in ac99b0c8b37: the suite runs `SET enable_sql_cache = false` before its first query. ########## 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: Agreed: each BE reports its index policies every `report_index_policy_interval_seconds` (10 s by default), and FE pushes the missing ones asynchronously. Fixed in ac99b0c8b37: the suite sets that interval to 1 s. Before the first insert, it runs `tokenize` with both analyzers on every replica of a one-tablet probe table, and retries while the error is `Policy not found`. EXPLAIN shows the call in the `OlapScanNode` projection, so each probe runs on that replica's BE. -- 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]
