181 Commits

Author SHA1 Message Date
Guy Korland
5946410d7b Few typo fixes 2018-07-30 16:18:56 +03:00
Oran Agra
28cf208bf3 slave buffers were wasteful and incorrectly counted causing eviction
A) slave buffers didn't count internal fragmentation and sds unused space,
   this caused them to induce eviction although we didn't mean for it.

B) slave buffers were consuming about twice the memory of what they actually needed.
- this was mainly due to sdsMakeRoomFor growing to twice as much as needed each time
  but networking.c not storing more than 16k (partially fixed recently in 237a38737).
- besides it wasn't able to store half of the new string into one buffer and the
  other half into the next (so the above mentioned fix helped mainly for small items).
- lastly, the sds buffers had up to 30% internal fragmentation that was wasted,
  consumed but not used.

C) inefficient performance due to starting from a small string and reallocing many times.

what i changed:
- creating dedicated buffers for reply list, counting their size with zmalloc_size
- when creating a new reply node from, preallocate it to at least 16k.
- when appending a new reply to the buffer, first fill all the unused space of the
  previous node before starting a new one.

other changes:
- expose mem_not_counted_for_evict info field for the benefit of the test suite
- add a test to make sure slave buffers are counted correctly and that they don't cause eviction
2018-07-16 16:43:42 +03:00
Jack Drogon
bae1d36e5d Fix typo 2018-07-03 18:19:46 +02:00
antirez
938d879c2a addReplySubSyntaxError() renamed to addReplySubcommandSyntaxError(). 2018-07-02 18:49:34 +02:00
Salvatore Sanfilippo
c44be0ab9b Merge pull request #4998 from itamarhaber/module_command_help
Module command help
2018-07-02 18:46:56 +02:00
shenlongxing
dbd1e254bd fix typo 2018-06-21 22:08:09 +08:00
antirez
38d51cbdec Modules: convert hash to hash table for big objects. 2018-06-19 16:03:00 +02:00
Itamar Haber
3b00405ac3 Capitalizes subscommands 2018-06-09 20:54:05 +03:00
Itamar Haber
08dda5f48f Adds MODULE HELP and implements addReplySubSyntaxError 2018-06-07 18:34:58 +03:00
zhaozhao.zz
0884b7a0a2 Modules Timer API: fix wrong raxInsert() usage 2018-04-14 01:20:02 +08:00
antirez
9191287d08 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
d9c726232c Modules API: moduleGetReplyClient() refactoring. 2018-04-13 13:42:49 +02:00
antirez
c8e556d710 Modules API: blocked client disconnection callback. 2018-04-12 13:21:48 +02:00
antirez
1192174b53 Modules API: fix OOM_WARNING flag implementation. 2018-04-11 16:25:54 +02:00
antirez
338d823975 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
62a9ee1988 getMaxmemoryState() fixed and improved. 2018-04-11 12:48:26 +02:00
antirez
7713af1b0c 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
e5b0340ecb Modules: remove trailing empty spaces. 2018-04-09 17:16:55 +02:00
antirez
1331ce96af 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
5957ec011b Modules API: RM_GetRandomBytes() / GetRandomHexChars(). 2018-04-05 13:24:22 +02:00
antirez
b9f0a4a7d5 Modules Cluster API: GetClusterSize() added. 2018-04-01 16:36:32 +02:00
antirez
778800f2c5 Modules Cluster API: GetMyClusterID() added. 2018-04-01 16:20:57 +02:00
antirez
b793d92918 Modules Timer API: Wait at least 1 ms per iteration. Convert to ms. 2018-03-31 10:11:30 +02:00
antirez
41d0174213 Modules Timer API: fix wrong raxRemove() key argument. 2018-03-31 09:58:43 +02:00
antirez
ba7d6001ba Modules Timer API: fix infinite loop and export API. 2018-03-31 00:44:46 +02:00
antirez
751ae32f75 Modules Timer API: timer handling implemented. 2018-03-30 22:50:21 +02:00
antirez
397089524e Modules Timer API: initial implementation. 2018-03-30 20:40:35 +02:00
antirez
b3291b0706 Modules Cluster API: node API exported, example improved. 2018-03-30 17:00:45 +02:00
antirez
611a5097e5 Modules Cluster API: nodes list and info API. 2018-03-30 16:16:47 +02:00
antirez
2ce3d47055 Modules Cluster API: node information struct and flags. 2018-03-30 13:16:55 +02:00
antirez
055ab3623b Modules Cluster API: make node IDs pointers constant. 2018-03-30 13:16:07 +02:00
antirez
9d5a054975 Modules Cluster API: fix new API calls exporting. 2018-03-30 12:49:16 +02:00
antirez
0edbb9221b Modules Cluster API: sending / receiving API first implementation. 2018-03-30 11:06:08 +02:00
antirez
72f11ded18 Modules Cluster API: message bus implementation. 2018-03-29 15:13:31 +02:00
charsyam
bc0b9d99b8 fix dlopen leak 2018-03-01 21:22:42 +09:00
antirez
ab4dddc4eb Remove non semantical spaces from module.c. 2018-02-15 21:41:03 +01:00
Dvir Volk
4538c12708 Add doc comment about notification flags 2018-02-14 21:54:00 +02:00
Dvir Volk
f48814e99d Use one static client for all keyspace notification callbacks 2018-02-14 21:40:10 +02:00
Dvir Volk
383edf2101 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
4f3e266117 Document flags for notifications 2018-02-14 21:38:58 +02:00
Dvir Volk
20f414af40 finished implementation of notifications. Tests unfinished 2018-02-14 21:38:58 +02:00
Salvatore Sanfilippo
2e51347925 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
7e4794f67c Added RM_UnlinkKey - a low level analog to UNLINK command 2018-01-07 16:41:43 +02:00
Oran Agra
5821e8cf82 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
78c28a5a54 Modules: fix memory leak in RM_IsModuleNameBusy(). 2017-11-24 13:29:54 +01:00
Salvatore Sanfilippo
8fa2ab29d8 Merge pull request #4344 from soloestoy/fix-module-name-conflict
Fix module name conflict
2017-11-24 09:37:06 +01:00
antirez
c2097bc95c Modules: fix for scripting replication of modules commands.
See issue #4466 / #4467.
2017-11-23 15:14:17 +01:00
Yossi Gottlieb
4902e26fef 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
37b501ca84 Limit statement in RM_BlockClient() to 80 cols. 2017-09-28 23:15:34 +02:00
zhaozhao.zz
cc7ef78988 Modules: handle the busy module name 2017-09-28 17:38:40 +08:00