6409 Commits

Author SHA1 Message Date
antirez
ba13aba3a0 Streams: fix bug in XREAD last received ID processing. 2017-12-01 10:24:24 +01:00
antirez
110e66b0c2 Streams: fix memory leak in freeStream(). 2017-12-01 10:24:24 +01:00
antirez
91e09d0959 Streams: rewrite XADD ID argument for AOF/slaves. 2017-12-01 10:24:24 +01:00
antirez
eb8d0671f8 Streams: fix XADD API and keyspace notifications.
XADD was suboptimal in the first incarnation of the command, not being
able to accept an ID (very useufl for replication), nor options for
having capped streams.

The keyspace notification for streams was not implemented.
2017-12-01 10:24:24 +01:00
antirez
6410396372 Streams: When XREAD blocks without COUNT, set a default one.
A client may lose a lot of time between invocations of blocking XREAD,
for example because it is processing the messages or for any other
cause. When it returns back, it may provide a low enough message ID that
the server will block to send an unreasonable number of messages in a
single call. For this reason we set a COUNT when the client is blocked
with XREAD calls, even if no COUNT is given. This is arbitrarily set to
1000 because it's enough to avoid slowing down the reception of many
messages, but low enough to avoid to block.
2017-12-01 10:24:24 +01:00
antirez
789f74bba2 Streams: fix handleClientsBlockedOnKeys() access to invalid ID. 2017-12-01 10:24:24 +01:00
antirez
06a30111a8 Streams: fix XREAD ready-key signaling.
With lists we need to signal only on key creation, but streams can
provide data to clients listening at every new item added.
To make this slightly more efficient we now track different classes of
blocked clients to avoid signaling keys when there is nobody listening.
A typical case is when the stream is used as a time series DB and
accessed only by range with XRANGE.
2017-12-01 10:24:24 +01:00
antirez
f3b3ca41f7 Streams: fix XREAD timeout handling, zero is valid. 2017-12-01 10:24:24 +01:00
antirez
ea5ea8da3d Streams: XREAD related code to serve blocked clients. 2017-12-01 10:24:24 +01:00
antirez
6d54ec5e24 Streams: XREAD ability to block fixed. 2017-12-01 10:24:24 +01:00
antirez
b6f1106630 Streams: synchronous xread fixes and improvements. 2017-12-01 10:24:24 +01:00
antirez
bfeeeb9f34 Streams: XREAD get-key method fixed. 2017-12-01 10:24:24 +01:00
antirez
084a871019 Streams: XREAD get-keys method. 2017-12-01 10:24:24 +01:00
antirez
6f79b52dfa Streams: XREAD, first draft. Handling of blocked clients still missing. 2017-12-01 10:24:24 +01:00
antirez
54e221af43 Streams: XREAD arguments parsing. 2017-12-01 10:24:24 +01:00
antirez
428bb7cca0 Streams: augment client.bpop with XREAD specific fields. 2017-12-01 10:24:24 +01:00
antirez
6195349b50 Streams: more internal preparation for blocking XREAD. 2017-12-01 10:24:24 +01:00
antirez
896300be30 Streams: initial work to use blocking lists logic for streams XREAD. 2017-12-01 10:24:24 +01:00
antirez
a168cbef13 Streams: implement stream object release. 2017-12-01 10:24:24 +01:00
antirez
760ad8f65c Streams: XLEN command. 2017-12-01 10:24:24 +01:00
antirez
64a7ad038d Streams: Save stream->length in RDB. 2017-12-01 10:24:24 +01:00
antirez
fac8b716ab Streams: change listpack allocator to zmalloc. 2017-12-01 10:24:24 +01:00
antirez
90c980b105 Streams: RDB loading. RDB saving modified.
After a few attempts it looked quite saner to just add the last item ID
at the end of the serialized listpacks, instead of scanning the last
listpack loaded from head to tail just to fetch it. It's a disk space VS
CPU-and-simplicity tradeoff basically.
2017-12-01 10:24:24 +01:00
antirez
f028e4e68e Streams: RDB saving. 2017-12-01 10:24:24 +01:00
antirez
e4e216f8cc Streams: assign value of 6 to OBJ_STREAM + some refactoring. 2017-12-01 10:24:24 +01:00
antirez
71ad8ff26e Streams: 12 commits squashed into the initial Streams implementation. 2017-12-01 10:24:24 +01:00
antirez
95eaf3aada PSYNC2: Fix off by one buffer size in luaCreateFunction(). 2017-11-30 18:38:29 +01:00
antirez
6051ebea33 PSYNC2: just store script bodies into RDB.
Related to #4483. As suggested by @soloestoy, we can retrieve the SHA1
from the body. Given that in the new implementation using AUX fields we
ended copying around a lot to create new objects and strings, extremize
such concept and trade CPU for space inside the RDB file.
2017-11-30 18:38:26 +01:00
antirez
d14beab331 PSYNC2: luaCreateFunction() should handle NULL client parameter.
See #4483. This is needed because luaCreateFunction() is now called
from RDB loading code outside a client context.
2017-11-30 18:37:52 +01:00
antirez
445d37f24d PSYNC2: Save Lua scripts state into RDB file.
This is currently needed in order to fix #4483, but this can be
useful in other contexts, so maybe later we may want to remove the
conditionals and always save/load scripts.

