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

Function replicationGetSlaveOffset

src/replication.cpp:4736–4752  ·  view source on GitHub ↗

Return the replica replication offset for this instance, that is * the offset for which we already processed the master replication stream. */

Source from the content-addressed store, hash-verified

4734/* Return the replica replication offset for this instance, that is
4735 * the offset for which we already processed the master replication stream. */
4736long long replicationGetSlaveOffset(redisMaster *mi) {
4737 long long offset = 0;
4738
4739 if (mi != NULL && mi->masterhost != NULL) {
4740 if (mi->master) {
4741 offset = mi->master->reploff;
4742 } else if (mi->cached_master) {
4743 offset = mi->cached_master->reploff;
4744 }
4745 }
4746 /* offset may be -1 when the master does not support it at all, however
4747 * this function is designed to return an offset that can express the
4748 * amount of data processed by the master, so we return a positive
4749 * integer. */
4750 if (offset < 0) offset = 0;
4751 return offset;
4752}
4753
4754/* --------------------------- REPLICATION CRON ---------------------------- */
4755

Callers 4

clusterBuildMessageHdrFunction · 0.85
clusterGetSlaveRankFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected