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
31f0a6ec
Commit
31f0a6ec
authored
Feb 12, 2013
by
antirez
Browse files
Replication: added new stats counting full and partial resynchronizations.
parent
5fe2577a
Changes
3
Show whitespace changes
Inline
Side-by-side
src/redis.c
View file @
31f0a6ec
...
...
@@ -1350,6 +1350,9 @@ void initServer() {
server
.
stat_peak_memory
=
0
;
server
.
stat_fork_time
=
0
;
server
.
stat_rejected_conn
=
0
;
server
.
stat_sync_full
=
0
;
server
.
stat_sync_partial_ok
=
0
;
server
.
stat_sync_partial_err
=
0
;
memset
(
server
.
ops_sec_samples
,
0
,
sizeof
(
server
.
ops_sec_samples
));
server
.
ops_sec_idx
=
0
;
server
.
ops_sec_last_sample_time
=
mstime
();
...
...
@@ -2069,6 +2072,9 @@ sds genRedisInfoString(char *section) {
"total_commands_processed:%lld
\r\n
"
"instantaneous_ops_per_sec:%lld
\r\n
"
"rejected_connections:%lld
\r\n
"
"sync_full:%lld
\r\n
"
"sync_partial_ok:%lld
\r\n
"
"sync_partial_err:%lld
\r\n
"
"expired_keys:%lld
\r\n
"
"evicted_keys:%lld
\r\n
"
"keyspace_hits:%lld
\r\n
"
...
...
@@ -2080,6 +2086,9 @@ sds genRedisInfoString(char *section) {
server
.
stat_numcommands
,
getOperationsPerSecond
(),
server
.
stat_rejected_conn
,
server
.
stat_sync_full
,
server
.
stat_sync_partial_ok
,
server
.
stat_sync_partial_err
,
server
.
stat_expiredkeys
,
server
.
stat_evictedkeys
,
server
.
stat_keyspace_hits
,
...
...
src/redis.h
View file @
31f0a6ec
...
...
@@ -561,6 +561,9 @@ struct redisServer {
size_t
stat_peak_memory
;
/* Max used memory record */
long
long
stat_fork_time
;
/* Time needed to perform latest fork() */
long
long
stat_rejected_conn
;
/* Clients rejected because of maxclients */
long
long
stat_sync_full
;
/* Number of full resyncs with slaves. */
long
long
stat_sync_partial_ok
;
/* Number of accepted PSYNC requests. */
long
long
stat_sync_partial_err
;
/* Number of unaccepted PSYNC requests. */
list
*
slowlog
;
/* SLOWLOG list of commands */
long
long
slowlog_entry_id
;
/* SLOWLOG current entry ID */
long
long
slowlog_log_slower_than
;
/* SLOWLOG time limit (to get logged) */
...
...
src/replication.c
View file @
31f0a6ec
...
...
@@ -490,8 +490,23 @@ void syncCommand(redisClient *c) {
*
* So the slave knows the new runid and offset to try a PSYNC later
* if the connection with the master is lost. */
if
(
!
strcasecmp
(
c
->
argv
[
0
]
->
ptr
,
"psync"
)
&&
masterTryPartialResynchronization
(
c
)
==
REDIS_OK
)
return
;
if
(
!
strcasecmp
(
c
->
argv
[
0
]
->
ptr
,
"psync"
))
{
if
(
masterTryPartialResynchronization
(
c
)
==
REDIS_OK
)
{
server
.
stat_sync_partial_ok
++
;
return
;
/* No full resync needed, return. */
}
else
{
char
*
master_runid
=
c
->
argv
[
1
]
->
ptr
;
/* Increment stats for failed PSYNCs, but only if the
* runid is not "?", as this is used by slaves to force a full
* resync on purpose when they are not albe to partially
* resync. */
if
(
master_runid
[
0
]
!=
'?'
)
server
.
stat_sync_partial_err
++
;
}
}
/* Full resynchronization. */
server
.
stat_sync_full
++
;
/* Here we need to check if there is a background saving operation
* in progress, or if it is required to start one */
...
...
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