JacobVorreuter/nsync — pull request #10 by ferd (2013-04-11 22:28:54+00:00)
Title: Fix RDB, add heartbeats.

1.
Newer redis versions appear to be sending PINGs from time to time to
make sure the communication is open. On older copies, though, there is
no heartbeat and thus no way to know if the communication is just silent
or down (without a reset packet having been sent to notify the reader).

This req adds a heartbeat with a long delay (15 minutes +) that will
shut down nsync (and let a supervisor restart it) if the server doesn't
answer to a PING command (with "+PONG\r\n") in the next few minutes.

2.
Ziplists with lengths greater than 63 bytes and up to 16383 bytes appear
not to be encoded as small endian like the rest. The original source at
https://github.com/sripathikrishnan/redis-rdb-tools/blob/master/docs/RDB_File_Format.textile
doesn't mention the endianness, so 'native' is being used. This will
default to 'big' on most architectures, maybe implode on clusters with
varying endianness.

This also includes a fix for an explicitly big endian format for
String values with length greater than or equal to 16384 bytes, as
showin at sripathikrishnan/redis-rdb-tools@4a4b7e0
in the original project.

3.
The zipmap entries allow to dynamically update the values, but not the
keys. The 'Free' entry may only be present before the value, not the key.

This patch fixes the zipmap entry parsing so that it is aware of what is
a key and what is a value, rather than assuming they are uniform.