Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
Upgrade to Redis 2.2.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Russell committed Sep 21, 2011
1 parent 3e4ca03 commit e917177
Show file tree
Hide file tree
Showing 293 changed files with 69 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bin/redis
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require 'socket'
class RedisController

MYSELF = File.expand_path($0)
REDIS_EXEC_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', 'redis', 'redis-2.2.13', 'src'))
REDIS_EXEC_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', 'redis', 'redis-2.2.14', 'src'))

def initialize(options = {})
@db_dir = options.fetch(:db_dir) { Dir.pwd }
Expand Down
2 changes: 1 addition & 1 deletion redis/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
all:
cd redis-2.2.13 && $(MAKE) $@
cd redis-2.2.14 && $(MAKE) $@

install:
echo
1 change: 0 additions & 1 deletion redis/redis-2.2.13/src/version.h

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ for 2.0.
CHANGELOG
---------

What's new in Redis 2.2.14
==========================

* [BUGFIX] Fixed a rare but possible AOF race condition that could result into
duplicated commands inside the AOF.
* [BUGFIX] Don't replicate SAVE.
* LRANGE optimization may drastically improve performances when querying the
final part of a long list.
* redis-cli now implements a --latency mode to monitory Redis delay.

What's new in Redis 2.2.13
==========================

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions redis/redis-2.2.13/src/aof.c → redis/redis-2.2.14/src/aof.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,11 @@ void backgroundRewriteDoneHandler(int statloc) {
if (server.appendfsync != APPENDFSYNC_NO) aof_fsync(fd);
server.appendseldb = -1; /* Make sure it will issue SELECT */
redisLog(REDIS_NOTICE,"The new append only file was selected for future appends.");

/* Clear regular AOF buffer since its contents was just written to
* the new AOF from the background rewrite buffer. */
sdsfree(server.aofbuf);
server.aofbuf = sdsempty();
} else {
/* If append only is disabled we just generate a dump in this
* format. Why not? */
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static struct config {
int shutdown;
int monitor_mode;
int pubsub_mode;
int latency_mode;
int stdinarg; /* get last arg from stdin. (-x option) */
char *auth;
int raw_output; /* output mode per command */
Expand Down Expand Up @@ -564,6 +565,8 @@ static int parseOptions(int argc, char **argv) {
i++;
} else if (!strcmp(argv[i],"--raw")) {
config.raw_output = 1;
} else if (!strcmp(argv[i],"--latency")) {
config.latency_mode = 1;
} else if (!strcmp(argv[i],"-d") && !lastarg) {
sdsfree(config.mb_delim);
config.mb_delim = sdsnew(argv[i+1]);
Expand Down Expand Up @@ -614,6 +617,7 @@ static void usage() {
" -x Read last argument from STDIN\n"
" -d <delimiter> Multi-bulk delimiter in for raw formatting (default: \\n)\n"
" --raw Use raw formatting for replies (default when STDOUT is not a tty)\n"
" --latency Enter a special mode continuously sampling latency.\n"
" --help Output this help and exit\n"
" --version Output version and exit\n"
"\n"
Expand Down Expand Up @@ -736,6 +740,38 @@ static int noninteractive(int argc, char **argv) {
return retval;
}

static void latencyMode(void) {
redisReply *reply;
long long start, latency, min, max, tot, count = 0;
double avg;

if (!context) exit(1);
while(1) {
start = mstime();
reply = redisCommand(context,"PING");
if (reply == NULL) {
fprintf(stderr,"\nI/O error\n");
exit(1);
}
latency = mstime()-start;
freeReplyObject(reply);
count++;
if (count == 1) {
min = max = tot = latency;
avg = (double) latency;
} else {
if (latency < min) min = latency;
if (latency > max) max = latency;
tot += latency;
avg = (double) tot/count;
}
printf("\x1b[0G\x1b[2Kmin: %lld, max: %lld, avg: %.2f (%lld samples)",
min, max, avg, count);
fflush(stdout);
usleep(10000);
}
}

int main(int argc, char **argv) {
int firstarg;

Expand All @@ -749,6 +785,7 @@ int main(int argc, char **argv) {
config.shutdown = 0;
config.monitor_mode = 0;
config.pubsub_mode = 0;
config.latency_mode = 0;
config.stdinarg = 0;
config.auth = NULL;
config.raw_output = !isatty(fileno(stdout)) && (getenv("FAKETTY") == NULL);
Expand All @@ -759,6 +796,12 @@ int main(int argc, char **argv) {
argc -= firstarg;
argv += firstarg;

/* Start in latency mode if appropriate */
if (config.latency_mode) {
cliConnect(0);
latencyMode();
}

/* Start interactive mode when no command is provided */
if (argc == 0) {
/* Note that in repl mode we don't abort on connection error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -967,9 +967,9 @@ void call(redisClient *c) {
duration = ustime()-start;
slowlogPushEntryIfNeeded(c->argv,c->argc,duration);

if (server.appendonly && dirty)
if (server.appendonly && dirty > 0)
feedAppendOnlyFile(c->cmd,c->db->id,c->argv,c->argc);
if ((dirty || c->cmd->flags & REDIS_CMD_FORCE_REPLICATION) &&
if ((dirty > 0 || c->cmd->flags & REDIS_CMD_FORCE_REPLICATION) &&
listLength(server.slaves))
replicationFeedSlaves(server.slaves,c->db->id,c->argv,c->argc);
if (listLength(server.monitors))
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,12 @@ void lrangeCommand(redisClient *c) {
p = ziplistNext(o->ptr,p);
}
} else if (o->encoding == REDIS_ENCODING_LINKEDLIST) {
listNode *ln = listIndex(o->ptr,start);
listNode *ln;

/* If we are nearest to the end of the list, reach the element
* starting from tail and going backward, as it is faster. */
if (start > llen/2) start -= llen;
ln = listIndex(o->ptr,start);

while(rangelen--) {
addReplyBulk(c,ln->value);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions redis/redis-2.2.14/src/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define REDIS_VERSION "2.2.14"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e917177

Please sign in to comment.