423 Commits

Author SHA1 Message Date
antirez
0f50c7c959 Simplify comment in moduleTryServeClientBlockedOnKey(). 2020-04-07 16:52:04 +02:00
Guy Benoish
f1ed8d93a0 Fix memory corruption in moduleHandleBlockedClients
By using a "circular BRPOPLPUSH"-like scenario it was
possible the get the same client on db->blocking_keys
twice (See comment in moduleTryServeClientBlockedOnKey)

The fix was actually already implememnted in
moduleTryServeClientBlockedOnKey but it had a bug:
the funxction should return 0 or 1 (not OK or ERR)

Other changes:
1. Added two commands to blockonkeys.c test module (To
   reproduce the case described above)
2. Simplify blockonkeys.c in order to make testing easier
3. cast raxSize() to avoid warning with format spec
2020-04-07 16:52:03 +02:00
antirez
514ca204bb Fix module commands propagation double MULTI bug.
b512cb40 introduced automatic wrapping of MULTI/EXEC for the
alsoPropagate API. However this collides with the built-in mechanism
already present in module.c. To avoid complex changes near Redis 6 GA
this commit introduces the ability to exclude call() MUTLI/EXEC wrapping
for also propagate in order to continue to use the old code paths in
module.c.
2020-03-31 16:57:20 +02:00
antirez
fde20b7967 Fix RM_Call() stale comment due to cut&paste. 2020-03-31 16:57:20 +02:00
antirez
5a13e0feb1 Modules: updated function doc after #7003. 2020-03-25 15:55:24 +01:00
Guy Benoish
6680c06705 Allow RM_GetContextFlags to work with ctx==NULL 2020-03-25 15:55:24 +01:00
chendianqiang
1994eda07e use correct list for moduleUnregisterUsedAPI 2020-03-25 15:54:34 +01:00
antirez
8a7e1fe3b0 Modules: reformat RM_Scan() top comment a bit. 2020-03-05 12:51:14 +01:00
antirez
76cfe21ff7 Modules: more details in RM_Scan API top comment. 2020-03-05 12:51:14 +01:00
Oran Agra
0693ac1961 RM_Scan disable dict rehashing
The callback approach we took is very efficient, the module can do any
filtering of keys without building any list and cloning strings, it can
also read data from the key's value. but if the user tries to re-open
the key, or any other key, this can cause dict re-hashing (dictFind does
that), and that's very bad to do from inside dictScan.

this commit protects the dict from doing any rehashing during scan, but
also warns the user not to attempt any writes or command calls from
within the callback, for fear of unexpected side effects and crashes.
2020-03-05 12:51:14 +01:00
Guy Benoish
470de731e9 Add RM_CreateStringFromDouble 2020-03-05 12:51:14 +01:00
Oran Agra
bec15e6534 module api docs for aux_save and aux_load 2020-03-05 12:51:14 +01:00
meir@redislabs.com
22c571795c Changed log level for module fork api from 'notice' to 'verbos'. 2020-02-27 18:02:30 +01:00
Ariel
663d207da4 fix ThreadSafeContext lock/unlock function names 2020-02-27 18:02:30 +01:00
Guy Benoish
9d5f9b3cb5 Modules: Do not auto-unblock clients if not blocked on keys 2020-02-27 18:02:30 +01:00
Oran Agra
d733b3ba17 add no-slowlog option to RM_CreateCommand 2020-02-27 17:59:57 +01:00
Guy Benoish
98a59c540d Exclude "keymiss" notification from NOTIFY_ALL
Because "keymiss" is "special" compared to the rest of
the notifications (Trying not to break existing apps
using the 'A' format for notifications)

Also updated redis.conf and module.c docs
2020-02-12 14:17:54 +01:00
Oran Agra
a1a25bc7f1 update RM_SignalModifiedKey doc comment 2020-02-12 14:17:40 +01:00
Oran Agra
a98e5a1fc3 Fix client flags to be int64 in module.c
currently there's no bug since the flags these functions handle are
always lower than 32bit, but still better fix the type to prevent future
bugs.
2020-02-12 14:17:40 +01:00
Oran Agra
e92983ed3f moduleRDBLoadError, add key name, and use panic rather than exit
using panic rather than exit means you get s stack trace of the code
path that experianced the error, and possibly other info.
2020-02-12 14:17:40 +01:00
Oran Agra
2ffb9a3682 fix uninitialized info_cb var in module.c 2020-02-04 10:23:48 +01:00
Guy Benoish
2ad427f862 ld2string should fail if string contains \0 in the middle
This bug affected RM_StringToLongDouble and HINCRBYFLOAT.
I added tests for both cases.

Main changes:
1. Fixed string2ld to fail if string contains \0 in the middle
2. Use string2ld in getLongDoubleFromObject - No point of
   having duplicated code here

