Commit Graph
161 Commits
Author SHA1 Message Date
John Sully 1eeb5de69f Merge commit 'c57d9146f41f4b661d9d2cb48b83b3abc757ba0e' into unstable
Former-commit-id: d74871da40
2020-05-22 15:36:44 -04:00
John Sully 27eb239f1a Fix bad merge in CI.yml
Former-commit-id: 6311d709c3
2020-05-21 22:09:06 -04:00
John 181fadb708 more reliability fixes for multimaster
Former-commit-id: 3543a3c763
2020-05-11 05:38:21 -04:00
John 3d6f990104 Make multimaster tests more reliable
Former-commit-id: 3122912920
2020-05-11 05:23:47 -04:00
Oran Agra 3d3861dd88 add daily github actions with libc malloc and valgrind
* fix memlry leaks with diskless replica short read.
* fix a few timing issues with valgrind runs
* fix issue with valgrind and watchdog schedule signal

about the valgrind WD issue:
the stack trace test in logging.tcl, has issues with valgrind:
==28808== Can't extend stack to 0x1ffeffdb38 during signal delivery for thread 1:
==28808==   too small or bad protection modes

it seems to be some valgrind bug with SA_ONSTACK.
SA_ONSTACK seems unneeded since WD is not recursive (SA_NODEFER was removed),
also, not sure if it's even valid without a call to sigaltstack()
2020-05-08 10:37:35 +02:00
Oran Agra ea63aea72d fix loading race in psync2 tests 2020-04-28 11:20:15 +02:00
Oran Agra e4d2bb62b2 Keep track of meaningful replication offset in replicas too
Now both master and replicas keep track of the last replication offset
that contains meaningful data (ignoring the tailing pings), and both
trim that tail from the replication backlog, and the offset with which
they try to use for psync.

the implication is that if someone missed some pings, or even have
excessive pings that the promoted replica has, it'll still be able to
psync (avoid full sync).

the downside (which was already committed) is that replicas running old
code may fail to psync, since the promoted replica trims pings form it's
backlog.

This commit adds a test that reproduces several cases of promotions and
demotions with stale and non-stale pings

Background:
The mearningful offset on the master was added recently to solve a problem were
the master is left all alone, injecting PINGs into it's backlog when no one is
listening and then gets demoted and tries to replicate from a replica that didn't
have any of the PINGs (or at least not the last ones).

however, consider this case:
master A has two replicas (B and C) replicating directly from it.
there's no traffic at all, and also no network issues, just many pings in the
tail of the backlog. now B gets promoted, A becomes a replica of B, and C
remains a replica of A. when A gets demoted, it trims the pings from its
backlog, and successfully replicate from B. however, C is still aware of
these PINGs, when it'll disconnect and re-connect to A, it'll ask for something
that's not in the backlog anymore (since A trimmed the tail of it's backlog),
and be forced to do a full sync (something it didn't have to do before the
meaningful offset fix).

Besides that, the psync2 test was always failing randomly here and there, it
turns out the reason were PINGs. Investigating it shows the following scenario:

cycle 1: redis #1 is master, and all the rest are direct replicas of #1
cycle 2: redis #2 is promoted to master, #1 is a replica of #2 and #3 is replica of #1
now we see that when #1 is demoted it prints:
17339:S 21 Apr 2020 11:16:38.523 * Using the meaningful offset 3929963 instead of 3929977 to exclude the final PINGs (14 bytes difference)
17339:S 21 Apr 2020 11:16:39.391 * Trying a partial resynchronization (request e2b3f8817735fdfe5fa4626766daa938b61419e5:3929964).
17339:S 21 Apr 2020 11:16:39.392 * Successful partial resynchronization with master.
and when #3 connects to the demoted #2, #2 says:
17339:S 21 Apr 2020 11:16:40.084 * Partial resynchronization not accepted: Requested offset for secondary ID was 3929978, but I can reply up to 3929964

