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
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) {
*
*/
#define REDIS_CONFIG_REWRITE_SIGNATURE "# Generated by CONFIG REWRITE"
/* We use the following dictionary type to store where a configuration
* option is mentioned in the old configuration file, so it's
* like "maxmemory" -> list of line numbers (first line is zero). */
...
...
@@ -1162,6 +1164,10 @@ int dictSdsKeyCompare(void *privdata, const void *key1, const void *key2);
void
dictSdsDestructor
(
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
=
{
dictSdsHash
,
/* hash function */
NULL
,
/* key dup */
...
...
@@ -1226,6 +1232,8 @@ struct rewriteConfigState *rewriteConfigReadOldFile(char *path) {
/* Handle comments and empty lines. */
if
(
line
[
0
]
==
'#'
||
line
[
0
]
==
'\0'
)
{
if
(
!
state
->
has_tail
&&
!
strcmp
(
line
,
REDIS_CONFIG_REWRITE_SIGNATURE
))
state
->
has_tail
=
1
;
rewriteConfigAppendLine
(
state
,
line
);
continue
;
}
...
...
@@ -1297,7 +1305,7 @@ void rewriteConfigRewriteLine(struct rewriteConfigState *state, char *option, sd
/* Append a new line. */
if
(
!
state
->
has_tail
)
{
rewriteConfigAppendLine
(
state
,
sdsnew
(
"# Generated by
CONFIG
REWRITE
"
));
sdsnew
(
REDIS_
CONFIG
_
REWRITE
_SIGNATURE
));
state
->
has_tail
=
1
;
}
rewriteConfigAppendLine
(
state
,
line
);
...
...
@@ -1735,6 +1743,7 @@ int rewriteConfig(char *path) {
rewriteConfigClientoutputbufferlimitOption
(
state
);
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
);
if
(
server
.
sentinel_mode
)
rewriteConfigSentinelOption
(
state
);
/* 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
...
...
src/redis.c
View file @
1ca56ea7
...
...
@@ -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
);
if
(
server
.
sofd
>
0
)
redisLog
(
REDIS_NOTICE
,
"The server is now ready to accept connections at %s"
,
server
.
unixsocket
);
}
else
{
sentinelIsRunning
();
}
/* Warning the user about suspicious maxmemory setting. */
...
...
src/redis.h
View file @
1ca56ea7
...
...
@@ -1169,6 +1169,9 @@ sds keyspaceEventsFlagsToString(int flags);
void
loadServerConfig
(
char
*
filename
,
char
*
options
);
void
appendServerSaveParams
(
time_t
seconds
,
int
changes
);
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 */
int
removeExpire
(
redisDb
*
db
,
robj
*
key
);
...
...
@@ -1220,6 +1223,7 @@ void initSentinelConfig(void);
void
initSentinel
(
void
);
void
sentinelTimer
(
void
);
char
*
sentinelHandleConfiguration
(
char
**
argv
,
int
argc
);
void
sentinelIsRunning
(
void
);
/* Scripting */
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