23 Commits

Author SHA1 Message Date
antirez
731ad0ef1d Streams: items compression implemented.
The approach used is to set a fixed header at the start of every
listpack blob (that contains many entries). The header contains a
"master" ID and fields, that are initially just obtained from the first
entry inserted in the listpack, so that the first enty is always well
compressed. Later every new entry is checked against these fields, and
if it matches, the SAMEFIELD flag is set in the entry so that we know to
just use the master entry flags. The IDs are always delta-encoded
against the first entry. This approach avoids cascading effects in which
entries are encoded depending on the previous entries, in order to avoid
complexity and rewritings of the data when data is removed in the middle
(which is a planned feature).
2017-12-01 10:24:24 +01:00
antirez
7118da8954 Streams: AOF rewriting + minor iterator improvements. 2017-12-01 10:24:24 +01:00
antirez
3d15e3f722 Streams: export iteration API. 2017-12-01 10:24:24 +01:00
antirez
1b0b5fa224 Streams: implement streamReplyWithRange() in terms of the iterator. 2017-12-01 10:24:24 +01:00
antirez
e630b17282 Streams: stream iteration refactoring, WIP 2. 2017-12-01 10:24:24 +01:00
antirez
11045c4399 Streams: stream iteration refactoring, WIP 1. 2017-12-01 10:24:24 +01:00
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
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
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
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
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
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