Commit Graph

21 Commits

Author SHA1 Message Date
antirez
d64d2e21c9 Make tests compatible with new INFO replication output. 2013-05-30 11:43:43 +02:00
Johan Bergström
1154283577 Use info nameofexectuable to find current executable 2013-01-24 09:37:18 +11:00
antirez
7eb850ef0e A reimplementation of blocking operation internals.
Redis provides support for blocking operations such as BLPOP or BRPOP.
This operations are identical to normal LPOP and RPOP operations as long
as there are elements in the target list, but if the list is empty they
block waiting for new data to arrive to the list.

All the clients blocked waiting for th same list are served in a FIFO
way, so the first that blocked is the first to be served when there is
more data pushed by another client into the list.

The previous implementation of blocking operations was conceived to
serve clients in the context of push operations. For for instance:

1) There is a client "A" blocked on list "foo".
2) The client "B" performs `LPUSH foo somevalue`.
3) The client "A" is served in the context of the "B" LPUSH,
synchronously.

Processing things in a synchronous way was useful as if "A" pushes a
value that is served by "B", from the point of view of the database is a
NOP (no operation) thing, that is, nothing is replicated, nothing is
written in the AOF file, and so forth.

However later we implemented two things:

1) Variadic LPUSH that could add multiple values to a list in the
context of a single call.
2) BRPOPLPUSH that was a version of BRPOP that also provided a "PUSH"
side effect when receiving data.

This forced us to make the synchronous implementation more complex. If
client "B" is waiting for data, and "A" pushes three elemnents in a
single call, we needed to propagate an LPUSH with a missing argument
in the AOF and replication link. We also needed to make sure to
replicate the LPUSH side of BRPOPLPUSH, but only if in turn did not
happened to serve another blocking client into another list ;)

This were complex but with a few of mutually recursive functions
everything worked as expected... until one day we introduced scripting
in Redis.

Scripting + synchronous blocking operations = Issue #614.

Basically you can't "rewrite" a script to have just a partial effect on
the replicas and AOF file if the script happened to serve a few blocked
clients.

The solution to all this problems, implemented by this commit, is to
change the way we serve blocked clients. Instead of serving the blocked
clients synchronously, in the context of the command performing the PUSH
operation, it is now an asynchronous and iterative process:

1) If a key that has clients blocked waiting for data is the subject of
a list push operation, We simply mark keys as "ready" and put it into a
queue.
2) Every command pushing stuff on lists, as a variadic LPUSH, a script,
or whatever it is, is replicated verbatim without any rewriting.
3) Every time a Redis command, a MULTI/EXEC block, or a script,
completed its execution, we run the list of keys ready to serve blocked
clients (as more data arrived), and process this list serving the
blocked clients.
4) As a result of "3" maybe more keys are ready again for other clients
(as a result of BRPOPLPUSH we may have push operations), so we iterate
back to step "3" if it's needed.

The new code has a much simpler semantics, and a simpler to understand
implementation, with the disadvantage of not being able to "optmize out"
a PUSH+BPOP as a No OP.

This commit will be tested with care before the final merge, more tests
will be added likely.
2012-09-17 10:26:46 +02:00
antirez
d9241b35e5 Properly wait the slave to sync with master in BRPOPLPUSH test. 2012-04-30 10:55:03 +02:00
antirez
2d4b55214f A more lightweight implementation of issue 141 regression test. 2012-04-29 17:16:44 +02:00
antirez
28ccb53008 Redis test: More reliable BRPOPLPUSH replication test.
Now it uses the new wait_for_condition testing primitive.
Also wait_for_condition implementation was fixed in this commit to properly
escape the expr command and its argument.
2012-04-26 11:25:13 +02:00
antirez
459e2975f4 On slow computers, 10 seconds are not enough for this heavy replication test. 2012-04-04 19:54:23 +02:00
antirez
06312eed86 Possible fix for false positives in issue 141 regression test 2012-01-12 16:24:54 +01:00
antirez
414c3deac1 Regression test for the main problem causing issue #141. Minor changes/fixes/additions to the test suite itself needed to write the test. 2012-01-06 17:28:40 +01:00
antirez
c0875a77a1 Regression test for issue #142 added 2011-10-17 10:41:46 +02:00
antirez
4c378d7f6c new test engine valgrind support 2011-07-11 13:41:06 +02:00
antirez
569f84aa7c replication test split into three parts in order to improve test execution time. Random fixes and improvements. 2011-07-11 00:46:25 +02:00
antirez
c1c9d551da Fix for bug 561 and other related problems 2011-06-20 17:19:36 +02:00
antirez
27fee630f5 Comment typo fixed 2011-05-24 10:43:35 +02:00
antirez
70bc5f7724 replication with expire test modified to produce no or less false failures 2011-05-12 20:21:43 +02:00
antirez
6146329f1f replication test with expires 2010-08-03 13:38:39 +02:00
antirez
a0573260b0 better random dataset creation function in test. master-slave replication test now is able to save the two datasets in CSV when an inconsistency is detected. 2010-07-28 14:08:46 +02:00
antirez
8b654e54c4 First implementation of a replication consistency test 2010-07-06 17:24:00 +02:00
Pieter Noordhuis
7f7499eeac tags for existing tests 2010-06-02 23:22:25 +02:00
Pieter Noordhuis
9e5d2e8bd6 changed how server.tcl accepts options to support more directives without requiring more arguments to the proc 2010-06-02 22:23:52 +02:00
Pieter Noordhuis
85ecc65edc initial rough integration test for replication 2010-05-14 20:50:58 +02:00