Commit Graph

3174 Commits

Author SHA1 Message Date
0781ad6899 getAbsolutePath() moved into utils.c 2013-07-02 11:56:52 +02:00
de9a221749 CONFIG SET maxclients. 2013-06-28 17:08:03 +02:00
8e2d082066 ae.c event loop: API to resize the fd set size on the run. 2013-06-28 16:39:49 +02:00
3130670b97 Allow SHUTDOWN in loading state. 2013-06-27 12:18:29 +02:00
13585dd677 function renamed: popcount_binary -> redisPopcount. 2013-06-26 15:19:06 +02:00
bae60ede1d Merge pull request #1111 from yamt/netbsd3
netbsd support
2013-06-26 06:17:02 -07:00
8ca265cdb7 Don't disconnect pre PSYNC replication clients for timeout.
Clients using SYNC to replicate are older implementations, such as
redis-cli --slave, and are not designed to acknowledge the master with
REPLCONF ACK commands, so we don't have any feedback and should not
disconnect them on timeout.
2013-06-26 10:11:20 +02:00
73d7955c6f Flush the replication script cache after SCRIPT FLUSH. 2013-06-25 15:36:48 +02:00
fb67468813 Force propagation of SCRIPT LOAD to AOF. 2013-06-25 12:49:56 +02:00
e27b136069 SCRIPT FLUSH comment minor pedantic improvement. 2013-06-25 10:56:59 +02:00
82ea1c6f5d Move Replication Script Cache initialization in safer place.
It should be called just one time at startup and not every time the Lua
scripting engine is re-initialized, otherwise memory is leaked.
2013-06-24 19:27:49 +02:00
f0bf5fd8c7 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
94ec7db470 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
515a26bbc1 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
5ac7ca9c94 Initialize char* to NULL to remove compiler warning 2013-06-20 17:53:35 +03:00
519c9e11d1 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
455563faec 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
4c0f8c4e5a 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
d363299af3 Allow writes from scripts called by AOF loading in read-only slaves.
This fixes issue #1163
2013-06-19 18:25:03 +02:00
338cd4835d 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
9c2c878e45 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
51adc6e1bc 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
b96ba52cfa 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
dfc98dccf4 Cluster: detect nodes address change. 2013-06-12 10:50:07 -07:00
d427373f01 clusterProcessPacket() comments improved for correctness. 2013-06-11 21:34:34 +02:00
cf71b82111 Binary safe dump of object content in redisLogObjectDebugInfo(). 2013-06-04 15:53:53 +02:00
b6a2878aa5 CONFIG SET: accept slave-priority zero, it is valid. 2013-05-31 19:31:36 +02:00
915c06a96c 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
88441bf18f 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
1a54d5963e Refresh good slaves count when setting slave state as online. 2013-05-30 12:13:25 +02:00
2ec7875cbf min-replicas-to-write: only deny write commands.
I guess I needed another coffee...
2013-05-30 11:30:09 +02:00
ed599d3aca 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
888400ebd5 repl_offset field in INFO replication is now just offset. 2013-05-29 19:56:33 +02:00
37c29e037b 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
091ed386f7 Accept REPLCONF in any state. 2013-05-28 15:26:20 +02:00
a864cae2a5 A comment about BLPOP timeout did not reflected actual behavior. 2013-05-27 19:34:14 +02:00
1909b8753d Version bumped to 2.9.11 2013-05-27 11:44:04 +02:00
3c82c85fcf 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
e06a560466 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
efd87031d0 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
dd0adbb777 Make sure that REPLCONF ACK really has no return value. 2013-05-27 11:42:30 +02:00
0292c5f7ae Replication: send REPLCONF ACK to master. 2013-05-27 11:42:25 +02:00
6b4635f4f5 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
a950f48906 Fixed a bug in no queueing replies to master. 2013-05-25 01:00:07 +02:00
dd937030f0 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
c853239a5e 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
c3229c33b1 Try to report source of bad Lua API calls 2013-05-22 18:17:58 -05:00
5d0f408d42 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
9fcead7a59 don't assume time_t == long
time_t is always 64bit on recent versions of NetBSD.
2013-05-17 17:22:39 +09:00
ae82867664 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