12903 Commits

Author SHA1 Message Date
christianEQ
011b69e9a6 killMainThread -> killServerThreads
Former-commit-id: 0fea781f8f0218c5475890a395c49bd7e4faa03f
2021-01-28 23:57:19 +00:00
christianEQ
67d6665795 compare_exchange in connSocketRead, explicitly enforce memory order (even if redundant)
Former-commit-id: 3c4cadc020c5aa9c39a066679255b8d2520c8e22
2021-01-28 23:17:48 +00:00
christianEQ
da274b9c14 fixed replicaof no one config, added test case
Former-commit-id: e2615ccf88ddb2a93536b62318983780890c4819
2021-01-28 19:49:22 +00:00
christianEQ
423ac80ccd updated version num to 255.255.255
Former-commit-id: 595deb0e1391c29c4766072bdd292202dd55c79d
2021-01-28 16:54:22 +00:00
christianEQ
e6aff64c71 Merge remote-tracking branch 'john/unstable' into redismerge_2021-01-20
Former-commit-id: 5372d1aab2174d23e91cbbec4e62925452fa2bda
2021-01-27 22:25:14 +00:00
christianEQ
5288425723 arm locker before checking zmalloc_used_memory
Former-commit-id: 52eca14ca61a54ac7dde57c2966216cab0e7ae2f
2021-01-27 22:24:06 +00:00
Daniel Dai
d69de1c689 Fix Swapdb crash
Former-commit-id: 1155f5ac6345591fb40a3ce77f81e11485a521dd
2021-01-27 15:24:10 -05:00
christianEQ
295106c2b2 fixed uninitialized variables in ACLSetUserCommandBit
Former-commit-id: 7319953ae389817679ce74c44b8baa631a4eafab
2021-01-26 23:29:15 +00:00
christianEQ
13dfc4f228 fixed strncpy off-by-one errors
Former-commit-id: b8e106a72e71bf5d8abd7d6032ff950f9722db59
2021-01-26 23:27:28 +00:00
christianEQ
8f132802d8 removed unimplemented killIOThreads function declaration
Former-commit-id: f30f8eba2f0a5cb247478c2104a4f748659a6cf2
2021-01-26 22:27:22 +00:00
christianEQ
396f8316e8 fixed server.cpp mentions
Former-commit-id: 7ed2296fc5d10a1c41020558b4bc445953531bdd
2021-01-26 22:22:19 +00:00
christianEQ
e73af5617c added note about io-threads to keydb.conf
Former-commit-id: 0691a46669d6fbd7dd4a1962c7b1c1929c089b11
2021-01-26 22:10:53 +00:00
christianEQ
be2991db56 fixed race condition in connSocketWrite
Former-commit-id: d7f01c1f7d1bb2d6e0b004f532f7b98ed968d389
2021-01-26 22:08:07 +00:00
christianEQ
48fdfe7d8f Removed Redis-specific things from conf file
Former-commit-id: 4d71929c6000b6a5ceb4793f9b3ee8c7576f4b71
2021-01-26 21:50:45 +00:00
christianEQ
358debebfa Merge tag 'tags/6.0.10' into redismerge_2021-01-20
Former-commit-id: dadce055f897cee83946c2d3e5cbb76341b94230
2021-01-26 21:43:09 +00:00
christianEQ
247c916f69 changed loading process config types to be consistent across environments
Former-commit-id: d2867580aba70bbfa703578cdb40093a4e1a7147
2021-01-14 21:12:36 -05:00
christianEQ
588a37583e renamed loaded key counter to be more clear
Former-commit-id: 8dc238efae8f6ba6b4ddc9b169e7195bcb43920b
2021-01-14 13:06:57 -05:00
christianEQ
b113977e94 removed 'comment arguments' from config options (doesn't ignore inline comments)
Former-commit-id: 7cd4b5e11c9c92e88cb551f7d83efc668aa259c7
2021-01-14 13:06:57 -05:00
christianEQ
6f97805577 fixed signedness warning
Former-commit-id: 00043f95099803f6b06a208ac3b19e2cef9abf4d
2021-01-14 13:06:57 -05:00
christianEQ
e68cee23a1 added section to keydb.conf for new options, tweaked default
Former-commit-id: 9b81f3f263de8cffab20ef4d20c2ac4935f63a10
2021-01-14 13:06:57 -05:00
christianEQ
d4ad045535 ping replicas during key load
Former-commit-id: 2747d1a1a99d3415d5486a472fe0e39135b79bc5
2021-01-14 13:06:57 -05:00
christianEQ
81536a31c8 added config option for loading callback interval keys
Former-commit-id: 9f7ed0b2327924563668105ead09f52833902d0b
2021-01-14 13:06:57 -05:00
christianEQ
4fa25cbc57 configurized loading_process_events_interval_bytes
Former-commit-id: c176ea73664a182af9caacda9d489fb2b344b2de
2021-01-14 13:06:57 -05:00
Oran Agra
8d70d498d5 Redis 6.0.10 2021-01-12 16:25:37 +02:00
Oran Agra
5745b469d3 Improve stability of new CSC eviction test (#8160)
c4fdf09c0 added a test that now fails with valgrind
it fails for two resons:
1) the test samples the used memory and then limits the maxmemory to
   that value, but it turns out this is not atomic and on slow machines
   the background cron process that clean out old query buffers reduces
   the memory so that the setting doesn't cause eviction.
2) the dbsize was tested late, after reading some invalidation messages
   by that time more and more keys got evicted, partially draining the
   db. this is not the focus of this fix (still a known limitation)

