diff options
author | Oran Agra <oran@redislabs.com> | 2019-07-01 15:22:29 +0300 |
---|---|---|
committer | Oran Agra <oran@redislabs.com> | 2019-07-08 15:37:48 +0300 |
commit | 2de544cfcc6d1aa7cf6d0c75a6116f7fc27b6fd6 (patch) | |
tree | 57d2e27d61fd4b5b369a7a3dfb7b8d7ce8d7ad74 /src/redis-check-rdb.c | |
parent | 722446510faf0debf0d309708b2ed4fe4d939319 (diff) | |
download | redis-2de544cfcc6d1aa7cf6d0c75a6116f7fc27b6fd6.tar.gz |
diskless replication on slave side (don't store rdb to file), plus some other related fixes
The implementation of the diskless replication was currently diskless only on the master side.
The slave side was still storing the received rdb file to the disk before loading it back in and parsing it.
This commit adds two modes to load rdb directly from socket:
1) when-empty
2) using "swapdb"
the third mode of using diskless slave by flushdb is risky and currently not included.
other changes:
--------------
distinguish between aof configuration and state so that we can re-enable aof only when sync eventually
succeeds (and not when exiting from readSyncBulkPayload after a failed attempt)
also a CONFIG GET and INFO during rdb loading would have lied
When loading rdb from the network, don't kill the server on short read (that can be a network error)
Fix rdb check when performed on preamble AOF
tests:
run replication tests for diskless slave too
make replication test a bit more aggressive
Add test for diskless load swapdb
Diffstat (limited to 'src/redis-check-rdb.c')
-rw-r--r-- | src/redis-check-rdb.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/redis-check-rdb.c b/src/redis-check-rdb.c index ec00ee71c..e2d71b5a5 100644 --- a/src/redis-check-rdb.c +++ b/src/redis-check-rdb.c @@ -202,7 +202,7 @@ int redis_check_rdb(char *rdbfilename, FILE *fp) { } expiretime = -1; - startLoading(fp); + startLoadingFile(fp, rdbfilename); while(1) { robj *key, *val; @@ -314,6 +314,7 @@ int redis_check_rdb(char *rdbfilename, FILE *fp) { } if (closefile) fclose(fp); + stopLoading(); return 0; eoferr: /* unexpected end of file is handled here with a fatal exit */ @@ -324,6 +325,7 @@ eoferr: /* unexpected end of file is handled here with a fatal exit */ } err: if (closefile) fclose(fp); + stopLoading(); return 1; } |