mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 21:12:28 +00:00
Fix no shared id during drop for the fourth time
This commit is contained in:
parent
582aa8b770
commit
f6131101bb
@ -7892,20 +7892,7 @@ String StorageReplicatedMergeTree::getTableSharedID() const
|
|||||||
|
|
||||||
/// 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();
|
||||||
if (has_metadata_in_zookeeper.has_value())
|
|
||||||
{
|
|
||||||
if (*has_metadata_in_zookeeper)
|
|
||||||
createTableSharedID();
|
|
||||||
else
|
|
||||||
throw Exception(ErrorCodes::TABLE_IS_DROPPED, "Table {} is already dropped", getStorageID().getNameForLogs());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw Exception(ErrorCodes::NO_ZOOKEEPER, "No connection to ZooKeeper, cannot get shared table ID for table {}. "
|
|
||||||
"It will be resolve automatically when connection will be established", getStorageID().getNameForLogs());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return toString(table_shared_id);
|
return toString(table_shared_id);
|
||||||
}
|
}
|
||||||
@ -7951,6 +7938,10 @@ void StorageReplicatedMergeTree::createTableSharedID() const
|
|||||||
id = zookeeper->get(zookeeper_table_id_path);
|
id = zookeeper->get(zookeeper_table_id_path);
|
||||||
LOG_DEBUG(log, "Shared ID on path {} concurrently created, will set ID {}", zookeeper_table_id_path, id);
|
LOG_DEBUG(log, "Shared ID on path {} concurrently created, will set ID {}", zookeeper_table_id_path, id);
|
||||||
}
|
}
|
||||||
|
else if (code == Coordination::Error::ZNONODE) /// table completely dropped, we can choose any id we want
|
||||||
|
{
|
||||||
|
LOG_DEBUG(log, "Table was completely drop, we can use anything as ID (will use {})", id);
|
||||||
|
}
|
||||||
else if (code != Coordination::Error::ZOK)
|
else if (code != Coordination::Error::ZOK)
|
||||||
{
|
{
|
||||||
throw zkutil::KeeperException(code, zookeeper_table_id_path);
|
throw zkutil::KeeperException(code, zookeeper_table_id_path);
|
||||||
|
Loading…
Reference in New Issue
Block a user