Skip to content

Commit 6a99acf

Browse files
committed
I am just too crazy at this point
1 parent 6cec570 commit 6a99acf

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/Storages/MergeTree/MergeTreeData.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6283,7 +6283,14 @@ void MergeTreeData::killExportPart(const String & transaction_id)
62836283

62846284
std::erase_if(export_manifests, [&](const auto & manifest)
62856285
{
6286-
return manifest.transaction_id == transaction_id;
6286+
if (manifest.transaction_id == transaction_id)
6287+
{
6288+
if (manifest.task)
6289+
manifest.task->cancel();
6290+
6291+
return true;
6292+
}
6293+
return false;
62876294
});
62886295
}
62896296

@@ -9130,13 +9137,17 @@ bool MergeTreeData::scheduleDataMovingJob(BackgroundJobsAssignee & assignee)
91309137
context_copy->setCurrentQueryId(manifest.transaction_id);
91319138
context_copy->setBackgroundOperationTypeForContext(ClientInfo::BackgroundOperationType::EXPORT_PART);
91329139

9133-
manifest.in_progress = assignee.scheduleMoveTask(std::make_shared<ExportPartTask>(*this, manifest, context_copy));
9140+
auto task = std::make_shared<ExportPartTask>(*this, manifest, context_copy);
9141+
9142+
manifest.in_progress = assignee.scheduleMoveTask(task);
91349143

91359144
if (!manifest.in_progress)
91369145
{
91379146
continue;
91389147
}
91399148

9149+
manifest.task = task;
9150+
91409151
return true;
91419152
}
91429153

src/Storages/MergeTree/MergeTreePartExportManifest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ struct MergeTreePartExportManifest
7373

7474
time_t create_time;
7575
mutable bool in_progress = false;
76+
mutable std::shared_ptr<ExportPartTask> task = nullptr;
7677

7778
bool operator<(const MergeTreePartExportManifest & rhs) const
7879
{

0 commit comments

Comments
 (0)