mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 10:52:30 +00:00
eaf95306ed
* Add small sleep for zero copy replication merges and mutations * Update src/Storages/MergeTree/MergeFromLogEntryTask.cpp Co-authored-by: Sergei Trifonov <sergei@clickhouse.com> * Update src/Storages/MergeTree/MergeFromLogEntryTask.cpp Co-authored-by: Sergei Trifonov <sergei@clickhouse.com> * Update src/Storages/MergeTree/MutateFromLogEntryTask.cpp Co-authored-by: Nikita Mikhaylov <mikhaylovnikitka@gmail.com> * Update src/Storages/MergeTree/MergeFromLogEntryTask.cpp Co-authored-by: Sergei Trifonov <sergei@clickhouse.com> * Update src/Storages/MergeTree/MutateFromLogEntryTask.cpp * Fix darwin build --------- Co-authored-by: Sergei Trifonov <sergei@clickhouse.com> Co-authored-by: Nikita Mikhaylov <mikhaylovnikitka@gmail.com>
68 lines
1.9 KiB
C++
68 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <pcg_random.hpp>
|
|
|
|
#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>
|
|
#include <Storages/MergeTree/ZeroCopyLock.h>
|
|
#include <Storages/StorageReplicatedMergeTree.h>
|
|
#include <Common/randomSeed.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class MutateFromLogEntryTask : public ReplicatedMergeMutateTaskBase
|
|
{
|
|
public:
|
|
template <typename Callback>
|
|
MutateFromLogEntryTask(
|
|
ReplicatedMergeTreeQueue::SelectedEntryPtr selected_entry_,
|
|
StorageReplicatedMergeTree & storage_,
|
|
Callback && task_result_callback_)
|
|
: ReplicatedMergeMutateTaskBase(
|
|
&Poco::Logger::get(storage_.getStorageID().getShortName() + "::" + selected_entry_->log_entry->new_part_name + " (MutateFromLogEntryTask)"),
|
|
storage_,
|
|
selected_entry_,
|
|
task_result_callback_)
|
|
, rng(randomSeed())
|
|
{}
|
|
|
|
|
|
Priority getPriority() override { return priority; }
|
|
|
|
private:
|
|
|
|
ReplicatedMergeMutateTaskBase::PrepareResult prepare() override;
|
|
|
|
bool finalize(ReplicatedMergeMutateTaskBase::PartLogWriter write_part_log) override;
|
|
|
|
bool executeInnerTask() override
|
|
{
|
|
return mutate_task->execute();
|
|
}
|
|
|
|
Priority priority;
|
|
|
|
TableLockHolder table_lock_holder{nullptr};
|
|
ReservationSharedPtr reserved_space{nullptr};
|
|
|
|
MergeTreePartInfo new_part_info;
|
|
MutationCommandsConstPtr commands;
|
|
|
|
MergeTreeData::TransactionUniquePtr transaction_ptr{nullptr};
|
|
std::optional<ZeroCopyLock> zero_copy_lock;
|
|
StopwatchUniquePtr stopwatch_ptr{nullptr};
|
|
|
|
MergeTreeData::MutableDataPartPtr new_part{nullptr};
|
|
FutureMergedMutatedPartPtr future_mutated_part{nullptr};
|
|
|
|
MutateTaskPtr mutate_task;
|
|
pcg64 rng;
|
|
};
|
|
|
|
|
|
}
|