Merge pull request #41296 from young-scott/fix_issuse_41096

fix issue #41096
This commit is contained in:
Alexander Tokmakov 2022-09-15 15:44:05 +03:00 committed by GitHub
commit b26cc5a1ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -61,18 +61,23 @@ public:
return host_fqdn_id; return host_fqdn_id;
} }
std::string getQueueDir() const
{
return queue_dir;
}
void startup(); void startup();
virtual void shutdown(); virtual void shutdown();
bool isCurrentlyActive() const { return initialized && !stop_flag; } bool isCurrentlyActive() const { return initialized && !stop_flag; }
protected:
/// Returns cached ZooKeeper session (possibly expired). /// Returns cached ZooKeeper session (possibly expired).
ZooKeeperPtr tryGetZooKeeper() const; ZooKeeperPtr tryGetZooKeeper() const;
/// If necessary, creates a new session and caches it. /// If necessary, creates a new session and caches it.
ZooKeeperPtr getAndSetZooKeeper(); ZooKeeperPtr getAndSetZooKeeper();
protected:
/// Iterates through queue tasks in ZooKeeper, runs execution of new tasks /// Iterates through queue tasks in ZooKeeper, runs execution of new tasks
void scheduleTasks(bool reinitialized); void scheduleTasks(bool reinitialized);

View File

@ -205,9 +205,9 @@ static void fillStatusColumns(MutableColumns & res_columns, size_t & col,
void StorageSystemDDLWorkerQueue::fillData(MutableColumns & res_columns, ContextPtr context, const SelectQueryInfo &) const void StorageSystemDDLWorkerQueue::fillData(MutableColumns & res_columns, ContextPtr context, const SelectQueryInfo &) const
{ {
zkutil::ZooKeeperPtr zookeeper = context->getZooKeeper(); auto& ddl_worker = context->getDDLWorker();
fs::path ddl_zookeeper_path = context->getConfigRef().getString("distributed_ddl.path", "/clickhouse/task_queue/ddl/"); fs::path ddl_zookeeper_path = ddl_worker.getQueueDir();
zkutil::ZooKeeperPtr zookeeper = ddl_worker.getAndSetZooKeeper();
Strings ddl_task_paths = zookeeper->getChildren(ddl_zookeeper_path); Strings ddl_task_paths = zookeeper->getChildren(ddl_zookeeper_path);
GetResponseFutures ddl_task_futures; GetResponseFutures ddl_task_futures;