Commit Graph

3651 Commits

Author SHA1 Message Date
antirez
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
antirez
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
ioddly
c3229c33b1 Try to report source of bad Lua API calls 2013-05-22 18:17:58 -05:00
antirez
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
YAMAMOTO Takashi
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
YAMAMOTO Takashi
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
YAMAMOTO Takashi
b2dd0849ce 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
YAMAMOTO Takashi
0a20ad40de don't define _XOPEN_SOURCE for NetBSD
on NetBSD, defining _XOPEN_SOURCE hides extensions
like inet_aton, strcasecmp, etc.
2013-05-17 17:19:02 +09:00
antirez
92f18d04a0 Merge branch 'config-rewrite' into unstable 2013-05-15 11:58:21 +02:00
antirez
78167807be Use memtoll() when parsing the backlog-size option. 2013-05-15 11:55:14 +02:00
antirez
25f2be6267 CONFIG REWRITE: backlog size is a bytes option. 2013-05-15 11:39:29 +02:00
antirez
cd48e4fc40 CONFIG REWRITE: bindaddr -> bind. 2013-05-15 11:38:43 +02:00
antirez
8a44e6c490 CONFIG REWRITE: when rewriting amount of bytes use GB, MB, KB if possible. 2013-05-15 11:33:02 +02:00
antirez
c590e18d15 CONFIG REWRITE: correctly escape the notify-keyspace-events option. 2013-05-15 11:15:31 +02:00
antirez
328843849f CONFIG REWRITE: "active-rehashing" -> "activerehashing". 2013-05-15 11:09:19 +02:00
antirez
402a0f1ca0 CONFIG REWRITE: fixed typo in AOF fsync policy. 2013-05-15 11:06:56 +02:00
antirez
72e980231c CONFIG REWRITE: repl-disable-tcp-nodelay is a boolean option. 2013-05-15 11:04:53 +02:00
antirez
86a6aad984 Test default config modified to set logfile to empty string.
Required because of recent changes in the way logfile is set to standard
output.
2013-05-15 10:19:14 +02:00
antirez
310dbba01c Added a define for most configuration defaults.
Also the logfile option was modified to always have an explicit value
and to log to stdout when an empty string is used as log file.

Previously there was special handling of the string "stdout" that set
the logfile to NULL, this always required some special handling.
2013-05-15 10:12:29 +02:00
antirez
9e74d216e1 CONFIG REWRITE: Use sane perms when creating redis.conf from scratch. 2013-05-14 12:45:04 +02:00
antirez
e252045454 CONFIG REWRITE: actually rewrite the config file, atomically. 2013-05-14 12:32:25 +02:00
antirez
25e049cc68 redis-cli: help.h updated. 2013-05-14 11:23:16 +02:00
antirez
78f94d90eb CONFIG REWRITE: remove orphaned lines. 2013-05-14 11:17:18 +02:00
antirez
ee721f1e5c CONFIG REWRITE: strip multiple empty lines. 2013-05-14 10:22:55 +02:00
antirez
c184f36d21 CONFIG REWRITE: support for client-output-buffer-limit. 2013-05-13 18:34:18 +02:00
antirez
d95592b116 CONFIG REWRITE: support for dir and slaveof. 2013-05-13 11:26:49 +02:00
antirez
2bc31e55ee CONFIG REWRITE: support for save and syslog-facility. 2013-05-13 11:11:45 +02:00
antirez
7e049fafd3 CONFIG REWRITE: Initial support code and design. 2013-05-13 11:11:12 +02:00
antirez
5947f170f9 Obtain absoute path of configuration file, expose it in INFO. 2013-05-09 16:57:59 +02:00
antirez
e938575220 Test: more PSYNC tests (backlog TTL). 2013-05-09 12:52:04 +02:00
antirez
a7486a6592 Version bumped to 2.9.10 2013-05-08 15:24:40 +02:00
antirez
16f2c3ea14 Test: check that replication partial sync works if we break the link.
The test checks both successful syncs and unsuccessful ones by changing
the backlog size.
2013-05-08 13:01:44 +02:00
antirez
c87dd0fe49 Test: various issues with the replication-4.tcl test fixed.
The test actually worked, but vars for master and slave were inverted
and sometimes used incorrectly.
2013-05-08 11:58:26 +02:00
antirez
0ae1b5b0a1 Revert "use long long instead of size_t make it more safe"
This reverts commit 2c75f2cf1a.

After further analysis, it is very unlikely that we'll raise the
string size limit to > 512MB, and at the same time such big strings
will be used in 32 bit systems.