so the issue here is that the meaningful offset feature saved the day for the
demoted master (since it needs to sync from a replica that didn't get the last
ping), but it didn't help one of the other replicas which did get the last ping.
2020-04-27 15:52:49 +02:00
John Sully c498381b1a Merge branch 'unstable' into redis_6_merge
Former-commit-id: cc9924ffa6
2020-04-15 23:00:13 -04:00
John Sully 24223ed818 Multithreading reliability, force single thread for test relying on internal behavior
Former-commit-id: 033761c5f9
2020-04-15 20:52:25 -04:00
John Sully 02147b4be0 Merge commit '0f7dfc378ce5ab0524ac28b6142545bc41435386' into redis_6_merge
Former-commit-id: cc3ebbe519
2020-04-14 22:19:29 -04:00
John Sully aa48225a76 Merge commit '76d57161d960f27ac92765118e3b80fef8847b8f' into redis_6_merge
Former-commit-id: 320bc3c032
2020-04-14 21:04:42 -04:00
John Sully eeca58777d Fix subkey expires not replicating correctly, and AOF issues
Former-commit-id: bd183cdee1
2020-04-04 21:52:27 -04:00
antirez e257f121e1 PSYNC2: meaningful offset test. 2020-03-25 15:55:24 +01:00
Oran Agra 6173815408 fix for flaky psync2 test
*** [err]: PSYNC2: total sum of full synchronizations is exactly 4 in tests/integration/psync2.tcl
Expected 5 == 4 (context: type eval line 6 cmd {assert {$sum == 4}} proc ::test)

issue was that sometime the test got an unexpected full sync since it
tried to switch to the replica before it was in sync with it's master.
2020-03-12 15:53:47 +01:00
John Sully ee99605def Merge branch 'unstable' into redis_6_merge
Former-commit-id: 18a5f46b61
2020-02-11 02:39:08 -05:00
John Sully 9dc9707693 Add missing test file
Former-commit-id: 0c101dccc8
2020-02-10 18:15:29 -05:00
John Sully 9cd3b8253d Ensure multi-master works for ring topologies
Former-commit-id: a7cc3aac28
2020-02-10 00:25:03 -05:00
John Sully a21c81c30e Add test to detect issue #137 and #132
Former-commit-id: 49d86746ed
2020-02-06 23:31:12 -05:00
John Sully 8e7f3304b2 More threading fixes from merge
Former-commit-id: 4a980f4ddb
2020-01-28 17:54:00 -05:00
John Sully 39378f982e Fix most tests (still some failures)
Former-commit-id: da83e84125
2020-01-27 18:16:19 -05:00
John Sully 8e5fe97525 Merge remote-tracking branch 'redis/6.0' into redis_merge
Former-commit-id: ef9a3cadcf
2020-01-27 02:55:48 -05:00
zhaozhao.zz 58554396d6 incrbyfloat: fix issue #5256 ttl lost after propagate 2019-12-18 15:44:51 +08:00
John Sully 633b7398e1 Fix issue #107, active replicas do their own expires
Former-commit-id: 8e4f323439
2019-11-20 19:44:31 -05:00
John Sully df8a20a744 Signals can happen on any thread, so look for the signal handler not the command on the callstack
Former-commit-id: f1d2b29450
2019-10-24 23:30:08 -04:00
Yossi Gottlieb 0db3b0a0ff Merge remote-tracking branch 'upstream/unstable' into tls 2019-10-16 17:08:07 +03:00
Daniel Dai 98600c9a11 update typo 2019-10-09 14:15:31 -04:00
Yossi Gottlieb 61733ded14 TLS: Configuration options.
Add configuration options for TLS protocol versions, ciphers/cipher
suites selection, etc.
2019-10-07 21:07:27 +03:00
Oran Agra 6b6294807c TLS: Implement support for write barrier. 2019-10-07 21:06:30 +03:00
Oran Agra 5a47794606 diskless replication rdb transfer uses pipe, and writes to sockets form the parent process.
misc:
- handle SSL_has_pending by iterating though these in beforeSleep, and setting timeout of 0 to aeProcessEvents
- fix issue with epoll signaling EPOLLHUP and EPOLLERR only to the write handlers. (needed to detect the rdb pipe was closed)
- add key-load-delay config for testing
- trim connShutdown which is no longer needed
- rioFdsetWrite -> rioFdWrite - simplified since there's no longer need to write to multiple FDs
- don't detect rdb child exited (don't call wait3) until we detect the pipe is closed
- Cleanup bad optimization from rio.c, add another one
2019-10-07 21:06:30 +03:00
Yossi Gottlieb b087dd1db6 TLS: Connections refactoring and TLS support.
* Introduce a connection abstraction layer for all socket operations and
integrate it across the code base.
* Provide an optional TLS connections implementation based on OpenSSL.
* Pull a newer version of hiredis with TLS support.
* Tests, redis-cli updates for TLS support.
2019-10-07 21:06:13 +03:00
John Sully 2c6fdf0f4e RREPLAY command now takes a DB argument
Former-commit-id: 6e1e5bd08b
2019-09-28 14:59:44 -04:00
Salvatore Sanfilippo 6129758558 Merge branch 'unstable' into modules_fork 2019-09-27 11:24:06 +02:00
Oran Agra 83e87bac76 Fix lastbgsave_status, when new child signal handler get intended kill
And add a test for that.
2019-09-26 15:16:34 +03:00
John Sully f31b1fd06b Issue #64 RREPLAY isn't binary safe. Add fix and test.
Former-commit-id: afe66288fe
2019-07-24 22:31:02 -04:00
John Sully 727bda7108 remove unnecessary variables
Former-commit-id: a9c4e3970f
2019-07-18 19:37:49 -04:00
John Sully 2110b84f7e Fix issue #59 - Test replicaof config variable
Former-commit-id: d5ecc2347a
2019-07-18 19:22:49 -04:00
Oran Agra c56b4ddc6f prevent diskless replica from terminating on short read
now that replica can read rdb directly from the socket, it should avoid exiting
on short read and instead try to re-sync.

this commit tries to have minimal effects on non-diskless rdb reading.
and includes a test that tries to trigger this scenario on various read cases.
2019-07-17 16:46:22 +02:00
John Sully 0dd9a27420 Give the active-rep more time to sync for test reliability
Former-commit-id: 620c2ec141
2019-07-12 23:52:07 -04:00
John Sully 03d41318b0 Add Active Replication tests
Former-commit-id: 528d10091f
2019-07-12 03:54:41 -04:00
Oran Agra 2de544cfcc diskless replication on slave side (don't store rdb to file), plus some other related fixes
The implementation of the diskless replication was currently diskless only on the master side.
The slave side was still storing the received rdb file to the disk before loading it back in and parsing it.

This commit adds two modes to load rdb directly from socket:
1) when-empty
2) using "swapdb"
the third mode of using diskless slave by flushdb is risky and currently not included.

other changes:
--------------
distinguish between aof configuration and state so that we can re-enable aof only when sync eventually
succeeds (and not when exiting from readSyncBulkPayload after a failed attempt)
also a CONFIG GET and INFO during rdb loading would have lied

When loading rdb from the network, don't kill the server on short read (that can be a network error)

Fix rdb check when performed on preamble AOF

tests:
run replication tests for diskless slave too
make replication test a bit more aggressive
Add test for diskless load swapdb
2019-07-08 15:37:48 +03:00
John Sully e48c132d35 Merge branch 'unstable' of https://github.com/antirez/redis into MergeRedis
Note: some tests failing

Former-commit-id: 86d7276f24
2019-05-11 02:20:34 -04:00
Oran Agra ba809f26d4 make replication tests more stable on slow machines
solving few replication related tests race conditions which fail on slow machines

bugfix in slave buffers test: since the test is executed twice, each time with
a different commands count, the threshold for the delta can't be a constant.
2019-05-05 08:25:01 +03:00
John Sully 422ac66531 Make PSYNC2 tests more reliable on slower hardware
Former-commit-id: 7b1dd0b60d
2019-03-26 18:59:31 -04:00
John Sully c2821078b1 complete rebranding with tests passing
Former-commit-id: 3e9b867709
2019-02-09 10:11:46 -05:00
antirez 009a929269 Remove debugging printf from replication.tcl test. 2018-12-12 11:55:30 +01:00
antirez 4cf8fdbbd3 Slave removal: remove slave from integration tests descriptions. 2018-09-11 15:32:28 +02:00
antirez febe102bf6 Test: processing of master stream in slave -BUSY state.
See #5297.
2018-08-31 16:45:02 +02:00
antirez 7a30be1237 Minor improvements to PR #5187. 2018-07-31 17:30:12 +02:00
Jack Drogon 93238575f7 Fix typo 2018-07-03 18:19:46 +02:00
Oran Agra de495ee7ab minor fix in creating a stream NACK for rdb and defrag tests 2018-06-27 15:34:17 +03:00