9183 Commits

Author SHA1 Message Date
Dave Nielsen
a88be2c6eb updated copyright year
Changed "2015" to "2020"

(cherry picked from commit e54ea02c4366632fe546c509453edc91748dbe95)
2020-07-20 21:08:26 +03:00
Oran Agra
8510588213 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 fe8d6fe74920798c146a587810ee91ff049a9093)
2020-07-20 21:08:26 +03:00
antirez
63073e6a44 Include cluster.h for getClusterConnectionsCount().
(cherry picked from commit 79e15d1686462c750073ed12c1bfab7fa8b090c8)
2020-07-20 21:08:26 +03:00
antirez
5f889001cf Fix BITFIELD i64 type handling, see #7417.
(cherry picked from commit 448a8bb0ed9e970a1c6db594a5dc88ded1036695)
2020-07-20 21:08:26 +03:00
antirez
93fa64f65a Clarify maxclients and cluster in conf. Remove myself too.
(cherry picked from commit c10a7a040f10e32f4a27288499c0c1e104754a1b)
2020-07-20 21:08:26 +03:00
hwware
e4e223ad79 fix memory leak in sentinel connection sharing
(cherry picked from commit bdac36b70e222e9457bad0c682f2f5bc2ba25238)
2020-07-20 21:08:26 +03:00
chenhui0212
ee992ea113 Fix comments in function raxLowWalk of listpack.c
(cherry picked from commit 44235ac718e34576fa9d202bd86132f5b2976b77)
2020-07-20 21:08:26 +03:00
Tomasz Poradowski
f13381da22 ensure SHUTDOWN_NOSAVE in Sentinel mode
- enforcing of SHUTDOWN_NOSAVE flag in one place to make it consitent
  when running in Sentinel mode

(cherry picked from commit 6782243054d7f8b5b861b5ae367db22b0f47a3b9)
2020-07-20 21:08:26 +03:00
chenhui0212
1c733df3d8 fix comments in listpack.c
(cherry picked from commit 6b82471098a03babcd9cd9a2ff63ba0d138a4279)
2020-07-20 21:08:26 +03:00
antirez
7412dbbef5 Use cluster connections too, to limit maxclients.
See #7401.

(cherry picked from commit fc08cafdb0e7f86ddd4ededfed87026b02f8447d)
2020-07-20 21:08:26 +03:00
antirez
d5515331e2 Tracking: fix enableBcastTrackingForPrefix() invalid sdslen() call.
Related to #7387.

(cherry picked from commit ae770c30349cb4c72393f3b70318371081f3cc65)
2020-07-20 21:08:26 +03:00
root
09e960ff62 cluster.c remove if of clusterSendFail in markNodeAsFailingIfNeeded
(cherry picked from commit 009a2d443a92f30e0f45ade08ce6fea275a5d71f)
2020-07-20 21:08:26 +03:00
meir@redislabs.com
cb06a48ef3 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 e37c16e42551a3a5c61e1f8a90cfc672d3e010e4)
2020-07-20 21:08:26 +03:00
antirez
9d3e874179 Fix LCS object type checking. Related to #7379.
(cherry picked from commit 00e1f87a08f7e0f2e1706a8f937671b83dc63f12)
2020-07-20 21:08:26 +03:00
hwware
3dbde34323 fix memory leak
(cherry picked from commit 8ab655bd7b92f4cc310cdfbf974c6c8627446628)
2020-07-20 21:08:26 +03:00
hwware
4a03e1e1f8 fix server crash in STRALGO command
(cherry picked from commit 44195a2047efbe4db1b37365bd4ed66ba0f9d306)
2020-07-20 21:08:26 +03:00
Benjamin Sergeant
2f9da08ead Update redis-cli.c
(cherry picked from commit 52a477c661beabb3308767a442178824579be912)
2020-07-20 21:08:26 +03:00
Jamie Scott
333f763693 minor fix
(cherry picked from commit 3ba9724d1637aad9699d652b150ad7860b7016d0)
2020-07-20 21:08:26 +03:00
antirez
d05cc51e4e help.h updated. 2020-06-12 12:16:24 +02:00
antirez
3dc6657ea8 LPOS: tests + crash fix. 2020-06-12 12:08:06 +02:00
antirez
010dd2b320 LPOS: update to latest proposal.
See https://gist.github.com/antirez/3591c5096bc79cad8b5a992e08304f48
2020-06-12 12:08:06 +02:00
antirez
00e400ed66 LPOS: implement the final design. 2020-06-12 12:08:06 +02:00
Paul Spooren
795c807fed LRANK: Add command (the command will be renamed LPOS).
The `LRANK` command returns the index (position) of a given element
within a list. Using the `direction` argument it is possible to specify
going from head to tail (acending, 1) or from tail to head (decending,
-1). Only the first found index is returend. The complexity is O(N).

When using lists as a queue it can be of interest at what position a
given element is, for instance to monitor a job processing through a
work queue. This came up within the Python `rq` project which is based
on Redis[0].

[0]: https://github.com/rq/rq/issues/1197

