4905 Commits

Author SHA1 Message Date
antirez
99e4cf4d84 Don't send SELECT to slaves in WAIT_BGSAVE_START state. 2015-08-05 13:53:28 +02:00
antirez
1dccb6cffb PSYNC test: also test the vanilla SYNC. 2015-08-05 13:52:57 +02:00
antirez
f6c65d3f45 syncCommand() comments improved. 2015-08-05 13:52:50 +02:00
antirez
9d2972183e PSYNC initial offset fix.
This commit attempts to fix a bug involving PSYNC and diskless
replication (currently experimental) found by Yuval Inbar from Redis Labs
and that was later found to have even more far reaching effects (the bug also
exists when diskstore is off).

The gist of the bug is that, a Redis master replies with +FULLRESYNC to
a PSYNC attempt that fails and requires a full resynchronization.
However, the baseline offset sent along with FULLRESYNC was always the
current master replication offset. This is not ok, because there are
many reasosn that may delay the RDB file creation. And... guess what,
the master offset we communicate must be the one of the time the RDB
was created. So for example:

1) When the BGSAVE for replication is delayed since there is one
   already but is not good for replication.
2) When the BGSAVE is not needed as we attach one currently ongoing.
3) When because of diskless replication the BGSAVE is delayed.

In all the above cases the PSYNC reply is wrong and the slave may
reconnect later claiming to need a wrong offset: this may cause
data curruption later.
2015-08-05 13:51:43 +02:00
antirez
32e979801b Test PSYNC with diskless replication.
Thanks to Oran Agra from Redis Labs for providing this patch.
2015-08-05 13:45:02 +02:00
antirez
f15bf6c8f8 Redis 3.0.3. 3.0.3 2015-07-17 11:50:21 +02:00
Jan-Erik Rediger
9b0a47cbc8 Do not attempt to lock on Solaris 2015-07-17 11:04:24 +02:00
MOON_CLJ
f22a9c0f78 pfcount support multi keys 2015-07-17 10:56:28 +02:00
Yongyue Sun
a57aa8831e bugfix: errno might change before logging
Signed-off-by: Yongyue Sun <abioy.sun@gmail.com>
2015-07-17 10:47:26 +02:00
Tom Kiemes
ad0082fde4 Fix: aof_delayed_fsync is not reset
aof_delayed_fsync was not set to 0 when calling CONFIG RESETSTAT
2015-07-17 10:39:30 +02:00
antirez
b029ff11b6 Client timeout handling improved.
The previos attempt to process each client at least once every ten
seconds was not a good idea, because:

1. Usually because of the past min iterations set to 50, you get much
better processing period most of the times.

2. However when there are many clients and a normal setting for
server.hz, the edge case is triggered, and waiting 10 seconds for a
BLPOP that asked for 1 second is not ok.

3. Moreover, because of the high min-itereations limit of 50, when HZ
was set to an high value, the actual behavior was to process a lot of
clients per second.

Also the function checking for timeouts called gettimeofday() at each
iteration which can be costly.

The new implementation will try to process each client once per second,
gets the current time as argument, and does not attempt to process more
than 5 clients per iteration if not needed.

So now:

1. The CPU usage of an idle Redis process is the same or better.
2. The CPU usage of a busy Redis process is the same or better.
3. However a non trivial amount of work may be performed per iteration
when there are many many clients. In this particular case the user may
want to raise the "HZ" value if needed.

Btw with 4000 clients it was still not possible to noticy any actual
latency created by processing 400 clients per second, since the work
performed for each client is pretty small.
2015-07-16 11:03:40 +02:00
antirez
5dcba26b31 Clarify a comment in clientsCron(). 2015-07-16 11:03:40 +02:00
antirez
7ae1d4d6f5 EXISTS is now variadic.
The new return value is the number of keys existing, among the ones
specified in the command line, counting the same key multiple times if
given multiple times (and if it exists).

See PR #2667.
2015-07-13 18:23:18 +02:00
antirez
55e8d4cf1b Add 3.0 changed config default for maxmemory policy to release notes. 2015-06-29 17:23:52 +02:00
linfangrong
d4a7c9e1ab Update t_zset.c 2015-06-11 15:15:45 +02:00
antirez
4e8759c65e Use best effort address binding to connect to the master
We usually want to reach the master using the address of the interface
Redis is bound to (via the "bind" config option). That's useful since
the master will get (and publish) the slave address getting the peer
name of the incoming socket connection from the slave.

However, when this is not possible, for example because the slave is
bound to the loopback interface but repliaces from a master accessed via
an external interface, we want to still connect with the master even
from a different interface: in this case it is not really important that
the master will provide any other address, while it is vital to be able
to replicate correctly.

Related to issues #2609 and #2612.
2015-06-11 13:01:06 +02:00
antirez
a8d7f00e2e anet.c: new API anetTcpNonBlockBestEffortBindConnect()
This performs a best effort source address binding attempt. If it is
possible to bind the local address and still have a successful
connect(), then this socket is returned. Otherwise the call is retried
without source address binding attempt.

Related to issues #2609 and #2612.
2015-06-11 13:01:04 +02:00
antirez
af8a9de663 anetTcpGenericConnect(), jump to error not end on error
Two code paths jumped to the "ok, return the socket to the user" code
path to handle error conditions.

