mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 13:42:02 +00:00
Better fix
This commit is contained in:
parent
96d8546b1c
commit
55af44ca2f
@ -7908,9 +7908,18 @@ String StorageReplicatedMergeTree::getTableSharedID() const
|
|||||||
{
|
{
|
||||||
std::lock_guard lock(table_shared_id_mutex);
|
std::lock_guard lock(table_shared_id_mutex);
|
||||||
|
|
||||||
|
/// If we has metadata or, we don't know about metadata -- try to create shared ID
|
||||||
|
/// Otherwise table is already dropped, doesn't make sense to do anything with shared ID
|
||||||
|
if (has_metadata_in_zookeeper.value_or(true))
|
||||||
|
{
|
||||||
/// Can happen if table was partially initialized before drop by DatabaseCatalog
|
/// Can happen if table was partially initialized before drop by DatabaseCatalog
|
||||||
if (table_shared_id == UUIDHelpers::Nil)
|
if (table_shared_id == UUIDHelpers::Nil)
|
||||||
createTableSharedID();
|
createTableSharedID();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return toString(UUIDHelpers::Nil);
|
||||||
|
}
|
||||||
|
|
||||||
return toString(table_shared_id);
|
return toString(table_shared_id);
|
||||||
}
|
}
|
||||||
@ -8101,6 +8110,13 @@ StorageReplicatedMergeTree::unlockSharedData(const IMergeTreeDataPart & part, co
|
|||||||
return std::make_pair(true, NameSet{});
|
return std::make_pair(true, NameSet{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto shared_id = getTableSharedID();
|
||||||
|
if (shared_id == toString(UUIDHelpers::Nil))
|
||||||
|
{
|
||||||
|
LOG_TRACE(log, "Part {} blobs can be removed, because table {} comletely dropped", part.name, getStorageID().getNameForLogs());
|
||||||
|
return std::make_pair(true, NameSet{});
|
||||||
|
}
|
||||||
|
|
||||||
/// If part is temporary refcount file may be absent
|
/// If part is temporary refcount file may be absent
|
||||||
if (part.getDataPartStorage().exists(IMergeTreeDataPart::FILE_FOR_REFERENCES_CHECK))
|
if (part.getDataPartStorage().exists(IMergeTreeDataPart::FILE_FOR_REFERENCES_CHECK))
|
||||||
{
|
{
|
||||||
@ -8140,7 +8156,7 @@ StorageReplicatedMergeTree::unlockSharedData(const IMergeTreeDataPart & part, co
|
|||||||
return std::make_pair(true, NameSet{});
|
return std::make_pair(true, NameSet{});
|
||||||
|
|
||||||
return unlockSharedDataByID(
|
return unlockSharedDataByID(
|
||||||
part.getUniqueId(), getTableSharedID(), part.name, replica_name,
|
part.getUniqueId(), shared_id, part.name, replica_name,
|
||||||
part.getDataPartStorage().getDiskType(), zookeeper, *getSettings(), log, zookeeper_path, format_version);
|
part.getDataPartStorage().getDiskType(), zookeeper, *getSettings(), log, zookeeper_path, format_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user