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
24f25836
Commit
24f25836
authored
Feb 12, 2013
by
antirez
Browse files
Replication: added new stats counting full and partial resynchronizations.
parent
ac8c89cb
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/redis.c
View file @
24f25836
...
@@ -1384,6 +1384,9 @@ void initServer() {
...
@@ -1384,6 +1384,9 @@ void initServer() {
server
.
stat_peak_memory
=
0
;
server
.
stat_peak_memory
=
0
;
server
.
stat_fork_time
=
0
;
server
.
stat_fork_time
=
0
;
server
.
stat_rejected_conn
=
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
));
memset
(
server
.
ops_sec_samples
,
0
,
sizeof
(
server
.
ops_sec_samples
));
server
.
ops_sec_idx
=
0
;
server
.
ops_sec_idx
=
0
;
server
.
ops_sec_last_sample_time
=
mstime
();
server
.
ops_sec_last_sample_time
=
mstime
();
...
@@ -2128,6 +2131,9 @@ sds genRedisInfoString(char *section) {
...
@@ -2128,6 +2131,9 @@ sds genRedisInfoString(char *section) {
"total_commands_processed:%lld
\r\n
"
"total_commands_processed:%lld
\r\n
"
"instantaneous_ops_per_sec:%lld
\r\n
"
"instantaneous_ops_per_sec:%lld
\r\n
"
"rejected_connections:%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
"
"expired_keys:%lld
\r\n
"
"evicted_keys:%lld
\r\n
"
"evicted_keys:%lld
\r\n
"
"keyspace_hits:%lld
\r\n
"
"keyspace_hits:%lld
\r\n
"
...
@@ -2140,6 +2146,9 @@ sds genRedisInfoString(char *section) {
...
@@ -2140,6 +2146,9 @@ sds genRedisInfoString(char *section) {
server
.
stat_numcommands
,
server
.
stat_numcommands
,
getOperationsPerSecond
(),
getOperationsPerSecond
(),
server
.
stat_rejected_conn
,
server
.
stat_rejected_conn
,
server
.
stat_sync_full
,
server
.
stat_sync_partial_ok
,
server
.
stat_sync_partial_err
,
server
.
stat_expiredkeys
,
server
.
stat_expiredkeys
,
server
.
stat_evictedkeys
,
server
.
stat_evictedkeys
,
server
.
stat_keyspace_hits
,
server
.
stat_keyspace_hits
,
...
...
src/redis.h
View file @
24f25836
...
@@ -691,6 +691,9 @@ struct redisServer {
...
@@ -691,6 +691,9 @@ struct redisServer {
size_t
stat_peak_memory
;
/* Max used memory record */
size_t
stat_peak_memory
;
/* Max used memory record */
long
long
stat_fork_time
;
/* Time needed to perform latest fork() */
long
long
stat_fork_time
;
/* Time needed to perform latest fork() */
long
long
stat_rejected_conn
;
/* Clients rejected because of maxclients */
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 */
list
*
slowlog
;
/* SLOWLOG list of commands */
long
long
slowlog_entry_id
;
/* SLOWLOG current entry ID */
long
long
slowlog_entry_id
;
/* SLOWLOG current entry ID */
long
long
slowlog_log_slower_than
;
/* SLOWLOG time limit (to get logged) */
long
long
slowlog_log_slower_than
;
/* SLOWLOG time limit (to get logged) */
...
...
src/replication.c
View file @
24f25836
...
@@ -490,8 +490,23 @@ void syncCommand(redisClient *c) {
...
@@ -490,8 +490,23 @@ void syncCommand(redisClient *c) {
*
*
* So the slave knows the new runid and offset to try a PSYNC later
* So the slave knows the new runid and offset to try a PSYNC later
* if the connection with the master is lost. */
* if the connection with the master is lost. */
if
(
!
strcasecmp
(
c
->
argv
[
0
]
->
ptr
,
"psync"
)
&&
if
(
!
strcasecmp
(
c
->
argv
[
0
]
->
ptr
,
"psync"
))
{
masterTryPartialResynchronization
(
c
)
==
REDIS_OK
)
return
;
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
/* Here we need to check if there is a background saving operation
* in progress, or if it is required to start one */
* 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