Skip to content

Commit e2092c8

Browse files
committed
merge glitch
1 parent 5f29e0a commit e2092c8

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/Storages/MergeTree/ExportPartTask.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,20 @@ namespace Setting
4242
extern const SettingsUInt64 export_merge_tree_part_max_rows_per_file;
4343
}
4444

45-
ExportPartTask::ExportPartTask(MergeTreeData & storage_, const MergeTreePartExportManifest & manifest_, ContextPtr context_)
45+
ExportPartTask::ExportPartTask(MergeTreeData & storage_, const MergeTreePartExportManifest & manifest_)
4646
: storage(storage_),
47-
manifest(manifest_),
48-
local_context(context_)
47+
manifest(manifest_)
4948
{
5049
}
5150

5251
bool ExportPartTask::executeStep()
5352
{
53+
auto local_context = Context::createCopy(storage.getContext());
54+
local_context->makeQueryContextForExportPart();
55+
local_context->setCurrentQueryId(manifest.transaction_id);
56+
local_context->setBackgroundOperationTypeForContext(ClientInfo::BackgroundOperationType::EXPORT_PART);
57+
local_context->setSettings(manifest.settings);
58+
5459
const auto & metadata_snapshot = manifest.metadata_snapshot;
5560

5661
Names columns_to_read = metadata_snapshot->getColumns().getNamesOfPhysical();

src/Storages/MergeTree/ExportPartTask.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ class ExportPartTask : public IExecutableTask
1212
public:
1313
explicit ExportPartTask(
1414
MergeTreeData & storage_,
15-
const MergeTreePartExportManifest & manifest_,
16-
ContextPtr context_);
15+
const MergeTreePartExportManifest & manifest_);
1716
bool executeStep() override;
1817
void onCompleted() override;
1918
StorageID getStorageID() const override;
@@ -25,7 +24,6 @@ class ExportPartTask : public IExecutableTask
2524
private:
2625
MergeTreeData & storage;
2726
MergeTreePartExportManifest manifest;
28-
ContextPtr local_context;
2927
QueryPipeline pipeline;
3028
std::atomic<bool> cancel_requested = false;
3129

src/Storages/MergeTree/MergeTreeData.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9141,7 +9141,7 @@ bool MergeTreeData::scheduleDataMovingJob(BackgroundJobsAssignee & assignee)
91419141
context_copy->setCurrentQueryId(manifest.transaction_id);
91429142
context_copy->setBackgroundOperationTypeForContext(ClientInfo::BackgroundOperationType::EXPORT_PART);
91439143

9144-
auto task = std::make_shared<ExportPartTask>(*this, manifest, context_copy);
9144+
auto task = std::make_shared<ExportPartTask>(*this, manifest);
91459145

91469146
manifest.in_progress = assignee.scheduleMoveTask(task);
91479147

0 commit comments

Comments
 (0)