Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
1ca56ea7
Commit
1ca56ea7
authored
Nov 21, 2013
by
antirez
Browse files
Merge branch 'newsentinel' into unstable
parents
cd4ff999
f55ad303
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
src/config.c
View file @
1ca56ea7
...
@@ -1154,6 +1154,8 @@ void configGetCommand(redisClient *c) {
...
@@ -1154,6 +1154,8 @@ void configGetCommand(redisClient *c) {
*
*
*/
*/
#define REDIS_CONFIG_REWRITE_SIGNATURE "# Generated by CONFIG REWRITE"
/* We use the following dictionary type to store where a configuration
/* We use the following dictionary type to store where a configuration
* option is mentioned in the old configuration file, so it's
* option is mentioned in the old configuration file, so it's
* like "maxmemory" -> list of line numbers (first line is zero). */
* like "maxmemory" -> list of line numbers (first line is zero). */
...
@@ -1162,6 +1164,10 @@ int dictSdsKeyCompare(void *privdata, const void *key1, const void *key2);
...
@@ -1162,6 +1164,10 @@ int dictSdsKeyCompare(void *privdata, const void *key1, const void *key2);
void
dictSdsDestructor
(
void
*
privdata
,
void
*
val
);
void
dictSdsDestructor
(
void
*
privdata
,
void
*
val
);
void
dictListDestructor
(
void
*
privdata
,
void
*
val
);
void
dictListDestructor
(
void
*
privdata
,
void
*
val
);
/* Sentinel config rewriting is implemented inside sentinel.c by
* rewriteConfigSentinelOption(). */
void
rewriteConfigSentinelOption
(
struct
rewriteConfigState
*
state
);
dictType
optionToLineDictType
=
{
dictType
optionToLineDictType
=
{
dictSdsHash
,
/* hash function */
dictSdsHash
,
/* hash function */
NULL
,
/* key dup */
NULL
,
/* key dup */
...
@@ -1226,6 +1232,8 @@ struct rewriteConfigState *rewriteConfigReadOldFile(char *path) {
...
@@ -1226,6 +1232,8 @@ struct rewriteConfigState *rewriteConfigReadOldFile(char *path) {
/* Handle comments and empty lines. */
/* Handle comments and empty lines. */
if
(
line
[
0
]
==
'#'
||
line
[
0
]
==
'\0'
)
{
if
(
line
[
0
]
==
'#'
||
line
[
0
]
==
'\0'
)
{
if
(
!
state
->
has_tail
&&
!
strcmp
(
line
,
REDIS_CONFIG_REWRITE_SIGNATURE
))
state
->
has_tail
=
1
;
rewriteConfigAppendLine
(
state
,
line
);
rewriteConfigAppendLine
(
state
,
line
);
continue
;
continue
;
}
}
...
@@ -1297,7 +1305,7 @@ void rewriteConfigRewriteLine(struct rewriteConfigState *state, char *option, sd
...
@@ -1297,7 +1305,7 @@ void rewriteConfigRewriteLine(struct rewriteConfigState *state, char *option, sd
/* Append a new line. */
/* Append a new line. */
if
(
!
state
->
has_tail
)
{
if
(
!
state
->
has_tail
)
{
rewriteConfigAppendLine
(
state
,
rewriteConfigAppendLine
(
state
,
sdsnew
(
"# Generated by
CONFIG
REWRITE
"
));
sdsnew
(
REDIS_
CONFIG
_
REWRITE
_SIGNATURE
));
state
->
has_tail
=
1
;
state
->
has_tail
=
1
;
}
}
rewriteConfigAppendLine
(
state
,
line
);
rewriteConfigAppendLine
(
state
,
line
);
...
@@ -1735,6 +1743,7 @@ int rewriteConfig(char *path) {
...
@@ -1735,6 +1743,7 @@ int rewriteConfig(char *path) {
rewriteConfigClientoutputbufferlimitOption
(
state
);
rewriteConfigClientoutputbufferlimitOption
(
state
);
rewriteConfigNumericalOption
(
state
,
"hz"
,
server
.
hz
,
REDIS_DEFAULT_HZ
);
rewriteConfigNumericalOption
(
state
,
"hz"
,
server
.
hz
,
REDIS_DEFAULT_HZ
);
rewriteConfigYesNoOption
(
state
,
"aof-rewrite-incremental-fsync"
,
server
.
aof_rewrite_incremental_fsync
,
REDIS_DEFAULT_AOF_REWRITE_INCREMENTAL_FSYNC
);
rewriteConfigYesNoOption
(
state
,
"aof-rewrite-incremental-fsync"
,
server
.
aof_rewrite_incremental_fsync
,
REDIS_DEFAULT_AOF_REWRITE_INCREMENTAL_FSYNC
);
if
(
server
.
sentinel_mode
)
rewriteConfigSentinelOption
(
state
);
/* Step 3: remove all the orphaned lines in the old file, that is, lines
/* Step 3: remove all the orphaned lines in the old file, that is, lines
* that were used by a config option and are no longer used, like in case
* that were used by a config option and are no longer used, like in case
...
...
src/redis.c
View file @
1ca56ea7
...
@@ -3108,6 +3108,8 @@ int main(int argc, char **argv) {
...
@@ -3108,6 +3108,8 @@ int main(int argc, char **argv) {
redisLog
(
REDIS_NOTICE
,
"The server is now ready to accept connections on port %d"
,
server
.
port
);
redisLog
(
REDIS_NOTICE
,
"The server is now ready to accept connections on port %d"
,
server
.
port
);
if
(
server
.
sofd
>
0
)
if
(
server
.
sofd
>
0
)
redisLog
(
REDIS_NOTICE
,
"The server is now ready to accept connections at %s"
,
server
.
unixsocket
);
redisLog
(
REDIS_NOTICE
,
"The server is now ready to accept connections at %s"
,
server
.
unixsocket
);
}
else
{
sentinelIsRunning
();
}
}
/* Warning the user about suspicious maxmemory setting. */
/* Warning the user about suspicious maxmemory setting. */
...
...
src/redis.h
View file @
1ca56ea7
...
@@ -1169,6 +1169,9 @@ sds keyspaceEventsFlagsToString(int flags);
...
@@ -1169,6 +1169,9 @@ sds keyspaceEventsFlagsToString(int flags);
void
loadServerConfig
(
char
*
filename
,
char
*
options
);
void
loadServerConfig
(
char
*
filename
,
char
*
options
);
void
appendServerSaveParams
(
time_t
seconds
,
int
changes
);
void
appendServerSaveParams
(
time_t
seconds
,
int
changes
);
void
resetServerSaveParams
();
void
resetServerSaveParams
();
struct
rewriteConfigState
;
/* Forward declaration to export API. */
void
rewriteConfigRewriteLine
(
struct
rewriteConfigState
*
state
,
char
*
option
,
sds
line
,
int
force
);
int
rewriteConfig
(
char
*
path
);
/* db.c -- Keyspace access API */
/* db.c -- Keyspace access API */
int
removeExpire
(
redisDb
*
db
,
robj
*
key
);
int
removeExpire
(
redisDb
*
db
,
robj
*
key
);
...
@@ -1220,6 +1223,7 @@ void initSentinelConfig(void);
...
@@ -1220,6 +1223,7 @@ void initSentinelConfig(void);
void
initSentinel
(
void
);
void
initSentinel
(
void
);
void
sentinelTimer
(
void
);
void
sentinelTimer
(
void
);
char
*
sentinelHandleConfiguration
(
char
**
argv
,
int
argc
);
char
*
sentinelHandleConfiguration
(
char
**
argv
,
int
argc
);
void
sentinelIsRunning
(
void
);
/* Scripting */
/* Scripting */
void
scriptingInit
(
void
);
void
scriptingInit
(
void
);
...
...
src/sentinel.c
View file @
1ca56ea7
This diff is collapsed.
Click to expand it.
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