summaryrefslogtreecommitdiff
path: root/tests/support
diff options
context:
space:
mode:
authorzhaozhao.zz <276441700@qq.com>2022-03-25 10:45:40 +0800
committerGitHub <noreply@github.com>2022-03-25 10:45:40 +0800
commit78bef6e1fe4b69e9cca6a922911bd88a92584edb (patch)
tree118d28a0dc758f5af8155e6fda4d89e17383cd9b /tests/support
parent1a57af629c4fa4e6bac35602a5373445ca42753b (diff)
downloadredis-78bef6e1fe4b69e9cca6a922911bd88a92584edb.tar.gz
optimize(remove) usage of client's pending_querybuf (#10413)
To remove `pending_querybuf`, the key point is reusing `querybuf`, it means master client's `querybuf` is not only used to parse command, but also proxy to sub-replicas. 1. add a new variable `repl_applied` for master client to record how many data applied (propagated via `replicationFeedStreamFromMasterStream()`) but not trimmed in `querybuf`. 2. don't sdsrange `querybuf` in `commandProcessed()`, we trim it to `repl_applied` after the whole replication pipeline processed to avoid fragmented `sdsrange`. And here are some scenarios we cannot trim to `qb_pos`: * we don't receive complete command from master * master client blocked because of client pause * IO threads operate read, master client flagged with CLIENT_PENDING_COMMAND In these scenarios, `qb_pos` points to the part of the current command or the beginning of next command, and the current command is not applied yet, so the `repl_applied` is not equal to `qb_pos`. Some other notes: * Do not do big arg optimization on master client, since we can only sdsrange `querybuf` after data sent to replicas. * Set `qb_pos` and `repl_applied` to 0 when `freeClient` in `replicationCacheMaster`. * Rewrite `processPendingCommandsAndResetClient` to `processPendingCommandAndInputBuffer`, let `processInputBuffer` to be called successively after `processCommandAndResetClient`.
Diffstat (limited to 'tests/support')
-rw-r--r--tests/support/util.tcl4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/support/util.tcl b/tests/support/util.tcl
index 46c9654c8..4ad96ab10 100644
--- a/tests/support/util.tcl
+++ b/tests/support/util.tcl
@@ -122,7 +122,7 @@ proc wait_replica_online r {
wait_for_condition 50 100 {
[string match "*slave0:*,state=online*" [$r info replication]]
} else {
- fail "replica didn't sync in time"
+ fail "replica didn't online in time"
}
}
@@ -130,7 +130,7 @@ proc wait_for_ofs_sync {r1 r2} {
wait_for_condition 50 100 {
[status $r1 master_repl_offset] eq [status $r2 master_repl_offset]
} else {
- fail "replica didn't sync in time"
+ fail "replica offset didn't match in time"
}
}