173 Commits

Author SHA1 Message Date
antirez
88c5e317c6 Modules: convert hash to hash table for big objects. 2018-06-19 16:03:00 +02:00
zhaozhao.zz
ba2dbba0cb Modules Timer API: fix wrong raxInsert() usage 2018-04-14 01:20:02 +08:00
antirez
7365cbf830 Modules API: Add call to get the blocked client handle from the context.
This is useful in the reply and timeout callback, if the module wants to
do some cleanup of the blocked client handle that may be stored around
in the module-private data structures.
2018-04-13 13:48:11 +02:00
antirez
d7fdac673c Modules API: moduleGetReplyClient() refactoring. 2018-04-13 13:42:49 +02:00
antirez
f305a7790d Modules API: blocked client disconnection callback. 2018-04-12 13:21:48 +02:00
antirez
643d5348cc Modules API: fix OOM_WARNING flag implementation. 2018-04-11 16:25:54 +02:00
antirez
936e29a1f3 Modules API: OOM_WARNING flags.
In some modules it may be useful to have an idea about being near to
OOM. Anyway additionally an explicit call to get the fill ratio will be
added in the future.
2018-04-11 16:22:52 +02:00
antirez
a0149c995b getMaxmemoryState() fixed and improved. 2018-04-11 12:48:26 +02:00
antirez
0d46b971f6 Modules: context flags now include OOM flag.
Plus freeMemoryIfNeeded() refactoring to improve legibility.
Please review this commit for sanity.
2018-04-09 17:44:30 +02:00
antirez
095de965c1 Modules: remove trailing empty spaces. 2018-04-09 17:16:55 +02:00
antirez
73b4f7873a Modules API: blocked client free callback modified to get a context.
Note that this was an experimental API that can only be enabled with
REIDSMODULE_EXPERIMENTAL_API, so it is subject to change until its
promoted to stable API. Sorry for the breakage, it is trivial to
resolve btw. This change will not be back ported to Redis 4.0.
2018-04-09 11:54:44 +02:00
antirez
7b028a237c Modules API: RM_GetRandomBytes() / GetRandomHexChars(). 2018-04-05 13:24:22 +02:00
antirez
978dd8a7f5 Modules Cluster API: GetClusterSize() added. 2018-04-01 16:36:32 +02:00
antirez
9302109e72 Modules Cluster API: GetMyClusterID() added. 2018-04-01 16:20:57 +02:00
antirez
736c0fc956 Modules Timer API: Wait at least 1 ms per iteration. Convert to ms. 2018-03-31 10:11:30 +02:00
antirez
e40b8e352e Modules Timer API: fix wrong raxRemove() key argument. 2018-03-31 09:58:43 +02:00
antirez
d120cca2f5 Modules Timer API: fix infinite loop and export API. 2018-03-31 00:44:46 +02:00
antirez
203257f3d7 Modules Timer API: timer handling implemented. 2018-03-30 22:50:21 +02:00
antirez
432e3e0b1c Modules Timer API: initial implementation. 2018-03-30 20:40:35 +02:00
antirez
a8857e6cba Modules Cluster API: node API exported, example improved. 2018-03-30 17:00:45 +02:00
antirez
ac2094f975 Modules Cluster API: nodes list and info API. 2018-03-30 16:16:47 +02:00
antirez
088dac5743 Modules Cluster API: node information struct and flags. 2018-03-30 13:16:55 +02:00
antirez
d7faf88f39 Modules Cluster API: make node IDs pointers constant. 2018-03-30 13:16:07 +02:00
antirez
9aa6ac8867 Modules Cluster API: fix new API calls exporting. 2018-03-30 12:49:16 +02:00
antirez
d0bf651ff9 Modules Cluster API: sending / receiving API first implementation. 2018-03-30 11:06:08 +02:00
antirez
3cb3ea3902 Modules Cluster API: message bus implementation. 2018-03-29 15:13:31 +02:00
charsyam
063e4b44c0 fix dlopen leak 2018-03-01 21:22:42 +09:00
antirez
f4395e232b Remove non semantical spaces from module.c. 2018-02-15 21:41:03 +01:00
Dvir Volk
0690168116 Add doc comment about notification flags 2018-02-14 21:54:00 +02:00
Dvir Volk
fbd0514a1f Use one static client for all keyspace notification callbacks 2018-02-14 21:40:10 +02:00
Dvir Volk
c54aaca680 Remove the NOTIFY_MODULE flag and simplify the module notification flow if there aren't subscribers 2018-02-14 21:40:10 +02:00
Dvir Volk
fa3b63fe82 Document flags for notifications 2018-02-14 21:38:58 +02:00
Dvir Volk
053941b983 finished implementation of notifications. Tests unfinished 2018-02-14 21:38:58 +02:00
Salvatore Sanfilippo
86fce15f71 Merge pull request #4581 from dvirsky/module_unlink
Added RM_UnlinkKey - a low level analog to UNLINK command
2018-01-12 17:41:09 +01:00
Dvir Volk
f47914ea05 Added RM_UnlinkKey - a low level analog to UNLINK command 2018-01-07 16:41:43 +02:00
Oran Agra
7fbdeedd6a fix processing of large bulks (above 2GB)
- protocol parsing (processMultibulkBuffer) was limitted to 32big positions in the buffer
  readQueryFromClient potential overflow
