4644 Commits

Author SHA1 Message Date
antirez
c623f0ac50 THP detection for LATENCY DOCTOR. 2014-11-12 11:17:44 +01:00
antirez
868f40c165 Check THP support at startup and warn about it. 2014-11-12 11:17:44 +01:00
antirez
e293cfcffb THP detection / reporting functions added. 2014-11-12 11:17:44 +01:00
antirez
90911905f8 Diskless SYNC: fix RDB EOF detection.
RDB EOF detection was relying on the final part of the RDB transfer to
be a magic 40 bytes EOF marker. However as the slave is put online
immediately, and because of sockets timeouts, the replication stream is
actually contiguous with the RDB file.

This means that to detect the EOF correctly we should either:

1) Scan all the stream searching for the mark. Sucks CPU-wise.
2) Start to send the replication stream only after an acknowledge.
3) Implement a proper chunked encoding.

For now solution "2" was picked, so the master does not start to send
ASAP the stream of commands in the case of diskless replication. We wait
for the first REPLCONF ACK command from the slave, that certifies us
that the slave correctly loaded the RDB file and is ready to get more
data.
2014-11-12 09:51:29 +01:00
antirez
78ac9b7f11 Disconnect timedout slave: regression introduced with diskless repl. 2014-11-12 09:51:29 +01:00
Matt Stancliff
75e68625f1 Parse cluster state file in IPv6 compatible way
We need to pick the port based on the _last_ colon, not the first one.
2014-10-31 10:39:33 +01:00
Matt Stancliff
bb0ff49ea3 Fix redis-trib.rb IP:Port disassembly for IPv6
IP format is now any of:
  - 127.0.0.1:6379
  - ::1:6379
2014-10-31 10:39:33 +01:00
Matt Stancliff
f1a6f78024 Networking: add more outbound IP binding fixes
Same as the original bind fixes (we just missed these the
first time around).

This helps Redis not automatically send
connections from the first IP on an interface if we are bound
to a specific IP address (e.g. with multiple IP aliases on one
interface, you want to send from _your_ IP, not from the first IP
on the interface).
2014-10-31 10:02:42 +01:00
Matt Stancliff
e8f7899ae2 redis-cli: ignore SIGPIPE network errors
Closes #2066
2014-10-30 12:02:28 +01:00
antirez
2480315f2a redis-cli: add missing newline in error message. 2014-10-29 14:27:15 +01:00
antirez
f0124c1d90 Fix DEBUG POPULATE warning for lack of casting. 2014-10-29 14:27:15 +01:00
antirez
6231c42ed6 Diskless replication: missing listRewind() added.
This caused BGSAVE to be triggered a second time without any need when
we switch from socket to disk target via the command

    CONFIG SET repl-diskless-sync no

and there is already a slave waiting for the BGSAVE to start.
Also comments clarified about what is happening.
2014-10-29 14:26:48 +01:00
antirez
18698b5269 Log slave ip:port in more log messages. 2014-10-29 14:26:48 +01:00
antirez
f687976601 Use new slave name function for diskless repl reporting. 2014-10-29 14:26:48 +01:00
antirez
2fd3fc7f01 Added a function to get slave name for logs. 2014-10-29 14:26:48 +01:00
antirez
e1c0a25ca4 Diskless replication: log BGSAVE delay only when it is non-zero. 2014-10-29 14:26:48 +01:00
antirez
fc486a585c Document repl-diskless-sync-delay in redis.conf. 2014-10-29 14:26:48 +01:00
antirez
6bbeb8c535 Diskless sync delay is now configurable. 2014-10-29 14:26:48 +01:00
antirez
2882f819f4 Remove duplicated log message about starting BGSAVE. 2014-10-29 14:26:48 +01:00
antirez
52f8f4a065 Diskless replication documented inside example redis.conf. 2014-10-29 14:26:48 +01:00
antirez
ec3e239794 Diskless replication tested with the multiple slaves consistency test. 2014-10-29 14:26:48 +01:00
antirez
575c80041c Diskless replication: child -> parent communication improved.
Child now reports full info to the parent including IDs of slaves in
failure state and exit code.
2014-10-29 14:26:48 +01:00
antirez
b3550808ea Translate rio fdset target EWOULDBLOCK error into ETIMEDOUT.
EWOULDBLOCK with the fdset rio target is returned when we try to write
but the send timeout socket option triggered an error. Better to
translate the error in something the user can actually recognize as a
timeout.
2014-10-29 14:26:48 +01:00
antirez
0e3c7e3223 Diskless replication: set / reset socket send timeout.
We need to avoid that a child -> slaves transfer can continue forever.
We use the same timeout used as global replication timeout, which is
documented to also affect I/O operations during bulk transfers.
2014-10-29 14:26:48 +01:00
antirez
a902919ee3 anet.c: new API anetSendTimeout(). 2014-10-29 14:26:48 +01:00
antirez
cd714ba510 Diskless replication: less debugging printfs around. 2014-10-29 14:26:48 +01:00
antirez
5012b0f1e9 rio.c fdset write() method fixed: wrong type for return value. 2014-10-29 14:26:48 +01:00
antirez
5fb51545ce rio fdset target: handle short writes.
While the socket is set in blocking mode, we still can get short writes
writing to a socket.
2014-10-29 14:26:48 +01:00
antirez
5291f7b791 anet.c: API to set sockets back to blocking mode. 2014-10-29 14:26:48 +01:00
antirez
55e9a71317 Diskless replication: rio fdset target new supports buffering.
To perform a socket write() for each RDB rio API write call was
extremely unefficient, so now rio has minimal buffering capabilities.
Writes are accumulated into a buffer and only when a given limit is
reacehd are actually wrote to the N slaves FDs.