Note that we are using the "lua" AUX field here, in order to guarantee
backward compatibility of the RDB file. The unknown AUX fields must be
discarded by past versions of Redis.
2017-11-30 18:37:52 +01:00
antirez
fbc1d53416 Regression test: Slave restart with EVALSHA in backlog issue #4483. 2017-11-30 18:37:10 +01:00
antirez
7f04efa1a8 Prevent corruption of server.executable after DEBUG RESTART.
Doing the following ended with a broken server.executable:

1. Start Redis with src/redis-server
2. Send CONFIG SET DIR /tmp/
3. Send DEBUG RESTART

At this point we called execve with an argv[0] that is no longer related
to the new path. So after the restart the absolute path of the
executable is recomputed in the wrong way. With this fix we pass the
absolute path already computed as argv[0].
2017-11-30 18:30:06 +01:00
antirez
f8d42c5ec6 Be more verbose when DEBUG RESTART fails. 2017-11-30 18:08:21 +01:00
antirez
7435fd6be9 Merge branch 'lfu-fixes' into unstable 2017-11-29 17:16:13 +01:00
Salvatore Sanfilippo
e13b5ea614 Merge pull request #4200 from jeesyn/fix_typo
fix a typo
2017-11-28 18:44:11 +01:00
Salvatore Sanfilippo
5a836dc690 Merge pull request #4165 from zyegfryed/patch-1
Fix some typos
2017-11-28 18:43:45 +01:00
Salvatore Sanfilippo
c847a62be6 Merge pull request #4166 from charpty/wip-redisclic-typo
redis-cli.c typo: helpe -> helper.
2017-11-28 18:41:51 +01:00
Salvatore Sanfilippo
35b359cdeb Merge pull request #4167 from charpty/wip-redisclic-typo2
redis-cli.c typo: Requets -> Requests.
2017-11-28 18:41:28 +01:00
Salvatore Sanfilippo
8f1d602a58 Merge pull request #4170 from TehWebby/patch-2
Fix typo
2017-11-28 18:40:43 +01:00
Salvatore Sanfilippo
4f5a9c99f8 Merge pull request #4172 from TehWebby/patch-3
Fix typo
2017-11-28 18:40:02 +01:00
Salvatore Sanfilippo
742d555754 Merge pull request #4176 from KrauseFx/patch-1
Update link to https and use inline link
2017-11-28 18:39:43 +01:00
antirez
ff2b31e9a3 t_hash.c: clarify calling two times the same function. 2017-11-28 18:39:00 +01:00
antirez
788710fa44 Merge branch 'unstable' of github.com:/antirez/redis into unstable 2017-11-28 18:27:35 +01:00
antirez
0cd79860ec adlist: fix listJoin() in the case the second list is empty.
See #4192, the original PR removed lines of code that are actually
needed, so thanks to @chunqiulfq for reporting the problem, but merging
solution from @jeesyn after checking, together with @artix75, that the
logic covers all the cases.
2017-11-28 18:25:14 +01:00
Salvatore Sanfilippo
7bb1fe976b Merge pull request #4215 from lamby/correct-faield-spelling
Correct spelling of "faield".
2017-11-28 18:08:32 +01:00
Salvatore Sanfilippo
355ba680e6 Merge pull request #4374 from rouzier/patch-1
Fix file descriptor leak and error handling
2017-11-28 17:33:23 +01:00
Salvatore Sanfilippo
1da0724a98 Merge pull request #4451 from devnexen/minor_build_fixes
Fix undefined behavior constant defined.
2017-11-28 17:23:48 +01:00
antirez
ac58cbc764 LFU: Fix LFUDecrAndReturn() to just decrement.
Splitting the popularity in half actually just needs decrementing the
counter because the counter is logarithmic.
2017-11-28 12:18:30 +01:00
zhaozhao.zz
0a76b9bcd8 LFU: add hotkeys option to redis-cli 2017-11-27 18:39:29 +01:00
zhaozhao.zz
660f01011c LFU: do some changes about LFU to find hotkeys
Firstly, use access time to replace the decreas time of LFU.
For function LFUDecrAndReturn,
it should only try to get decremented counter,
not update LFU fields, we will update it in an explicit way.
And we will times halve the counter according to the times of
elapsed time than server.lfu_decay_time.
Everytime a key is accessed, we should update the LFU
including update access time, and increment the counter after
call function LFUDecrAndReturn.
If a key is overwritten, the LFU should be also updated.
Then we can use `OBJECT freq` command to get a key's frequence,
and LFUDecrAndReturn should be called in `OBJECT freq` command
in case of the key has not been accessed for a long time,
because we update the access time only when the key is read or
overwritten.
2017-11-27 18:39:22 +01:00