819 Commits

Author SHA1 Message Date
John Sully
367067c98a Prevent test crash due to unimplemented save for nested hash
Former-commit-id: 7e0077f293c5f91f240ab401e5f167e487afbfe0
2020-12-11 00:23:44 +00:00
VivekSainiEQ
52561f1729 Added module data type load/save tests
Former-commit-id: cae9924fd9eefcd88cef1c964f0bc8bce7dd4242
2020-11-30 17:47:04 -05:00
VivekSainiEQ
3d15a7b65a Removed use of module datatypes, now should work if tests/modules is not built
Former-commit-id: 089f28e8ba91ed2b875048efa0b28ceb32010541
2020-11-30 17:47:04 -05:00
VivekSainiEQ
54b36868ba Added tests for saving various data types to disk and loading them back, and for loading data types from redis to maintain compatibility
Former-commit-id: dcb44d3a09a4021f05079bedbac690e33ec7f39e
2020-11-30 17:47:04 -05:00
Kajaruban Surendran
fd03008bbf Configurable option for MOTD
Former-commit-id: 49a89d636ba698dbd0858d5059d3d6387c8c1fc7
2020-11-30 10:42:48 -05:00
VivekSainiEQ
86ca4300c8 Added test for issue #257
Former-commit-id: 779c775df9e8be36064689404e3ff51bead8a364
2020-11-25 17:21:37 -05:00
John Sully
5de36840ad Add missing file
Former-commit-id: 97fd73692363e05b80e0c0e84b7b2b8fe7f760b8
2020-11-11 03:29:38 +00:00
John Sully
b226b318ff Prevent crashes on shutdown due to lock being held
Former-commit-id: 6a74f524e558100dfb3e54779020cd3407706e08
2020-10-27 04:53:19 +00:00
John Sully
4f18a247e3 Merge tag '6.0.8' into unstable
Former-commit-id: 4c7e4b91a6bb2034636856b608b8c386d07f5541
2020-09-30 19:47:55 +00:00
John Sully
ff1a43ea18 Reduce test noise
Former-commit-id: 13c9a094d1636d4ea9842746e20096eabbd80cba
2020-09-19 22:00:17 +00:00
Yossi Gottlieb
bf6c002005 TLS: Session caching configuration support. (#7420)
* TLS: Session caching configuration support.
* TLS: Remove redundant config initialization.


Former-commit-id: d3834c50699bc4f31f381d6d03d4c1b022380895
2020-09-16 02:10:29 +00:00
Yossi Gottlieb
0052d5196d Tests: fix oom-score-adj false positives. (#7772)
The key save delay is too short and on certain systems the child process
is gone before we have a chance to inspect it.

(cherry picked from commit b2a73c404bf277bac287c72494a4c4cd2ba02f8c)
2020-09-10 14:09:00 +03:00
杨博东
b55b0ea0f2 Tests: Add aclfile load and save tests (#7765)
improves test coverage

(cherry picked from commit 0666267d2771b1a46cdf36eef27d8a7a393c0c7a)
2020-09-10 14:09:00 +03:00
Roi Lipman
25e211bcf0 RM_ThreadSafeContextTryLock a non-blocking method for acquiring GIL (#7738)
Co-authored-by: Yossi Gottlieb <yossigo@gmail.com>
Co-authored-by: Oran Agra <oran@redislabs.com>
(cherry picked from commit 042189fd8707544139337b3ddcf38b5c5fea1bf0)
2020-09-10 14:09:00 +03:00
Yossi Gottlieb
635704d424 Tests: validate CONFIG REWRITE for all params. (#7764)
This is a catch-all test to confirm that that rewrite produces a valid
output for all parameters and that this process does not introduce
undesired configuration changes.

(cherry picked from commit a8b7268911803f4ac827ab22e8e5b10134664832)
2020-09-10 14:09:00 +03:00
bodong.ybd
781e50d41f Tests: Some fixes for macOS
1) cur_test: when restart_server, "no such variable" error occurs
  ./runtest --single integration/rdb
  test {client freed during loading}
      SET ::cur_test
      restart_server
        kill_server
          test "Check for memory leaks (pid $pid)"
          SET ::cur_test
          UNSET ::cur_test
      UNSET ::cur_test // This global variable has been unset.

2) `ps --ppid` not available on macOS platform, can be replaced with
`pgrep -P pid`.

(cherry picked from commit f22fa9594d536cb53f83ed8e508c03d4278778b0)
2020-09-10 14:09:00 +03:00
Oran Agra
5b8de5b7f2 test infra - reduce disk space usage
this is important when running a test with --loop

(cherry picked from commit e3e69c25fd05b608f5ea8d612bc0e377922a6115)
2020-09-10 14:09:00 +03:00
Yossi Gottlieb
f38e2802b6 Fix oom-score-adj on older distros. (#7724)
Don't assume `ps` handles `-h` to display output without headers and
manually trim headers line from output.

(cherry picked from commit b61b663895f16d9f559a14c408c225062254a57b)
2020-09-01 09:27:58 +03:00
Yossi Gottlieb
f6d04d01b9 Add oom-score-adj configuration option to control Linux OOM killer. (#1690)
Add Linux kernel OOM killer control option.

This adds the ability to control the Linux OOM killer oom_score_adj
parameter for all Redis processes, depending on the process role (i.e.
master, replica, background child).

A oom-score-adj global boolean flag control this feature. In addition,
specific values can be configured using oom-score-adj-values if
additional tuning is required.

(cherry picked from commit 2530dc0ebd8be8d792f4673073401377cd5bdc42)
2020-09-01 09:27:58 +03:00
Meir Shpilraien (Spielrein)
2fc915f509 see #7544, added RedisModule_HoldString api. (#7577)
Added RedisModule_HoldString that either returns a
shallow copy of the given String (by increasing
the String ref count) or a new deep copy of String
in case its not possible to get a shallow copy.

Co-authored-by: Itamar Haber <itamar@redislabs.com>
(cherry picked from commit 3f494cc49d25929f27fa75a78d9921a9dee771f2)
2020-09-01 09:27:58 +03:00
Meir Shpilraien (Spielrein)
2257f38b68 This PR introduces a new loaded keyspace event (#7536)
Co-authored-by: Oran Agra <oran@redislabs.com>
Co-authored-by: Itamar Haber <itamar@redislabs.com>
(cherry picked from commit 8d826393191399e132bd9e56fb51ed83223cc5ca)
2020-09-01 09:27:58 +03:00
valentinogeron
e6f6731c66 EXEC with only read commands should not be rejected when OOM (#7696)
If the server gets MULTI command followed by only read
commands, and right before it gets the EXEC it reaches OOM,
the client will get OOM response.

So, from now on, it will get OOM response only if there was
at least one command that was tagged with `use-memory` flag

(cherry picked from commit b7289e912cbe1a011a5569cd67929e83731b9660)
2020-09-01 09:27:58 +03:00
Valentino Geron
19ef1f371d Fix LPOS command when RANK is greater than matches
When calling to LPOS command when RANK is higher than matches,
the return value is non valid response. For example:
```
LPUSH l a
:1
LPOS l b RANK 5 COUNT 10
*-4
```
It may break client-side parser.

Now, we count how many replies were replied in the array.
```
LPUSH l a
:1
LPOS l b RANK 5 COUNT 10
*0
```

(cherry picked from commit 9204a9b2c2f6eb59767ab0bddcde62c75e8c20b0)
2020-09-01 09:27:58 +03:00
Yossi Gottlieb
8d79702d8a Tests: fix redis-cli with remote hosts. (#7693)
(cherry picked from commit f80f3f492a0ca56e163899eeca7ad40d67d903be)
2020-09-01 09:27:58 +03:00
Yossi Gottlieb
1180537589 Module API: fix missing RM_CLIENTINFO_FLAG_SSL. (#7666)
The `REDISMODULE_CLIENTINFO_FLAG_SSL` flag was already a part of the `RedisModuleClientInfo` structure but was not implemented.

(cherry picked from commit 64c360c5156ca6ee6d1eb52bfeb3fa48f3b25da5)
2020-09-01 09:27:58 +03:00
Oran Agra
a5294c4e52 module hook for master link up missing on successful psync (#7584)
besides, hooks test was time sensitive. when the replica managed to
reconnect quickly after the client kill, the test would fail

(cherry picked from commit f7e77759902aa19cfa537ed454e6bc987498e8c5)
2020-09-01 09:27:58 +03:00
Oran Agra
67750ce3b3 Fix failing tests due to issues with wait_for_log_message (#7572)
- the test now waits for specific set of log messages rather than wait for
  timeout looking for just one message.
- we don't wanna sample the current length of the log after an action, due
  to a race, we need to start the search from the line number of the last
  message we where waiting for.
- when attempting to trigger a full sync, use multi-exec to avoid a race
  where the replica manages to re-connect before we completed the set of
  actions that should force a full sync.
- fix verify_log_message which was broken and unused

(cherry picked from commit 109b5ccdcd6e6b8cecdaeb13a246bc49ce7a61f4)
2020-09-01 09:27:58 +03:00
Jiayuan Chen
096285ab64 Add optional tls verification (#7502)
Adds an `optional` value to the previously boolean `tls-auth-clients` configuration keyword.

Co-authored-by: Yossi Gottlieb <yossigo@gmail.com>
(cherry picked from commit f31260b0445f5649449da41555e1272a40ae4af7)
2020-09-01 09:27:58 +03:00
WuYunlong
b1a01fda91 Fix command help for unexpected options (#7476)
(cherry picked from commit 93bdbf5aa4857ede0816cf790f951da8e2fa2ae9)
2020-07-20 21:08:26 +03:00
Oran Agra
aea4db2f5a fix recently added time sensitive tests failing with valgrind (#7512)
interestingly the latency monitor test fails because valgrind is slow
enough so that the time inside PEXPIREAT command from the moment of
the first mstime() call to get the basetime until checkAlreadyExpired
calls mstime() again is more than 1ms, and that test was too sensitive.

using this opportunity to speed up the test (unrelated to the failure)
the fix is just the longer time passed to PEXPIRE.

(cherry picked from commit e5227aab899628653285478a9d1083e8e8f51b57)
2020-07-20 21:08:26 +03:00
Yossi Gottlieb
7a536c2912 TLS: Session caching configuration support. (#7420)
* TLS: Session caching configuration support.
* TLS: Remove redundant config initialization.

(cherry picked from commit 3e6f2b1a45176ac3d81b95cb6025f30d7aaa1393)
2020-07-20 21:08:26 +03:00
Oran Agra
95ba01b538 RESTORE ABSTTL won't store expired keys into the db (#7472)
Similarly to EXPIREAT with TTL in the past, which implicitly deletes the
key and return success, RESTORE should not store key that are already
expired into the db.
When used together with REPLACE it should emit a DEL to keyspace
notification and replication stream.

(cherry picked from commit 5977a94842a25140520297fe4bfda15e0e4de711)
2020-07-20 21:08:26 +03:00
Oran Agra
33ca884cc5 skip a test that uses +inf on valgrind (#7440)
On some platforms strtold("+inf") with valgrind returns a non-inf result

[err]: INCRBYFLOAT does not allow NaN or Infinity in tests/unit/type/incr.tcl
Expected 'ERR*would produce*' to equal or match '1189731495357231765085759.....'

(cherry picked from commit 909bc97c526db757a3d022b29911ff6d08eba59c)
2020-07-20 21:08:26 +03:00
Oran Agra
2b5f23197c stabilize tests that look for log lines (#7367)
tests were sensitive to additional log lines appearing in the log
causing the search to come empty handed.

instead of just looking for the n last log lines, capture the log lines
before performing the action, and then search from that offset.

(cherry picked from commit 8e76e13472b7d277af78691775c2cf845f68ab90)
2020-07-20 21:08:26 +03:00
antirez
17aaf5ec97 LPOS: option FIRST renamed RANK.
(cherry picked from commit a5a3a7bbc61203398ecc1d5b52c76214f5672776)
2020-07-20 21:08:26 +03:00
Oran Agra
05e483cbb3 EXEC always fails with EXECABORT and multi-state is cleared
In order to support the use of multi-exec in pipeline, it is important that
MULTI and EXEC are never rejected and it is easy for the client to know if the
connection is still in multi state.

It was easy to make sure MULTI and DISCARD never fail (done by previous
commits) since these only change the client state and don't do any actual
change in the server, but EXEC is a different story.

Since in the past, it was possible for clients to handle some EXEC errors and
retry the EXEC, we now can't affort to return any error on EXEC other than
EXECABORT, which now carries with it the real reason for the abort too.

Other fixes in this commit:
- Some checks that where performed at the time of queuing need to be re-
  validated when EXEC runs, for instance if the transaction contains writes
  commands, it needs to be aborted. there was one check that was already done
  in execCommand (-READONLY), but other checks where missing: -OOM, -MISCONF,
  -NOREPLICAS, -MASTERDOWN
- When a command is rejected by processCommand it was rejected with addReply,
  which was not recognized as an error in case the bad command came from the
  master. this will enable to count or MONITOR these errors in the future.
- make it easier for tests to create additional (non deferred) clients.
- add tests for the fixes of this commit.

(cherry picked from commit 65a3307bc95aadbc91d85cdf9dfbe1b3493222ca)
2020-07-20 21:08:26 +03:00
meir@redislabs.com
51e178454d Fix RM_ScanKey module api not to return int encoded strings
The scan key module API provides the scan callback with the current
field name and value (if it exists). Those arguments are RedisModuleString*
which means it supposes to point to robj which is encoded as a string.
Using createStringObjectFromLongLong function might return robj that
points to an integer and so break a module that tries for example to
use RedisModule_StringPtrLen on the given field/value.

The PR introduces a fix that uses the createObject function and sdsfromlonglong function.
Using those function promise that the field and value pass to the to the
scan callback will be Strings.

The PR also changes the Scan test module to use RedisModule_StringPtrLen
to catch the issue. without this, the issue is hidden because
RedisModule_ReplyWithString knows to handle integer encoding of the
given robj (RedisModuleString).

The PR also introduces a new test to verify the issue is solved.

(cherry picked from commit a89bf734a933e45b9dd3ae85ef4c3b62bd6891d8)
2020-07-20 21:08:26 +03:00
John Sully
d4dd336834 Merge tag '6.0.5' into unstable
Redis 6.0.5


Former-commit-id: b736a95b0d23e4b73daa88c676b76d1d18e8bd17
2020-07-13 00:55:23 +00:00
antirez
e0022d8cfe LPOS: tests + crash fix. 2020-06-12 12:08:06 +02:00
antirez
a7d3670da5 Adapt EVAL+busy script test to new behavior. 2020-06-09 12:19:30 +02:00
zhaozhao.zz
1d7bf208ce AOF: append origin SET if no expire option 2020-06-09 11:53:01 +02:00
John Sully
c31b96339a Stream tests rely on deferring clients, mitigate races caused by them
Former-commit-id: 2caf8e4c8095215b189942b7eaec3bf5023f7fcf
2020-06-07 13:59:41 -04:00
John Sully
b006a06924 fix race in test
Former-commit-id: 02e821530a402796697e63c68e768b563de0a3cb
2020-06-07 00:44:11 -04:00
John Sully
f7a7d16524 Make lazyfree more reliable
Former-commit-id: b6c3d80edbdc4348c071b4108b039f4da5c88ce5
2020-06-07 00:40:58 -04:00
John Sully
3403a1f648 Detect issues like #189
Former-commit-id: 0042586190a3e5b212a015aeb3577695cd3623c5
2020-06-05 22:18:28 -04:00
John Sully
7b70d8c7d0 maxmem tests should be run solo for higher reliability
Former-commit-id: 95f46e60779fca715244745ced7b2ab04bbf9e3a
2020-06-01 16:50:30 -04:00
John Sully
4f7102f46c Fix for issue #187 we need to properly handle the case where a key with a subkey expirey itself expires during load
Former-commit-id: e6a9a6b428b91b6108df24ae6285ea9b582b7b23
2020-06-01 15:33:19 -04:00
John Sully
4b08ccd0b1 Fix client race in test (test only issue)
Former-commit-id: f25aebf2698509a132ebf599374b245efb51e365
2020-05-31 21:39:50 -04:00
John Sully
eb8a183583 PUBSUB test reliability: A client race was erroneously failing tests (test only issue)
Former-commit-id: 5147f0153ad1efb827a1709c10cd0f58e6ae65d8
2020-05-31 21:27:15 -04:00
John Sully
a73e580ad4 Fix memory test failures with multithreading enabled
Former-commit-id: 58035404227a9ef1c3bd92623a333c915d50eab6
2020-05-30 00:06:15 -04:00