MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / replicationCountAcksByOffset

Function replicationCountAcksByOffset

src/replication.cpp:4635–4648  ·  view source on GitHub ↗

Return the number of slaves that already acknowledged the specified * replication offset. */

Source from the content-addressed store, hash-verified

4633/* Return the number of slaves that already acknowledged the specified
4634 * replication offset. */
4635int replicationCountAcksByOffset(long long offset) {
4636 listIter li;
4637 listNode *ln;
4638 int count = 0;
4639
4640 listRewind(g_pserver->slaves,&li);
4641 while((ln = listNext(&li))) {
4642 client *replica = (client*)ln->value;
4643
4644 if (replica->replstate != SLAVE_STATE_ONLINE) continue;
4645 if ((replica->repl_ack_off) >= offset) count++;
4646 }
4647 return count;
4648}
4649
4650/* WAIT for N replicas to acknowledge the processing of our latest
4651 * write command (and all the previous commands). */

Callers 3

waitCommandFunction · 0.85

Calls 2

listRewindFunction · 0.85
listNextFunction · 0.85

Tested by

no test coverage detected