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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 15e1f5fc562 [branch-2.1](memory) Fix SnapshotManager MemTracker attach 
thread #33501
15e1f5fc562 is described below

commit 15e1f5fc5625632f777d3398f39cf5dda202d0f2
Author: Xinyi Zou <[email protected]>
AuthorDate: Wed Apr 10 22:01:26 2024 +0800

    [branch-2.1](memory) Fix SnapshotManager MemTracker attach thread #33501
---
 be/src/olap/snapshot_manager.cpp | 6 +++---
 be/src/olap/snapshot_manager.h   | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/be/src/olap/snapshot_manager.cpp b/be/src/olap/snapshot_manager.cpp
index 0fa4e591854..370161597a6 100644
--- a/be/src/olap/snapshot_manager.cpp
+++ b/be/src/olap/snapshot_manager.cpp
@@ -80,7 +80,7 @@ SnapshotManager* SnapshotManager::instance() {
 
 Status SnapshotManager::make_snapshot(const TSnapshotRequest& request, string* 
snapshot_path,
                                       bool* allow_incremental_clone) {
-    SCOPED_CONSUME_MEM_TRACKER(_mem_tracker);
+    SCOPED_ATTACH_TASK(_mem_tracker);
     Status res = Status::OK();
     if (snapshot_path == nullptr) {
         return Status::Error<INVALID_ARGUMENT>("output parameter cannot be 
null");
@@ -106,7 +106,7 @@ Status SnapshotManager::make_snapshot(const 
TSnapshotRequest& request, string* s
 Status SnapshotManager::release_snapshot(const string& snapshot_path) {
     // If the requested snapshot_path is located in the root/snapshot folder, 
it is considered legal and can be deleted.
     // Otherwise, it is considered an illegal request and returns an error 
result.
-    SCOPED_CONSUME_MEM_TRACKER(_mem_tracker);
+    SCOPED_ATTACH_TASK(_mem_tracker);
     auto stores = StorageEngine::instance()->get_stores();
     for (auto store : stores) {
         std::string abs_path;
@@ -127,7 +127,7 @@ Status SnapshotManager::release_snapshot(const string& 
snapshot_path) {
 Result<std::vector<PendingRowsetGuard>> SnapshotManager::convert_rowset_ids(
         const std::string& clone_dir, int64_t tablet_id, int64_t replica_id, 
int64_t partition_id,
         int32_t schema_hash) {
-    SCOPED_CONSUME_MEM_TRACKER(_mem_tracker);
+    SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(_mem_tracker);
     std::vector<PendingRowsetGuard> guards;
     // check clone dir existed
     bool exists = true;
diff --git a/be/src/olap/snapshot_manager.h b/be/src/olap/snapshot_manager.h
index 20b11ce7b33..4f06c3c87c0 100644
--- a/be/src/olap/snapshot_manager.h
+++ b/be/src/olap/snapshot_manager.h
@@ -29,7 +29,7 @@
 #include "olap/rowset/rowset.h"
 #include "olap/tablet.h"
 #include "olap/tablet_schema.h"
-#include "runtime/memory/mem_tracker.h"
+#include "runtime/memory/mem_tracker_limiter.h"
 
 namespace doris {
 class RowsetMetaPB;
@@ -63,7 +63,7 @@ public:
 
 private:
     SnapshotManager() : _snapshot_base_id(0) {
-        _mem_tracker = std::make_shared<MemTracker>("SnapshotManager");
+        _mem_tracker = 
MemTrackerLimiter::create_shared(MemTrackerLimiter::Type::OTHER, 
"SnapshotManager");
     }
 
     Status _calc_snapshot_id_path(const TabletSharedPtr& tablet, int64_t 
timeout_s,
@@ -97,7 +97,7 @@ private:
     std::mutex _snapshot_mutex;
     uint64_t _snapshot_base_id;
 
-    std::shared_ptr<MemTracker> _mem_tracker;
+    std::shared_ptr<MemTrackerLimiter> _mem_tracker;
 }; // SnapshotManager
 
 } // namespace doris


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to