Merge branch 'redis_merge' into keydb_pro_merge
Former-commit-id: e10d9de29059f42193560712991df0950eeef679
This commit is contained in:
commit
81b616bfbb
@ -1879,6 +1879,9 @@ void readSyncBulkPayload(connection *conn) {
|
|||||||
/* We need to stop any AOF rewriting child before flusing and parsing
|
/* We need to stop any AOF rewriting child before flusing and parsing
|
||||||
* the RDB, otherwise we'll create a copy-on-write disaster. */
|
* the RDB, otherwise we'll create a copy-on-write disaster. */
|
||||||
if (g_pserver->aof_state != AOF_OFF) stopAppendOnly();
|
if (g_pserver->aof_state != AOF_OFF) stopAppendOnly();
|
||||||
|
|
||||||
|
if (!fUpdate)
|
||||||
|
{
|
||||||
signalFlushedDb(-1);
|
signalFlushedDb(-1);
|
||||||
|
|
||||||
/* When diskless RDB loading is used by replicas, it may be configured
|
/* When diskless RDB loading is used by replicas, it may be configured
|
||||||
@ -1890,6 +1893,7 @@ void readSyncBulkPayload(connection *conn) {
|
|||||||
diskless_load_backup = disklessLoadMakeBackups();
|
diskless_load_backup = disklessLoadMakeBackups();
|
||||||
}
|
}
|
||||||
emptyDb(-1,empty_db_flags,replicationEmptyDbCallback);
|
emptyDb(-1,empty_db_flags,replicationEmptyDbCallback);
|
||||||
|
}
|
||||||
|
|
||||||
/* Before loading the DB into memory we need to delete the readable
|
/* Before loading the DB into memory we need to delete the readable
|
||||||
* handler, otherwise it will get called recursively since
|
* handler, otherwise it will get called recursively since
|
||||||
@ -1916,6 +1920,7 @@ void readSyncBulkPayload(connection *conn) {
|
|||||||
"from socket");
|
"from socket");
|
||||||
cancelReplicationHandshake(mi);
|
cancelReplicationHandshake(mi);
|
||||||
rioFreeConn(&rdb, NULL);
|
rioFreeConn(&rdb, NULL);
|
||||||
|
if (!fUpdate) {
|
||||||
if (g_pserver->repl_diskless_load == REPL_DISKLESS_LOAD_SWAPDB) {
|
if (g_pserver->repl_diskless_load == REPL_DISKLESS_LOAD_SWAPDB) {
|
||||||
/* Restore the backed up databases. */
|
/* Restore the backed up databases. */
|
||||||
disklessLoadRestoreBackups(diskless_load_backup,1);
|
disklessLoadRestoreBackups(diskless_load_backup,1);
|
||||||
@ -1924,6 +1929,7 @@ void readSyncBulkPayload(connection *conn) {
|
|||||||
* an empty replica. */
|
* an empty replica. */
|
||||||
emptyDb(-1,empty_db_flags,replicationEmptyDbCallback);
|
emptyDb(-1,empty_db_flags,replicationEmptyDbCallback);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Note that there's no point in restarting the AOF on SYNC
|
/* Note that there's no point in restarting the AOF on SYNC
|
||||||
* failure, it'll be restarted when sync succeeds or the replica
|
* failure, it'll be restarted when sync succeeds or the replica
|
||||||
@ -1932,6 +1938,7 @@ void readSyncBulkPayload(connection *conn) {
|
|||||||
}
|
}
|
||||||
stopLoading(1);
|
stopLoading(1);
|
||||||
|
|
||||||
|
if (!fUpdate) {
|
||||||
/* RDB loading succeeded if we reach this point. */
|
/* RDB loading succeeded if we reach this point. */
|
||||||
if (g_pserver->repl_diskless_load == REPL_DISKLESS_LOAD_SWAPDB) {
|
if (g_pserver->repl_diskless_load == REPL_DISKLESS_LOAD_SWAPDB) {
|
||||||
/* Delete the backup databases we created before starting to load
|
/* Delete the backup databases we created before starting to load
|
||||||
@ -1939,6 +1946,7 @@ void readSyncBulkPayload(connection *conn) {
|
|||||||
* data is useless. */
|
* data is useless. */
|
||||||
disklessLoadRestoreBackups(diskless_load_backup,0);
|
disklessLoadRestoreBackups(diskless_load_backup,0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Verify the end mark is correct. */
|
/* Verify the end mark is correct. */
|
||||||
if (usemark) {
|
if (usemark) {
|
||||||
|
@ -129,3 +129,31 @@ start_server {tags {"active-repl"} overrides {active-replica yes}} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach mdl {no yes} {
|
||||||
|
foreach sdl {disabled swapdb} {
|
||||||
|
start_server {tags {"active-repl"} overrides {active-replica yes}} {
|
||||||
|
set master [srv 0 client]
|
||||||
|
$master config set repl-diskless-sync $mdl
|
||||||
|
set master_host [srv 0 host]
|
||||||
|
set master_port [srv 0 port]
|
||||||
|
r set masterkey foo
|
||||||
|
start_server {overrides {active-replica yes}} {
|
||||||
|
test "Active replication databases are merged, master diskless=$mdl, replica diskless=$sdl" {
|
||||||
|
r config set repl-diskless-load $sdl
|
||||||
|
r set slavekey bar
|
||||||
|
r replicaof $master_host $master_port
|
||||||
|
|
||||||
|
wait_for_condition 50 400 {
|
||||||
|
[string match *state=online* [$master info]]
|
||||||
|
} else {
|
||||||
|
fail "Replica never came online"
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_equal bar [r get slavekey]
|
||||||
|
assert_equal foo [r get masterkey]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user