This is an automated email from the ASF dual-hosted git repository.

eldenmoon 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 09de9bba05d branch-3.0: [fix](variant) use lock to protect schema from 
threading unsafe #45026 (#45174)
09de9bba05d is described below

commit 09de9bba05dd64b71315024c7ec1ba1709c52b0e
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Dec 9 15:44:22 2024 +0800

    branch-3.0: [fix](variant) use lock to protect schema from threading unsafe 
#45026 (#45174)
    
    Cherry-picked from #45026
    
    Co-authored-by: lihangyu <lihan...@selectdb.com>
---
 be/src/cloud/cloud_tablet.cpp | 1 +
 be/src/olap/base_tablet.h     | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/be/src/cloud/cloud_tablet.cpp b/be/src/cloud/cloud_tablet.cpp
index 44ba92c5bea..628e3771bf7 100644
--- a/be/src/cloud/cloud_tablet.cpp
+++ b/be/src/cloud/cloud_tablet.cpp
@@ -219,6 +219,7 @@ Status CloudTablet::sync_if_not_running() {
 }
 
 TabletSchemaSPtr CloudTablet::merged_tablet_schema() const {
+    std::shared_lock rlock(_meta_lock);
     return _merged_tablet_schema;
 }
 
diff --git a/be/src/olap/base_tablet.h b/be/src/olap/base_tablet.h
index db464dcc6e1..f8f2869136f 100644
--- a/be/src/olap/base_tablet.h
+++ b/be/src/olap/base_tablet.h
@@ -266,7 +266,10 @@ public:
                                         int limit);
 
     // Return the merged schema of all rowsets
-    virtual TabletSchemaSPtr merged_tablet_schema() const { return 
_max_version_schema; }
+    virtual TabletSchemaSPtr merged_tablet_schema() const {
+        std::shared_lock rlock(_meta_lock);
+        return _max_version_schema;
+    }
 
     void traverse_rowsets(std::function<void(const RowsetSharedPtr&)> visitor,
                           bool include_stale = false) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to