9403 Commits

Author SHA1 Message Date
Oran Agra
e001152825 test infra - wait_done_loading
reduce code duplication in aof.tcl.
move creation of clients into the test so that it can be skipped

(cherry picked from commit cc455a710cc68d0fd8243cd1f04c5ee7332e4fdb)
2020-09-10 14:09:00 +03:00
Oran Agra
f180326b65 test infra - flushall between tests in external mode
(cherry picked from commit 2468c17a3229ae37825466a18dce9a5272eeef30)
2020-09-10 14:09:00 +03:00
Oran Agra
575d07b7a8 test infra - improve test skipping ability
- skip full units
- skip a single test (not just a list of tests)
- when skipping tag, skip spinning up servers, not just the tests
- skip tags when running against an external server too
- allow using multiple tags (split them)

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

(cherry picked from commit fc18f16260d15b3584d92f73cebafa3a552e2686)
2020-09-10 14:09:00 +03:00
Oran Agra
60bec0c20c test infra - write test name to logfile
(cherry picked from commit e783c03dd1828fbf67259ee037a4faf835c4700a)
2020-09-10 14:09:00 +03:00
Yossi Gottlieb
e5db52f19f redis-cli: fix writeConn() buffer handling. (#7749)
Fix issues with writeConn() which resulted with corruption of the stream by leaving an extra byte in the buffer. The trigger for this is partial writes or write errors which were not experienced on Linux but reported on macOS.

(cherry picked from commit 94cd74e5deb18e0383bcad5c596c72980e5350b6)
2020-09-10 14:09:00 +03:00
Oran Agra
894016c396 Print server startup messages after daemonization (#7743)
When redis isn't configured to have a log file, having these prints
before damonization puts them in the calling process stdout rather than
/dev/null

(cherry picked from commit 0db61f564991ad483e2a2014738f25628584476b)
2020-09-10 14:09:00 +03:00
Thandayuthapani
f8d0d902a5 Add masters/replicas options to redis-cli --cluster call command (#6491)
* Add master/slave option in --cluster call command

* Update src/redis-cli.c

* Update src/redis-cli.c

Co-authored-by: Itamar Haber <itamar@redislabs.com>
(cherry picked from commit 535222063951cc1f3c2c8f78fd84fb9e0d8acefd)
2020-09-10 14:09:00 +03:00
Oran Agra
9f60eb0a3e fix README about BUILD_WITH_SYSTEMD usage (#7739)
BUILD_WITH_SYSTEMD is an internal variable. Users should use USE_SYSTEMD=yes.

(cherry picked from commit 9b61917d7f749d29cd37d2ad6f6563683b0b0bf6)
2020-09-10 14:09:00 +03:00
Yossi Gottlieb
7aa207ad2c Fix double-make issue with make && make install. (#7734)
All user-supplied variables that affect the build should be explicitly
persisted.

Fixes #7254

(cherry picked from commit d377b116bad2eab176fe5f5271302823da50c94c)
2020-09-10 14:09:00 +03:00
Oran Agra
6e7733c276 Redis 6.0.7 2020-09-01 09:27:58 +03:00
Oran Agra
6041fc99b5 Reduce the probability of failure when start redis in runtest-cluster #7554 (#7635)
When runtest-cluster, at first, we need to create a cluster use spawn_instance,
a port which is not used is choosen, however sometimes we can't run server on
the port. possibley due to a race with another process taking it first.
such as redis/redis/runs/896537490. It may be due to the machine problem or
In order to reduce the probability of failure when start redis in
runtest-cluster, we attemp to use another port when find server do not start up.

Co-authored-by: Oran Agra <oran@redislabs.com>
Co-authored-by: yanhui13 <yanhui13@meituan.com>
(cherry picked from commit 1deaad884c38e92e5b691f36b253ef4ee2201ca4)
2020-09-01 09:27:58 +03:00
Yossi Gottlieb
f2ab7ac5d7 Backport Lua 5.2.2 stack overflow fix. (#7733)
This fixes the issue described in CVE-2014-5461. At this time we cannot
confirm that the original issue has a real impact on Redis, but it is
included as an extra safety measure.

(cherry picked from commit 374270d3a04e8b224a12655518c815497aeb497d)
2020-09-01 09:27:58 +03:00
Leoš Literák
6c68ac1d4c Update README.md with instructions how to build with systemd support (#7730)
#7728 - update instructions for systemd support

(cherry picked from commit 635d6ca6390ebab09bca3214777253910cb46547)
2020-09-01 09:27:58 +03:00
Yossi Gottlieb
ba1da77a3d 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 ae8420298cacc2737e8e3ffa3c5acc038cd27849)
2020-09-01 09:27:58 +03:00
Wang Yuan
a399ca9bf7 Fix wrong format specifiers of 'sdscatfmt' for the INFO command (#7706)
unlike printf, sdscatfmt doesn't take %d

(cherry picked from commit 48a00e6b99430d493ae8e4daa169f4a9ee9a8fa6)
2020-09-01 09:27:58 +03:00
Wen Hui
edcc2032e4 fix make warnings (#7692)
(cherry picked from commit 7386b998e80affe8696b89b750ba86c9d8b9f453)
2020-09-01 09:27:58 +03:00
Nathan Scott
7b04660be7 Annotate module API functions in redismodule.h for use with -fno-common (#6900)
In order to keep the redismodule.h self-contained but still usable with
gcc v10 and later, annotate each API function tentative definition with
the __common__ attribute.  This avoids the 'multiple definition' errors
modules will otherwise see for all API functions at link time.

Further details at gcc.gnu.org/gcc-10/porting_to.html

Turn the existing __attribute__ ((unused)), ((__common__)) and ((print))
annotations into conditional macros for any compilers not accepting this
syntax.  These macros only expand to API annotations under gcc.

Provide a pre- and post- macro for every API function, so that they can
be defined differently by the file that includes redismodule.h.

Removing REDISMODULE_API_FUNC in the interest of keeping the function
declarations readable.

Co-authored-by: Yossi Gottlieb <yossigo@gmail.com>
Co-authored-by: Oran Agra <oran@redislabs.com>
(cherry picked from commit 9d4736b04441b609c17c414e0780882cf92c5e33)
2020-09-01 09:27:58 +03:00
Yossi Gottlieb
f0e28abc07 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 70c823a64e800f22ac68f0172acdd1da82d7be32)
2020-09-01 09:27:58 +03:00
Meir Shpilraien (Spielrein)
63e3f1e449 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 4f99b22118ca91e3a7fe9c1c68c19dd717dfdbb5)
2020-09-01 09:27:58 +03:00
ShooterIT
d8ddc73796 [Redis-benchmark] Remove zrem test, add zpopmin test
(cherry picked from commit 8925fac39568295b7b6b2dbde0768d7275e663e9)
2020-09-01 09:27:58 +03:00
ShooterIT
e7ce996d8c [Redis-benchmark] Support zset type
(cherry picked from commit e6c811cd851cc1b37a0b626458258a26cea0bab3)
2020-09-01 09:27:58 +03:00
Arun Ranganathan
57c6b0e718 Show threading configuration in INFO output (#7446)
Co-authored-by: Oran Agra <oran@redislabs.com>
(cherry picked from commit 444b53e6402dabc7c2bf52be6603c4c9bbfb9921)
2020-09-01 09:27:58 +03:00
Meir Shpilraien (Spielrein)
f63e428e5b 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 73198c50194cbf0254afd4cc5245f9274a538d13)
2020-09-01 09:27:58 +03:00
Oran Agra
888cbf6822 Fix rejectCommand trims newline in shared error objects, hung clients (#7714)
fe8d6fe74 (released in 6.0.6) has a side effect, when processCommand
rejects a command with pre-made shared object error string, it trims the
newlines from the end of the string. if that string is later used with
addReply, the newline will be missing, breaking the protocol, and
leaving the client hung.

It seems that the only scenario which this happens is when replying with
-LOADING to some command, and later using that reply from the CONFIG
SET command (still during loading). this will result in hung client.

Refactoring the code in order to avoid trimming these newlines from
shared string objects, and do the newline trimming only in other cases
where it's needed.

Co-authored-by: Guy Benoish <guy.benoish@redislabs.com>
(cherry picked from commit 2640897e3a01fbacb620c12e021c934e48eeccb9)
2020-09-01 09:27:58 +03:00
valentinogeron
3c136a7777 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 0292720ccb0a189d3ed49d7bf912602360a4ecdd)
2020-09-01 09:27:58 +03:00
Itamar Haber
c77e8e2f1c Expands lazyfree's effort estimate to include Streams (#5794)
Otherwise, it is treated as a single allocation and freed synchronously. The following logic is used for estimating the effort in constant-ish time complexity:

1. Check the number of nodes.
1. Add an allocation for each consumer group registered inside the stream.
1. Check the number of PELs in the first CG, and then add this count times the number of CGs.
1. Check the number of consumers in the first CG, and then add this count times the number of CGs.

(cherry picked from commit cb504d7fddd09149655e91496588c610e89ca131)
2020-09-01 09:27:58 +03:00
Yossi Gottlieb
fe6da3c36b Add language servers stuff, test/tls to gitignore. (#7698)
(cherry picked from commit 74d9d9544969fed000bde5f8504b5b3f211e473f)
2020-09-01 09:27:58 +03:00
Valentino Geron
d727f52723 Assert that setDeferredAggregateLen isn't called with negative value
In case the redis is about to return broken reply we want to crash
with assert so that we are notified about the bug. see #7687.

(cherry picked from commit 7e6c9ef8819a071679f8dd18035dbbe2455c7b12)
2020-09-01 09:27:58 +03:00
Valentino Geron
34124fff88 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 7a555da64f56a4fb2f300d84a35778bee8f471ca)
2020-09-01 09:27:58 +03:00
Yossi Gottlieb
c5675c66bc Tests: fix redis-cli with remote hosts. (#7693)
(cherry picked from commit 257f9f462f7782dcaecf7bbf35f4701b20b88a45)
2020-09-01 09:27:58 +03:00
huangzhw
907b0124e8 RedisModuleEvent_LoadingProgress always at 100% progress (#7685)
It was also using the wrong struct, but luckily RedisModuleFlushInfo and RedisModuleLoadingProgress
are identical.

(cherry picked from commit b980e999293e9214a844712f9c88ca69acd20b1b)
2020-09-01 09:27:58 +03:00
guybe7
d0b8583167 Modules: Invalidate saved_oparray after use (#7688)
We wanna avoid a chance of someone using the pointer in it after it'll be freed / realloced.

(cherry picked from commit 4de17eb032160c7ba94c505eab4b776a456e5117)
2020-09-01 09:27:58 +03:00
杨博东
b42976bd56 Fix flock cluster config may cause failure to restart after kill -9 (#7674)
After fork, the child process(redis-aof-rewrite) will get the fd opened
by the parent process(redis), when redis killed by kill -9, it will not
graceful exit(call prepareForShutdown()), so redis-aof-rewrite thread may still
alive, the fd(lock) will still be held by redis-aof-rewrite thread, and
redis restart will fail to get lock, means fail to start.

This issue was causing failures in the cluster tests in github actions.

Co-authored-by: Oran Agra <oran@redislabs.com>
(cherry picked from commit 5e6212e087c4696abc682b64079202c9ade8666c)
2020-09-01 09:27:58 +03:00
Raghav Muddur
3564aab1a5 Update clusterMsgDataPublish to clusterMsgModule (#7682)
Correcting the variable to clusterMsgModule.

(cherry picked from commit f7cf24b5da539dbf4fafc404355a32bac06aa2f5)
2020-09-01 09:27:58 +03:00
Madelyn Olson
f80b756076 Fixed hset error since it's shared with hmset (#7678)
(cherry picked from commit 17c6b3c7eeb486a75d05ba7fb3c4490b7abbc597)
2020-09-01 09:27:58 +03:00
guybe7
d74a98eaac PERSIST should signalModifiedKey (Like EXPIRE does) (#7671)
(cherry picked from commit 64cceb12ad5982393f9b93557a2c7d3c77ffc946)
2020-09-01 09:27:58 +03:00
Oran Agra
299c092077 OOM Crash log include size of allocation attempt. (#7670)
Since users often post just the crash log in github issues, the log
print that's above it is missing.
No reason not to include the size in the panic message itself.

(cherry picked from commit 1b5cc94836d24b7b36cb6618644f9e2d60113c59)
2020-09-01 09:27:58 +03:00
Wen Hui
3e11f9d967 [module] using predefined REDISMODULE_NO_EXPIRE in RM_GetExpire (#7669)
It was already defined in the API header and the documentation, but not used by the implementation.

(cherry picked from commit b7236f0002bcaa15f3a487def9c5069b6c422e65)
2020-09-01 09:27:58 +03:00
Oran Agra
b091e0059d Trim trailing spaces in error replies coming from rejectCommand (#7668)
fe8d6fe749 added rejectCommand which takes an robj reply and passes it
through addReplyErrorSafe to addReplyErrorLength.
The robj contains newline at it's end, but addReplyErrorSafe converts it
to spaces, and passes it to addReplyErrorLength which adds the protocol
newlines.

The result was that most error replies (like OOM) had extra two trailing
spaces in them.

(cherry picked from commit 05a4af3464b16e42b31dfb1ea62e2a66dc032fb2)
2020-09-01 09:27:58 +03:00
Yossi Gottlieb
d13c44583c 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 2ec11f941ae41188e517670fc3224b12c7666541)
2020-09-01 09:27:58 +03:00
Yossi Gottlieb
3ed7d0af20 TLS: relax verification on CONFIG SET. (#7665)
Avoid re-configuring (and validating) SSL/TLS configuration on `CONFIG
SET` when TLS is not actively enabled for incoming connections, cluster
bus or replication.

This fixes failures when tests run without `--tls` on binaries that were
built with TLS support.

An additional benefit is that it's now possible to perform a multi-step
configuration process while TLS is disabled. The new configuration will
be verified and applied only when TLS is effectively enabled.

(cherry picked from commit 24efd22e894c90f380aa05a5fa77134bb9423ad3)
2020-09-01 09:27:58 +03:00
Madelyn Olson
e0f6c0de33 Fixed timer warning (#5953)
(cherry picked from commit 46ce35c55e3c6d5c3b2f43194de7694c27ad1d5d)
2020-09-01 09:27:58 +03:00
Wagner Francisco Mezaroba
4772370a87 allow --pattern to be used along with --bigkeys (#3586)
Adds --pattern option to cli's --bigkeys, --hotkeys & --scan modes

(cherry picked from commit 3ec7f8e915fb15634ea5babf217b8a8ecb3e3647)
2020-09-01 09:27:58 +03:00
zhaozhao.zz
a42e7f6876 redis-benchmark: fix wrong random key for hset (#4895)
(cherry picked from commit b1a242b84a7ff4aadf8c47ea83a658db9cf0e98b)
2020-09-01 09:27:58 +03:00
zhaozhao.zz
f573b23187 CLIENT_MASTER should ignore server.proto_max_bulk_len
(cherry picked from commit 0061dbba04918b3f62f943f469f41590d4200919)
2020-09-01 09:27:58 +03:00
zhaozhao.zz
f0f4ef4423 config: proto-max-bulk-len must be 1mb or greater
(cherry picked from commit 46323cec56793c66273005b72f1f29146c108840)
2020-09-01 09:27:58 +03:00
zhaozhao.zz
0d78615532 using proto-max-bulk-len in checkStringLength for SETRANGE and APPEND
(cherry picked from commit 912b48e4b9d9a0738ab3010c4f30e47a3beec3fc)
2020-09-01 09:27:58 +03:00
YoongHM
5e0a3e2626 Start redis after network is online (#7639)
The two lines allow systemd to start redis.service after the network is online. Only after the network is online that Redis could bind to IP address other than 127.0.0.1 during initial boot up process.

(cherry picked from commit 1c6caaaef7d69e05b526626f284bb822fc82dd9f)
2020-09-01 09:27:58 +03:00
Yossi Gottlieb
9c7c0c511a Run daily workflow on main repo only (no forks). (#7646)
(cherry picked from commit b8f0c2de4aa76a5ba86a6970b7ab550a35ff12c6)
2020-09-01 09:27:58 +03:00