From e291fdc6db7aed9e4fa875b0969a43cdd542320b Mon Sep 17 00:00:00 2001 From: deardeng <565620795@qq.com> Date: Thu, 19 Sep 2024 18:35:02 +0800 Subject: [PATCH] [fix](create table) Fix `test_partition_create_tablet_rr` docker regression case --- be/src/olap/storage_engine.cpp | 8 ++++---- be/src/olap/storage_engine.h | 10 +++++----- .../test_partition_create_tablet_rr.groovy | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/be/src/olap/storage_engine.cpp b/be/src/olap/storage_engine.cpp index ebf40c90bea35b..e00b5b595e20dc 100644 --- a/be/src/olap/storage_engine.cpp +++ b/be/src/olap/storage_engine.cpp @@ -209,7 +209,7 @@ StorageEngine::StorageEngine(const EngineOptions& options) _txn_manager(new TxnManager(*this, config::txn_map_shard_size, config::txn_shard_size)), _default_rowset_type(BETA_ROWSET), _create_tablet_idx_lru_cache( - new CreateTabletIdxCache(config::partition_disk_index_lru_size)), + new CreateTabletRRIdxCache(config::partition_disk_index_lru_size)), _snapshot_mgr(std::make_unique(*this)) { REGISTER_HOOK_METRIC(unused_rowsets_count, [this]() { // std::lock_guard lock(_gc_mutex); @@ -515,7 +515,7 @@ Status StorageEngine::set_cluster_id(int32_t cluster_id) { int StorageEngine::_get_and_set_next_disk_index(int64 partition_id, TStorageMedium::type storage_medium) { - auto key = CreateTabletIdxCache::get_key(partition_id, storage_medium); + auto key = CreateTabletRRIdxCache::get_key(partition_id, storage_medium); int curr_index = _create_tablet_idx_lru_cache->get_index(key); // -1, lru can't find key if (curr_index == -1) { @@ -1511,7 +1511,7 @@ Status StorageEngine::_persist_broken_paths() { return Status::OK(); } -int CreateTabletIdxCache::get_index(const std::string& key) { +int CreateTabletRRIdxCache::get_index(const std::string& key) { auto* lru_handle = lookup(key); if (lru_handle) { Defer release([cache = this, lru_handle] { cache->release(lru_handle); }); @@ -1522,7 +1522,7 @@ int CreateTabletIdxCache::get_index(const std::string& key) { return -1; } -void CreateTabletIdxCache::set_index(const std::string& key, int next_idx) { +void CreateTabletRRIdxCache::set_index(const std::string& key, int next_idx) { assert(next_idx >= 0); auto* value = new CacheValue; value->idx = next_idx; diff --git a/be/src/olap/storage_engine.h b/be/src/olap/storage_engine.h index b2a313adcdbb7e..421c0eb352d712 100644 --- a/be/src/olap/storage_engine.h +++ b/be/src/olap/storage_engine.h @@ -69,7 +69,7 @@ class Thread; class ThreadPool; class TxnManager; class ReportWorker; -class CreateTabletIdxCache; +class CreateTabletRRIdxCache; struct DirInfo; class SnapshotManager; @@ -532,7 +532,7 @@ class StorageEngine final : public BaseStorageEngine { // next index for create tablet std::map _last_use_index; - std::unique_ptr _create_tablet_idx_lru_cache; + std::unique_ptr _create_tablet_idx_lru_cache; std::unique_ptr _snapshot_mgr; }; @@ -540,7 +540,7 @@ class StorageEngine final : public BaseStorageEngine { // lru cache for create tabelt round robin in disks // key: partitionId_medium // value: index -class CreateTabletIdxCache : public LRUCachePolicy { +class CreateTabletRRIdxCache : public LRUCachePolicy { public: // get key, delimiter with DELIMITER '-' static std::string get_key(int64_t partition_id, TStorageMedium::type medium) { @@ -557,10 +557,10 @@ class CreateTabletIdxCache : public LRUCachePolicy { int idx = 0; }; - CreateTabletIdxCache(size_t capacity) + CreateTabletRRIdxCache(size_t capacity) : LRUCachePolicy(CachePolicy::CacheType::CREATE_TABLET_RR_IDX_CACHE, capacity, LRUCacheType::NUMBER, - /*stale_sweep_time_s*/ 30 * 60) {} + /*stale_sweep_time_s*/ 30 * 60, 1) {} }; struct DirInfo { diff --git a/regression-test/suites/partition_p0/test_partition_create_tablet_rr.groovy b/regression-test/suites/partition_p0/test_partition_create_tablet_rr.groovy index 836dff938f8c96..f31322facff966 100644 --- a/regression-test/suites/partition_p0/test_partition_create_tablet_rr.groovy +++ b/regression-test/suites/partition_p0/test_partition_create_tablet_rr.groovy @@ -26,7 +26,8 @@ suite("test_partition_create_tablet_rr", "docker") { options.beConfigs += [ 'report_tablet_interval_seconds=1', 'report_disk_state_interval_seconds=1', - "partition_disk_index_lru_size=$partition_disk_index_lru_size" + "partition_disk_index_lru_size=$partition_disk_index_lru_size", + 'sys_log_verbose_modules=*' ] options.beDisks = ['HDD=4','SSD=4'] options.enableDebugPoints()