Active Replicas should always use their own slaveseldb variable when sending/saving rdbs - never those of their masters. This is because the Active Replica is also simultaneously a master

Former-commit-id: bb090b6d20bfc3d5d3ca07270f64bf15fad42681
This commit is contained in:
John Sully 2019-07-18 20:50:20 -04:00
parent 133650ac7d
commit cfee6376d2

View File

@ -2547,7 +2547,7 @@ rdbSaveInfo *rdbPopulateSaveInfo(rdbSaveInfo *rsi) {
* connects to us, the NULL repl_backlog will trigger a full * connects to us, the NULL repl_backlog will trigger a full
* synchronization, at the same time we will use a new replid and clear * synchronization, at the same time we will use a new replid and clear
* replid2. */ * replid2. */
if (!listLength(g_pserver->masters) && g_pserver->repl_backlog) { if (g_pserver->fActiveReplica || (!listLength(g_pserver->masters) && g_pserver->repl_backlog)) {
/* Note that when g_pserver->slaveseldb is -1, it means that this master /* Note that when g_pserver->slaveseldb is -1, it means that this master
* didn't apply any write commands after a full synchronization. * didn't apply any write commands after a full synchronization.
* So we can let repl_stream_db be 0, this allows a restarted slave * So we can let repl_stream_db be 0, this allows a restarted slave