mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 22:22:00 +00:00
Update waitForTableReplicaToProcessLogEntry comments
This commit is contained in:
parent
a9d108fc5f
commit
19f64b3f25
@ -5318,14 +5318,10 @@ bool StorageReplicatedMergeTree::waitForTableReplicaToProcessLogEntry(
|
||||
String entry_str = entry.toString();
|
||||
String log_node_name;
|
||||
|
||||
/** Two types of entries can be passed to this function
|
||||
* 1. (more often) From `log` directory - a common log, from where replicas copy entries to their queue.
|
||||
* 2. From the `queue` directory of one of the replicas.
|
||||
/** Wait for entries from `log` directory (a common log, from where replicas copy entries to their queue) to be processed.
|
||||
*
|
||||
* The problem is that the numbers (`sequential` node) of the queue elements in `log` and in `queue` do not match.
|
||||
* (And the numbers of the same log element for different replicas do not match in the `queue`.)
|
||||
*
|
||||
* Therefore, you should consider these cases separately.
|
||||
*/
|
||||
|
||||
/** First, you need to wait until replica takes `queue` element from the `log` to its queue,
|
||||
@ -5348,9 +5344,7 @@ bool StorageReplicatedMergeTree::waitForTableReplicaToProcessLogEntry(
|
||||
|
||||
if (startsWith(entry.znode_name, "log-"))
|
||||
{
|
||||
/** In this case, just take the number from the node name `log-xxxxxxxxxx`.
|
||||
*/
|
||||
|
||||
/// Take the number from the node name `log-xxxxxxxxxx`.
|
||||
UInt64 log_index = parse<UInt64>(entry.znode_name.substr(entry.znode_name.size() - 10));
|
||||
log_node_name = entry.znode_name;
|
||||
|
||||
@ -5375,14 +5369,10 @@ bool StorageReplicatedMergeTree::waitForTableReplicaToProcessLogEntry(
|
||||
else
|
||||
throw Exception("Logical error: unexpected name of log node: " + entry.znode_name, ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
if (!log_node_name.empty())
|
||||
LOG_DEBUG(log, "Looking for node corresponding to {} in {} queue", log_node_name, replica);
|
||||
else
|
||||
LOG_DEBUG(log, "Looking for corresponding node in {} queue", replica);
|
||||
LOG_DEBUG(log, "Looking for node corresponding to {} in {} queue", log_node_name, replica);
|
||||
|
||||
/** Second - find the corresponding entry in the queue of the specified replica.
|
||||
* Its number may match neither the `log` node nor the `queue` node of the current replica (for us).
|
||||
* Therefore, we search by comparing the content.
|
||||
* Its number may not match the `log` node. Therefore, we search by comparing the content.
|
||||
*/
|
||||
|
||||
Strings queue_entries = getZooKeeper()->getChildren(fs::path(table_zookeeper_path) / "replicas" / replica / "queue");
|
||||
|
Loading…
Reference in New Issue
Block a user