Signed-off-by: Paul Spooren <mail@aparcar.org>
2020-06-12 12:08:06 +02:00
antirez
ce8f107a5e Redis 6.0.5. 2020-06-09 12:19:30 +02:00
antirez
93e76ba456 Adapt EVAL+busy script test to new behavior. 2020-06-09 12:19:30 +02:00
antirez
e819e3ee26 Temporary fix for #7353 issue about EVAL during -BUSY. 2020-06-09 11:53:01 +02:00
xhe
5fae6590a1 return the correct proto version
HELLO should return the current proto version, while the code hardcoded
3
2020-06-09 11:53:01 +02:00
Oran Agra
640a4479b0 Don't queue commands in an already aborted MULTI state 2020-06-09 11:53:01 +02:00
Oran Agra
881d2c4663 Avoid rejecting WATCH / UNWATCH, like MULTI/EXEC/DISCARD
Much like MULTI/EXEC/DISCARD, the WATCH and UNWATCH are not actually
operating on the database or server state, but instead operate on the
client state. the client may send them all in one long pipeline and check
all the responses only at the end, so failing them may lead to a
mismatch between the client state on the server and the one on the
client end, and execute the wrong commands (ones that were meant to be
discarded)

the watched keys are not actually stored in the client struct, but they
are in fact part of the client state. for instance, they're not cleared
or moved in SWAPDB or FLUSHDB.
2020-06-09 11:53:01 +02:00
zhaozhao.zz
d496ce7271 AOF: append origin SET if no expire option 2020-06-09 11:53:01 +02:00
Oran Agra
216b5a1aae fix disconnectSlaves, to try to free each slave.
the recent change in that loop (iteration rather than waiting for it to
be empty) was intended to avoid an endless loop in case some slave would
refuse to be freed.

but the lookup of the first client remained, which would have caused it
to try the first one again and again instead of moving on.
2020-06-09 11:53:01 +02:00
zhaozhao.zz
2a8ee55176 donot free protected client in freeClientsInAsyncFreeQueue
related #7234
2020-06-09 11:53:01 +02:00
Oran Agra
fed743b2e1 fix pingoff test race 2020-06-06 11:44:21 +02:00
Kevin Fwu
ce014c2a3b Fix TLS certificate loading for chained certificates.
This impacts client verification for chained certificates (such as Lets
Encrypt certificates). Client Verify requires the full chain in order to
properly verify the certificate.
2020-06-06 11:44:21 +02:00
antirez
bec1ac9899 Revert "Implements sendfile for redis."
This reverts commit 5675053269b0cbc2cf525c99321c96b7c2b39abe.
2020-06-06 11:43:29 +02:00
antirez
8bfdba1e08 Revert "avoid using sendfile if tls-replication is enabled"
This reverts commit 13bbd165e87923558952203d310e9ad053d4d7c0.
2020-06-06 11:43:29 +02:00
Liu Zhen
123d94ffc0 fix clusters mixing accidentally by gossip
`clusterStartHandshake` will start hand handshake
and eventually send CLUSTER MEET message, which is strictly prohibited
in the REDIS CLUSTER SPEC.
Only system administrator can initiate CLUSTER MEET message.
Futher, according to the SPEC, rather than IP/PORT pairs, only nodeid
can be trusted.
2020-06-06 11:43:29 +02:00
antirez
a5f0fa7f7a Fix handling of special chars in ACL LOAD.
Now it is also possible for ACL SETUSER to accept empty strings
as valid operations (doing nothing), so for instance

    ACL SETUSER myuser ""

Will have just the effect of creating a user in the default state.

This should fix #7329.
2020-06-06 11:43:29 +02:00
antirez
c512f64428 Redis 6.0.4. 2020-05-28 12:18:38 +02:00
antirez
41bb699867 Test: take PSYNC2 test master timeout high during switch.
This will likely avoid false positives due to trailing pings.
2020-05-28 10:56:14 +02:00
antirez
40578433c7 Test: add the tracking unit as default. 2020-05-28 10:22:29 +02:00
Oran Agra
571b03021a tests: find_available_port start search from next port
i.e. don't start the search from scratch hitting the used ones again.
this will also reduce the likelihood of collisions (if there are any
left) by increasing the time until we re-use a port we did use in the
past.
2020-05-28 10:09:51 +02:00
Oran Agra
4653d796f0 tests: each test client work on a distinct port range
apparently when running tests in parallel (the default of --clients 16),
there's a chance for two tests to use the same port.
specifically, one test might shutdown a master and still have the
replica up, and then another test will re-use the port number of master
for another master, and then that replica will connect to the master of
the other test.

this can cause a master to count too many full syncs and fail a test if
we run the tests with --single integration/psync2 --loop --stop

see Probmem 2 in #7314
2020-05-28 10:09:51 +02:00
Oran Agra
31bd963557 32bit CI needs to build modules correctly 2020-05-28 10:09:51 +02:00
Oran Agra
01039e5964 adjust revived meaningful offset tests
these tests create several edge cases that are otherwise uncovered (at
least not consistently) by the test suite, so although they're no longer
testing what they were meant to test, it's still a good idea to keep
them in hope that they'll expose some issue in the future.
2020-05-28 10:09:51 +02:00
Oran Agra
98e6f2cd5b revive meaningful offset tests 2020-05-28 10:09:51 +02:00
antirez
84117d13b7 Replication: showLatestBacklog() refactored out. 2020-05-28 10:09:51 +02:00
antirez
14d99c183f Drop useless line from replicationCacheMaster(). 2020-05-28 10:09:51 +02:00
antirez
0163e4e495 Another meaningful offset test removed. 2020-05-28 10:09:51 +02:00
antirez
24a0f7bf55 Remove the PSYNC2 meaningful offset test. 2020-05-28 10:09:51 +02:00