(cherry picked from commit a102b21d178453247078b355a47762bfc121ac20)
2021-01-12 16:25:37 +02:00
Oran Agra
a11c842ecd fix race in cluster transactions test (#8312)
we didn't wait for the commands executed on the master to reach the replica.

(cherry picked from commit 4f8458d8d6c59a47c6ffbb1ac88c69854ccf1592)
2021-01-12 16:25:37 +02:00
Oran Agra
615eb0db86 Fix cluster diskless load swapdb test (#8308)
The test was trying to wait for the replica to start loading the rdb
from the master before it kills the master, but it was actually waiting
for ROLE to be in "sync" mode, which corresponds to REPL_STATE_TRANSFER
that starts before the actual loading starts.
now instead it waits for the loading flag to be set.

Besides, the test was dependent on the previous configuration of the
servers, relying on the fact the replica is configured to persist
(either RDB of AOF), now it is set explicitly.

(cherry picked from commit 264953871b97bcc3d663cd006578c151a13b48ca)
2021-01-12 16:25:37 +02:00
Bob Li
203feb6ea2 Fix overflow of rdbWriteRaw return value (#8306)
Saving string of more than 2GB to the RDB file, can result in corrupt RDB, or failure in rdbSave.
S

(cherry picked from commit 542455ce2afbaffc065afbfdf6578399b8faecda)
2021-01-12 16:25:37 +02:00
guybe7
08c3f0bca6 Modules: Fix an integer sign bug in moduleTimerHandler (#8131)
bug was introduced in 1a91a2700b

(cherry picked from commit 2f41a3856845265ffc6cc3a35524883a8690cff7)
2021-01-12 16:25:37 +02:00
Egor Seredin
3bf02ea7e8 Allow '\0' inside of result of sdscatvprintf, and efficiency improvements (#6260)
This will allow to use: RedisModule_CreateStringPrintf(ctx, "%s %c %s", "string1", 0, "string2");

On large string, the previous code would incrementally retry to double the output buffer.
now it uses the the return value of snprintf and grows to the right size in one step.

and also avoids an excessive strlen in sdscat at the end.

(cherry picked from commit f4ca3d8757d6abb3536610ddb7b9ab3ad39e81df)
2021-01-12 16:25:37 +02:00
guybe7
acb4cd2135 Modules: Improve timer accuracy (#7987)
The bug occurs when 'callback' re-registers itself to a point
in the future and the execution time in non-negligible:
'now' refers to time BEFORE callback was executed and is used
to calculate 'next_period'.
We must get the actual current time when calculating 'next_period'

(cherry picked from commit 1a91a2700b24211e90c695d3fdbbfe7e8d75dbe4)
2021-01-12 16:25:37 +02:00
Meir Shpilraien (Spielrein)
fb86ecb802 Moved RMAPI_FUNC_SUPPORTED location such that it will be visible to modules (#8037)
The RMAPI_FUNC_SUPPORTED was defined in the wrong place on redismodule.h
and was not visible to modules.

(cherry picked from commit 97d647a13920c230a27685992a23679b44b73550)
2021-01-12 16:25:37 +02:00
David CARLIER
2c5865cd90 raspberry build fix. (#8095)
__ILP32__ is 32 bits ABI and does not imply x86, this patch resolves this. 

(cherry picked from commit 0719388cfb1a79160204314beb1de1f9c29a3684)
2021-01-12 16:25:37 +02:00
Yossi Gottlieb
ebbcd05e03 Fix crash log output on ARM. (#8020)
(cherry picked from commit 7e4325cbc9af96d55f0b61c7648233a4473e8c93)
2021-01-12 16:25:37 +02:00
Oran Agra
de4f04a272 Fix cluster access to unaligned memory (SIGBUS on old ARM) (#7958)
Turns out this was broken since version 4.0 when we added sds size
classes.
The cluster code uses sds for the receive buffer, and then casts it to a
struct and accesses a 64 bit variable.
This commit replaces the use of sds with a simple reallocated buffer.

(cherry picked from commit 380f6048e0bbc762f12fa50b57b73cf29049f967)
2021-01-12 16:25:37 +02:00
Oran Agra
f2f57eb44f prevent client tracking from causing feedback loop in performEvictions (#8100)
When client tracking is enabled signalModifiedKey can increase memory usage,
this can cause the loop in performEvictions to keep running since it was measuring
the memory usage impact of signalModifiedKey.

The section that measures the memory impact of the eviction should be just on dbDelete,
excluding keyspace notification, client tracking, and propagation to AOF and replicas.

This resolves part of the problem described in #8069
p.s. fix took 1 minute, test took about 3 hours to write.

(cherry picked from commit c4fdf09c0584a3cee32b92f01b7958c72776aedc)
2021-01-12 16:25:37 +02:00
Madelyn Olson
8119259bb6 White space tweaks and skip categories already applied
(cherry picked from commit d310beb4170ebbc8985ae120ee301f9213d33e39)
2021-01-12 16:25:37 +02:00
Madelyn Olson
e664f38170 Further improved ACL algorithm for picking categories
(cherry picked from commit 411bcf1a41d2758823d17e0864ef45e5f3948b7a)
2021-01-12 16:25:37 +02:00
Yang Bodong
f464cf2380 Swapdb should make transaction fail if there is any client watching keys (#8239)
This PR not only fixes the problem that swapdb does not make the
transaction fail, but also optimizes the FLUSHALL and FLUSHDB command to
set the CLIENT_DIRTY_CAS flag to avoid unnecessary traversal of clients.

FLUSHDB was changed to first iterate on all watched keys, and then on the
clients watching each key.
Instead of iterating though all clients, and for each iterate on watched keys.

Co-authored-by: Oran Agra <oran@redislabs.com>
(cherry picked from commit 10f94b0ab12f9315939dcccf39d64b9388c0c7fa)
2021-01-12 16:25:37 +02:00
Itamar Haber
02c395a179 Adds 'use-memory' to GEORADIUS[BYMEMBER] (#8107)
Partial resolution for #6860, item 7

(cherry picked from commit feba7cbf4d75f7822f34bd67a56b2ef4a755eff9)
2021-01-12 16:25:37 +02:00
Oran Agra
acdccab019 fix valgrind warning created by recent pidfile fix (#8235)
This isn't a leak, just an warning due to unreachable
allocation on the fork child.
Problem created by 92a483b

(cherry picked from commit 2426aaa099e5dfee29cce17af39298d0ce14cc2a)
2021-01-12 16:25:37 +02:00
Meir Shpilraien (Spielrein)
e9f674e5fb Fix issue where fork process deletes the parent pidfile (#8231)
Turns out that when the fork child crashes, the crash log was deleting
the pidfile from the disk (although the parent is still running.

Now we set the pidfile of the fork process to NULL so the fork process
will never deletes it.

(cherry picked from commit 92a483bca2df734aff5caada6c23409ed6256773)
2021-01-12 16:25:37 +02:00
Wen Hui
0f8d47c9ed Sentinel: add missing calls for sentinelflushconfig when config master at runtime (#8229)
(cherry picked from commit 781d7b0d9b51d1d80097c1f6ddec6270c1532ede)
2021-01-12 16:25:37 +02:00
Wen Hui
f1d56c981d fix memory leak in processInlineBuffer error handling code (#8295)
This code path is normally executed only when v6.0 and above replicates from v2.4

(cherry picked from commit cfcd0fa6f71af4e224c1d86be55b6b01f2288be2)
2021-01-12 16:25:37 +02:00
huangzhw
ea595784f9 sdscatfmt call sdsMakeRoomFor, asked for more space than intended (#8286)
instead of asking for the extra new space it wanted, it asked to grow the
string by the size it already has too.
i.e. a string of 1000 bytes, needing to grow by 10 bytes, would have been
asking for an **additional** 1010 bytes.

(cherry picked from commit 595ecd5f4be39eeec71fb07f687b2d6b7cf5c20c)
2021-01-12 16:25:37 +02:00
huangzhw
549fe1f3af sort Command lookupKeyRead and lookupKeyWrite are used on the opposite (#8283)
This is a recent problem, introduced by 7471743 (redis 6.0)

The implications are:
The sole difference between LookupKeyRead and LookupKeyWrite is for command
executed on a replica, which are not received from its master client. (for the master,
and for the master client on the replica, these two functions behave the same)!

Since SORT is a write command, this bug only implicates a writable-replica.
And these are its implications:

- SORT STORE will behave as it did before the above mentioned commit (like before
  redis 6.0). on a writable-replica an already logically expired the key would have
  appeared missing. (store dest key would be deleted, instead of being populated
  with the data from the already logically expired key)
- SORT (the non store variant, which in theory could have been executed on
  read-only-replica if it weren't for the write flag), will (in redis 6.0) have a new bug
  and return the data from the already logically expired key instead of empty response.

(cherry picked from commit 08ad6abd04c5aafe5471fa754000e512ae6b0f05)
2021-01-12 16:25:37 +02:00
Oran Agra
cf6b0f9cef Fix rdb checksum / crc64 on bigendian (#8270)
Turns out the RDB checksum in Redis 6.0 on bigendian is broken.
It always returned 0, so the RDB files are generated as if checksum is
disabled, and will be loaded ok on littleendian, and on bigendian.
But it'll not be able to load RDB files generated on littleendian or older versions.

Similarly DUMP and RESTORE will work on the same version (0==0),
but will be unable to exchange dump payloads with littleendian or old versions.

(cherry picked from commit 324070c8f6f63240629893c2ce9bcbeecf6e77fb)
2021-01-12 16:25:37 +02:00
Oran Agra
02e930624a fix crash in redis-cli after making cluster backup (#8267)
getRDB is "designed" to work in two modes: one for redis-cli --rdb and
one for redis-cli --cluster backup.
in the later case it uses the hiredis connection from the cluster nodes
and it used to free it without nullifying the context, so a later
attempt to free the context would crash.

I suppose the reason it seems to want to free the hiredis context ASAP
is that it wants to disconnect the replica link, so that replication
buffers will not be accumulated.

(cherry picked from commit 41b2ed2bbc0671e43101feecc48cac26a5e312cb)
2021-01-12 16:25:37 +02:00
Oran Agra
ec56906bd6 Fix wrong order of key/value in Lua map response (#8266)
When a Lua script returns a map to redis (a feature which was added in
redis 6 together with RESP3), it would have returned the value first and
the key second.

If the client was using RESP2, it was getting them out of order, and if
the client was in RESP3, it was getting a map of value => key.
This was happening regardless of the Lua script using redis.setresp(3)
or not.

This also affects a case where the script was returning a map which it got
from from redis by doing something like: redis.setresp(3); return redis.call()

This fix is a breaking change for redis 6.0 users who happened to rely
on the wrong order (either ones that used redis.setresp(3), or ones that
returned a map explicitly).

This commit also includes other two changes in the tests:
1. The test suite now handles RESP3 maps as dicts rather than nested
   lists
2. Remove some redundant (duplicate) tests from tracking.tcl

(cherry picked from commit 2017407b4d1d19a91af1e7c0b199f2c1775dbaf9)
2021-01-12 16:25:37 +02:00
Oran Agra
23d299234c Crash log would crash half way on commands with no arguments (#8260)
The crash log attempts to print the current client info, and when it
does that it attempts to check if the first argument happens to be a key
but it did so for commands with no arguments too, which caused the crash
log to crash half way and not reach its end.

(cherry picked from commit 152b5d46c4a76f2d16031ef794092bfc8d322f8a)
2021-01-12 16:25:37 +02:00