mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Fix data race in DDLWorker
This commit is contained in:
parent
8868a5e944
commit
1f612042dc
@ -29,6 +29,13 @@ namespace ErrorCodes
|
||||
extern const int DNS_ERROR;
|
||||
}
|
||||
|
||||
|
||||
DDLTaskBase::~DDLTaskBase()
|
||||
{
|
||||
chassert(completely_processed);
|
||||
}
|
||||
|
||||
|
||||
HostID HostID::fromString(const String & host_port_str)
|
||||
{
|
||||
HostID res;
|
||||
@ -36,6 +43,7 @@ HostID HostID::fromString(const String & host_port_str)
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
bool HostID::isLocalAddress(UInt16 clickhouse_port) const
|
||||
{
|
||||
try
|
||||
|
@ -114,7 +114,7 @@ struct DDLTaskBase
|
||||
|
||||
DDLTaskBase(const String & name, const String & path) : entry_name(name), entry_path(path) {}
|
||||
DDLTaskBase(const DDLTaskBase &) = delete;
|
||||
virtual ~DDLTaskBase() = default;
|
||||
virtual ~DDLTaskBase();
|
||||
|
||||
virtual void parseQueryFromEntry(ContextPtr context);
|
||||
void formatRewrittenQuery(ContextPtr context);
|
||||
|
@ -279,7 +279,9 @@ void DDLWorker::scheduleTasks(bool reinitialized)
|
||||
task->completely_processed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
processTask(*task, zookeeper);
|
||||
}
|
||||
++task_it;
|
||||
}
|
||||
else
|
||||
@ -291,6 +293,7 @@ void DDLWorker::scheduleTasks(bool reinitialized)
|
||||
/// of log entry number (with leading zeros).
|
||||
if (!first_failed_task_name || task->entry_name < *first_failed_task_name)
|
||||
first_failed_task_name = task->entry_name;
|
||||
|
||||
task_it = current_tasks.erase(task_it);
|
||||
}
|
||||
}
|
||||
@ -660,8 +663,8 @@ void DDLWorker::processTask(DDLTaskBase & task, const ZooKeeperPtr & zookeeper)
|
||||
active_node->setAlreadyRemoved();
|
||||
|
||||
task.createSyncedNodeIfNeed(zookeeper);
|
||||
task.completely_processed = true;
|
||||
updateMaxDDLEntryID(task.entry_name);
|
||||
task.completely_processed = true;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user