65 Commits

Author SHA1 Message Date
antirez
27ba85c022 Modules: zset lex iterator #1. 2016-05-10 06:40:08 +02:00
antirez
5b8a856d14 Modules: zset iterator redesign #1. 2016-05-10 06:40:08 +02:00
antirez
073e9a3213 Modules: sorted set iterators WIP #3. 2016-05-10 06:40:08 +02:00
antirez
f254c9747d Modules: sorted set iterators WIP #2. 2016-05-10 06:40:08 +02:00
antirez
d43b5498f4 Modules: sorted set iterators WIP. 2016-05-10 06:40:08 +02:00
antirez
83fe739fb6 Modules: first preview 31 March 2016. 2016-05-10 06:40:05 +02:00
Salvatore Sanfilippo
3cf68cb168 Merge pull request #3188 from therealbill/unstable
maxmemory_policy fix for #3187
2016-05-05 09:02:25 +02:00
Oran Agra
7496636280 various cleanups and minor fixes 2016-04-25 16:49:57 +03:00
therealbill
85e3d50559 fix for #3187
I've renamed maxmemoryToString to evictPolicyToString since that is
more accurate (and easier to mentally connect with the correct data), as
well as updated the function to user server.maxmemory_policy rather than
server.maxmemory. Now with a default config it is actually returning
the correct policy rather than volatile-lru.
2016-04-22 10:43:48 -05:00
antirez
d63bc36021 ZREM refactored into proper API. 2016-04-15 15:20:57 +02:00
antirez
be3fcd7aca ZRANK refactored into proper API. 2016-04-15 12:47:03 +02:00
antirez
5410ab9574 zsetAdd() API exposed into server.h. 2016-04-14 16:00:08 +02:00
antirez
5b3ab9d132 BITFIELD command initial implementation.
The new bitfield command is an extension to the Redis bit operations,
where not just single bit operations are performed, but the array of
bits composing a string, can be addressed at random, not aligned
offsets, with any width unsigned and signed integers like u8, s5, u10
(up to 64 bit signed integers and 63 bit unsigned integers).

The BITFIELD command supports subcommands that can SET, GET, or INCRBY
those arbitrary bit counters, with multiple overflow semantics.

Trivial and credits:

A similar command was imagined a few times in the past, but for
some reason looked a bit far fetched or not well specified.
Finally the command was proposed again in a clear form by
Yoav Steinberg from Redis Labs, that proposed a set of commands on
arbitrary sized integers stored at bit offsets.

Starting from this proposal I wrote an initial specification of a single
command with sub-commands similar to what Yoav envisioned, using short
names for types definitions, and adding control on the overflow.

This commit is the resulting implementation.

Examples:

    BITFIELD mykey OVERFLOW wrap INCRBY i2 10 -1 GET i2 10
2016-02-26 15:00:19 +01:00
antirez
f33d9bd114 addReplyHumanLongDouble() API added.
Send a long double or double as a bulk reply, in a human friendly
format.
2016-02-18 22:08:50 +01:00
antirez
416adf1a9c New options for GEORADIUS: STORE and STOREDIST.
Related to issue #3019.
2016-02-18 10:24:16 +01:00
antirez
d3f71a409a Merge branch 'cluster-docker' into unstable 2016-02-01 18:01:22 +01:00
antirez
08e9a00ceb Typo ASII -> ASCII fixed in comment. 2016-01-29 12:08:10 +01:00
antirez
51a16c9ca0 Cluster announce ip / port initial implementation. 2016-01-29 09:06:37 +01:00
antirez
d398ce34e6 Cluster announce ip / port configuration handling. 2016-01-29 09:06:37 +01:00
antirez
d609d9942d New security feature: Redis protected mode.
An exposed Redis instance on the internet can be cause of serious
issues. Since Redis, by default, binds to all the interfaces, it is easy
to forget an instance without any protection layer, for error.

Protected mode try to address this feature in a soft way, providing a
layer of protection, but giving clues to Redis users about why the
server is not accepting connections.

When protected mode is enabeld (the default), and if there are no
minumum hints about the fact the server is properly configured (no
"bind" directive is used in order to restrict the server to certain
interfaces, nor a password is set), clients connecting from external
intefaces are refused with an error explaining what to do in order to
fix the issue.

Clients connecting from the IPv4 and IPv6 lookback interfaces are still
accepted normally, similarly Unix domain socket connections are not
restricted in any way.
2016-01-07 13:00:14 +01:00
antirez
2305500353 Hopefully better memory test on crash.
The old test, designed to do a transformation on the bits that was
invertible, in order to avoid touching the original memory content, was
not effective as it was redis-server --test-memory. The former often
reported OK while the latter was able to spot the error.

So the test was substituted with one that may perform better, however
the new one must backup the memory tested, so it tests memory in small
pieces. This limits the effectiveness because of the CPU caches. However
some attempt is made in order to trash the CPU cache between the fill
and the check stages, but not for the addressing test unfortunately.