Related to issues #2609 and #2612.
2015-06-11 13:00:55 +02:00
antirez
d815289d54 Don't try to bind the source address for MIGRATE
Related to issues #2609 and #2612.
2015-06-11 13:00:52 +02:00
antirez
f58d67b015 Fix 3.0.2 release notes to give full credits. 2015-06-04 11:59:45 +02:00
antirez
01888d1e58 Redis 3.0.2 3.0.2 2015-06-04 11:35:56 +02:00
Ben Murphy
30278061cc hide access to debug table 2015-06-03 13:36:00 +02:00
Ben Murphy
49efe300af disable loading lua bytecode 2015-06-03 13:35:59 +02:00
antirez
702f914771 Scripting: Lua cmsgpack lib updated to include str8 support 2015-06-03 08:45:58 +02:00
Itamar Haber
e0b2e24830 Removed incorrect suggestion
DEL/INCR/DECR and others could be NTH but apparently never made it to the implementation of SORT
2015-05-29 12:27:59 +02:00
antirez
0da453160b Test: ZADD CH tests 2015-05-29 12:27:17 +02:00
antirez
1d8973c47d ZADD RETCH option renamed CH
From Twitter:

    "@antirez that’s an awfully-named command :(
     http://en.wikipedia.org/wiki/Retching"
2015-05-29 12:27:17 +02:00
antirez
df7add9e70 Test: ZADD INCR test 2015-05-29 12:27:17 +02:00
antirez
9003483d43 Test: ZADD NX and XX options tests 2015-05-29 12:27:17 +02:00
antirez
a13d6378c1 ZADD RETCH option: Return number of elements added or updated
Normally ZADD only returns the number of elements added to a sorted
set, using the RETCH option it returns the sum of elements added or
for which the score was updated.
2015-05-29 12:27:17 +02:00
antirez
fa17e2daf0 ZADD NX and XX options 2015-05-29 12:27:17 +02:00
antirez
ff7c1faa12 ZADD implemenation able to take options. 2015-05-29 12:27:16 +02:00
therealbill
e252e9f231 adding a sentinel command: "flushconfig"
This new command triggers a config flush to save the in-memory config to
disk. This is useful for cases of a configuration management system or a
package manager wiping out your sentinel config while the process is
still running - and has not yet been restarted. It can also be useful
for scripting a backup and migrate or clone of a running sentinel.
2015-05-25 12:06:52 +02:00
antirez
9c0a68861e Sentinel: CKQUORUM tests 2015-05-19 12:27:19 +02:00
antirez
5844f5d0d1 Sentinel: SENTINEL CKQUORUM command
A way for monitoring systems to check that Sentinel is technically able
to reach the quorum and failover, using the currently visible Sentinels.
2015-05-19 12:27:19 +02:00
antirez
a97658f293 Merge branch '3.0' of github.com:/antirez/redis into 3.0 2015-05-15 17:40:03 +02:00
antirez
138e7af57b Rewrite smoveCommand test with ternary operator 2015-05-15 17:39:37 +02:00
Glenn Nethercutt
3a9f41ad86 uphold the smove contract to return 0 when the element is not a member of the source set, even if source=dest 2015-05-15 17:39:37 +02:00
Salvatore Sanfilippo
71fba427c2 Merge pull request #2567 from ryanschwartz/patch-1
Update 00-RELEASENOTES
2015-05-15 17:22:21 +02:00
Jungtaek Lim
08d4df8d31 protocol error log should be seen debug/verbose level 2015-05-15 17:06:42 +02:00
Ryan Schwartz
e7422ef166 Update 00-RELEASENOTES
Fix typo in 00-RELEASENOTES.
2015-05-07 14:28:21 -05:00
antirez
362032e43a Release notes: Sentinel upgrade urgency moved to moderate 2015-05-05 11:16:20 +02:00
antirez
10323dc5fe Redis 3.0.1 3.0.1 2015-05-05 11:01:19 +02:00
FuGangqiang
e213c408fa sdsfree x and y 2015-05-04 13:03:01 +02:00
FuGangqiang
5674656db7 fix doc example 2015-05-04 13:03:01 +02:00
FuGangqiang
35d71b1ffc fix typo 2015-05-04 13:03:01 +02:00
Itamar Haber
6637862838 update copyright year 2015-05-04 12:56:50 +02:00
therealbill
b065f4441b Making sentinel flush config on +slave
Originally, only the +slave event which occurs when a slave is
reconfigured during sentinelResetMasterAndChangeAddress triggers a flush
of the config to disk.  However, newly discovered slaves don't
apparently trigger this flush but do trigger the +slave event issuance.

So if you start up a sentinel, add a master, then add a slave to the
master (as a way to reproduce it) you'll see the +slave event issued,
but the sentinel config won't be updated with the known-slave entry.

This change makes sentinel do the flush of the config if a new slave is
deteted in sentinelRefreshInstanceInfo.
2015-05-04 12:55:27 +02:00
antirez
bd99b26bc5 Sentinel: remove useless sentinelFlushConfig() call
To rewrite the config in the loop that adds slaves back after a master
reset, in order to handle switching to another master, is useless: it
just adds latency since there is an fsync call in the inner loop,
without providing any additional guarantee, but the contrary, since if
after the first loop iteration the server crashes we end with just a
single slave entry losing all the other informations.

It is wiser to rewrite the config at the end when the full new
state is configured.
2015-05-04 12:55:27 +02:00
Yossi Gottlieb
0560738f6b Fix Redis server crash when Lua command exceeds client output buffer
limit.
2015-05-04 12:20:24 +02:00