mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 02:12:21 +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())
|
if (!disk || !disk->supportZeroCopyReplication())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto ref_count = disk->getRefCount(fs::path(part.getFullRelativePath()) / IMergeTreeDataPart::FILE_FOR_REFERENCES_CHECK);
|
/// If part is temporary refcount file may be absent
|
||||||
if (ref_count > 0) /// Keep part shard info for frozen backups
|
auto ref_count_path = fs::path(part.getFullRelativePath()) / IMergeTreeDataPart::FILE_FOR_REFERENCES_CHECK;
|
||||||
return false;
|
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,
|
return unlockSharedDataByID(part.getUniqueId(), getTableSharedID(), name, replica_name, disk, getZooKeeper(), *getSettings(), log,
|
||||||
zookeeper_path);
|
zookeeper_path);
|
||||||
|
Loading…
Reference in New Issue
Block a user