From 9510581501c7ba36170ac7244d606ac24bb654d5 Mon Sep 17 00:00:00 2001 From: koarz Date: Wed, 25 Jun 2025 10:42:30 +0800 Subject: [PATCH 1/2] [fix](cloud)fix tablet_path when rowset is null --- be/src/cloud/cloud_tablet.cpp | 7 +++++-- be/src/cloud/cloud_tablet.h | 2 +- be/src/olap/base_tablet.h | 2 +- be/src/olap/tablet.h | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/be/src/cloud/cloud_tablet.cpp b/be/src/cloud/cloud_tablet.cpp index 07fd356c541f50..dac2c3507b5f89 100644 --- a/be/src/cloud/cloud_tablet.cpp +++ b/be/src/cloud/cloud_tablet.cpp @@ -78,8 +78,11 @@ bool CloudTablet::exceed_version_limit(int32_t limit) { return _approximate_num_rowsets.load(std::memory_order_relaxed) > limit; } -const std::string& CloudTablet::tablet_path() const { - return get_rowset_with_max_version()->tablet_path(); +std::string CloudTablet::tablet_path() const { + if (auto rowset = get_rowset_with_max_version(); rowset != nullptr) { + return rowset->tablet_path(); + } + return ""; } Status CloudTablet::capture_consistent_rowsets_unlocked( diff --git a/be/src/cloud/cloud_tablet.h b/be/src/cloud/cloud_tablet.h index f5a767a2ea78d4..a08526c5ff65ae 100644 --- a/be/src/cloud/cloud_tablet.h +++ b/be/src/cloud/cloud_tablet.h @@ -70,7 +70,7 @@ class CloudTablet final : public BaseTablet { return _approximate_data_size.load(std::memory_order_relaxed); } - const std::string& tablet_path() const override; + std::string tablet_path() const override; // clang-format off int64_t fetch_add_approximate_num_rowsets (int64_t x) { return _approximate_num_rowsets .fetch_add(x, std::memory_order_relaxed); } diff --git a/be/src/olap/base_tablet.h b/be/src/olap/base_tablet.h index c4ed7959f46c93..2adc963bd88e47 100644 --- a/be/src/olap/base_tablet.h +++ b/be/src/olap/base_tablet.h @@ -103,7 +103,7 @@ class BaseTablet { void set_alter_failed(bool alter_failed) { _alter_failed = alter_failed; } bool is_alter_failed() { return _alter_failed; } - virtual const std::string& tablet_path() const = 0; + virtual std::string tablet_path() const = 0; virtual bool exceed_version_limit(int32_t limit) = 0; diff --git a/be/src/olap/tablet.h b/be/src/olap/tablet.h index a52755c1d04fee..afd44950a4cd4d 100644 --- a/be/src/olap/tablet.h +++ b/be/src/olap/tablet.h @@ -116,7 +116,7 @@ class Tablet final : public BaseTablet { DataDir* data_dir() const { return _data_dir; } int64_t replica_id() const { return _tablet_meta->replica_id(); } - const std::string& tablet_path() const override { return _tablet_path; } + std::string tablet_path() const override { return _tablet_path; } bool set_tablet_schema_into_rowset_meta(); Status init(); From fd719c935818b856fb7dce6896653f1a8e17e3fd Mon Sep 17 00:00:00 2001 From: koarz Date: Wed, 25 Jun 2025 14:08:08 +0800 Subject: [PATCH 2/2] fix --- be/src/cloud/cloud_tablet.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/be/src/cloud/cloud_tablet.cpp b/be/src/cloud/cloud_tablet.cpp index dac2c3507b5f89..4f481026b64ac5 100644 --- a/be/src/cloud/cloud_tablet.cpp +++ b/be/src/cloud/cloud_tablet.cpp @@ -79,9 +79,6 @@ bool CloudTablet::exceed_version_limit(int32_t limit) { } std::string CloudTablet::tablet_path() const { - if (auto rowset = get_rowset_with_max_version(); rowset != nullptr) { - return rowset->tablet_path(); - } return ""; }