merge with master

This commit is contained in:
Anton Popov 2020-08-24 16:09:23 +03:00
parent 4df5c72878
commit 4331158d30
5 changed files with 26 additions and 7 deletions

View File

@ -165,4 +165,19 @@ void DiskDecorator::truncateFile(const String & path, size_t size)
delegate->truncateFile(path, size);
}
int DiskDecorator::open(const String & path, mode_t mode) const
{
return delegate->open(path, mode);
}
void DiskDecorator::close(int fd) const
{
delegate->close(fd);
}
void DiskDecorator::sync(int fd) const
{
delegate->sync(fd);
}
}

View File

@ -42,6 +42,9 @@ public:
void setReadOnly(const String & path) override;
void createHardLink(const String & src_path, const String & dst_path) override;
void truncateFile(const String & path, size_t size) override;
int open(const String & path, mode_t mode) const override;
void close(int fd) const override;
void sync(int fd) const override;
const String getType() const override { return delegate->getType(); }
protected:

View File

@ -70,7 +70,7 @@ void MergeTreeDataPartWriterInMemory::calculateAndSerializePrimaryIndex(const Bl
}
}
void MergeTreeDataPartWriterInMemory::finishDataSerialization(IMergeTreeDataPart::Checksums & checksums)
void MergeTreeDataPartWriterInMemory::finishDataSerialization(IMergeTreeDataPart::Checksums & checksums, bool)
{
/// If part is empty we still need to initialize block by empty columns.
if (!part_in_memory->block)

View File

@ -18,7 +18,7 @@ public:
void write(const Block & block, const IColumn::Permutation * permutation,
const Block & primary_key_block, const Block & skip_indexes_block) override;
void finishDataSerialization(IMergeTreeDataPart::Checksums & checksums) override;
void finishDataSerialization(IMergeTreeDataPart::Checksums & checksums, bool sync) override;
void calculateAndSerializePrimaryIndex(const Block & primary_index_block) override;

View File

@ -251,6 +251,7 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataWriter::writeTempPart(BlockWithPa
new_data_part->minmax_idx = std::move(minmax_idx);
new_data_part->is_temp = true;
std::optional<FileSyncGuard> sync_guard;
if (new_data_part->isStoredOnDisk())
{
/// The name could be non-unique in case of stale files from previous runs.
@ -262,12 +263,12 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataWriter::writeTempPart(BlockWithPa
new_data_part->volume->getDisk()->removeRecursive(full_path);
}
const auto disk = new_data_part->volume->getDisk();
disk->createDirectories(full_path);
const auto disk = new_data_part->volume->getDisk();
disk->createDirectories(full_path);
std::optional<FileSyncGuard> sync_guard;
if (data.getSettings()->fsync_part_directory)
sync_guard.emplace(disk, full_path);
if (data.getSettings()->fsync_part_directory)
sync_guard.emplace(disk, full_path);
}
/// If we need to calculate some columns to sort.
if (metadata_snapshot->hasSortingKey() || metadata_snapshot->hasSecondaryIndices())