@@ -1142,17 +1142,7 @@ bool DDLWorker::initializeMainThread()
11421142 auto zookeeper = getAndSetZooKeeper ();
11431143 zookeeper->createAncestors (fs::path (queue_dir) / " " );
11441144 initializeReplication ();
1145- try
1146- {
1147- // / We have this try/catch for a very weird edge case when it's related to localhost
1148- // / Each replica has a localhost as hostid and if we configured multiple replicas to add their
1149- // / localhosts to some clusters multiple of them may think that they must mark it as active.
1150- markReplicasActive (true );
1151- }
1152- catch (...)
1153- {
1154- tryLogCurrentException (log, " Cannot mark replica as active: " );
1155- }
1145+ markReplicasActive (true );
11561146 initialized = true ;
11571147 return true ;
11581148 }
@@ -1398,10 +1388,23 @@ void DDLWorker::markReplicasActive(bool /*reinitialized*/)
13981388 zookeeper->deleteEphemeralNodeIfContentMatches (active_path, active_id);
13991389 }
14001390 Coordination::Requests ops;
1391+ Coordination::Responses res;
14011392 ops.emplace_back (zkutil::makeCreateRequest (active_path, active_id, zkutil::CreateMode::Ephemeral));
14021393 // / To bump node mtime
14031394 ops.emplace_back (zkutil::makeSetRequest (fs::path (replicas_dir) / host_id, " " , -1 ));
1404- zookeeper->multi (ops);
1395+ auto code = zookeeper->tryMulti (ops, res);
1396+
1397+ // / We have this tryMulti for a very weird edge case when it's related to localhost.
1398+ // / Each replica may have a localhost as hostid and if we configured multiple replicas to add their
1399+ // / localhosts to some clusters multiple of them may think that they must mark it as active.
1400+ if (code != Coordination::Error::ZOK)
1401+ {
1402+ LOG_WARNING (log, " Cannot mark a replica active: active_path={}, active_id={}, code={}" , active_path, active_id, Coordination::errorMessage (code));
1403+ }
1404+ else
1405+ {
1406+ LOG_DEBUG (log, " Marked a replica active: active_path={}, active_id={}" , active_path, active_id);
1407+ }
14051408
14061409 auto active_node_holder_zookeeper = zookeeper;
14071410 auto active_node_holder = zkutil::EphemeralNodeHolder::existing (active_path, *active_node_holder_zookeeper);
0 commit comments