The two changes above broke RM_SaveLongDouble/RM_LoadLongDouble
because the long double string was saved with length+1 (An innocent
mistake, but it's actually a bug - The length passed to
RM_SaveLongDouble should not include the last \0).
2020-02-04 10:23:48 +01:00
antirez
229229eb55 Add more info in the unblockClientFromModule() function. 2020-02-04 10:23:48 +01:00
Guy Benoish
d9f508d527 Modules: Fix blocked-client-related memory leak
If a blocked module client times-out (or disconnects, unblocked
by CLIENT command, etc.) we need to call moduleUnblockClient
in order to free memory allocated by the module sub-system
and blocked-client private data

Other changes:
Made blockedonkeys.tcl tests a bit more aggressive in order
to smoke-out potential memory leaks
2020-02-04 10:23:48 +01:00
Yossi Gottlieb
3f8a690161 Add REDISMODULE_CTX_FLAGS_MULTI_DIRTY. 2020-01-10 13:16:03 +01:00
antirez
a640d1bb5c Fix ip and missing mode in RM_GetClusterNodeInfo(). 2019-12-29 15:46:31 +01:00
Salvatore Sanfilippo
95a43c2178 Merge pull request #6615 from soloestoy/wrap-also-propagate-as-multi
Wrap also propagate as multi
2019-12-19 09:24:52 +01:00
antirez
15e2c2b2f1 Modules: rewrite top function doc of AvoidReplicaTraffic(). 2019-12-18 17:11:03 +01:00
Salvatore Sanfilippo
f9644f1903 Merge pull request #6497 from oranagra/avoid_replica_traffic
Add config and module API for AvoidReplicaTraffic
2019-12-18 17:06:05 +01:00
antirez
75687fcf17 Avoid changing setKey() API after #6679 fix. 2019-12-18 11:58:02 +01:00
zhaozhao.zz
746c23419f add a new SET option KEEPTTL that doesn't remove expire time 2019-12-18 15:20:36 +08:00
Salvatore Sanfilippo
8912e70042 Merge pull request #5916 from madolson/dev-unstable-acl-module-pr
Add module APIs for custom authentication
2019-12-17 09:58:26 +01:00
Madelyn Olson
1ce271b9b4 Split error message so dependandent callers give a useful result 2019-12-16 23:34:37 -08:00
Madelyn Olson
35aed09f95 Added better exception handling around scripting and module 2019-12-16 23:33:53 -08:00
Madelyn Olson
783831bb10 Tweaking the documentation 2019-12-17 07:28:55 +00:00
Madelyn Olson
05b7628687 Add module APIs for custom authentication 2019-12-17 06:59:59 +00:00
antirez
caba0f876e Merge branch 'unstable' of github.com:/antirez/redis into unstable 2019-12-16 11:18:20 +01:00
antirez
c600118cfb Modules: allow to execute RM_Call() from the module init function. 2019-12-13 17:34:37 +01:00
Yossi Gottlieb
937a32d84c Improve RM_ModuleTypeReplaceValue() API.
With the previous API, a NULL return value was ambiguous and could
represent either an old value of NULL or an error condition. The new API
returns a status code and allows the old value to be returned
by-reference.

This commit also includes test coverage based on
tests/modules/datatype.c which did not exist at the time of the original
commit.
2019-12-12 18:50:11 +02:00
antirez
22552a5794 Remove useless space from moduleLoad(). 2019-12-12 09:29:10 +01:00
Salvatore Sanfilippo
f1f0548419 Merge branch 'unstable' into ModuleSecurity 2019-12-12 09:27:14 +01:00
Oran Agra
f4a1d066a6 Add module API for AvoidReplicaTraffic
This is useful to tell redis and modules to try to avoid doing things that may
increment the replication offset, and should be used when draining a master
and waiting for replicas to be in perfect sync before a failover.
2019-12-12 08:38:09 +02:00
Salvatore Sanfilippo
1ed8bda113 Merge pull request #6656 from oranagra/leak_rm_load_from_str
fix leak in RM_LoadDataTypeFromString, and save
2019-12-11 11:39:27 +01:00
Oran Agra
4e1326940c fix leak in RM_LoadDataTypeFromString, and save 2019-12-11 12:35:00 +02:00
antirez
e65c6772fc Modules: more clarification about disconnection callback. 2019-12-09 12:15:38 +01:00
antirez
d4c5516650 Modules: clarify when the disconnection callback is called. 2019-12-05 10:38:18 +01:00
antirez
c57ba6d6b4 Modules: create timers in contexts without a client. 2019-12-03 16:21:23 +01:00
zhaozhao.zz
bb0183a3bf Propagation: flag module client as CLIENT_MULTI if needed
in case of nested MULTI/EXEC
2019-11-22 16:20:30 +08:00
zhaozhao.zz
b512cb40b8 Propagation: wrap commands in also_propagate array with MULIT/EXEC
Random command like SPOP with count is replicated as
some SREM operations, and store them in also_propagate
array to propagate after the call, but this would break
atomicity.

To keep the command's atomicity, wrap also_propagate
array with MULTI/EXEC.
2019-11-22 15:42:49 +08:00
Salvatore Sanfilippo
22c68cc3bf Merge branch 'unstable' into rm_get_server_info 2019-11-21 10:06:15 +01:00