Skip to content

Commit

Permalink
Reset current_memory_tracker when WNEstablishDisaggTaskHandler finish…
Browse files Browse the repository at this point in the history
…ed. (#8174) (#8175)

close #8173
  • Loading branch information
ti-chi-bot authored Oct 10, 2023
1 parent 58f980b commit 58dba71
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions dbms/src/Flash/FlashService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,9 +889,6 @@ grpc::Status FlashService::EstablishDisaggTask(
DM::DisaggTaskId task_id(meta);
auto logger = Logger::get(task_id);

auto handler = std::make_shared<WNEstablishDisaggTaskHandler>(db_context, task_id);
SCOPE_EXIT({ current_memory_tracker = nullptr; });

auto record_other_error = [&](int flash_err_code, const String & err_msg) {
// Note: We intentinally do not remove the snapshot from the SnapshotManager
// when this request is failed. Consider this case:
Expand All @@ -905,9 +902,11 @@ grpc::Status FlashService::EstablishDisaggTask(
try
{
auto task = std::make_shared<std::packaged_task<void()>>(
[&handler, &request, &response, deadline = grpc_context->deadline()]() {
[db_context = db_context, &task_id, &request, &response, deadline = grpc_context->deadline()]() {
auto current = std::chrono::system_clock::now();
RUNTIME_CHECK(current < deadline, current, deadline);
auto handler = std::make_unique<WNEstablishDisaggTaskHandler>(db_context, task_id);
SCOPE_EXIT({ current_memory_tracker = nullptr; });
handler->prepare(request);
handler->execute(response);
});
Expand Down

0 comments on commit 58dba71

Please sign in to comment.