We'll see if this test will be able to find errors where the old failed.
2015-12-16 17:41:22 +01:00
antirez
a2dbc186de memtest.c now can be called as API in non interactive mode. 2015-12-16 12:31:42 +01:00
antirez
47cb5c697b MIGRATE: Fix key extraction for new form. 2015-12-11 18:09:01 +01:00
antirez
76fd26e778 Lua debugger: call wait3() if there are pending forked debugging sessions. 2015-11-17 15:43:23 +01:00
antirez
5c05038252 Lua debugger: handle forked sessions children during shutdown. 2015-11-17 15:43:22 +01:00
antirez
063bbc8074 Lua debugger: foundations implemented. 2015-11-17 15:43:20 +01:00
antirez
e8eb45509e Initialize all Lua scripting related things into scripting.c 2015-11-05 11:37:39 +01:00
antirez
f56eabe870 scripting.c source code better organized into sections. 2015-11-05 10:37:10 +01:00
antirez
169e86f9b1 Scripting: ability to turn on Lua commands style replication globally.
Currently this feature is only accessible via DEBUG for testing, since
otherwise depending on the instance configuration a given script works
or is broken, which is against the Redis philosophy.
2015-10-30 12:06:09 +01:00
antirez
7d05c2d795 Lua script selective replication fixes. 2015-10-30 12:06:08 +01:00
antirez
d8e5f64638 Lua script selective replication WIP. 2015-10-30 12:06:08 +01:00
antirez
24103bafd0 Scripting: single commands replication mode implemented.
By calling redis.replicate_commands(), the scripting engine of Redis
switches to commands replication instead of replicating whole scripts.
This is useful when the script execution is costly but only results in a
few writes performed to the dataset.

Morover, in this mode, it is possible to call functions with side
effects freely, since the script execution does not need to be
deterministic: anyway we'll capture the outcome from the point of view
of changes to the dataset.

In this mode math.random() returns different sequences at every call.

If redis.replicate_commnads() is not called before any other write, the
command returns false and sticks to whole scripts replication instead.
2015-10-30 12:06:08 +01:00
antirez
52b4464ed6 call(): selective ability to prevent propagation on AOF / slaves. 2015-10-30 12:06:08 +01:00
antirez
63988c9026 CLIENT REPLY command implemented: ON, OFF and SKIP modes.
Sometimes it can be useful for clients to completely disable replies
from the Redis server. For example when the client sends fire and forget
commands or performs a mass loading of data, or in caching contexts
where new data is streamed constantly. In such contexts to use server
time and bandwidth in order to send back replies to clients, which are
going to be ignored, is a shame.

Multiple mechanisms are possible to implement such a feature. For
example it could be a feature of MULTI/EXEC, or a command prefix
such as "NOREPLY SADD myset foo", or a different mechanism that allows
to switch on/off requests using the CLIENT command.

The MULTI/EXEC approach has the problem that transactions are not
strictly part of the no-reply semantics, and if we want to insert a lot
of data in a bulk way, creating a huge MULTI/EXEC transaction in the
server memory is bad.

The prefix is the best in this specific use case since it does not allow
desynchronizations, and is pretty clear semantically. However Redis
internals and client libraries are not prepared to handle this
currently.

So the implementation uses the CLIENT command, providing a new REPLY
subcommand with three options:

    CLIENT REPLY OFF disables the replies, and does not reply itself.
    CLIENT REPLY ON re-enables the replies, replying +OK.
    CLIENT REPLY SKIP only discards the reply of the next command, and
                      like OFF does not reply anything itself.

The reason to add the SKIP command is that it allows to have an easy
way to send conceptually "single" commands that don't need a reply
as the sum of two pipelined commands:

    CLIENT REPLY SKIP
    SET key value

Note that CLIENT REPLY ON replies with +OK so it should be used when
sending multiple commands that don't need a reply. However since it
replies with +OK the client can check that the connection is still
active and all the previous commands were received.

This is currently just into Redis "unstable" so the proposal can be
modified or abandoned based on users inputs.
2015-10-21 20:43:37 +02:00
antirez
0c9c68346c PR 2813 fix ported to unstable. 2015-10-15 10:20:09 +02:00
antirez
5b7bd883e6 Server: restartServer() API.
This new function is able to restart the server "in place". The current
Redis process executes the same executable it was executed with, using
the same arguments and configuration file.
2015-10-13 11:02:35 +02:00
antirez
27ec5105eb Lazyfree: cond vars to enabled/disable it based on DEL context. 2015-10-02 15:27:57 +02:00
antirez
da103b45ed Lazyfree: pending objects count in INFO output. 2015-10-01 13:02:26 +02:00
antirez
cf03e071ea Lazyfree: ability to free whole DBs in background. 2015-10-01 13:02:26 +02:00
antirez
7babd6e184 Lazyfree: incremental removed, only threaded survived. 2015-10-01 13:02:25 +02:00
antirez
fbc46738f4 Threaded lazyfree WIP #1. 2015-10-01 13:02:25 +02:00
antirez
cc71d239bd Hash new implementation memleaks fixed. 2015-10-01 13:02:25 +02:00
antirez
5eb85d8fe7 Lazyfree: Hash converted to use plain SDS WIP 4. 2015-10-01 13:02:25 +02:00
antirez
c4175281f6 Lazyfree: Sorted sets convereted to plain SDS. (several commits squashed) 2015-10-01 13:02:24 +02:00
antirez
062bf5ce19 Lazyfree: Convert Sets to use plains SDS (several commits squashed). 2015-10-01 13:02:24 +02:00
antirez
ca8d13bd90 Lazyfree: a first implementation of non blocking DEL. 2015-10-01 13:00:19 +02:00
antirez
0810ed570e Fix processEventsWhileBlocked() to handle PENDING_WRITE clients.
After the introduction of the list with clients with pending writes, to
process clients incrementally outside of the event loop we also need to
process the pending writes list.
2015-09-30 17:23:44 +02:00
antirez
af182a200f Refactoring: unlinkClient() added to lower freeClient() complexity. 2015-09-30 17:10:03 +02:00
antirez
8268ed723a Refactoring: new function to test if client has pending output. 2015-09-30 16:41:48 +02:00
antirez
7a7b8bc244 Move handleClientsWithPendingWrites() in networking.c. 2015-09-30 16:29:42 +02:00