get zookeeper from global context

This commit is contained in:
fastio 2021-02-24 16:33:39 +08:00
parent 3ddb729e4a
commit fea2836673

View File

@ -749,8 +749,12 @@ void StorageReplicatedMergeTree::drop()
if (has_metadata_in_zookeeper)
{
/// Table can be shut down, restarting thread is not active
/// and calling StorageReplicatedMergeTree::getZooKeeper() won't suffice.
auto zookeeper = getZooKeeper();
/// and calling StorageReplicatedMergeTree::getZooKeeper()/getAuxiliaryZooKeeper() won't suffice.
zkutil::ZooKeeperPtr zookeeper;
if (zookeeper_name == default_zookeeper_name)
zookeeper = global_context.getZooKeeper();
else
zookeeper = global_context.getAuxiliaryZooKeeper(zookeeper_name);
/// If probably there is metadata in ZooKeeper, we don't allow to drop the table.
if (!zookeeper)