12127 Commits

Author SHA1 Message Date
Leibale Eidelman
adc4748248 fix ZRANGESTORE - should return 0 when src points to an empty key (#9089)
mistakenly it used to return an empty array rather than 0.

Co-authored-by: Oran Agra <oran@redislabs.com>
(cherry picked from commit 95274f1f8a3ef4cb4033beecfaa99ea1439ed170)
2021-07-21 21:06:49 +03:00
guybe7
3b32512dc9 Include sizeof(struct stream) in objectComputeSize (#9164)
Affects MEMORY USAGE

(cherry picked from commit 4434cebbb38ae2ef39b2d74ed3e6cd8d1a061d0c)
2021-07-21 21:06:49 +03:00
Binbin
0be66e4ebe ZRANDMEMBER WITHSCORES with negative COUNT may return bad score (#9162)
Return a bad score when used with negative count (or count of 1), and non-ziplist encoded zset.
Also add test to validate the return value and cover the issue.

(cherry picked from commit 4bc5a8324d3cb23ed2cc8a9cd19444a893a6d52c)
2021-07-21 21:06:49 +03:00
Evan
21a768990c modules: Add newlen == 0 handling to RM_StringTruncate (#3717) (#3718)
Previously, passing 0 for newlen would not truncate the string at all.
This adds handling of this case, freeing the old string and creating a new empty string.

Other changes:
- Move `src/modules/testmodule.c` to `tests/modules/basics.c`
- Introduce that basic test into the test suite
- Add tests to cover StringTruncate
- Add `test-modules` build target for the main makefile
- Extend `distclean` build target to clean modules too

(cherry picked from commit 1ccf2ca2f475a161b8ca0c574d4c0e6ef9ecf754)
2021-07-21 21:06:49 +03:00
yvette903
fde58863d5 Fix coredump after Client Unpause command when threaded I/O is enabled (#9041)
Fix crash when using io-threads-do-reads and issuing CLIENT PAUSE and
CLIENT UNPAUSE.
This issue was introduced in redis 6.2 together with the FAILOVER command.

(cherry picked from commit 096c5fd5d22caa2c21a4863cbaaf64fd8e7107d2)
2021-07-21 21:06:49 +03:00
guybe7
288ff19198 Module API for current command name (#8792)
sometimes you can be very deep in the call stack, without access to argv.
once you're there you may want your reply/log to contain the command name.

(cherry picked from commit e16d3eb998f7017c95ef17179de77aa5b6f2e272)
2021-07-21 21:06:49 +03:00
Huang Zhw
5a963f360f Fix XTRIM or XADD with LIMIT may delete more entries than Count. (#9048)
The decision to stop trimming due to LIMIT in XADD and XTRIM was after the limit was reached.
i.e. the code was deleting **at least** that count of records (from the LIMIT argument's perspective, not the MAXLEN),
instead of **up to** that count of records.
see #9046

(cherry picked from commit eaa7a7bb93c1ac6dbf347e1c29ac719a12a75158)
2021-07-21 21:06:49 +03:00
Huang Zhw
300b06f1f0 XTRIM call streamParseAddOrTrimArgsOrReply use wrong arg xadd. (#9047)
xtrimCommand call streamParseAddOrTrimArgsOrReply should use xadd==0.

When the syntax is valid, it does not cause any bugs because the params of XADD is superset of XTRIM.
Just XTRIM will not respond with error on invalid syntax. The syntax of XADD will also be accpeted by XTRIM.

(cherry picked from commit 91f3689bf5dc4ce3cf00d9d957b9677b362a205e)
2021-07-21 21:06:49 +03:00
YaacovHazan
4af7a28728 stabilize tests that involved with load handlers (#8967)
When test stop 'load handler' by killing the process that generating the load,
some commands that already in the input buffer, still might be processed by the server.
This may cause some instability in tests, that count on that no more commands
processed after we stop the `load handler'

In this commit, new proc 'wait_load_handlers_disconnected' added, to verify that no more
cammands from any 'load handler' prossesed, by checking that the clients who
genreate the load is disconnceted.

Also, replacing check of dbsize with wait_for_ofs_sync before comparing debug digest, as
it would fail in case the last key the workload wrote was an overridden key (not a new one).

Affected tests
Race fix:
- failover command to specific replica works
- Connect multiple replicas at the same time (issue #141), master diskless=$mdl, replica diskless=$sdl
- AOF rewrite during write load: RDB preamble=$rdbpre

Cleanup and speedup:
- Test replication with blocking lists and sorted sets operations
- Test replication with parallel clients writing in different DBs
- Test replication partial resync: $descr (diskless: $mdl, $sdl, reconnect: $reconnect

(cherry picked from commit 32a2584e079a1b3c2d1e6649e38239381a73a459)
2021-07-21 21:06:49 +03:00
perryitay
6ae3673b5e Fail EXEC command in case a watched key is expired (#9194)
There are two issues fixed in this commit: 
1. we want to fail the EXEC command in case there is a watched key that's logically
   expired but not yet deleted by active expire or lazy expire.
2. we saw that currently cache time is update in every `call()` (including nested calls),
   this time is being also being use for the isKeyExpired comparison, we want to update
   the cache time only in the first call (execCommand)

Co-authored-by: Oran Agra <oran@redislabs.com>
(cherry picked from commit ac8b1df8850cc80fbf9ce8c2fbde0c1d3a1b4e91)
2021-07-21 21:06:49 +03:00
Huang Zhw
970302c00c Do not install a file event to send data to rewrite child when parent stop sending diff to child in aof rewrite. (#8767)
In aof rewrite, when parent stop sending data to child, if there is
new rewrite data, aofChildWriteDiffData write event will be installed.
Then this event is issued and deletes the file event without do anyting.
This will happen over and over again until aof rewrite finish.

This bug used to waste a few system calls per excessive wake-up
(epoll_ctl and epoll_wait) per cycle, each cycle triggered by receiving
a write command from a client.

(cherry picked from commit cb961d8c8e10ff3b619f1579a03336a15e9e6f45)
2021-07-21 21:06:49 +03:00
Omer Shadmi
3687f210a1 Avoid exiting to allow diskless loading to recover from RDB short read on module AUX data (#9199)
Currently a replica is able to recover from a short read (when diskless loading
is enabled) and avoid crashing/exiting, replying to the master and then the rdb
could be sent again by the master for another load attempt by the replica.
There were a few scenarios that were not behaving similarly, such as when
there is no end-of-file marker, or when module aux data failed to load, which
should be allowed to occur due to a short read.

(cherry picked from commit f06d782f5abcb30efb0117841232828ed3e129bf)
2021-07-21 21:06:49 +03:00
Oran Agra
f1ff72c7a3 Fix race in client side tracking (#9116)
The `Tracking gets notification of expired keys` test in tracking.tcl
used to hung in valgrind CI quite a lot.

It turns out the reason is that with valgrind and a busy machine, the
server cron active expire cycle could easily run in the same event loop
as the command that created `mykey`, so that when they key got expired,
there were two change events to broadcast, one that set the key and one
that expired it, but since we used raxTryInsert, the client that was
associated with the "last" change was the one that created the key, so
the NOLOOP filtered that event.

This commit adds a test that reproduces the problem by using lazy expire
in a multi-exec which makes sure the key expires in the same event loop
as the one that added it.

(cherry picked from commit 9b564b525d8ce88295ec14ffdc3bede7e5f5c33e)
2021-07-21 21:06:49 +03:00
Maxim Galushka
9562821f12 redis-cli: support for REDIS_REPLY_SET in CSV and RAW output. (#7338)
Fixes #6792. Added support of REDIS_REPLY_SET in raw and csv output of `./redis-cli`

Test:

run commands to test:
  ./redis-cli -3 --csv COMMAND
  ./redis-cli -3 --raw COMMAND

Now they are returning resuts, were failing with: "Unknown reply type: 10" before the change.

(cherry picked from commit 96bb078577ce2b0d093c873faae5d3ecca26a1de)
2021-07-21 21:06:49 +03:00
malavan
69f3e7c802 remove duplicate function
Former-commit-id: 81cf9979ed1d86d0a690e5cd27ed018b125b1d58
2021-07-21 16:00:24 +00:00
malavan
99a165e0f6 add stacktrace message
Former-commit-id: 5be1620629ce8de7f419bc001f18d22d6eb4fa8a
2021-07-19 23:17:18 +00:00
malavan
16f361abf6 dd comment and set eip unused
Former-commit-id: 685b87e2ef4f67cd599b12e38b08f5b70b7a6c58
2021-07-19 17:32:38 +00:00
malavan
70cb3267de dd comment and set eip unused
Former-commit-id: 72429c21067318696897c26783f654eb7bc6040f
2021-07-19 17:31:24 +00:00
malavan
9e411426f2 dd comment and set eip unused
Former-commit-id: 7707fe15a9c9774820b3afb9837a50e73c40a5a8
2021-07-19 17:29:43 +00:00
malavan
abf2114117 add backtrace for alpine using libunwind
Former-commit-id: c583ffff412b9df705b7c96e68e3908b645c7d43
2021-07-19 17:20:52 +00:00
Christian Legge
d05333bf53 Merge pull request #321 from EQ-Alpha/ci-flags-fix
Requested changes from 6.2.2 merge

Former-commit-id: 7c1ab8b8e274972ad807296f756ebf80fcddd04b
2021-07-15 16:42:02 -04:00
christianEQ
43f31da324 fix warnings for mac build
Former-commit-id: 570fbd014944a655f6c8e7216f2b9226f378c7c7
2021-07-15 20:14:14 +00:00
christianEQ
a833c9b2a7 Merge remote-tracking branch 'origin/unstable' into ci-flags-fix
Former-commit-id: da1f09e9b551cacdfd24dc839ee659a5e5e1e1de
2021-07-14 22:56:15 +00:00
malavan
bfefd8a11b use INVALID_EXPIRE instead of -1
Former-commit-id: 9e45984a97a293d87474f87612204a24c831a343
2021-07-14 22:13:29 +00:00
christianEQ
f11601bcfc added REDIS_CFLAGS to makefile for backwards compatibility
Former-commit-id: b2fb4f4b9bba28f45828ead5670fc206a4c2a2f6
2021-07-14 21:51:44 +00:00
malavan
c255a454ec cleanup based on 6.2.2 merge review
Former-commit-id: 51277b17a7ab4bb5b3f06fd5af8f26257ac35a37
2021-07-14 15:22:27 -04:00
Christian Legge
5019f9c537 Merge pull request #322 from EQ-Alpha/diagnostic-tool
Basic first iteration of Diagnostic Tool

Former-commit-id: 32f5ef864e85a46ed81d3a2fdfd51d0be4f361f5
2021-07-14 14:19:44 -04:00
Christian Legge
25d992777c Merge pull request #327 from EQ-Alpha/issue323_fix
fix for #323: seg fault on expiremember

Former-commit-id: a8f28297ec1677f48e9afa9deeb3dbbd2e2f41d9
2021-07-12 16:54:31 -04:00
christianEQ
229bb85dec tabs -> spaces
Former-commit-id: 0ae13c973166106efd17aa6b5dfeb80236ed862c
2021-07-12 18:55:44 +00:00
John Sully
c0160a4415 Merge tag '6.2.3' into unstable
Former-commit-id: 1895dbb7680fa9aadf6040912e89c733abc8c706
2021-07-09 04:40:31 +00:00
christianEQ
cf23416296 added eq alpha copyright
Former-commit-id: a6cbbd0f318f3a091ed23dbdbcc1593f32fa5e25
2021-07-08 02:58:18 +00:00
christianEQ
145015dc51 fix for #323: seg fault on expiremember
Former-commit-id: f1f52af9cfcac03a1af84265f7e5cb2172e8ebde
2021-07-08 02:50:05 +00:00
christianEQ
ea95e6c406 various branding and cleanup fixes
Former-commit-id: e3c619eca4755c96af83e1959a6ea5ba95734e93
2021-07-08 02:46:42 +00:00
christianEQ
e5939c5de9 removed unused command line options
Former-commit-id: 57e59d97db3674eb241f9bd0836e38f4c8356cac
2021-06-22 17:13:35 +00:00
christianEQ
6c5246fb09 changed --ms to --time
Former-commit-id: d7cada0f38668f67eb307172a3e91599b1f00a24
2021-06-21 19:57:14 +00:00
christianEQ
59102658a3 added more verbose options
Former-commit-id: fd2ac1fcfc94285cad683528f3d209b204ccfd2b
2021-06-21 18:40:37 +00:00
christianEQ
2bbb8a54fc -t threads option
Former-commit-id: 0181b0e7a17ad5f83a544401110a9eac2b292aa4
2021-06-21 18:36:21 +00:00
christianEQ
0d9e0a9039 added starting line so diagnostic tool doesnt look frozen at first
Former-commit-id: 2b5e5cfa4cf1478682c46d74436025c63ac6c217
2021-06-18 20:21:47 +00:00
christianEQ
4028d35560 Merge remote-tracking branch 'origin/unstable' into diagnostic-tool
Former-commit-id: bfb0d02622dfc9ac0c67ec68ae8a21cccd5c9004
2021-06-18 20:19:31 +00:00
christianEQ
248059e50c detect stagnating server load before 100% (diagnostic tool)
Former-commit-id: 534b70643b8f39303331048d3e86475caa08b864
2021-06-18 19:01:51 +00:00
christianEQ
b21b868de2 added config option for time to spin up new client threads (diagnostic tool)
Former-commit-id: 3d0f729572b175457d4874b6e381754ac47e9055
2021-06-18 16:58:16 +00:00
christianEQ
29e3f7da84 detect full load + server threads (diagnostic tool)
Former-commit-id: fd4ed1e425e32b628c5850e83c9ea9411c471bbe
2021-06-18 16:49:25 +00:00
christianEQ
4237c9d5ff detect client cpu usage in diagnostic tool
Former-commit-id: 693450393c848679b60c5a9bf55428ae1d4f769f
2021-06-17 20:40:10 +00:00
christianEQ
fd72894fbf accurate cpu usage in diagnostic tool
Former-commit-id: 8ee7584cffc5c5cacfb7ad20fc964112974683e4
2021-06-17 18:32:11 +00:00
John Sully
420b07960c Prevent test code crash due to no log data
Former-commit-id: 0a56a73bd98d4e692ae77683fdb9dd644ecfc2eb
2021-06-14 22:06:36 +00:00
John Sully
dd8e8b098c active defrag tests need to run single threaded because jemalloc has seperate mempools per thread and the numbers won't match otherwise
Former-commit-id: 3a1d3090f2ec5a442e3a7c192987cdfa24094145
2021-06-14 16:32:47 +00:00
christianEQ
9dd97c9c0d changed redis_flags names to keydb in makefile
Former-commit-id: 07273936271536e4a57efdb7a31bc34e5b8d50f1
2021-06-14 16:09:42 +00:00
christianEQ
2417c7a593 several redis->keydb changes in sentinel.conf
Former-commit-id: d2ef0594711c83ec9223d2e3b26fce9b5a4f685f
2021-06-11 19:16:33 +00:00
christianEQ
3ea398ad5e renamed redis mentions in runtest files
Former-commit-id: 2e894a512b30a8317619e55fa30a218306f8514f
2021-06-11 19:11:12 +00:00
christianEQ
e0aafaee37 renamed redis mention in readme
Former-commit-id: 34b0209f05d4f44e4b14278ad746f1eda679b32a
2021-06-11 19:10:35 +00:00