[branch-2.1](memory) Fix SnapshotManager MemTracker attach thread #33501
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user