summaryrefslogtreecommitdiff
path: root/src/server.h
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-11-10 12:35:29 +0100
committerantirez <antirez@gmail.com>2016-11-10 12:35:29 +0100
commit28c96d73b2e157a37465560bc421280d17005708 (patch)
tree0843c6a1f22c38815eff7ab0638999ad8f5789a2 /src/server.h
parent4e5e366ed265f2571124edfa9c2f9eaa0d450c45 (diff)
downloadredis-psync2.tar.gz
PSYNC2: Save replication ID/offset on RDB file.psync2
This means that stopping a slave and restarting it will still make it able to PSYNC with the master. Moreover the master itself will retain its ID/offset, in case it gets turned into a slave, or if a slave will try to PSYNC with it with an exactly updated offset (otherwise there is no backlog). This change was possible thanks to PSYNC v2 that makes saving the current replication state much simpler.
Diffstat (limited to 'src/server.h')
-rw-r--r--src/server.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/server.h b/src/server.h
index 8aa1d6fcb..b7f909933 100644
--- a/src/server.h
+++ b/src/server.h
@@ -813,10 +813,16 @@ struct redisMemOverhead {
* select the correct DB and are able to accept the stream coming from the
* top-level master. */
typedef struct rdbSaveInfo {
+ /* Used saving and loading. */
int repl_stream_db; /* DB to select in server.master client. */
+
+ /* Used only loading. */
+ int repl_id_is_set; /* True if repl_id field is set. */
+ char repl_id[CONFIG_RUN_ID_SIZE+1]; /* Replication ID. */
+ long long repl_offset; /* Replication offset. */
} rdbSaveInfo;
-#define RDB_SAVE_INFO_INIT {-1}
+#define RDB_SAVE_INFO_INIT {-1,0,"000000000000000000000000000000",-1}
/*-----------------------------------------------------------------------------
* Global server state
@@ -1441,6 +1447,7 @@ int replicationSetupSlaveForFullResync(client *slave, long long offset);
void changeReplicationId(void);
void clearReplicationId2(void);
void chopReplicationBacklog(void);
+void replicationCacheMasterUsingMyself(void);
/* Generic persistence functions */
void startLoading(FILE *fp);