Compare commits

...

11 Commits

9 changed files with 94 additions and 13 deletions

View File

@@ -8,6 +8,33 @@ cases, basicaly it is very unlikely that you will experience any problem
upgrading your 2.0 instances to 2.2, as 2.2 can work as a drop in replacement
for 2.0.
---------
CHANGELOG
---------
What's new in Redis 2.1.10 (2.2 Release Candidate 4)
====================================================
Redis 2.2 RC4 is a bug fix and minor enhancement release:
* Fixed timeout error in replication where master took a big time to BGSAVE.
* Introduced explicit PING between master and slave, to reliably detect when
the link is down, even if the socket remains apparently connected.
* Fixed compilation on FreeBSD.
* Removed a small portability issue in redis-benchmark.
What's new in Redis 2.1.10 (2.2 Release Candidate 3)
====================================================
Redis 2.2 RC3 is a bug fix and minor enhancements release:
* Solaris fixes
* Fixes and improvements for redis-benchmark
* New INFO field with memory allocation details
* New INFO fields with info about clients max input/output buffer
* Replication: KEYS fixed in slaves
* Different default thresholds for Hash type memory saving encodings
What's new in Redis 2.1.10 (2.2 Release Candidate 2)
====================================================

9
README
View File

@@ -2,10 +2,7 @@ Where to find complete Redis documentation?
-------------------------------------------
This README is just a fast "quick start" document. You can find more detailed
documentation here:
1) http://code.google.com/p/redis
2) Check the 'doc' directory. doc/README.html is a good starting point :)
documentation at http://redis.io
Building Redis
--------------
@@ -23,7 +20,7 @@ You can run a 32 bit Redis binary using:
% make 32bit
After you build Redis is a good idea to test it, using:
After building Redis is a good idea to test it, using:
% make test
@@ -80,7 +77,7 @@ then in another terminal try the following:
You can find the list of all the available commands here:
http://code.google.com/p/redis/wiki/CommandReference
http://redis.io/commands
Enjoy!

View File

@@ -498,7 +498,6 @@ void freeClient(redisClient *c) {
/* Case 2: we lost the connection with the master. */
if (c->flags & REDIS_MASTER) {
server.master = NULL;
/* FIXME */
server.replstate = REDIS_REPL_CONNECT;
/* Since we lost the connection with the master, we should also
* close the connection with all our slaves if we have any, so

View File

@@ -143,7 +143,7 @@ static void randomizeClientKey(client c) {
for (i = 0; i < c->randlen; i++) {
r = random() % config.randomkeys_keyspacelen;
snprintf(buf,sizeof(buf),"%012lu",r);
snprintf(buf,sizeof(buf),"%012zu",r);
memcpy(c->randptr[i],buf,12);
}
}

View File

@@ -516,7 +516,7 @@ void updateLRUClock(void) {
}
int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
int j, loops = server.cronloops++;
int j, loops = server.cronloops;
REDIS_NOTUSED(eventLoop);
REDIS_NOTUSED(id);
REDIS_NOTUSED(clientData);
@@ -645,6 +645,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
* to detect transfer failures. */
if (!(loops % 10)) replicationCron();
server.cronloops++;
return 100;
}

View File

@@ -328,6 +328,12 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
buf+1);
replicationAbortSyncTransfer();
return;
} else if (buf[0] == '\0') {
/* At this stage just a newline works as a PING in order to take
* the connection live. So we refresh our last interaction
* timestamp. */
server.repl_transfer_lastio = time(NULL);
return;
} else if (buf[0] != '$') {
redisLog(REDIS_WARNING,"Bad protocol from MASTER, the first byte is not '$', are you sure the host and port are right?");
replicationAbortSyncTransfer();
@@ -488,17 +494,26 @@ void slaveofCommand(redisClient *c) {
/* --------------------------- REPLICATION CRON ---------------------------- */
#define REDIS_REPL_TRANSFER_TIMEOUT 60
#define REDIS_REPL_TIMEOUT 60
#define REDIS_REPL_PING_SLAVE_PERIOD 10
void replicationCron(void) {
/* Bulk transfer I/O timeout? */
if (server.masterhost && server.replstate == REDIS_REPL_TRANSFER &&
(time(NULL)-server.repl_transfer_lastio) > REDIS_REPL_TRANSFER_TIMEOUT)
(time(NULL)-server.repl_transfer_lastio) > REDIS_REPL_TIMEOUT)
{
redisLog(REDIS_WARNING,"Timeout receiving bulk data from MASTER...");
replicationAbortSyncTransfer();
}
/* Timed out master when we are an already connected slave? */
if (server.masterhost && server.replstate == REDIS_REPL_CONNECTED &&
(time(NULL)-server.master->lastinteraction) > REDIS_REPL_TIMEOUT)
{
redisLog(REDIS_WARNING,"MASTER time out: no data nor PING received...");
freeClient(server.master);
}
/* Check if we should connect to a MASTER */
if (server.replstate == REDIS_REPL_CONNECT) {
redisLog(REDIS_NOTICE,"Connecting to MASTER...");
@@ -507,4 +522,33 @@ void replicationCron(void) {
if (server.appendonly) rewriteAppendOnlyFileBackground();
}
}
/* If we have attached slaves, PING them from time to time.
* So slaves can implement an explicit timeout to masters, and will
* be able to detect a link disconnection even if the TCP connection
* will not actually go down. */
if (!(server.cronloops % (REDIS_REPL_PING_SLAVE_PERIOD*10))) {
listIter li;
listNode *ln;
listRewind(server.slaves,&li);
while((ln = listNext(&li))) {
redisClient *slave = ln->value;
/* Don't ping slaves that are in the middle of a bulk transfer
* with the master for first synchronization. */
if (slave->replstate == REDIS_REPL_SEND_BULK) continue;
if (slave->replstate == REDIS_REPL_ONLINE) {
/* If the slave is online send a normal ping */
addReplySds(slave,sdsnew("PING\r\n"));
} else {
/* Otherwise we are in the pre-synchronization stage.
* Just a newline will do the work of refreshing the
* connection last interaction time, and at the same time
* we'll be sure that being a single char there are no
* short-write problems. */
write(slave->fd, "\n", 1);
}
}
}
}

View File

@@ -1 +1 @@
#define REDIS_VERSION "2.1.11"
#define REDIS_VERSION "2.1.12"

View File

@@ -262,7 +262,7 @@ size_t zmalloc_get_rss(void) {
return t_info.resident_size;
}
#else
float zmalloc_get_rss(void) {
size_t zmalloc_get_rss(void) {
/* If we can't get the RSS in an OS-specific way for this system just
* return the memory usage we estimated in zmalloc()..
*

13
utils/mktarball.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/sh
if [ "$1" = "" ]
then
echo "Usage: mktarball.sh <git tag, branch or commit>"
echo "Example: mktarball.sh 2.2-rc4"
exit 1
fi
PREFIX="redis-${1}/"
TARBALL="/tmp/redis-${1}.tar.gz"
git archive --format=tar --prefix=$PREFIX $1 | gzip -c > $TARBALL
echo "File created: $TARBALL"