mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-13 09:52:38 +00:00
Fix bug with existing part
This commit is contained in:
parent
c028269e6f
commit
bb361e3b01
@ -7196,9 +7196,19 @@ bool StorageReplicatedMergeTree::unlockSharedData(const IMergeTreeDataPart & par
|
||||
if (!disk || !disk->supportZeroCopyReplication())
|
||||
return true;
|
||||
|
||||
auto ref_count = disk->getRefCount(fs::path(part.getFullRelativePath()) / IMergeTreeDataPart::FILE_FOR_REFERENCES_CHECK);
|
||||
if (ref_count > 0) /// Keep part shard info for frozen backups
|
||||
return false;
|
||||
/// If part is temporary refcount file may be absent
|
||||
auto ref_count_path = fs::path(part.getFullRelativePath()) / IMergeTreeDataPart::FILE_FOR_REFERENCES_CHECK;
|
||||
if (disk->exists(ref_count_path))
|
||||
{
|
||||
auto ref_count = disk->getRefCount(ref_count_path);
|
||||
if (ref_count > 0) /// Keep part shard info for frozen backups
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Temporary part with some absent file cannot be locked in shared mode
|
||||
return true;
|
||||
}
|
||||
|
||||
return unlockSharedDataByID(part.getUniqueId(), getTableSharedID(), name, replica_name, disk, getZooKeeper(), *getSettings(), log,
|
||||
zookeeper_path);
|
||||
|
Loading…
Reference in New Issue
Block a user