3444 Commits

Author SHA1 Message Date
antirez
eaebabe564 Use the RSC to replicate EVALSHA unmodified.
This commit uses the Replication Script Cache in order to avoid
translating EVALSHA into EVAL whenever possible for both the AOF and
slaves.
2013-06-24 18:57:31 +02:00
antirez
a9e1c46f40 Replication of scripts as EVALSHA: sha1 caching implemented.
This code is only responsible to take an LRU-evicted fixed length cache
of SHA1 that we are sure all the slaves received.

In this commit only the implementation is provided, but the Redis core
does not use it to actually send EVALSHA to slaves when possible.
2013-06-24 10:26:04 +02:00
antirez
08dff9fb66 New API to force propagation.
The old REDIS_CMD_FORCE_REPLICATION flag was removed from the
implementation of Redis, now there is a new API to force specific
executions of a command to be propagated to AOF / Replication link:

    void forceCommandPropagation(int flags);

The new API is also compatible with Lua scripting, so a script that will
execute commands that are forced to be propagated, will also be
propagated itself accordingly even if no change to data is operated.

As a side effect, this new design fixes the issue with scripts not able
to propagate PUBLISH to slaves (issue #873).
2013-06-21 12:07:53 +02:00
Salvatore Sanfilippo
e73548b0ee Merge pull request #1167 from badboy/patch-1
Initialize char* to NULL to remove compiler warning
2013-06-20 07:56:31 -07:00
Jan-Erik Rediger
21afa5dbed Initialize char* to NULL to remove compiler warning 2013-06-20 17:53:35 +03:00
antirez
c0a47ea63c Allow PUBSUB NUMSUB without channels.
The result is an empty list but it is handy to call it programmatically.
2013-06-20 15:34:56 +02:00
antirez
d337302b90 PUBSUB command implemented.
Currently it implements three subcommands:

PUBSUB CHANNELS [<pattern>]    List channels with non-zero subscribers.
PUBSUB NUMSUB [channel_1 ...]  List number of subscribers for channels.
PUBSUB NUMPAT                  Return number of subscribed patterns.
2013-06-20 15:32:00 +02:00
antirez
8b49716f0d Sentinel: parse new INFO replication output correctly.
Sentinel was not able to detect slaves when connected to a very recent
version of Redis master since a previos non-backward compatible change
to INFO broken the parsing of the slaves ip:port INFO output.

This fixes issue #1164
2013-06-20 10:23:23 +02:00
antirez
5f770dcc2f Test: regression test for #1163. 2013-06-19 18:53:07 +02:00
antirez
96574ee610 Fix comment typo in integration/aof.tcl. 2013-06-19 18:31:33 +02:00
antirez
f352985cc1 Allow writes from scripts called by AOF loading in read-only slaves.
This fixes issue #1163
2013-06-19 18:25:03 +02:00
antirez
f0861f0116 Fix logStackTrace() when logging to stdout.
When the semantics changed from logfile = NULL to logfile = "" to log
into standard output, no proper change was made to logStackTrace() to
make it able to work with the new setup.

This commit fixes the issue.
2013-06-19 14:44:40 +02:00
antirez
058541f3be Lua script errors format more unified.
lua_pcall error handler now formats errors in a way more similar to
luaPushError() so that errors generated in different contexts look alike.
2013-06-18 19:30:56 +02:00
antirez
af2cadc4b7 Lua scripting: improve error reporting.
When calling Lua scripts we try to report not just the error but
information about the code line causing the error.
2013-06-18 17:33:35 +02:00
Salvatore Sanfilippo
8cf042f959 Merge pull request #1124 from ioddly/fix-issue-1121
Try to report source of bad Lua API calls
2013-06-17 03:14:31 -07:00
Salvatore Sanfilippo
3acb4acba8 Merge pull request #819 from Keruspe/unstable
test-server: only listen to 127.0.0.1
2013-06-17 03:08:14 -07:00
Marc-Antoine Perennou
f9eef102c8 test-server: only listen to 127.0.0.1
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2013-06-12 22:49:32 +02:00
antirez
811c5a2cdf Cluster: detect nodes address change. 2013-06-12 10:50:07 -07:00
antirez
fffc5f809e clusterProcessPacket() comments improved for correctness. 2013-06-11 21:34:34 +02:00
antirez
f62a4017b5 Binary safe dump of object content in redisLogObjectDebugInfo(). 2013-06-04 15:53:53 +02:00
antirez
9aa989d073 CONFIG SET: accept slave-priority zero, it is valid. 2013-05-31 19:31:36 +02:00
antirez
650fc5218f Test: avoid a false positive in min-slaves test. 2013-05-31 11:43:30 +02:00
antirez
89ec3e8b22 Tests added for min-slaves feature. 2013-05-30 18:54:28 +02:00
antirez
45ff68db75 Refresh good slaves count after CONFIG SET min-slaves-...
This way just after the CONFIG SET enabling the min-slaves feature it is
possible to write to the database without delays.
2013-05-30 12:23:41 +02:00
antirez
57984ee8f2 New INFO field "min_slaves_good_slaves".
When min-slaves-to-write feature is active, this field reports the
number of slaves considered good (online state, lag within the specified
range).
2013-05-30 12:18:31 +02:00
antirez
e802b22dfb Refresh good slaves count when setting slave state as online. 2013-05-30 12:13:25 +02:00
antirez
376797e1b5 Make tests compatible with new INFO replication output. 2013-05-30 11:43:43 +02:00
antirez
b6e37a61c4 min-replicas-to-write: only deny write commands.
I guess I needed another coffee...
2013-05-30 11:30:09 +02:00
antirez
cb76f29230 min-slaves-to-write: don't accept writes with less than N replicas.
This feature allows the user to specify the minimum number of
connected replicas having a lag less or equal than the specified
amount of seconds for writes to be accepted.
2013-05-30 11:30:04 +02:00
antirez
78259af9ec min-slaves-to-write: initial description of the feature in redis.conf 2013-05-30 11:29:58 +02:00
antirez
564d8c4c0b repl_offset field in INFO replication is now just offset. 2013-05-29 19:56:33 +02:00
antirez
db72ecccc8 Slaves list in INFO output: lag added, format changed.
There is a new 'lag' information in the list of slaves, in the
"replication" section of the INFO output.

Also the format was changed in a backward incompatible way in order to
make it more easy to parse if new fields are added in the future, as the
new format is comma separated but has named fields (no longer positional
fields).
2013-05-29 19:54:44 +02:00
antirez
be6182c26a Accept REPLCONF in any state. 2013-05-28 15:26:20 +02:00
antirez
d0a7837797 A comment about BLPOP timeout did not reflected actual behavior. 2013-05-27 19:34:14 +02:00
antirez
25e71b041d Version bumped to 2.9.11 2013-05-27 11:44:04 +02:00
antirez
b19e3de1d7 redis.conf updated: repl-timeout now uesd by masters as well. 2013-05-27 11:42:45 +02:00
antirez
8752adc059 Close connection with timedout slaves.
Now masters, using the time at which the last REPLCONF ACK was received,
are able to explicitly disconnect slaves that are no longer responding.

Previously the only chance was to see a very long output buffer, that
was highly suboptimal.
2013-05-27 11:42:42 +02:00
antirez
8304ed9a06 Send ACK to master once every second.
ACKs can be also used as a base for synchronous replication. However in
that case they'll be explicitly requested by the master when the client
sends a request that needs to be replicated synchronously.
2013-05-27 11:42:38 +02:00
antirez
c9af89d8cd Don't ACK the master after every command.
Sending an ACK is now moved into the replicationSendAck() function.
2013-05-27 11:42:35 +02:00
antirez
dfc2575703 Make sure that REPLCONF ACK really has no return value. 2013-05-27 11:42:30 +02:00
antirez
84c7d48a80 Replication: send REPLCONF ACK to master. 2013-05-27 11:42:25 +02:00
antirez
6d2b8f5845 REPLCONF ACK command.
This special command is used by the slave to inform the master the
amount of replication stream it currently consumed.

it does not return anything so that we not need to consume additional
bandwidth needed by the master to reply something.

The master can do a number of things knowing the amount of stream
processed, such as understanding the "lag" in bytes of the slave, verify
if a given command was already processed by the slave, and so forth.
2013-05-27 11:42:17 +02:00
antirez
e29d536e17 Fixed a bug in no queueing replies to master. 2013-05-25 01:00:07 +02:00
antirez
f1a7fd7a95 Replication: don't even queue replies to master commands.
When master send commands, there is no need for the slave to reply.
Redis used to queue the reply in the output buffer and discard the reply
later, this is a waste of work and it is not clear why it was this way
(I sincerely don't remember).

This commit changes it in order to don't queue the reply at all.

All tests passing.
2013-05-24 18:58:57 +02:00
antirez
f06f9dacb7 Top comment for prepareClientToWrite() clarified.
We don't write the output buffer to the client socket for slaves only if
the slave is not online.
2013-05-24 18:41:43 +02:00
ioddly
d56c9e48ff Try to report source of bad Lua API calls 2013-05-22 18:17:58 -05:00
antirez
53890a2973 Don't stop reading redis.conf if line has no args.
Should be "continue" and was "return".

This fixes issue #1110
2013-05-18 16:21:52 +02:00
YAMAMOTO Takashi
2e829fc15d don't assume time_t == long
time_t is always 64bit on recent versions of NetBSD.
2013-05-17 17:22:39 +09:00
YAMAMOTO Takashi
321c1a5905 use nanosleep instead of usleep
SUSv3 says that:
	The useconds argument shall be less than one million. If the value of
	useconds is 0, then the call has no effect.
and actually NetBSD's implementation rejects such a value with EINVAL.
use nanosleep which has no such a limitation instead.
2013-05-17 17:21:28 +09:00
YAMAMOTO Takashi
ed23c6ff59 rename popcount to popcount_binary to avoid a conflict with NetBSD libc
NetBSD-current's libc has a function named popcount.
hiding these extensions using feature macros is not possible because
redis uses other extensions covered by the same feature macro.
eg. inet_aton
2013-05-17 17:21:28 +09:00