- rioWriteBulkCount used int, although rioWriteBulkString gave it size_t
- several places in sds.c that used int for string length or index.
- bugfix in RM_SaveAuxField (return was 1 or -1 and not length)
- RM_SaveStringBuffer was limitted to 32bit length
2017-12-29 12:24:19 +02:00
antirez
63f2530a04 Modules: fix memory leak in RM_IsModuleNameBusy(). 2017-11-24 13:29:54 +01:00
Salvatore Sanfilippo
4394eedf5e Merge pull request #4344 from soloestoy/fix-module-name-conflict
Fix module name conflict
2017-11-24 09:37:06 +01:00
antirez
cff7b04fdc Modules: fix for scripting replication of modules commands.
See issue #4466 / #4467.
2017-11-23 15:14:17 +01:00
Yossi Gottlieb
3246b95129 Nested MULTI/EXEC may replicate in different cases.
For example:
1. A module command called within a MULTI section.
2. A Lua script with replicate_commands() called within a MULTI section.
3. A module command called from a Lua script in the above context.
2017-11-22 22:02:51 +02:00
antirez
ba954302f6 Limit statement in RM_BlockClient() to 80 cols. 2017-09-28 23:15:34 +02:00
zhaozhao.zz
f1333eb992 Modules: handle the busy module name 2017-09-28 17:38:40 +08:00
zhaozhao.zz
7fb3864e95 Modules: handle the conflict of registering commands 2017-09-28 16:21:21 +08:00
Dvir Volk
6f37695620 Added safety net preventing redis from crashing if a module decide to block in MULTI 2017-09-27 15:17:53 +03:00
Dvir Volk
c3777932f6 Renamed GetCtxFlags to GetContextFlags 2017-09-27 11:58:16 +03:00
Dvir Volk
f5909f2c18 Added support for module context flags with RM_GetCtxFlags 2017-09-27 11:58:07 +03:00
antirez
4bd29fcdab Modules: don't crash when Lua calls a module blocking command.
Lua scripting does not support calling blocking commands, however all
the native Redis commands are flagged as "s" (no scripting flag), so
this is not possible at all. With modules there is no such mechanism in
order to flag a command as non callable by the Lua scripting engine,
moreover we cannot trust the modules users from complying all the times:
it is likely that modules will be released to have blocking commands
without such commands being flagged correctly, even if we provide a way to
signal this fact.

This commit attempts to address the problem in a short term way, by
detecting that a module is trying to block in the context of the Lua
scripting engine client, and preventing to do this. The module will
actually believe to block as usually, but what happens is that the Lua
script receives an error immediately, and the background call is ignored
by the Redis engine (if not for the cleanup callbacks, once it
unblocks).

Long term, the more likely solution, is to introduce a new call called
RedisModule_GetClientFlags(), so that a command can detect if the caller
is a Lua script, and return an error, or avoid blocking at all.

Being the blocking API experimental right now, more work is needed in
this regard in order to reach a level well blocking module commands and
all the other Redis subsystems interact peacefully.

Now the effect is like the following:

    127.0.0.1:6379> eval "redis.call('hello.block',1,5000)" 0
    (error) ERR Error running script (call to
    f_b5ba35ff97bc1ef23debc4d6e9fd802da187ed53): @user_script:1: ERR
    Blocking module command called from Lua script

This commit fixes issue #4127 in the short term.
2017-07-23 12:55:37 +02:00
antirez
70f29030ae Fix typo in unblockClientFromModule() top comment. 2017-07-23 12:41:26 +02:00
antirez
a19700091a Fix two bugs in moduleTypeLookupModuleByID().
The function cache was not working at all, and the function returned
wrong values if there where two or more modules exporting native data
types.

See issue #4131 for more details.
2017-07-20 14:59:42 +02:00
antirez
b36074dae3 Modules: fix thread safe context DB selection.
Before this fix the DB currenty selected by the client blocked was not
respected and operations were always performed on DB 0.
2017-07-14 13:02:15 +02:00