mirror of
https://github.com/fluencelabs/redis
synced 2025-03-17 16:10:50 +00:00
Sentinel: take the replication offset in slaves state.
This commit is contained in:
parent
b1f5a0b3ec
commit
a6ebd910d8
@ -165,10 +165,11 @@ typedef struct sentinelRedisInstance {
|
||||
mstime_t master_link_down_time; /* Slave replication link down time. */
|
||||
int slave_priority; /* Slave priority according to its INFO output. */
|
||||
mstime_t slave_reconf_sent_time; /* Time at which we sent SLAVE OF <new> */
|
||||
struct sentinelRedisInstance *master; /* Master instance if SRI_SLAVE is set. */
|
||||
struct sentinelRedisInstance *master; /* Master instance if it's slave. */
|
||||
char *slave_master_host; /* Master host as reported by INFO */
|
||||
int slave_master_port; /* Master port as reported by INFO */
|
||||
int slave_master_link_status; /* Master link status as reported by INFO */
|
||||
unsigned long long slave_repl_offset; /* Slave replication offset. */
|
||||
/* Failover */
|
||||
char *leader; /* If this is a master instance, this is the runid of
|
||||
the Sentinel that should perform the failover. If
|
||||
@ -900,6 +901,7 @@ sentinelRedisInstance *createSentinelRedisInstance(char *name, int flags, char *
|
||||
ri->slave_master_host = NULL;
|
||||
ri->slave_master_port = 0;
|
||||
ri->slave_master_link_status = SENTINEL_MASTER_LINK_STATUS_DOWN;
|
||||
ri->slave_repl_offset = 0;
|
||||
ri->sentinels = dictCreate(&instancesDictType,NULL);
|
||||
ri->quorum = quorum;
|
||||
ri->parallel_syncs = SENTINEL_DEFAULT_PARALLEL_SYNCS;
|
||||
@ -1738,6 +1740,10 @@ void sentinelRefreshInstanceInfo(sentinelRedisInstance *ri, const char *info) {
|
||||
/* slave_priority:<priority> */
|
||||
if (sdslen(l) >= 15 && !memcmp(l,"slave_priority:",15))
|
||||
ri->slave_priority = atoi(l+15);
|
||||
|
||||
/* slave_repl_offset:<offset> */
|
||||
if (sdslen(l) >= 18 && !memcmp(l,"slave_repl_offset:",18))
|
||||
ri->slave_repl_offset = strtoull(l+18,NULL,10);
|
||||
}
|
||||
}
|
||||
ri->info_refresh = mstime();
|
||||
@ -2262,6 +2268,10 @@ void addReplySentinelRedisInstance(redisClient *c, sentinelRedisInstance *ri) {
|
||||
addReplyBulkCString(c,"slave-priority");
|
||||
addReplyBulkLongLong(c,ri->slave_priority);
|
||||
fields++;
|
||||
|
||||
addReplyBulkCString(c,"slave-repl-offset");
|
||||
addReplyBulkLongLong(c,ri->slave_repl_offset);
|
||||
fields++;
|
||||
}
|
||||
|
||||
/* Only sentinels */
|
||||
|
Loading…
x
Reference in New Issue
Block a user