mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Something
This commit is contained in:
parent
e2a779b315
commit
83b584b2dd
@ -691,7 +691,12 @@ DataPartStoragePtr DataPartStorageOnDisk::clone(
|
||||
return std::make_shared<DataPartStorageOnDisk>(single_disk_volume, to, dir_path);
|
||||
}
|
||||
|
||||
void DataPartStorageOnDisk::rename(const std::string & new_root_path, const std::string & new_part_dir, Poco::Logger * log, bool remove_new_dir_if_exists, bool fsync_part_dir)
|
||||
void DataPartStorageBuilderOnDisk::rename(
|
||||
const std::string & new_root_path,
|
||||
const std::string & new_part_dir,
|
||||
Poco::Logger * log,
|
||||
bool remove_new_dir_if_exists,
|
||||
bool fsync_part_dir)
|
||||
{
|
||||
if (!exists())
|
||||
throw Exception(
|
||||
@ -699,7 +704,6 @@ void DataPartStorageOnDisk::rename(const std::string & new_root_path, const std:
|
||||
"Part directory {} doesn't exist. Most likely it is a logical error.",
|
||||
std::string(fs::path(volume->getDisk()->getPath()) / root_path / part_dir));
|
||||
|
||||
/// Why "" ?
|
||||
String to = fs::path(new_root_path) / new_part_dir / "";
|
||||
|
||||
if (volume->getDisk()->exists(to))
|
||||
@ -725,9 +729,6 @@ void DataPartStorageOnDisk::rename(const std::string & new_root_path, const std:
|
||||
}
|
||||
}
|
||||
|
||||
// metadata_manager->deleteAll(true);
|
||||
// metadata_manager->assertAllDeleted(true);
|
||||
|
||||
String from = getRelativePath();
|
||||
|
||||
/// Why?
|
||||
@ -735,7 +736,6 @@ void DataPartStorageOnDisk::rename(const std::string & new_root_path, const std:
|
||||
volume->getDisk()->moveDirectory(from, to);
|
||||
part_dir = new_part_dir;
|
||||
root_path = new_root_path;
|
||||
// metadata_manager->updateAll(true);
|
||||
|
||||
SyncGuardPtr sync_guard;
|
||||
if (fsync_part_dir)
|
||||
|
@ -104,8 +104,6 @@ public:
|
||||
const DiskPtr & disk,
|
||||
Poco::Logger * log) const override;
|
||||
|
||||
void rename(const std::string & new_root_path, const std::string & new_part_dir, Poco::Logger * log, bool remove_new_dir_if_exists, bool fsync_part_dir) override;
|
||||
|
||||
void changeRootPath(const std::string & from_root, const std::string & to_root) override;
|
||||
|
||||
private:
|
||||
@ -159,6 +157,17 @@ public:
|
||||
|
||||
DataPartStoragePtr getStorage() const override;
|
||||
|
||||
/// Rename part.
|
||||
/// Ideally, new_root_path should be the same as current root (but it is not true).
|
||||
/// Examples are: 'all_1_2_1' -> 'detached/all_1_2_1'
|
||||
/// 'moving/tmp_all_1_2_1' -> 'all_1_2_1'
|
||||
void rename(
|
||||
const std::string & new_root_path,
|
||||
const std::string & new_part_dir,
|
||||
Poco::Logger * log,
|
||||
bool remove_new_dir_if_exists,
|
||||
bool fsync_part_dir) override;
|
||||
|
||||
void commit() override;
|
||||
|
||||
private:
|
||||
|
@ -191,17 +191,6 @@ public:
|
||||
const DiskPtr & disk,
|
||||
Poco::Logger * log) const = 0;
|
||||
|
||||
/// Rename part.
|
||||
/// Ideally, new_root_path should be the same as current root (but it is not true).
|
||||
/// Examples are: 'all_1_2_1' -> 'detached/all_1_2_1'
|
||||
/// 'moving/tmp_all_1_2_1' -> 'all_1_2_1'
|
||||
virtual void rename(
|
||||
const std::string & new_root_path,
|
||||
const std::string & new_part_dir,
|
||||
Poco::Logger * log,
|
||||
bool remove_new_dir_if_exists,
|
||||
bool fsync_part_dir) = 0;
|
||||
|
||||
/// Change part's root. from_root should be a prefix path of current root path.
|
||||
/// Right now, this is needed for rename table query.
|
||||
virtual void changeRootPath(const std::string & from_root, const std::string & to_root) = 0;
|
||||
@ -244,6 +233,17 @@ public:
|
||||
|
||||
virtual DataPartStoragePtr getStorage() const = 0;
|
||||
|
||||
/// Rename part.
|
||||
/// Ideally, new_root_path should be the same as current root (but it is not true).
|
||||
/// Examples are: 'all_1_2_1' -> 'detached/all_1_2_1'
|
||||
/// 'moving/tmp_all_1_2_1' -> 'all_1_2_1'
|
||||
virtual void rename(
|
||||
const std::string & new_root_path,
|
||||
const std::string & new_part_dir,
|
||||
Poco::Logger * log,
|
||||
bool remove_new_dir_if_exists,
|
||||
bool fsync_part_dir) = 0;
|
||||
|
||||
virtual void commit() = 0;
|
||||
};
|
||||
|
||||
|
@ -1358,20 +1358,7 @@ bool IMergeTreeDataPart::shallParticipateInMerges(const StoragePolicyPtr & stora
|
||||
return data_part_storage->shallParticipateInMerges(*storage_policy);
|
||||
}
|
||||
|
||||
// UInt64 IMergeTreeDataPart::calculateTotalSizeOnDisk(const DataPartStoragePtr & data_part_storage_, const String & from)
|
||||
// {
|
||||
// if (data_part_storage_->isFile(from))
|
||||
// return data_part_storage_->getFileSize(from);
|
||||
// std::vector<std::string> files;
|
||||
// disk_->listFiles(from, files);
|
||||
// UInt64 res = 0;
|
||||
// for (const auto & file : files)
|
||||
// res += calculateTotalSizeOnDisk(data_part_storage_, fs::path(from) / file);
|
||||
// return res;
|
||||
// }
|
||||
|
||||
|
||||
void IMergeTreeDataPart::renameTo(const String & new_relative_path, bool remove_new_dir_if_exists) const
|
||||
void IMergeTreeDataPart::renameTo(const String & new_relative_path, bool remove_new_dir_if_exists, DataPartStorageBuilderPtr builder) const
|
||||
try
|
||||
{
|
||||
assertOnDisk();
|
||||
|
@ -345,7 +345,7 @@ public:
|
||||
|
||||
/// Makes checks and move part to new directory
|
||||
/// Changes only relative_dir_name, you need to update other metadata (name, is_temp) explicitly
|
||||
virtual void renameTo(const String & new_relative_path, bool remove_new_dir_if_exists) const;
|
||||
virtual void renameTo(const String & new_relative_path, bool remove_new_dir_if_exists, DataPartStorageBuilderPtr builder) const;
|
||||
|
||||
/// Makes clone of a part in detached/ directory via hard links
|
||||
virtual void makeCloneInDetached(const String & prefix, const StorageMetadataPtr & metadata_snapshot) const;
|
||||
|
@ -144,7 +144,7 @@ void MergeTreeDataPartInMemory::makeCloneInDetached(const String & prefix, const
|
||||
flushToDisk(detached_path, metadata_snapshot);
|
||||
}
|
||||
|
||||
void MergeTreeDataPartInMemory::renameTo(const String & new_relative_path, bool /* remove_new_dir_if_exists */) const
|
||||
void MergeTreeDataPartInMemory::renameTo(const String & new_relative_path, bool /* remove_new_dir_if_exists */, DataPartStorageBuilderPtr builder) const
|
||||
{
|
||||
data_part_storage->setRelativePath(new_relative_path);
|
||||
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
bool isStoredOnRemoteDiskWithZeroCopySupport() const override { return false; }
|
||||
bool hasColumnFiles(const NameAndTypePair & column) const override { return !!getColumnPosition(column.getNameInStorage()); }
|
||||
String getFileNameForColumn(const NameAndTypePair & /* column */) const override { return ""; }
|
||||
void renameTo(const String & new_relative_path, bool remove_new_dir_if_exists) const override;
|
||||
void renameTo(const String & new_relative_path, bool remove_new_dir_if_exists, DataPartStorageBuilderPtr builder) const override;
|
||||
void makeCloneInDetached(const String & prefix, const StorageMetadataPtr & metadata_snapshot) const override;
|
||||
|
||||
DataPartStoragePtr flushToDisk(const String & new_relative_path, const StorageMetadataPtr & metadata_snapshot) const;
|
||||
|
@ -4154,8 +4154,12 @@ bool StorageReplicatedMergeTree::fetchPart(const String & part_name, const Stora
|
||||
}
|
||||
|
||||
|
||||
DataPartStoragePtr StorageReplicatedMergeTree::fetchExistsPart(const String & part_name, const StorageMetadataPtr & metadata_snapshot,
|
||||
const String & source_replica_path, DiskPtr replaced_disk, String replaced_part_path)
|
||||
DataPartStoragePtr StorageReplicatedMergeTree::fetchExistsPart(
|
||||
const String & part_name,
|
||||
const StorageMetadataPtr & metadata_snapshot,
|
||||
const String & source_replica_path,
|
||||
DiskPtr replaced_disk,
|
||||
String replaced_part_path)
|
||||
{
|
||||
auto zookeeper = getZooKeeper();
|
||||
const auto part_info = MergeTreePartInfo::fromPartName(part_name, format_version);
|
||||
|
Loading…
Reference in New Issue
Block a user