mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fix nasty bug
This commit is contained in:
parent
7570c5cf67
commit
06ccdb1ecf
@ -209,7 +209,7 @@ void DataPartStorageOnDisk::remove(
|
|||||||
std::list<ProjectionChecksums> projections,
|
std::list<ProjectionChecksums> projections,
|
||||||
bool is_temp,
|
bool is_temp,
|
||||||
MergeTreeDataPartState state,
|
MergeTreeDataPartState state,
|
||||||
Poco::Logger * log) const
|
Poco::Logger * log)
|
||||||
{
|
{
|
||||||
/// NOTE We rename part to delete_tmp_<relative_path> instead of delete_tmp_<name> to avoid race condition
|
/// NOTE We rename part to delete_tmp_<relative_path> instead of delete_tmp_<name> to avoid race condition
|
||||||
/// when we try to remove two parts with the same name, but different relative paths,
|
/// when we try to remove two parts with the same name, but different relative paths,
|
||||||
@ -259,6 +259,7 @@ void DataPartStorageOnDisk::remove(
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
disk->moveDirectory(from, to);
|
disk->moveDirectory(from, to);
|
||||||
|
onRename(root_path, part_dir_without_slash);
|
||||||
}
|
}
|
||||||
catch (const fs::filesystem_error & e)
|
catch (const fs::filesystem_error & e)
|
||||||
{
|
{
|
||||||
@ -271,9 +272,7 @@ void DataPartStorageOnDisk::remove(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!can_remove_description)
|
if (!can_remove_description)
|
||||||
{
|
|
||||||
can_remove_description.emplace(can_remove_callback());
|
can_remove_description.emplace(can_remove_callback());
|
||||||
}
|
|
||||||
|
|
||||||
// Record existing projection directories so we don't remove them twice
|
// Record existing projection directories so we don't remove them twice
|
||||||
std::unordered_set<String> projection_directories;
|
std::unordered_set<String> projection_directories;
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
std::list<ProjectionChecksums> projections,
|
std::list<ProjectionChecksums> projections,
|
||||||
bool is_temp,
|
bool is_temp,
|
||||||
MergeTreeDataPartState state,
|
MergeTreeDataPartState state,
|
||||||
Poco::Logger * log) const override;
|
Poco::Logger * log) override;
|
||||||
|
|
||||||
std::string getRelativePathForPrefix(Poco::Logger * log, const String & prefix, bool detached) const override;
|
std::string getRelativePathForPrefix(Poco::Logger * log, const String & prefix, bool detached) const override;
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public:
|
|||||||
std::list<ProjectionChecksums> projections,
|
std::list<ProjectionChecksums> projections,
|
||||||
bool is_temp,
|
bool is_temp,
|
||||||
MergeTreeDataPartState state,
|
MergeTreeDataPartState state,
|
||||||
Poco::Logger * log) const = 0;
|
Poco::Logger * log) = 0;
|
||||||
|
|
||||||
/// Get a name like 'prefix_partdir_tryN' which does not exist in a root dir.
|
/// Get a name like 'prefix_partdir_tryN' which does not exist in a root dir.
|
||||||
/// TODO: remove it.
|
/// TODO: remove it.
|
||||||
|
@ -1433,7 +1433,7 @@ void IMergeTreeDataPart::remove() const
|
|||||||
assert(assertHasValidVersionMetadata());
|
assert(assertHasValidVersionMetadata());
|
||||||
part_is_probably_removed_from_disk = true;
|
part_is_probably_removed_from_disk = true;
|
||||||
|
|
||||||
auto can_remove_callback = [&] ()
|
auto can_remove_callback = [this] ()
|
||||||
{
|
{
|
||||||
auto [can_remove, files_not_to_remove] = canRemovePart();
|
auto [can_remove, files_not_to_remove] = canRemovePart();
|
||||||
if (!can_remove)
|
if (!can_remove)
|
||||||
|
@ -2187,11 +2187,7 @@ void MergeTreeData::dropAllData()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
LOG_INFO(log, "dropAllData: removing table directory recursive to cleanup garbage");
|
LOG_INFO(log, "dropAllData: removing table directory recursive to cleanup garbage");
|
||||||
|
disk->removeRecursive(relative_data_path);
|
||||||
if (disk->supportZeroCopyReplication() && settings_ptr->allow_remote_fs_zero_copy_replication)
|
|
||||||
disk->removeSharedRecursive(relative_data_path, true, {});
|
|
||||||
else
|
|
||||||
disk->removeRecursive(relative_data_path);
|
|
||||||
}
|
}
|
||||||
catch (const fs::filesystem_error & e)
|
catch (const fs::filesystem_error & e)
|
||||||
{
|
{
|
||||||
|
@ -7604,7 +7604,7 @@ std::pair<bool, NameSet> StorageReplicatedMergeTree::unlockSharedData(const IMer
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_TRACE(log, "Part {} looks temporary, because checksums file doesn't exists, blobs can be removed", part.name);
|
LOG_TRACE(log, "Part {} looks temporary, because {} file doesn't exists, blobs can be removed", part.name, IMergeTreeDataPart::FILE_FOR_REFERENCES_CHECK);
|
||||||
/// Temporary part with some absent file cannot be locked in shared mode
|
/// Temporary part with some absent file cannot be locked in shared mode
|
||||||
return std::make_pair(true, NameSet{});
|
return std::make_pair(true, NameSet{});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user