Commit Graph

10301 Commits

Author SHA1 Message Date
sundb
5100ef9f82
Fix memory leak in moduleDefragGlobals (#8853) 2021-05-02 10:32:57 +03:00
Huang Zhw
0b1b9edb28
Improve redis-cli help. When help command, we only match command (#8879)
prefix args not all args. So when we help commands with subcommands,
all subcommands will be output.
2021-04-29 12:08:52 +03:00
Binbin
9c927e9de9
Delete some unimplemented prototype. (#8882)
Remove forward declarations from header files to functions that do not exist.
2021-04-29 08:25:10 +03:00
Binbin
1eff8564c7
redis-benchmark: Add zfree(data) and fix lrange size / text mismatch (#8872)
missing zfree(data) in redis-benchmark.

And also correct the wrong size in lrange.
the text mentioned 500, but size was 450, changed to 500
2021-04-28 16:03:24 +03:00
Binbin
416f277339
redis-cli: Do not use hostsocket when we got redirected in cluster mode (#8870)
When redis-cli was used with both -c (cluster) and -s (unix socket),
it would have kept trying to use that unix socket, even if it got
redirected by the cluster (resulting in an infinite loop).
2021-04-28 13:19:55 +03:00
filipe oliveira
ef6f902372
redis-benchmark: Error/Warning handling updates. (#8869)
- Immediately exit on errors that are not related to topology updates.
- Deprecates the `-e` option ( retro compatible ) and warns that we now
  exit immediately on errors that are not related to topology updates.
- Fixed wrongfully failing on config fetch error (warning only). This only affects RE.

Bottom line:
- MOVED and ASK errors will not show any warning (unlike the throttled error with `-e` before).
- CLUSTERDOWN still prints an error unconditionally and sleeps for 1 second.
- other errors are fatal.
2021-04-28 09:51:07 +03:00
Huang Zhw
2b22fffc78
Fix potential CONFIG SET bind test failure. (#8875)
Use an invalid IP address to trigger CONFIG SET bind failure, instead of DNS which is not guaranteed to always fail.
2021-04-27 18:02:23 +03:00
yoav-steinberg
2e88b06396
Bump freebsd-vm version to fix CI failures (#8876)
Specifically we had issues with NTP sync failure which was resolved here: 457af73456
2021-04-27 16:22:22 +03:00
Andy Pan
3d56be3788
Fixes some typos (#8874) 2021-04-27 14:25:02 +03:00
avimredis
93e7750699
GEOSEARCHSTORE: removed unsupported args from comment (#8873) 2021-04-27 10:37:18 +03:00
Oran Agra
46f4ebbe84
Prevent replicas from sending commands that interact with keyspace (#8868)
This solves an issue reported in #8712 in which a replica would bypass
the client write pause check and cause an assertion due to executing a
write command during failover.

The fact is that we don't expect replicas to execute any command other
than maybe REPLCONF and PING, etc. but matching against the ADMIN
command flag is insufficient, so instead i just block keyspace access
for now.
2021-04-27 08:15:10 +03:00
sundb
bcf1b384e3
Remove dead code from lpStringToInt64() (#8863) 2021-04-26 16:40:58 -07:00
avimredis
4bfcf4654a
Fix error reply of GEOSEARCHSTORE unsupported args (#8865)
When [WITHCOORD] [WITHDIST] [WITHHASH] are used, the error mentioned GEORADIUS command
2021-04-26 21:11:38 +03:00
Yossi Gottlieb
ebfbb09109
Remove redundant -latomic on arm64. (#8867) 2021-04-26 18:43:57 +03:00
sundb
074e28a46e
Simplify rax free for RM_FreeServerInfo (#8866) 2021-04-26 16:30:34 +03:00
Andy Pan
a8b6596d23
Fail fast when systemic error occurs in poll (#8749)
Most of the ae.c backends didn't explicitly handle errors, and instead
ignored all errors and did an implicit retry.
This is desired for EAGAIN and EINTER, but in case of other systematic
errors, we prefer to fail and log the error we got rather than get into a busy loop.
2021-04-26 15:52:06 +03:00
Guy Korland
d1ca1e665f
Add codeql static analysis in PR CI (#8854) 2021-04-26 12:55:54 +03:00
Huang Zhw
20735a5354
Distinguish between pong and meet messages in clusterProcessPacket log (#8848)
Fix clusterProcessPacket log don't distinguish between pong and meet.
Additionally log node name instead of pointer and delete a redundant
log.
2021-04-25 19:58:54 -07:00
Huang Zhw
72aa376237
Fix comments and typos in sentinel.c. (#8801) 2021-04-25 15:50:15 +03:00
Yang Bodong
8423b77f14
When the password is wrong, redis-benchmark should exit (#8855) 2021-04-25 14:00:35 +03:00
Oran Agra
611959eee5
fuzz tester, try to print hung command (#8837) 2021-04-25 13:08:46 +03:00
ZheNing Hu
828ae842b9
Improve ziplistRandomPairs code logic (#8851)
After sorting, each item in picks is sorted according
to its index.

In the original code logic, we traverse from the first
element of ziplist until `zipindex == picks[pickindex].index`.

We may be able to start directly in `picks[0].index`,
this will bring small performance improvement.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
2021-04-25 10:53:53 +03:00
sundb
f29a0b9351
Fix some wrongly used constants in module.c (#8844)
This change does not fix any bugs.
1. ```moduleUnload``` should return ```C_OK``` or ```C_ERR```, not ```REDISMODULE_ERR``` or ```REDISMODULE_OK```.
2. The ```where``` parameter of ```listTypePush``` and ```listTypePop``` should be ```LIST_HEAD``` or ```LIST_TAIL```
2021-04-25 10:36:02 +03:00
pfee
cc0091f0f9
Typo fix in gen-test-certs.sh (#8841) 2021-04-25 10:11:16 +03:00
Istemi Ekin Akkus
af035c1e1d
Modules: Fix RM_GetClusterNodeInfo() to correctly populate the master_id (#8846) 2021-04-25 10:05:12 +03:00
bugwz
e43dbd03f3
Fixes a comment typo in sentinel.c (#8845) 2021-04-24 14:19:25 +03:00
彬彬同学丶
c4a5816ccd
Changes http to https in README.md (#8843) 2021-04-24 14:16:39 +03:00
zyxwvu Shi
f61c37cec9
Use monotonic clock to check for Lua script timeout. (#8812)
This prevents a case where NTP moves the system clock
forward resulting in a false detection of a busy script.

Signed-off-by: zyxwvu Shi <i@shiyc.cn>
2021-04-22 08:59:10 +03:00
Wang Yuan
63acfe4b00
Expire key firstly and then notify keyspace event (#8830)
Modules event subscribers may get wrong things in notifyKeyspaceEvent callback,
such as wrong number of keys, or be able to lookup this key.
This commit changes the order to be like the one in evict.c.

Cleanup:
Since we know the key exists (it expires now), db*Delete is sure to return 1,
so there's no need to check it's output (misleading).
2021-04-22 08:32:43 +03:00
Javier Li Sam
b9d7d55b2c
Update redis conf (#8707)
* Fix typo for compatible
* Trim trailing whitespace
2021-04-21 13:51:52 +03:00
Ikko Ashimine
ac36161694
Fix typo in server.c (#8809) 2021-04-21 13:43:38 +03:00
xsddz
473588c399
Fix typo in rdb.c (#8827) 2021-04-21 13:43:06 +03:00
Uri Shachar
9fab26904f
Fix typo and (hopefully) slightly improve comment readability (#8834) 2021-04-21 13:42:46 +03:00
Seunghyun Lee
8636c3e003
Fix typo in redis-cli.c (#8772) 2021-04-21 13:41:25 +03:00
Oran Agra
bb16cf0f4f
fix anetGenericAccept error return check (#8835)
the anetGenericAccept return ANET_ERR but outside use constant -1

Co-authored-by: libo <buaa_libo@126.com>
2021-04-21 13:33:18 +03:00
Andy Pan
5f6e166bce
Shrink code lines and reduce code cyclomatic complexity (#8748)
code cleanup in anetGenericAccept
2021-04-21 09:04:36 +03:00
bugwz
761d7d2771
Print the number of abnormal line in AOF (#8823)
When redis-check-aof finds an error, it prints the line number for faster troubleshooting.
2021-04-20 21:51:24 +03:00
Huang Zhw
080d4579db
Fix migrateCommand may migrate wrong value. (#8815)
This scene is hard to happen. When first attempt some keys expired,
only kv position is updated not ov. Then socket err happens, second
attempt is taken. This time kv items may be mismatching with ov items.
2021-04-20 10:59:44 +03:00
Madelyn Olson
c73b4ddfd9
Fix memory leak when doing lazyfreeing client tracking table (#8822)
Interior rax pointers were not being freed
2021-04-19 22:16:27 -07:00
Bonsai
c2aff4c744
clean dead assignment, start is never used in sdstrim function (#8796) 2021-04-19 21:37:37 -07:00
Viktor Söderqvist
61d3fdb474
Fix space included in links in modules API doc (#8818) 2021-04-19 21:35:14 +03:00
Hanna Fadida
53a4d6c3b1
Modules: adding a module type for key space notification (#8759)
Adding a new type mask ​for key space notification, REDISMODULE_NOTIFY_MODULE, to enable unique notifications from commands on REDISMODULE_KEYTYPE_MODULE type keys (which is currently unsupported).

Modules can subscribe to a module key keyspace notification by RM_SubscribeToKeyspaceEvents,
and clients by notify-keyspace-events of redis.conf or via the CONFIG SET, with the characters 'd' or 'A' 
(REDISMODULE_NOTIFY_MODULE type mask is part of the '**A**ll' notation for key space notifications).

Refactor: move some pubsub test infra from pubsub.tcl to util.tcl to be re-used by other tests.
2021-04-19 21:33:26 +03:00
guybe7
f40ca9cb58
Modules: Replicate lazy-expire even if replication is not allowed (#8816)
Before this commit using RM_Call without "!" could cause the master
to lazy-expire a key (delete it) but without replicating to replicas.
This could cause the replica's memory usage to gradually grow and
could also cause consistency issues if the master and replica have
a clock diff.
This bug was introduced in #8617

Added a test which demonstrates that scenario.
2021-04-19 17:16:02 +03:00
Harkrishn Patro
7a3d1487e4
ACL channels permission handling for save/load scenario. (#8794)
In the initial release of Redis 6.2 setting a user to only allow pubsub access to
a specific channel, and doing ACL SAVE, resulted in an assertion when
ACL LOAD was used. This was later changed by #8723 (not yet released),
but still not properly resolved (now it errors instead of crash).

The problem is that the server that generates an ACL file, doesn't know what
would be the setting of the acl-pubsub-default config in the server that will load it.
so ACL SAVE needs to always start with resetchannels directive.

This should still be compatible with old acl files (from redis 6.0), and ones from earlier
versions of 6.2 that didn't mess with channels.

Co-authored-by: Harkrishn Patro <harkrisp@amazon.com>
Co-authored-by: Oran Agra <oran@redislabs.com>
2021-04-19 13:27:44 +03:00
sundb
3a955d9ad4
Fix ouput buffer limit test (#8803)
The tail size of c->reply is 16kb, but in the test only publish a
few chars each time, due to a change in #8699, the obuf limit
is now checked a new memory allocation is made, so this test
would have sometimes failed to trigger a soft limit disconnection
in time.

The solution is to write bigger payloads to the output buffer, but
still limit their rate (not more than 100k/s).
2021-04-19 10:08:07 +03:00
Wen Hui
0413fbc7d0
fix invalid master_link_down_since_seconds in info repication (#8785)
When replica never successfully connect to master, server.repl_down_since
will be initialized to 0, therefore, the info master_link_down_since_seconds
was showing the current unix timestamp, which does not make much sense.

This commit fixes the issue by showing master_link_down_since_seconds to -1.
means the replica never connect to master before.

This commit also resets this variable back to 0 when a replica is turned into
a master, so that it'll behave the same if the master is later turned into a
replica again.

The implication of this change is that if some app is checking if the value is > 60
do something, like conclude the replica is stale, this could case harm (changing
a big positive number with a small one).
2021-04-19 09:34:21 +03:00
Yossi Gottlieb
c0f5c678c2
Revert cluster slot migration tests. (#8806)
Disables #8649 and subsequent attempts to stabilize the test.
2021-04-18 20:51:08 +03:00
Oran Agra
a9897b0084
Fix timing of new replication test (#8807)
In github actions CI with valgrind, i saw that even the fast replica
(one that wasn't paused), didn't get to complete the replication fast
enough, and ended up getting disconnected by timeout.

Additionally, due to a typo in uname, we didn't get to actually run the
CPU efficiency part of the test.
2021-04-18 15:12:34 +03:00
Oran Agra
f4b5a4d869
Improve testsuite print of log file (#8805)
1. the `dump_logs` option would have printed only logs of servers that were
   spawn before the test proc started, and not ones that the test proc
   started inside it.
2. when a server proc catches an exception it should normally forward the
   exception upwards, specifically when it's an assertion that should be
   caught by a test proc above. however, in `durable` mode, we caught all
   exceptions printed them to stdout and let the code continue,
   this was wrong to do for assertions, which should have still been
   propagated to the test function.
3. don't bother to search for crash log to print if we printed the the
   entire log anyway
4. if no crash log was found, no need to print anything (i.e. the fact it
   wasn't found)
5. rename warnings_from_file to crashlog_from_file
2021-04-18 11:55:54 +03:00
guybe7
a60016e061
ReplicationCron: Prevent invalid access to freed pointer (#8799)
Fixes #8797
2021-04-16 16:56:38 +03:00