ClickHouse/src/Storages/MergeTree/MergeTreeSink.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.1 KiB
C++
Raw Normal View History

2014-03-13 12:48:07 +00:00
#pragma once
2021-07-23 19:33:59 +00:00
#include <Processors/Sinks/SinkToStorage.h>
#include <Storages/StorageInMemoryMetadata.h>
2014-03-13 12:48:07 +00:00
2014-03-13 12:48:07 +00:00
namespace DB
{
class Block;
class StorageMergeTree;
struct StorageSnapshot;
using StorageSnapshotPtr = std::shared_ptr<StorageSnapshot>;
2021-07-23 19:33:59 +00:00
class MergeTreeSink : public SinkToStorage
2014-03-13 12:48:07 +00:00
{
public:
2021-07-23 19:33:59 +00:00
MergeTreeSink(
StorageMergeTree & storage_,
StorageMetadataPtr metadata_snapshot_,
size_t max_parts_per_block_,
ContextPtr context_);
~MergeTreeSink() override;
2014-03-13 12:48:07 +00:00
2021-07-23 19:33:59 +00:00
String getName() const override { return "MergeTreeSink"; }
void consume(Chunk chunk) override;
2021-07-26 14:47:29 +00:00
void onStart() override;
void onFinish() override;
2014-03-13 12:48:07 +00:00
private:
StorageMergeTree & storage;
StorageMetadataPtr metadata_snapshot;
size_t max_parts_per_block;
ContextPtr context;
StorageSnapshotPtr storage_snapshot;
uint64_t chunk_dedup_seqnum = 0; /// input chunk ordinal number in case of dedup token
/// We can delay processing for previous chunk and start writing a new one.
struct DelayedChunk;
std::unique_ptr<DelayedChunk> delayed_chunk;
void finishDelayedChunk();
2014-03-13 12:48:07 +00:00
};
}