2020-04-14 19:47:19 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Storages/MergeTree/IMergeTreeDataPart.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class MergeTreeDataPartInMemory : public IMergeTreeDataPart
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MergeTreeDataPartInMemory(
|
|
|
|
const MergeTreeData & storage_,
|
|
|
|
const String & name_,
|
|
|
|
const MergeTreePartInfo & info_,
|
|
|
|
const DiskPtr & disk_,
|
|
|
|
const std::optional<String> & relative_path_ = {});
|
|
|
|
|
|
|
|
MergeTreeDataPartInMemory(
|
|
|
|
MergeTreeData & storage_,
|
|
|
|
const String & name_,
|
|
|
|
const DiskPtr & disk_,
|
|
|
|
const std::optional<String> & relative_path_ = {});
|
|
|
|
|
|
|
|
MergeTreeReaderPtr getReader(
|
|
|
|
const NamesAndTypesList & columns,
|
|
|
|
const MarkRanges & mark_ranges,
|
|
|
|
UncompressedCache * uncompressed_cache,
|
|
|
|
MarkCache * mark_cache,
|
|
|
|
const MergeTreeReaderSettings & reader_settings_,
|
|
|
|
const ValueSizeMap & avg_value_size_hints,
|
|
|
|
const ReadBufferFromFileBase::ProfileCallback & profile_callback) const override;
|
|
|
|
|
|
|
|
MergeTreeWriterPtr getWriter(
|
|
|
|
const NamesAndTypesList & columns_list,
|
|
|
|
const std::vector<MergeTreeIndexPtr> & indices_to_recalc,
|
|
|
|
const CompressionCodecPtr & default_codec_,
|
|
|
|
const MergeTreeWriterSettings & writer_settings,
|
|
|
|
const MergeTreeIndexGranularity & computed_index_granularity) const override;
|
|
|
|
|
|
|
|
bool isStoredOnDisk() const override { return false; }
|
2020-05-28 23:59:13 +00:00
|
|
|
bool hasColumnFiles(const String & column_name, const IDataType & /* type */) const override { return !!getColumnPosition(column_name); }
|
2020-04-14 19:47:19 +00:00
|
|
|
String getFileNameForColumn(const NameAndTypePair & /* column */) const override { return ""; }
|
|
|
|
void renameTo(const String & /*new_relative_path*/, bool /*remove_new_dir_if_exists*/) const override {}
|
2020-05-29 15:02:12 +00:00
|
|
|
void makeCloneInDetached(const String & prefix) const override;
|
2020-04-14 19:47:19 +00:00
|
|
|
|
2020-04-20 01:38:38 +00:00
|
|
|
bool waitUntilMerged(size_t timeout) const override;
|
|
|
|
void notifyMerged() const override;
|
|
|
|
|
2020-04-14 19:47:19 +00:00
|
|
|
mutable Block block;
|
|
|
|
|
|
|
|
private:
|
2020-04-20 01:38:38 +00:00
|
|
|
mutable std::condition_variable is_merged;
|
|
|
|
|
2020-04-14 19:47:19 +00:00
|
|
|
void checkConsistency(bool /* require_part_metadata */) const override {}
|
|
|
|
|
|
|
|
/// Loads marks index granularity into memory
|
|
|
|
void loadIndexGranularity() override;
|
|
|
|
|
|
|
|
/// Compact parts doesn't support per column size, only total size
|
|
|
|
void calculateEachColumnSizesOnDisk(ColumnSizeByName & each_columns_size, ColumnSize & total_size) const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
using DataPartInMemoryPtr = std::shared_ptr<const MergeTreeDataPartInMemory>;
|
|
|
|
|
|
|
|
}
|