mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Diskless replication flag renamed repl_diskless -> repl_diskless_sync.
This commit is contained in:
parent
e9e007555e
commit
5f8360eb21
@ -1480,7 +1480,7 @@ void initServerConfig(void) {
|
|||||||
server.repl_slave_ro = REDIS_DEFAULT_SLAVE_READ_ONLY;
|
server.repl_slave_ro = REDIS_DEFAULT_SLAVE_READ_ONLY;
|
||||||
server.repl_down_since = 0; /* Never connected, repl is down since EVER. */
|
server.repl_down_since = 0; /* Never connected, repl is down since EVER. */
|
||||||
server.repl_disable_tcp_nodelay = REDIS_DEFAULT_REPL_DISABLE_TCP_NODELAY;
|
server.repl_disable_tcp_nodelay = REDIS_DEFAULT_REPL_DISABLE_TCP_NODELAY;
|
||||||
server.repl_diskless = REDIS_DEFAULT_RDB_DISKLESS;
|
server.repl_diskless_sync = REDIS_DEFAULT_RDB_DISKLESS_SYNC;
|
||||||
server.slave_priority = REDIS_DEFAULT_SLAVE_PRIORITY;
|
server.slave_priority = REDIS_DEFAULT_SLAVE_PRIORITY;
|
||||||
server.master_repl_offset = 0;
|
server.master_repl_offset = 0;
|
||||||
|
|
||||||
|
@ -114,8 +114,8 @@ typedef long long mstime_t; /* millisecond time type. */
|
|||||||
#define REDIS_DEFAULT_RDB_COMPRESSION 1
|
#define REDIS_DEFAULT_RDB_COMPRESSION 1
|
||||||
#define REDIS_DEFAULT_RDB_CHECKSUM 1
|
#define REDIS_DEFAULT_RDB_CHECKSUM 1
|
||||||
#define REDIS_DEFAULT_RDB_FILENAME "dump.rdb"
|
#define REDIS_DEFAULT_RDB_FILENAME "dump.rdb"
|
||||||
#define REDIS_DEFAULT_RDB_DISKLESS 0
|
#define REDIS_DEFAULT_RDB_DISKLESS_SYNC 0
|
||||||
#define REDIS_DEFAULT_RDB_DISKLESS_DELAY 5
|
#define REDIS_DEFAULT_RDB_DISKLESS_SYNC_DELAY 5
|
||||||
#define REDIS_DEFAULT_SLAVE_SERVE_STALE_DATA 1
|
#define REDIS_DEFAULT_SLAVE_SERVE_STALE_DATA 1
|
||||||
#define REDIS_DEFAULT_SLAVE_READ_ONLY 1
|
#define REDIS_DEFAULT_SLAVE_READ_ONLY 1
|
||||||
#define REDIS_DEFAULT_REPL_DISABLE_TCP_NODELAY 0
|
#define REDIS_DEFAULT_REPL_DISABLE_TCP_NODELAY 0
|
||||||
@ -801,7 +801,7 @@ struct redisServer {
|
|||||||
int repl_min_slaves_to_write; /* Min number of slaves to write. */
|
int repl_min_slaves_to_write; /* Min number of slaves to write. */
|
||||||
int repl_min_slaves_max_lag; /* Max lag of <count> slaves to write. */
|
int repl_min_slaves_max_lag; /* Max lag of <count> slaves to write. */
|
||||||
int repl_good_slaves_count; /* Number of slaves with lag <= max_lag. */
|
int repl_good_slaves_count; /* Number of slaves with lag <= max_lag. */
|
||||||
int repl_diskless; /* Send RDB to slaves sockets directly. */
|
int repl_diskless_sync; /* Send RDB to slaves sockets directly. */
|
||||||
/* Replication (slave) */
|
/* Replication (slave) */
|
||||||
char *masterauth; /* AUTH with this password with master */
|
char *masterauth; /* AUTH with this password with master */
|
||||||
char *masterhost; /* Hostname of master */
|
char *masterhost; /* Hostname of master */
|
||||||
|
@ -417,9 +417,9 @@ int startBgsaveForReplication(void) {
|
|||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
redisLog(REDIS_NOTICE,"Starting BGSAVE for SYNC with target: %s",
|
redisLog(REDIS_NOTICE,"Starting BGSAVE for SYNC with target: %s",
|
||||||
server.repl_diskless ? "slaves sockets" : "disk");
|
server.repl_diskless_sync ? "slaves sockets" : "disk");
|
||||||
|
|
||||||
if (server.repl_diskless)
|
if (server.repl_diskless_sync)
|
||||||
retval = rdbSaveToSlavesSockets();
|
retval = rdbSaveToSlavesSockets();
|
||||||
else
|
else
|
||||||
retval = rdbSaveBackground(server.rdb_filename);
|
retval = rdbSaveBackground(server.rdb_filename);
|
||||||
@ -523,7 +523,7 @@ void syncCommand(redisClient *c) {
|
|||||||
c->replstate = REDIS_REPL_WAIT_BGSAVE_START;
|
c->replstate = REDIS_REPL_WAIT_BGSAVE_START;
|
||||||
redisLog(REDIS_NOTICE,"Waiting for next BGSAVE for SYNC");
|
redisLog(REDIS_NOTICE,"Waiting for next BGSAVE for SYNC");
|
||||||
} else {
|
} else {
|
||||||
if (server.repl_diskless) {
|
if (server.repl_diskless_sync) {
|
||||||
/* Diskless replication RDB child is created inside
|
/* Diskless replication RDB child is created inside
|
||||||
* replicationCron() since we want to delay its start a
|
* replicationCron() since we want to delay its start a
|
||||||
* few seconds to wait for more slaves to arrive. */
|
* few seconds to wait for more slaves to arrive. */
|
||||||
@ -1944,7 +1944,7 @@ void replicationCron(void) {
|
|||||||
/* If we are using diskless replication and there are slaves waiting
|
/* If we are using diskless replication and there are slaves waiting
|
||||||
* in WAIT_BGSAVE_START state, check if enough seconds elapsed and
|
* in WAIT_BGSAVE_START state, check if enough seconds elapsed and
|
||||||
* start one. */
|
* start one. */
|
||||||
if (server.repl_diskless && server.rdb_child_pid == -1 &&
|
if (server.repl_diskless_sync && server.rdb_child_pid == -1 &&
|
||||||
server.aof_child_pid == -1)
|
server.aof_child_pid == -1)
|
||||||
{
|
{
|
||||||
time_t idle, max_idle = 0;
|
time_t idle, max_idle = 0;
|
||||||
@ -1962,7 +1962,7 @@ void replicationCron(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slaves_waiting && max_idle > REDIS_DEFAULT_RDB_DISKLESS_DELAY) {
|
if (slaves_waiting && max_idle > REDIS_DEFAULT_RDB_DISKLESS_SYNC_DELAY) {
|
||||||
/* Let's start a BGSAVE with disk target. */
|
/* Let's start a BGSAVE with disk target. */
|
||||||
if (startBgsaveForReplication() == REDIS_OK) {
|
if (startBgsaveForReplication() == REDIS_OK) {
|
||||||
/* It started! We need to change the state of slaves
|
/* It started! We need to change the state of slaves
|
||||||
|
Loading…
Reference in New Issue
Block a user