Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
4d5f4684
Commit
4d5f4684
authored
Oct 16, 2014
by
antirez
Browse files
Diskless replication flag renamed repl_diskless -> repl_diskless_sync.
parent
989e2ae2
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/redis.c
View file @
4d5f4684
...
...
@@ -1480,7 +1480,7 @@ void initServerConfig(void) {
server.repl_slave_ro = REDIS_DEFAULT_SLAVE_READ_ONLY;
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_diskless = REDIS_DEFAULT_RDB_DISKLESS;
server.repl_diskless
_sync
= REDIS_DEFAULT_RDB_DISKLESS
_SYNC
;
server.slave_priority = REDIS_DEFAULT_SLAVE_PRIORITY;
server.master_repl_offset = 0;
...
...
src/redis.h
View file @
4d5f4684
...
...
@@ -114,8 +114,8 @@ typedef long long mstime_t; /* millisecond time type. */
#define REDIS_DEFAULT_RDB_COMPRESSION 1
#define REDIS_DEFAULT_RDB_CHECKSUM 1
#define REDIS_DEFAULT_RDB_FILENAME "dump.rdb"
#define REDIS_DEFAULT_RDB_DISKLESS 0
#define REDIS_DEFAULT_RDB_DISKLESS_DELAY 5
#define REDIS_DEFAULT_RDB_DISKLESS
_SYNC
0
#define REDIS_DEFAULT_RDB_DISKLESS_
SYNC_
DELAY 5
#define REDIS_DEFAULT_SLAVE_SERVE_STALE_DATA 1
#define REDIS_DEFAULT_SLAVE_READ_ONLY 1
#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_max_lag
;
/* Max lag of <count> slaves to write. */
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) */
char
*
masterauth
;
/* AUTH with this password with master */
char
*
masterhost
;
/* Hostname of master */
...
...
src/replication.c
View file @
4d5f4684
...
...
@@ -417,9 +417,9 @@ int startBgsaveForReplication(void) {
int
retval
;
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
();
else
retval
=
rdbSaveBackground
(
server
.
rdb_filename
);
...
...
@@ -523,7 +523,7 @@ void syncCommand(redisClient *c) {
c
->
replstate
=
REDIS_REPL_WAIT_BGSAVE_START
;
redisLog
(
REDIS_NOTICE
,
"Waiting for next BGSAVE for SYNC"
);
}
else
{
if
(
server
.
repl_diskless
)
{
if
(
server
.
repl_diskless
_sync
)
{
/* Diskless replication RDB child is created inside
* replicationCron() since we want to delay its start a
* 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
* in WAIT_BGSAVE_START state, check if enough seconds elapsed and
* 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
)
{
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. */
if
(
startBgsaveForReplication
()
==
REDIS_OK
)
{
/* It started! We need to change the state of slaves
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment