summaryrefslogtreecommitdiff
path: root/src/rdb.c
diff options
context:
space:
mode:
authorDarrenJiang13 <yjjiang1996@163.com>2022-05-31 13:07:33 +0800
committerGitHub <noreply@github.com>2022-05-31 08:07:33 +0300
commitbb1de082eac26d5242733eb0b40959bd9de2e15b (patch)
treec3e1125652b263c3fefea1ea0eeca33f686a12bb /src/rdb.c
parent4065b4f27efc539b86beb63829bc148a02adecb1 (diff)
downloadredis-bb1de082eac26d5242733eb0b40959bd9de2e15b.tar.gz
Adds isolated netstats for replication. (#10062)
The amount of `server.stat_net_output_bytes/server.stat_net_input_bytes` is actually the sum of replication flow and users' data flow. It may cause confusions like this: "Why does my server get such a large output_bytes while I am doing nothing? ". After discussions and revisions, now here is the change about what this PR brings (final version before merge): - 2 server variables to count the network bytes during replication, including fullsync and propagate bytes. - `server.stat_net_repl_output_bytes`/`server.stat_net_repl_input_bytes` - 3 info fields to print the input and output of repl bytes and instantaneous value of total repl bytes. - `total_net_repl_input_bytes` / `total_net_repl_output_bytes` - `instantaneous_repl_total_kbps` - 1 new API `rioCheckType()` to check the type of rio. So we can use this to distinguish between diskless and diskbased replication - 2 new counting items to keep network statistics consistent between master and slave - rdb portion during diskless replica. in `rdbLoadProgressCallback()` - first line of the full sync payload. in `readSyncBulkPayload()` Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'src/rdb.c')
-rw-r--r--src/rdb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rdb.c b/src/rdb.c
index 62ec5bbb2..1faecd2f3 100644
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -2782,6 +2782,9 @@ void rdbLoadProgressCallback(rio *r, const void *buf, size_t len) {
processEventsWhileBlocked();
processModuleLoadingProgressEvent(0);
}
+ if (server.repl_state == REPL_STATE_TRANSFER && rioCheckType(r) == RIO_TYPE_CONN) {
+ atomicIncr(server.stat_net_repl_input_bytes, len);
+ }
}
/* Save the given functions_ctx to the rdb.