Better to revert to size_t so that 32 bit processors will not be
forced to use a 64 bit counter in normal operations, that is currently
completely useless.
2013-05-08 10:01:27 +02:00
Salvatore Sanfilippo
c1ae7d2377 Merge pull request #1093 from july2993/unstable
in 32bit machine, popcount don't work with a input string length up to 5...
2013-05-08 00:49:33 -07:00
antirez
5885a34b67 Added more info about 32 bit builds into README. 2013-05-08 09:48:38 +02:00
Jiahao Huang
2c75f2cf1a use long long instead of size_t make it more safe 2013-05-07 23:37:22 +08:00
Jiahao Huang
e3ed78d43b in 32bit machine, popcount don't work with a input string length up to 512 MB,
bitcount commant may return negtive integer with string length more than 256 MB
2013-05-07 19:55:57 +08:00
antirez
5c9f6d4f55 Cluster: link reconnection on delayed PONG reply.
When the PONG delay is half the cluster node timeout, the link gets
disconnected (and later automatically reconnected) in order to ensure
that it's not just a dead connection issue.

However this operation is only performed if the link is old enough, in
order to avoid to disconnect the same link again and again (and among
the other problems, never receive the PONG because of that).

Note: when the link is reconnected, the 'ping_sent' field is not updated
even if a new ping is sent using the new connection, so we can still
reliably detect a node ping timeout.
2013-05-03 15:43:03 +02:00
antirez
1315b9f246 Cluster: restore PING sent time on reconnections. 2013-05-03 15:42:59 +02:00
antirez
ae71731019 Cluster: PING/PONG handling redesigned. 2013-05-03 15:42:38 +02:00
antirez
a120560f70 Cluster: process config from PING packets as we do for PONG.
Also clusterBroadcastPing() was renamed into clusterBroadcastPong()
that's what the function is actually doing.
2013-05-03 15:41:34 +02:00
antirez
8a51c067ad Cluster: createClusterLink() comment fixed for grammar. 2013-05-03 15:41:29 +02:00
antirez
0d9c1f536b CONFIG SET server.masterauth aesthetic change.
This is just to make the code exactly like the above instance used for
requirepass. No actual change nor the original code violated the Redis
coding style.
2013-05-02 17:20:49 +02:00
Michel Martens
649b304e0f Reset masterauth if an empty string is configured. 2013-05-02 17:19:11 +02:00
charsyam
9cd06e4406 Fix AOF bug: expire could be removed from key on AOF rewrite.
There was a race condition in the AOF rewrite code that, with bad enough
timing, could cause a volatile key just about to expire to be turned
into a non-volatile key. The bug was never reported to cause actualy
issues, but was found analytically by an user in the Redis mailing list:

https://groups.google.com/forum/?fromgroups=#!topic/redis-db/Kvh2FAGK4Uk

This commit fixes issue #1079.
2013-05-02 15:35:59 +02:00
antirez
e5ef85c444 Sentinel: changes to tilt mode.
Tilt mode was too aggressive (not processing INFO output), this
resulted in a few problems:

1) Redirections were not followed when in tilt mode. This opened a
   window to misinform clients about the current master when a Sentinel
   was in tilt mode and a fail over happened during the time it was not
   able to update the state.

2) It was possible for a Sentinel exiting tilt mode to detect a false
   fail over start, if a slave rebooted with a wrong configuration
   about at the same time. This used to happen since in tilt mode we
   lose the information that the runid changed (reboot).

   Now instead the Sentinel in tilt mode will still remove the instance
   from the list of slaves if it changes state AND runid at the same
   time.

Both are edge conditions but the changes should overall improve the
reliability of Sentinel.
2013-04-30 15:08:29 +02:00
antirez
ef05a78e7e Sentinel: more sensible delay in master demote after tilt. 2013-04-30 15:08:22 +02:00
antirez
214adc5051 Lua updated to version 5.1.5. 2013-04-29 12:00:54 +02:00
antirez
48ede0d84d Sentinel: only demote old master into slave under certain conditions.
We used to always turn a master into a slave if the DEMOTE flag was set,
as this was a resurrecting master instance.

However the following race condition is possible for a Sentinel that
got partitioned or internal issues (tilt mode), and was not able to
refresh the state in the meantime:

1) Sentinel X is running, master is instance "A".
3) "A" fails, sentinels will promote slave "B" as master.
2) Sentinel X goes down because of a network partition.
4) "A" returns available, Sentinels will demote it as a slave.
5) "B" fails, other Sentinels will promote slave "A" as master.
6) At this point Sentinel X comes back.

When "X" comes back he thinks that:

"B" is the master.
"A" is the slave to demote.

We want to avoid that Sentinel "X" will demote "A" into a slave.
We also want that Sentinel "X" will detect that the conditions changed
and will reconfigure itself to monitor the right master.

There are two main ways for the Sentinel to reconfigure itself after
this event:

1) If "B" is reachable and already configured as a slave by other
sentinels, "X" will perform a redirection to "A".
2) If there are not the conditions to demote "A", the fact that "A"
reports to be a master will trigger a failover detection in "X", that
will end into a reconfiguraiton to monitor "A".

However if the Sentinel was not reachable, its state may not be updated,
so in case it titled, or was partiitoned from the master instance of the
slave to demote, the new implementation waits some time (enough to
guarantee we can detect the new INFO, and new DOWN conditions).

If after some time still there are not the right condiitons to demote
the instance, the DEMOTE flag is cleared.
2013-04-26 17:02:13 +02:00