2021-09-16 21:19:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-04-19 20:47:29 +00:00
|
|
|
#include <boost/noncopyable.hpp>
|
2021-09-16 21:19:58 +00:00
|
|
|
#include <Storages/MergeTree/IExecutableTask.h>
|
|
|
|
#include <Storages/MergeTree/MutateTask.h>
|
|
|
|
#include <Storages/MergeTree/ReplicatedMergeMutateTaskBase.h>
|
|
|
|
#include <Storages/MergeTree/ReplicatedMergeTreeQueue.h>
|
|
|
|
#include <Storages/MergeTree/ReplicatedMergeTreeLogEntry.h>
|
2022-02-10 19:45:52 +00:00
|
|
|
#include <Storages/MergeTree/ZeroCopyLock.h>
|
2021-09-16 21:19:58 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2022-04-19 20:47:29 +00:00
|
|
|
class MutateFromLogEntryTask : public ReplicatedMergeMutateTaskBase, boost::noncopyable
|
2021-09-16 21:19:58 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
template <typename Callback>
|
|
|
|
MutateFromLogEntryTask(
|
|
|
|
ReplicatedMergeTreeQueue::SelectedEntryPtr selected_entry_,
|
|
|
|
StorageReplicatedMergeTree & storage_,
|
|
|
|
Callback && task_result_callback_)
|
|
|
|
: ReplicatedMergeMutateTaskBase(&Poco::Logger::get("MutateFromLogEntryTask"), storage_, selected_entry_, task_result_callback_) {}
|
|
|
|
|
2022-04-19 20:47:29 +00:00
|
|
|
|
2021-09-30 21:26:24 +00:00
|
|
|
UInt64 getPriority() override { return priority; }
|
|
|
|
|
2021-09-16 21:19:58 +00:00
|
|
|
private:
|
2022-03-19 16:31:33 +00:00
|
|
|
ReplicatedMergeMutateTaskBase::PrepareResult prepare() override;
|
2021-09-16 21:19:58 +00:00
|
|
|
bool finalize(ReplicatedMergeMutateTaskBase::PartLogWriter write_part_log) override;
|
|
|
|
|
|
|
|
bool executeInnerTask() override
|
|
|
|
{
|
|
|
|
return mutate_task->execute();
|
|
|
|
}
|
|
|
|
|
2021-09-30 21:26:24 +00:00
|
|
|
UInt64 priority{0};
|
|
|
|
|
2021-09-16 21:19:58 +00:00
|
|
|
TableLockHolder table_lock_holder{nullptr};
|
|
|
|
ReservationSharedPtr reserved_space{nullptr};
|
|
|
|
|
|
|
|
MergeTreePartInfo new_part_info;
|
|
|
|
MutationCommandsConstPtr commands;
|
|
|
|
|
|
|
|
MergeTreeData::TransactionUniquePtr transaction_ptr{nullptr};
|
2022-02-10 19:45:52 +00:00
|
|
|
std::optional<ZeroCopyLock> zero_copy_lock;
|
2021-09-16 21:19:58 +00:00
|
|
|
StopwatchUniquePtr stopwatch_ptr{nullptr};
|
|
|
|
|
|
|
|
MergeTreeData::MutableDataPartPtr new_part{nullptr};
|
|
|
|
FutureMergedMutatedPartPtr future_mutated_part{nullptr};
|
|
|
|
|
2021-10-04 21:13:18 +00:00
|
|
|
ContextMutablePtr fake_query_context;
|
2021-09-16 21:19:58 +00:00
|
|
|
MutateTaskPtr mutate_task;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|