Trivia: rio lacked support for buffering since our targets were:

1) Memory buffers.
2) C standard I/O.

Both were buffered already.
2014-10-29 14:26:48 +01:00
antirez
34b0158772 Diskless replication: Various fixes to backgroundSaveDoneHandlerSocket() 2014-10-29 14:26:48 +01:00
antirez
ff6f015b2b Diskless replication: don't send "\n" pings to slaves.
This is useful for normal replication in order to refresh the slave
when we are persisting on disk, but for diskless replication the
child is already receiving data while in WAIT_BGSAVE_END state.
2014-10-29 14:26:47 +01:00
antirez
9512211548 Diskless replication: remove 40 bytes EOF mark from end of RDB file. 2014-10-29 14:26:47 +01:00
antirez
dbfdd9917b Diskless replication: swap inverted branches to compute read len. 2014-10-29 14:26:47 +01:00
antirez
d1b54c4607 Diskless replication: don't enter the read-payload branch forever. 2014-10-29 14:26:47 +01:00
antirez
3b6706848b syncReadLine(): actually enforce buffer size limits. 2014-10-29 14:26:47 +01:00
antirez
b699c8ea63 Diskless replication: EOF:<mark> streaming support slave side. 2014-10-29 14:26:47 +01:00
antirez
1472c68212 Diskless replication: redis.conf and CONFIG SET/GET support. 2014-10-29 14:26:47 +01:00
antirez
78adcfe139 Diskless replication: trigger a BGSAVE after a config change.
If we turn from diskless to disk-based replication via CONFIG SET, we
need a way to start a BGSAVE if there are slaves alerady waiting for a
BGSAVE to start. Normally with disk-based replication we do it as soon
as the previous child exits, but when there is a configuration change
via CONFIG SET, we may have slaves in WAIT_BGSAVE_START state without
an RDB background process currently active.
2014-10-29 14:26:47 +01:00
antirez
4d5f4684c1 Diskless replication flag renamed repl_diskless -> repl_diskless_sync. 2014-10-29 14:26:47 +01:00
antirez
989e2ae2e8 Diskless replication: trigger diskless RDB transfer if needed. 2014-10-29 14:26:47 +01:00
antirez
94e9dd6b56 Diskless replication: handle putting the slave online. 2014-10-29 14:26:47 +01:00
antirez
46a0509ef0 Diskless replication: read report from child. 2014-10-29 14:26:47 +01:00
antirez
cdd975587c Diskless replication: child writes report to parent. 2014-10-29 14:26:47 +01:00
antirez
9563942f4f rio.c fdset target: tolerate (and report) a subset of FDs in error.
Fdset target is used when we want to write an RDB file directly to
slave's sockets. In this setup as long as there is a single slave that
is still receiving our payload, we want to continue sennding instead of
aborting. However rio calls should abort of no FD is ok.

Also we want the errors reported so that we can signal the parent who is
ok and who is broken, so there is a new set integers with the state of
each fd. Zero is ok, non-zero is the errno of the failure, if avaialble,
or a generic EIO.
2014-10-29 14:26:47 +01:00
antirez
eaeeb1216d Diskless replication: parent-child pipe and a few TODOs. 2014-10-29 14:26:47 +01:00
antirez
30231ea005 Diskless replication: RDB -> slaves transfer draft implementation. 2014-10-29 14:26:47 +01:00
antirez
0d40744918 rio.c: draft implementation of fdset target implemented. 2014-10-29 14:26:47 +01:00
antirez
e477832257 rio.c refactoring before adding a new target. 2014-10-29 14:26:47 +01:00
antirez
a71beaa0cb Add some comments in syncCommand() to clarify RDB target. 2014-10-29 14:26:47 +01:00