10801 Commits

Author SHA1 Message Date
John Sully
3e828a5988 Ensure multithreaded tests pass
Former-commit-id: 0bcce502859647529b8835a4a101b64ddf0d625c
2020-11-13 21:08:10 +00:00
John Sully
973b769b21 Improve replication performance in multithreaded scenarios
Former-commit-id: 96e0b2a2b19df220975e61131cbc535b0c34a828
2020-11-13 21:08:10 +00:00
John Sully
104164aa14 Add ability to compile KeyDB without MOTD and curl
Former-commit-id: f3794d2c420423ca7dcc51688c478f8ada290786
2020-11-13 20:51:30 +00:00
John Sully
2fdac516a6 Add missing file
Former-commit-id: 97fd73692363e05b80e0c0e84b7b2b8fe7f760b8
2020-11-11 03:29:38 +00:00
John Sully
4f7ac9c11f Second implementation of nested hashes
Former-commit-id: ba950a3d1f5708ed986f9b348eafcace6a7c22b9
2020-11-06 19:24:48 +00:00
John Sully
f6f5fc3ccf Additional test reliability fixes
Former-commit-id: dad5a902d394719ba722e487879fc283ca148786
2020-10-27 07:25:43 +00:00
Oran Agra
984d33e8b6 Redis 6.0.9. 2020-10-27 09:12:01 +02:00
Yossi Gottlieb
77b0060fbe Fix wrong zmalloc_size() assumption. (#7963)
When using a system with no malloc_usable_size(), zmalloc_size() assumed
that the heap allocator always returns blocks that are long-padded.

This may not always be the case, and will result with zmalloc_size()
returning a size that is bigger than allocated. At least in one case
this leads to out of bound write, process crash and a potential security
vulnerability.

Effectively this does not affect the vast majority of users, who use
jemalloc or glibc.

This problem along with a (different) fix was reported by Drew DeVault.

(cherry picked from commit 05a086617dc52d07868604e1a0fa922e5b9ce67c)
2020-10-27 09:12:01 +02:00
Oran Agra
bfe67bd205 Attempt to fix sporadic test failures due to wait_for_log_messages (#7955)
The tests sometimes fail to find a log message.
Recently i added a print that shows the log files that are searched
and it shows that the message was in deed there.
The only reason i can't think of for this seach to fail, is we we
happened to read an incomplete line, which didn't match our pattern and
then on the next iteration we would continue reading from the line after
it.

The fix is to always re-evaluation the previous line.

(cherry picked from commit 35eb8ec6f3f6a2deab49ff70b0e9a8587adfd6de)
2020-10-27 09:12:01 +02:00
David CARLIER
8f7b0343ab cpu affinity: DragonFlyBSD support (#7956)
(cherry picked from commit c1ff07dfbb26ffcc9686af3de5a6778e23ab2ce6)
2020-10-27 09:12:01 +02:00
Zach Fewtrell
67b92eaffe fix invalid 'failover' identifier in cluster slave selection test (#7942)
(cherry picked from commit 0a0ec83e48e374ec2b6184049d5b1499e508d8b9)
2020-10-27 09:12:01 +02:00
WuYunlong
39272f6836 Update rdb_last_bgsave_time_sec in INFO on diskless replication (#7917)
`info Persistence` will include correct (updated) rdb_last_bgsave_time_sec
For diskless bgsave (sockets) too (like a few other persistence info fields).

Refactor code to reduce duplicate code.

(cherry picked from commit 51f36283df29e6969215baf63223653d7cec0059)
2020-10-27 09:12:01 +02:00
Wen Hui
6b4aba30a9 do not add save parameter during config rewrite in sentinel mode (#7945)
Previous code would have added default redis save parameters
to the config file on rewrite, which would have been silently ignored
when the config file is loaded.

The new code avoids adding this, and also actively removes these lines
If added by a previous config rewrite. 

(cherry picked from commit f61435fe8b7907f59cb0f11f28f13db50b9023a5)
2020-10-27 09:12:01 +02:00
Qu Chen
872744d196 WATCH no longer ignores keys which have expired for MULTI/EXEC. (#7920)
This wrong behavior was backed by a test, and also documentation, and dates back to 2010.
But it makes no sense to anyone involved so it was decided to change that.

Note that 3b031b1 (invalidate watch on expire on access) was released in 6.0 RC2
and 62a3ec8 released in in 6.0.0 GA (invalidate watch when key is evicted).
both of which do similar changes.

(cherry picked from commit 44bcbed2eed8577e7634e04817c4a75f9b722a62)
2020-10-27 09:12:01 +02:00
Oran Agra
7aec82cdb9 improve verbose logging on failed test. print log file lines (#7938)
(cherry picked from commit 33c59266cc338eb9051d70a7cdf5a4120915f84a)
2020-10-27 09:12:01 +02:00
Yossi Gottlieb
deaa71637a Add a --no-latency tests flag. (#7939)
Useful for running tests on systems which may be way slower than usual.

(cherry picked from commit be43c030df2a352c5fa02d70e4dcaa46ece25b2b)
2020-10-27 09:12:01 +02:00
filipe oliveira
0a4aaa631f Fixed bug concerning redis-benchmark non clustered benchmark forcing always the same hash tag {tag} (#7931)
Adding the ":{tag}" only if --cluster is used, so that when used against
a proxy it generates traffic to all shards.

Co-authored-by: Oran Agra <oran@redislabs.com>
(cherry picked from commit 128bc0f4951e3c887a0cbe16360adb04fdeeda82)
2020-10-27 09:12:01 +02:00
Oran Agra
edf8894162 fix 32bit build warnings (#7926)
(cherry picked from commit cc231e4882f8b49f4d6524904ac980250642a465)
2020-10-27 09:12:01 +02:00
Wen Hui
4807eeef21 fix double fclose in aofrewrite (#7919)
minor fix for a bug which happen on error handling code
and doesn't look like it could have caused any real harm
(fd number wouldn't have been reused yet)

(cherry picked from commit ee8cb472a781e42ec7b10c6a88d258a3399ca34f)
2020-10-27 09:12:01 +02:00
Oran Agra
c55bc96dc6 INFO report peak memory before eviction (#7894)
In some cases one command added a very big bulk of memory, and this
would be "resolved" by the eviction before the next command.

Seeing an unexplained mass eviction we would wish to
know the highest momentary usage too.

Tracking it in call() and beforeSleep() adds some hooks in AOF and RDB
loading.

The fix in clientsCronTrackExpansiveClients is related to #7874

(cherry picked from commit 0de424cab96633a3fc94bcdaec83176eacb080b2)
2020-10-27 09:12:01 +02:00
Yossi Gottlieb
c9dcf82020 Fix tests failure on busybox systems. (#7916)
(cherry picked from commit 6a035f5edff0be3b404f1bfb9f07e9373cd63934)
2020-10-27 09:12:01 +02:00
Oran Agra
1ee7b3973b Allow requirepass config to clear the password (#7899)
This is a compatibility issue with redis 5.0 that was introduced by ACL.
Before this commit, setting requirepass to an empty string will result
in a server that needs an empty AUTH, unlike redis 5.0 which would
accept connections without an AUTH.

(cherry picked from commit c7fe6387d92b266581ff313ab6a3b39443747b87)
2020-10-27 09:12:01 +02:00
Wang Yuan
86c8cf42a0 Remove temporary aof and rdb files in a background thread (#7905)
If we fail or stop to rewrite aof, we need to remove temporary aof.
We also remove temporary rdb when replicas abort to receive rdb.
But currently we delete them in main thread, to avoid blocking,
we should use bg_unlink to remove them in a background thread.

Btw, we have already used this way to removed child process temporary rdb.

(cherry picked from commit 5bb220660e6b548daee2a68c81d3e7f4b35e1fcc)
2020-10-27 09:12:01 +02:00
guybe7
371555135f Minor improvements to module blocked on keys (#7903)
- Clarify some documentation comments
- Make sure blocked-on-keys client privdata is accessible
  from withing the timeout callback
- Handle blocked clients in beforeSleep - In case a key
  becomes "ready" outside of processCommand

See #7879 #7880

(cherry picked from commit c816eec8938297e827b0ddd19f9011847bab05c3)
2020-10-27 09:12:01 +02:00
Andreas Lind
2a9f491e0d Support redis-cli -u rediss://... (#7900)
(cherry picked from commit efa784d5f24c60b41edb50d61afc2338864c9f39)
2020-10-27 09:12:01 +02:00
Yossi Gottlieb
c6c0155725 Modules: fix RM_GetCommandKeys API. (#7901)
This cleans up and simplifies the API by passing the command name as the
first argument. Previously the command name was specified explicitly,
but was still included in the argv.

(cherry picked from commit a94ddb27fe919d60c598c2403b230b27c6e3a11c)
2020-10-27 09:12:01 +02:00
Meir Shpilraien (Spielrein)
dbf3902481 Add Module API for version and compatibility checks (#7865)
* Introduce a new API's: RM_GetContextFlagsAll, and
RM_GetKeyspaceNotificationFlagsAll that will return the
full flags mask of each feature. The module writer can
check base on this value if the Flags he needs are
supported or not.

* For each flag, introduce a new value on redismodule.h,
this value represents the LAST value and should be there
as a reminder to update it when a new value is added,
also it will be used in the code to calculate the full
flags mask (assuming flags are incrementally increasing).
In addition, stated that the module writer should not use
the LAST flag directly and he should use the GetFlagAll API's.

* Introduce a new API: RM_IsSubEventSupported, that returns for a given
event and subevent, whether or not the subevent supported.

* Introduce a new macro RMAPI_FUNC_SUPPORTED(func) that returns whether
or not a function API is supported by comparing it to NULL.

* Introduce a new API: int RM_GetServerVersion();, that will return the
current Redis version in the format 0x00MMmmpp; e.g. 0x00060008;

* Changed unstable version from 999.999.999 to 255.255.255

Co-authored-by: Oran Agra <oran@redislabs.com>
Co-authored-by: Yossi Gottlieb <yossigo@gmail.com>
(cherry picked from commit e9c837ad3118f5ea2cb4defb0ab82cbd113733e7)
2020-10-27 09:12:01 +02:00
Yossi Gottlieb
02edabc9aa Module API: Add RM_GetClientCertificate(). (#7866)
This API function makes it possible to retrieve the X.509 certificate
used by clients to authenticate TLS connections.

(cherry picked from commit 929f1e2ec73c147251d693631a746baaaf5d4127)
2020-10-27 09:12:01 +02:00
Yossi Gottlieb
298808cf32 Modules: Add RM_GetDetachedThreadSafeContext(). (#7886)
The main motivation here is to provide a way for modules to create a
single, global context that can be used for logging.

Currently, it is possible to obtain a thread-safe context that is not
attached to any blocked client by using `RM_GetThreadSafeContext`.
However, the attached context is not linked to the module identity so
log messages produced are not tagged with the module name.

Ideally we'd fix this in `RM_GetThreadSafeContext` itself but as it
doesn't accept the current context as an argument there's no way to do
that in a backwards compatible manner.

(cherry picked from commit e270302cdf06b6a7b38c7dcb59680419b1b589c8)
2020-10-27 09:12:01 +02:00
Yossi Gottlieb
4af8059e61 Modules: add RM_GetCommandKeys().
This is essentially the same as calling COMMAND GETKEYS but provides a
more efficient interface that can be used in every context (i.e. not a
Redis command).

(cherry picked from commit 9e58b52a19fed12c4e9fbe120ec0d4baf9c2bc28)
2020-10-27 09:12:01 +02:00
Yossi Gottlieb
ad1ed7dcd0 Introduce getKeysResult for getKeysFromCommand.
Avoid using a static buffer for short key index responses, and make it
caller's responsibility to stack-allocate a result type. Responses that
don't fit are still allocated on the heap.

(cherry picked from commit bf5beab64a196214c3c741d9ef67d0446c6480c3)
2020-10-27 09:12:01 +02:00
Madelyn Olson
ec9b1cca59 Fixed excessive categories being displayed from acls (#7889)
(cherry picked from commit abe416c5f251b7b151440b38829a719c4846b8b8)
2020-10-27 09:12:01 +02:00
Oran Agra
9cf7292ef7 Add some additional signal info to the crash log (#7891)
- si_code can be very useful info some day.
- a clear indication that redis was killed by an external user

(cherry picked from commit 38c7c62d2270b4921219953aaabfcdc721154b88)
2020-10-27 09:12:01 +02:00
Oran Agra
6e03b388ce Allow blocked XREAD on a cluster replica (#7881)
I suppose that it was overlooked, since till recently none of the blocked commands were readonly.

other changes:
- add test for the above.
- add better support for additional (and deferring) clients for
  cluster tests
- improve a test which left the client in MULTI state.

(cherry picked from commit ba61700db24628451212c5875e0ca7e5d83ea743)
2020-10-27 09:12:01 +02:00
Oran Agra
a5302a8c21 memory reporting of clients argv (#7874)
track and report memory used by clients argv.
this is very usaful in case clients started sending a command and didn't
complete it. in which case the first args of the command are already
trimmed from the query buffer.

in an effort to avoid cache misses and overheads while keeping track of
these, i avoid calling sdsZmallocSize and instead use the sdslen /
bulk-len which can at least give some insight into the problem.

This memory is now added to the total clients memory usage, as well as
the client list.

(cherry picked from commit 7481e513f0507d01381a87046d8d1366c718f94e)
2020-10-27 09:12:01 +02:00
DvirDukhan
7a8a268ac4 redis-cli add control on raw format line delimiter (#7841)
Adding -D option for redis-cli to control newline between command
responses in raw mode.

Also removing cleanup code before calling exit, just in order
to avoid adding more adding more cleanup code (redis doesn't
bother to release allocations before exit anyway)

Co-authored-by: Oran Agra <oran@redislabs.com>
(cherry picked from commit f0f8e9c824b819c8aec996ec8c8851773a6f9432)
2020-10-27 09:12:01 +02:00
Oran Agra
0d7a1d1d37 Include internal sds fragmentation in MEMORY reporting (#7864)
The MEMORY command is used for debugging memory usage, so it should include internal
fragmentation, same as used_memory

(cherry picked from commit 86483e795262c6e2efdffe92c1642a72ef0dd6a0)
2020-10-27 09:12:01 +02:00
Oran Agra
51dd4677c9 Fix crash in script timeout during AOF loading (#7870)
(cherry picked from commit 8cff3e03520bb08cb7dfdbd11f98827a3cb1d3a5)
2020-10-27 09:12:01 +02:00
Rafi Einstein
57027f0c55 Makefile: enable program suffixes via PROG_SUFFIX (#7868)
(cherry picked from commit 2636b760fb062a763ae528800fd998d2913c7cb1)
2020-10-27 09:12:01 +02:00
nitaicaro
e7bae88392 Fixed Tracking test “The other connection is able to get invalidations” (#7871)
PROBLEM:

[$rd1 read] reads invalidation messages one by one, so it's never going to see the second invalidation message produced after INCR b, whether or not it exists. Adding another read will block incase no invalidation message is produced.

FIX:

We switch the order of "INCR a" and "INCR b" - now "INCR b" comes first. We still only read the first invalidation message produces. If an invalidation message is wrongly produces for b - then it will be produced before that of a, since "INCR b" comes before "INCR a".

Co-authored-by: Nitai Caro <caronita@amazon.com>
(cherry picked from commit 94e9b0124e8582912c3771f9828842348490bc38)
2020-10-27 09:12:01 +02:00
Yossi Gottlieb
38853fd487 Modules: expose real client on conn events.
When REDISMODULE_EVENT_CLIENT_CHANGE events are delivered, modules may
want to mutate the client state (e.g. perform authentication).

This change links the module context with the real client rather than a
fake client for these events.

(cherry picked from commit 4aca4e5f392ad6030150a92a9ef82412072f9622)
2020-10-27 09:12:01 +02:00
Yossi Gottlieb
0816b8fadd Module API: Fail ineffective auth calls.
The client pointed to by the module context may in some cases be a fake
client. RM_Authenticate*() calls in this case would be ineffective but
appear to succeed, and this change fails them to make it easier to catch
such cases.

(cherry picked from commit 82866776d0c26f17043f9c1b0f0f5f48660e6848)
2020-10-27 09:12:01 +02:00
Yossi Gottlieb
51a6e1e61a TLS: Do not require CA config if not used. (#7862)
The tls-ca-cert or tls-ca-cert-dir configuration parameters are only
used when Redis needs to authenticate peer certificates, in one of these
scenarios:

1. Incoming clients or replicas, with `tls-auth-clients` enabled.
2. A replica authenticating the master's peer certificate.
3. Cluster nodes authenticating other nodes when establishing the bus
   protocol connection.

(cherry picked from commit 3bd9d0cc85d4ef8f4cc2789e9ab27e5557471409)
2020-10-27 09:12:01 +02:00
Oran Agra
c7cae0df77 warning: comparison between signed and unsigned integer in 32bit build (#7838)
(cherry picked from commit c11bda25fd2959523cb1e87af5b366cc451dbd04)
2020-10-27 09:12:01 +02:00
David CARLIER
4da8211063 Add support for Haiku OS (#7435)
(cherry picked from commit d535a5061ccd561d0c132b2e97b56a3bd252fde9)
2020-10-27 09:12:01 +02:00
Gavrie Philipson
c6d6646567 Fix typo in module API docs (#7861)
(cherry picked from commit ce5efb444b203536335ca6dd5d34cb57425b55be)
2020-10-27 09:12:01 +02:00
David CARLIER
58a7774ca4 getting rss size implementation for netbsd (#7293)
(cherry picked from commit 520c3b26c3fce1c86cf0c70961acd0515c8cb498)
2020-10-27 09:12:01 +02:00
Oran Agra
0fc601b3dd Fix new obuf-limits tests to work with TLS (#7848)
Also stabilize new shutdown tests on slow machines (valgrind)

(cherry picked from commit d89ae2d7ab3f6d181689b2546f2784b574d9b80e)
2020-10-27 09:12:01 +02:00
caozb
5ed795f025 ignore slaveof no one in redis.conf (#7842)
when slaveof config is "no one", reset any pre-existing config and resume.

also solve a memory leak if slaveof appears twice.
and fail loading if port number is out of range or not an integer.

Co-authored-by: caozhengbin <caozb@yidingyun.com>
Co-authored-by: Oran Agra <oran@redislabs.com>
(cherry picked from commit 01694608cb4e39a6ec7970d24b21ab33b7347e31)
2020-10-27 09:12:01 +02:00
Wang Yuan
a6f8745127 Don't support Gopher if enable io threads to read queries (#7851)
There's currently an issue with IO threads and gopher (issuing lookupKey from within the thread).
simply fix is to just not support it for now.

(cherry picked from commit 9bdef76f8e3bbfaacf0962ab1ceded1bafa80bda)
2020-10-27 09:12:01 +02:00