Fix more accounting errors with active replication and the replication offset. Specifically we don't update repl_ack_off as frequently as we do reploff_skipped

Former-commit-id: 6cf85d1d01e56de0bb6e5d34590623cd8dabd32b
This commit is contained in:
John Sully 2019-07-11 19:20:12 -04:00
parent 2bccf7adbf
commit f0e17a7d04
2 changed files with 4 additions and 4 deletions

View File

@ -992,7 +992,7 @@ void replconfCommand(client *c) {
if ((getLongLongFromObject(c->argv[j+1], &offset) != C_OK))
return;
if (offset > c->repl_ack_off)
c->repl_ack_off = offset + c->reploff_skipped;
c->repl_ack_off = offset;
c->repl_ack_time = g_pserver->unixtime;
/* If this was a diskless replication, we need to really put
* the slave online when the first ACK is received (which
@ -2435,7 +2435,7 @@ void roleCommand(client *c) {
addReplyArrayLen(c,3);
addReplyBulkCString(c,slaveip);
addReplyBulkLongLong(c,slave->slave_listening_port);
addReplyBulkLongLong(c,slave->repl_ack_off);
addReplyBulkLongLong(c,slave->repl_ack_off+slave->reploff_skipped);
slaves++;
}
setDeferredArrayLen(c,mbcount,slaves);
@ -2780,7 +2780,7 @@ int replicationCountAcksByOffset(long long offset) {
client *slave = (client*)ln->value;
if (slave->replstate != SLAVE_STATE_ONLINE) continue;
if (slave->repl_ack_off >= offset) count++;
if ((slave->repl_ack_off + slave->reploff_skipped) >= offset) count++;
}
return count;
}

View File

@ -4448,7 +4448,7 @@ sds genRedisInfoString(const char *section) {
"slave%d:ip=%s,port=%d,state=%s,"
"offset=%lld,lag=%ld\r\n",
slaveid,slaveip,slave->slave_listening_port,state,
slave->repl_ack_off, lag);
(slave->repl_ack_off + slave->reploff_skipped), lag);
slaveid++;
}
}