This is an automated email from the ASF dual-hosted git repository. dataroaring 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 a733b3f0663 branch-3.0: [Fix](cloud) Should not skip to calculate delete bitmaps in publish phase if cache miss when get delete bitmap #48867 (#48962) a733b3f0663 is described below commit a733b3f06637452313dbe117dd020abe0e8cd96b Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Wed Mar 12 18:44:12 2025 +0800 branch-3.0: [Fix](cloud) Should not skip to calculate delete bitmaps in publish phase if cache miss when get delete bitmap #48867 (#48962) Cherry-picked from #48867 Co-authored-by: bobhan1 <bao...@selectdb.com> --- be/src/cloud/cloud_tablet.cpp | 2 + be/src/cloud/cloud_txn_delete_bitmap_cache.cpp | 3 + .../test_cloud_publish_skip_calc_cache_miss.out | Bin 0 -> 183 bytes .../test_cloud_publish_skip_calc_cache_miss.groovy | 78 +++++++++++++++++++++ 4 files changed, 83 insertions(+) diff --git a/be/src/cloud/cloud_tablet.cpp b/be/src/cloud/cloud_tablet.cpp index 82a5927c1c4..a1026c9518d 100644 --- a/be/src/cloud/cloud_tablet.cpp +++ b/be/src/cloud/cloud_tablet.cpp @@ -731,6 +731,8 @@ Status CloudTablet::save_delete_bitmap(const TabletTxnInfo* txn_info, int64_t tx DBUG_EXECUTE_IF("CloudTablet::save_delete_bitmap.injected_error", { auto retry = dp->param<bool>("retry", false); + auto sleep_sec = dp->param<int>("sleep", 0); + std::this_thread::sleep_for(std::chrono::seconds(sleep_sec)); if (retry) { // return DELETE_BITMAP_LOCK_ERROR to let it retry return Status::Error<ErrorCode::DELETE_BITMAP_LOCK_ERROR>( "injected DELETE_BITMAP_LOCK_ERROR"); diff --git a/be/src/cloud/cloud_txn_delete_bitmap_cache.cpp b/be/src/cloud/cloud_txn_delete_bitmap_cache.cpp index 95077f5c888..9a8b669e0ae 100644 --- a/be/src/cloud/cloud_txn_delete_bitmap_cache.cpp +++ b/be/src/cloud/cloud_txn_delete_bitmap_cache.cpp @@ -81,6 +81,9 @@ Status CloudTxnDeleteBitmapCache::get_tablet_txn_info( if (delete_bitmap != nullptr) { *delete_bitmap = std::make_shared<DeleteBitmap>(tablet_id); } + // to avoid to skip calculating + **publish_status = PublishStatus::INIT; + return Status::OK(); } return st; diff --git a/regression-test/data/fault_injection_p0/cloud/test_cloud_publish_skip_calc_cache_miss.out b/regression-test/data/fault_injection_p0/cloud/test_cloud_publish_skip_calc_cache_miss.out new file mode 100644 index 00000000000..5444c51dbc8 Binary files /dev/null and b/regression-test/data/fault_injection_p0/cloud/test_cloud_publish_skip_calc_cache_miss.out differ diff --git a/regression-test/suites/fault_injection_p0/cloud/test_cloud_publish_skip_calc_cache_miss.groovy b/regression-test/suites/fault_injection_p0/cloud/test_cloud_publish_skip_calc_cache_miss.groovy new file mode 100644 index 00000000000..f11c8cc790f --- /dev/null +++ b/regression-test/suites/fault_injection_p0/cloud/test_cloud_publish_skip_calc_cache_miss.groovy @@ -0,0 +1,78 @@ +// 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. + +suite("test_cloud_publish_skip_calc_cache_miss", "nonConcurrent") { + if (!isCloudMode()) { + return + } + + def customFeConfig = [ + delete_bitmap_lock_expiration_seconds : 10, + calculate_delete_bitmap_task_timeout_seconds : 5, + ] + + setFeConfigTemporary(customFeConfig) { + + def table1 = "test_cloud_publish_skip_calc_cache_miss" + sql "DROP TABLE IF EXISTS ${table1} FORCE;" + sql """ CREATE TABLE IF NOT EXISTS ${table1} ( + `k1` int NOT NULL, + `c1` int, + `c2` int + )UNIQUE KEY(k1) + DISTRIBUTED BY HASH(k1) BUCKETS 1 + PROPERTIES ( + "enable_unique_key_merge_on_write" = "true", + "disable_auto_compaction" = "true", + "replication_num" = "1"); """ + + sql "insert into ${table1} values(1,1,1);" + sql "insert into ${table1} values(2,2,2);" + sql "insert into ${table1} values(3,3,3);" + sql "sync;" + order_qt_sql "select * from ${table1};" + + try { + GetDebugPoint().clearDebugPointsForAllFEs() + GetDebugPoint().clearDebugPointsForAllBEs() + + GetDebugPoint().enableDebugPointForAllBEs("CloudTxnDeleteBitmapCache::get_delete_bitmap.cache_miss") + // inject failure after saving its result in BE's delete bitmap cache successfully, so that later retry will + // try to skip to calculate + GetDebugPoint().enableDebugPointForAllBEs("CloudTablet::save_delete_bitmap.injected_error", [retry: true, sleep: 5]) + + def t1 = Thread.start { + sql "insert into ${table1} values(1,999,999);" + } + + Thread.sleep(3000) + + GetDebugPoint().disableDebugPointForAllBEs("CloudTablet::save_delete_bitmap.injected_error") + + t1.join() + + qt_dup_key_count "select count() from (select k1,count() as cnt from ${table1} group by k1 having cnt > 1) A;" + qt_sql "select * from ${table1} order by k1,c1,c2;" + } catch(Exception e) { + logger.info(e.getMessage()) + throw e + } finally { + GetDebugPoint().clearDebugPointsForAllBEs() + GetDebugPoint().clearDebugPointsForAllFEs() + } + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org