diff --git a/00-RELEASENOTES b/00-RELEASENOTES index 6108816df46ec54e68bf1f8bd8675fd5cbbf839d..e06319cd51495027e423c498938ac0c3def1ed8b 100644 --- a/00-RELEASENOTES +++ b/00-RELEASENOTES @@ -14,6 +14,36 @@ HIGH: There is a critical bug that may affect a subset of users. Upgrade! CRITICAL: There is a critical bug affecting MOST USERS. Upgrade ASAP. -------------------------------------------------------------------------------- +--[ Redis 2.8.19 ] Release date: 16 Dec 2014 + +# UPGRADE URGENCY: LOW for both Redis and Sentinel. This release mostly + fixes small issues. + +02d465c Don't log admin commands in MONITOR. (antirez) +4d8f426 List of commands flagged as admin commands modified. (antirez) +e47e460 Lua cmsgpack lib updated to latest version. (antirez) +5509c14 Add symlink to redis-sentinel during make install (Rhommel Lamas) +7de1ef7 SORT: Don't sort Set elements if not needed. (antirez) +e945a54 Fix zero-ordering SORT when called against lists (Matt Stancliff) +d81c383 Update redis_init_script.tpl (Ben Dowling) +dba57ea FIXED redis-benchmark's idle mode.With idle mode shouldn't create write event (zhanghailei) +888ea17 zipmap.c: update comments above (Sun He) +86ebc13 replaced // comments #2150 (Deepak Verma) +3d73f08 redis-benchmark AUTH command to be discarded after the first send #2150 (azure provisioned user) +76d53a6 sds.c: Correct two spelling mistakes in comments (Sun He) +4848cf9 sds.c/sdscatvprintf: set va_end to finish va_list cpy (Sun He) +d2f584f sds.c: Correct some comments (Sun He) +2ed3f09 Update whatisdoing.sh (Serghei Iakovlev) +77b997d Include stropts only if __sun is defined. (antirez) +d409371 Fix implicit declaration of ioctl on Solaris (Jan-Erik Rediger) +23b96c0 Silence _BSD_SOURCE warnings in glibc 2.20 and forward (Johan Bergström) +a47a042 Mark whatisdoing.sh as deprecated in top-comment. (antirez) +b5737d2 getting pid fixes (Serghei Iakovlev) +a598e08 sparkline.c: AddSample skip Empty label (Sun He) +7d480ab sparkline.c: mov label-ini into the AddSample Function (Sun He) +2f3c860 Only ignore sigpipe in interactive mode (Jan-Erik Rediger) +0c211a1 Simplify lua_cmsgpack macro and fix build on old Linux distros. (antirez) + --[ Redis 2.8.18 ] Release date: 4 Dec 2014 # UPGRADE URGENCY: LOW for both Redis and Sentinel. This release mostly diff --git a/deps/lua/src/lua_cmsgpack.c b/deps/lua/src/lua_cmsgpack.c index 87bf346c9ae347f96203da6ddb8b1ad850fdb490..dea71572818d201899dd98794ec4e46a7c527899 100644 --- a/deps/lua/src/lua_cmsgpack.c +++ b/deps/lua/src/lua_cmsgpack.c @@ -18,14 +18,8 @@ #define LUACMSGPACK_MAX_NESTING 16 /* Max tables nesting. */ #endif -#if (_XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L) - #define IS_FINITE(x) isfinite(x) -#else - #define IS_FINITE(x) ((x) == (x) && (x) + 1 > (x)) -#endif - /* Check if float or double can be an integer without loss of precision */ -#define IS_INT_TYPE_EQUIVALENT(x, T) (IS_FINITE(x) && (T)(x) == (x)) +#define IS_INT_TYPE_EQUIVALENT(x, T) (!isinf(x) && (T)(x) == (x)) #define IS_INT64_EQUIVALENT(x) IS_INT_TYPE_EQUIVALENT(x, int64_t) #define IS_INT_EQUIVALENT(x) IS_INT_TYPE_EQUIVALENT(x, int) @@ -37,12 +31,10 @@ #define BITS_32 0 #endif -#if LUA_VERSION_NUM < 503 - #if BITS_32 - #define lua_pushunsigned(L, n) lua_pushnumber(L, n) - #else - #define lua_pushunsigned(L, n) lua_pushinteger(L, n) - #endif +#if BITS_32 + #define lua_pushunsigned(L, n) lua_pushnumber(L, n) +#else + #define lua_pushunsigned(L, n) lua_pushinteger(L, n) #endif /* ============================================================================= @@ -262,7 +254,7 @@ static void mp_encode_int(mp_buf *buf, int64_t n) { } } else { if (n >= -32) { - b[0] = ((char)n); /* negative fixnum */ + b[0] = ((signed char)n); /* negative fixnum */ enclen = 1; } else if (n >= -128) { b[0] = 0xd0; /* int 8 */ @@ -550,6 +542,7 @@ static int mp_pack(lua_State *L) { void mp_decode_to_lua_type(lua_State *L, mp_cur *c); void mp_decode_to_lua_array(lua_State *L, mp_cur *c, size_t len) { + assert(len <= UINT_MAX); int index = 1; lua_newtable(L); @@ -562,6 +555,7 @@ void mp_decode_to_lua_array(lua_State *L, mp_cur *c, size_t len) { } void mp_decode_to_lua_hash(lua_State *L, mp_cur *c, size_t len) { + assert(len <= UINT_MAX); lua_newtable(L); while(len--) { mp_decode_to_lua_type(L,c); /* key */ @@ -594,7 +588,7 @@ void mp_decode_to_lua_type(lua_State *L, mp_cur *c) { break; case 0xd0: /* int 8 */ mp_cur_need(c,2); - lua_pushinteger(L,(char)c->p[1]); + lua_pushinteger(L,(signed char)c->p[1]); mp_cur_consume(c,2); break; case 0xcd: /* uint 16 */ @@ -705,13 +699,14 @@ void mp_decode_to_lua_type(lua_State *L, mp_cur *c) { case 0xdb: /* raw 32 */ mp_cur_need(c,5); { - size_t l = (c->p[1] << 24) | - (c->p[2] << 16) | - (c->p[3] << 8) | - c->p[4]; - mp_cur_need(c,5+l); - lua_pushlstring(L,(char*)c->p+5,l); - mp_cur_consume(c,5+l); + size_t l = ((size_t)c->p[1] << 24) | + ((size_t)c->p[2] << 16) | + ((size_t)c->p[3] << 8) | + (size_t)c->p[4]; + mp_cur_consume(c,5); + mp_cur_need(c,l); + lua_pushlstring(L,(char*)c->p,l); + mp_cur_consume(c,l); } break; case 0xdc: /* array 16 */ @@ -725,10 +720,10 @@ void mp_decode_to_lua_type(lua_State *L, mp_cur *c) { case 0xdd: /* array 32 */ mp_cur_need(c,5); { - size_t l = (c->p[1] << 24) | - (c->p[2] << 16) | - (c->p[3] << 8) | - c->p[4]; + size_t l = ((size_t)c->p[1] << 24) | + ((size_t)c->p[2] << 16) | + ((size_t)c->p[3] << 8) | + (size_t)c->p[4]; mp_cur_consume(c,5); mp_decode_to_lua_array(L,c,l); } @@ -744,10 +739,10 @@ void mp_decode_to_lua_type(lua_State *L, mp_cur *c) { case 0xdf: /* map 32 */ mp_cur_need(c,5); { - size_t l = (c->p[1] << 24) | - (c->p[2] << 16) | - (c->p[3] << 8) | - c->p[4]; + size_t l = ((size_t)c->p[1] << 24) | + ((size_t)c->p[2] << 16) | + ((size_t)c->p[3] << 8) | + (size_t)c->p[4]; mp_cur_consume(c,5); mp_decode_to_lua_hash(L,c,l); } @@ -836,15 +831,15 @@ static int mp_unpack(lua_State *L) { } static int mp_unpack_one(lua_State *L) { - int offset = luaL_optint(L, 2, 0); + int offset = luaL_optinteger(L, 2, 0); /* Variable pop because offset may not exist */ lua_pop(L, lua_gettop(L)-1); return mp_unpack_full(L, 1, offset); } static int mp_unpack_limit(lua_State *L) { - int limit = luaL_checkint(L, 2); - int offset = luaL_optint(L, 3, 0); + int limit = luaL_checkinteger(L, 2); + int offset = luaL_optinteger(L, 3, 0); /* Variable pop because offset may not exist */ lua_pop(L, lua_gettop(L)-1); diff --git a/msvs/setups/chocolatey/Redis.nuspec b/msvs/setups/chocolatey/Redis.nuspec index 77a4cb3815a87662729e563c6d3ddd4eb900df0d..8c6ed85c4055c3a5efe564e9909015dd62c8c74b 100644 --- a/msvs/setups/chocolatey/Redis.nuspec +++ b/msvs/setups/chocolatey/Redis.nuspec @@ -3,7 +3,7 @@ redis-64 redis-64 - 2.8.18 + 2.8.19 Jonathan Pickett Microsoft Open Technologies, Inc. Redis is a very popular open-source, networked, in-memory, key-value data store known for high performance, flexibility, a rich set of data structures, and a simple straightforward API. @@ -14,7 +14,7 @@ https://github.com/MSOpenTech/redis/blob/2.8/license.txt false http://redis.io/images/redis.png - Includes the changes from Redis 2.8.12 -> 2.8.18. Please see the release notes for the UNIX 2.8 branch to understand how this impacts Redis functionality. + Includes the changes from Redis 2.8.12 -> 2.8.19. Please see the release notes for the UNIX 2.8 branch to understand how this impacts Redis functionality. diff --git a/msvs/setups/documentation/Redis on Windows Release Notes.docx b/msvs/setups/documentation/Redis on Windows Release Notes.docx index eac2c16b0243a44b8144f4c8cef700fbaacc16b5..149a93cf7b7d3fa2752bf497205c08b36baa5e17 100644 Binary files a/msvs/setups/documentation/Redis on Windows Release Notes.docx and b/msvs/setups/documentation/Redis on Windows Release Notes.docx differ diff --git a/msvs/setups/nuget/Redis.nuspec b/msvs/setups/nuget/Redis.nuspec index 77a4cb3815a87662729e563c6d3ddd4eb900df0d..8c6ed85c4055c3a5efe564e9909015dd62c8c74b 100644 --- a/msvs/setups/nuget/Redis.nuspec +++ b/msvs/setups/nuget/Redis.nuspec @@ -3,7 +3,7 @@ redis-64 redis-64 - 2.8.18 + 2.8.19 Jonathan Pickett Microsoft Open Technologies, Inc. Redis is a very popular open-source, networked, in-memory, key-value data store known for high performance, flexibility, a rich set of data structures, and a simple straightforward API. @@ -14,7 +14,7 @@ https://github.com/MSOpenTech/redis/blob/2.8/license.txt false http://redis.io/images/redis.png - Includes the changes from Redis 2.8.12 -> 2.8.18. Please see the release notes for the UNIX 2.8 branch to understand how this impacts Redis functionality. + Includes the changes from Redis 2.8.12 -> 2.8.19. Please see the release notes for the UNIX 2.8 branch to understand how this impacts Redis functionality. diff --git a/src/Makefile b/src/Makefile index 8b3e959890b5e026a5636edb54ea90bbb4a7cb88..bb2c044868d826195374cd4f2550d63c4976bd37 100644 --- a/src/Makefile +++ b/src/Makefile @@ -251,3 +251,4 @@ install: all $(REDIS_INSTALL) $(REDIS_CLI_NAME) $(INSTALL_BIN) $(REDIS_INSTALL) $(REDIS_CHECK_DUMP_NAME) $(INSTALL_BIN) $(REDIS_INSTALL) $(REDIS_CHECK_AOF_NAME) $(INSTALL_BIN) + @ln -sf $(INSTALL_BIN)/$(REDIS_SERVER_NAME) $(INSTALL_BIN)/$(REDIS_SENTINEL_NAME) diff --git a/src/fmacros.h b/src/fmacros.h index 69d94123e84e0c2eea9b019d4b9b5a8708afb114..a99f76cad66fd2074926ff8f868fa36a683b8485 100644 --- a/src/fmacros.h +++ b/src/fmacros.h @@ -34,6 +34,7 @@ #if defined(__linux__) #define _GNU_SOURCE +#define _DEFAULT_SOURCE #endif #if defined(_AIX) diff --git a/src/latency.c b/src/latency.c index 1d4d1cb41da072e9cdbb445b681c3ca43912387b..ff15297c049885df8e2483bbcd2935d56bd25aee 100644 --- a/src/latency.c +++ b/src/latency.c @@ -512,7 +512,6 @@ sds latencyCommandGenSparkeline(char *event, struct latencyTimeSeries *ts) { for (j = 0; j < LATENCY_TS_LEN; j++) { int i = (ts->idx + j) % LATENCY_TS_LEN; int elapsed; - char *label; char buf[64]; if (ts->samples[i].time == 0) continue; @@ -534,8 +533,7 @@ sds latencyCommandGenSparkeline(char *event, struct latencyTimeSeries *ts) { snprintf(buf,sizeof(buf),"%dh",elapsed/3600); else snprintf(buf,sizeof(buf),"%dd",elapsed/(3600*24)); - label = zstrdup(buf); - sparklineSequenceAddSample(seq,ts->samples[i].latency,label); + sparklineSequenceAddSample(seq,ts->samples[i].latency,buf); } graph = sdscatprintf(graph, diff --git a/src/memtest.c b/src/memtest.c index a8f3022659de346343bfa3867075f3a3846cf7ac..c1370e4b1bd845e08657b5bfc3fd8ed15285649b 100644 --- a/src/memtest.c +++ b/src/memtest.c @@ -36,6 +36,9 @@ #ifndef _WIN32 #include #include +#if defined(__sun) +#include +#endif #else #include "win32_Interop/win32fixes.h" #include "win32_Interop/win32_ANSI.h" diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c index 3a4a5a058c8d597a1f122979a5099025bc16900d..8819877b40b0652b563f84a8aacf53e460c37575 100644 --- a/src/redis-benchmark.c +++ b/src/redis-benchmark.c @@ -471,7 +471,8 @@ static client createClient(char *cmd, size_t len, client from) { } } } - aeCreateFileEvent(config.el,c->context->fd,AE_WRITABLE,writeHandler,c); + if (config.idlemode == 0) + aeCreateFileEvent(config.el,c->context->fd,AE_WRITABLE,writeHandler,c); listAddNodeTail(config.clients,c); config.liveclients++; return c; @@ -682,9 +683,13 @@ int showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData if (config.liveclients == 0) { fprintf(stderr,"All clients disconnected... aborting.\n"); exit(1); - } - + } if (config.csv) return 250; + if (config.idlemode == 1) { + printf("clients: %d\r", config.liveclients); + fflush(stdout); + return 250; + } dt = (float)((mstime()-config.start)/1000.0); rps = (float)(config.requests_finished/dt); printf("%s: %.2f\r", config.title, rps); diff --git a/src/redis-cli.c b/src/redis-cli.c index 58b2c6d1b68bb39b0b14617a61178ad254f19c05..7f877694e082fce8f28366053939c777731f6aa3 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -1960,8 +1960,6 @@ int main(int argc, char **argv) { argc -= firstarg; argv += firstarg; - signal(SIGPIPE, SIG_IGN); - /* Latency mode */ if (config.latency_mode) { if (cliConnect(0) == REDIS_ERR) exit(1); @@ -2010,6 +2008,9 @@ int main(int argc, char **argv) { /* Start interactive mode when no command is provided */ if (argc == 0 && !config.eval) { + /* Ignore SIGPIPE in interactive mode to force a reconnect */ + signal(SIGPIPE, SIG_IGN); + /* Note that in repl mode we don't abort on connection error. * A new attempt will be performed for every command send. */ cliConnect(0); diff --git a/src/redis.c b/src/redis.c index 0ead60a2e871cf972a03f98335d56df1cf464b3d..cd7074c685b14a5b4dad224d0c292306b81f19ef 100644 --- a/src/redis.c +++ b/src/redis.c @@ -253,7 +253,7 @@ struct redisCommand redisCommandTable[] = { {"pttl",pttlCommand,2,"rF",0,NULL,1,1,1,0,0}, {"persist",persistCommand,2,"wF",0,NULL,1,1,1,0,0}, {"slaveof",slaveofCommand,3,"ast",0,NULL,0,0,0,0,0}, - {"role",roleCommand,1,"last",0,NULL,0,0,0,0,0}, + {"role",roleCommand,1,"lst",0,NULL,0,0,0,0,0}, {"debug",debugCommand,-2,"as",0,NULL,0,0,0,0,0}, {"config",configCommand,-2,"art",0,NULL,0,0,0,0,0}, {"subscribe",subscribeCommand,-2,"rpslt",0,NULL,0,0,0,0,0}, @@ -264,15 +264,15 @@ struct redisCommand redisCommandTable[] = { {"pubsub",pubsubCommand,-2,"pltrR",0,NULL,0,0,0,0,0}, {"watch",watchCommand,-2,"rsF",0,NULL,1,-1,1,0,0}, {"unwatch",unwatchCommand,1,"rsF",0,NULL,0,0,0,0,0}, - {"restore",restoreCommand,4,"awm",0,NULL,1,1,1,0,0}, - {"migrate",migrateCommand,6,"aw",0,NULL,0,0,0,0,0}, - {"dump",dumpCommand,2,"ar",0,NULL,1,1,1,0,0}, + {"restore",restoreCommand,4,"wm",0,NULL,1,1,1,0,0}, + {"migrate",migrateCommand,6,"w",0,NULL,0,0,0,0,0}, + {"dump",dumpCommand,2,"r",0,NULL,1,1,1,0,0}, {"object",objectCommand,3,"r",0,NULL,2,2,2,0,0}, - {"client",clientCommand,-2,"ars",0,NULL,0,0,0,0,0}, + {"client",clientCommand,-2,"rs",0,NULL,0,0,0,0,0}, {"eval",evalCommand,-3,"s",0,zunionInterGetKeys,0,0,0,0,0}, {"evalsha",evalShaCommand,-3,"s",0,zunionInterGetKeys,0,0,0,0,0}, {"slowlog",slowlogCommand,-2,"r",0,NULL,0,0,0,0,0}, - {"script",scriptCommand,-2,"ras",0,NULL,0,0,0,0,0}, + {"script",scriptCommand,-2,"rs",0,NULL,0,0,0,0,0}, {"time",timeCommand,1,"rRF",0,NULL,0,0,0,0,0}, {"bitop",bitopCommand,-4,"wm",0,NULL,2,-1,1,0,0}, {"bitcount",bitcountCommand,-2,"r",0,NULL,1,1,1,0,0}, @@ -2024,7 +2024,7 @@ void call(redisClient *c, int flags) { * not generated from reading an AOF. */ if (listLength(server.monitors) && !server.loading && - !(c->cmd->flags & REDIS_CMD_SKIP_MONITOR)) + !(c->cmd->flags & (REDIS_CMD_SKIP_MONITOR|REDIS_CMD_ADMIN))) { replicationFeedMonitors(c,server.monitors,c->db->id,c->argv,c->argc); } diff --git a/src/sds.c b/src/sds.c index 626c380bd739eb44958fda05b6e6d3e04ea08d92..6e7a03deadd941fa5f99fb006cbc613abf1d7a5c 100644 --- a/src/sds.c +++ b/src/sds.c @@ -298,7 +298,7 @@ sds sdscpy(sds s, const char *t) { * conversion. 's' must point to a string with room for at least * SDS_LLSTR_SIZE bytes. * - * The function returns the lenght of the null-terminated string + * The function returns the length of the null-terminated string * representation stored at 's'. */ #define SDS_LLSTR_SIZE 21 int sdsll2str(char *s, long long value) { @@ -372,7 +372,7 @@ sds sdsfromlonglong(long long value) { return sdsnewlen(buf,len); } -/* Like sdscatpritf() but gets va_list instead of being variadic. */ +/* Like sdscatprintf() but gets va_list instead of being variadic. */ sds sdscatvprintf(sds s, const char *fmt, va_list ap) { va_list cpy; char staticbuf[1024], *buf = staticbuf, *t; @@ -398,7 +398,7 @@ sds sdscatvprintf(sds s, const char *fmt, va_list ap) { #else vsnprintf(buf, buflen, fmt, cpy); #endif - va_end(ap); + va_end(cpy); if (buf[buflen-2] != '\0') { if (buf != staticbuf) zfree(buf); buflen *= 2; @@ -431,7 +431,7 @@ sds sdscatvprintf(sds s, const char *fmt, va_list ap) { * * Example: * - * s = sdsempty("Sum is: "); + * s = sdsnew("Sum is: "); * s = sdscatprintf(s,"%d+%d = %d",a,b,a+b). * * Often you need to create a string from scratch with the printf-alike @@ -659,8 +659,8 @@ void sdstoupper(sds s) { * * Return value: * - * 1 if s1 > s2. - * -1 if s1 < s2. + * positive if s1 > s2. + * negative if s1 < s2. * 0 if s1 and s2 are exactly the same binary string. * * If two strings share exactly the same prefix, but one of the two has diff --git a/src/sort.c b/src/sort.c index 500811b7b9fadf21f4265fb303b13fa231398b82..60ed1321e91adb329f498bc3a0715201b9a0a0d2 100644 --- a/src/sort.c +++ b/src/sort.c @@ -264,16 +264,15 @@ void sortCommand(redisClient *c) { j++; } - /* For the STORE option, or when SORT is called from a Lua script, - * we want to force a specific ordering even when no explicit ordering - * was asked (SORT BY nosort). This guarantees that replication / AOF - * is deterministic. + /* When sorting a set with no sort specified, we must sort the output + * so the result is consistent across scripting and replication. * - * However in the case 'dontsort' is true, but the type to sort is a - * sorted set, we don't need to do anything as ordering is guaranteed - * in this special case. */ - if ((storekey || c->flags & REDIS_LUA_CLIENT) && - (dontsort && sortval->type != REDIS_ZSET)) + * The other types (list, sorted set) will retain their native order + * even if no sort order is requested, so they remain stable across + * scripting and replication. */ + if (dontsort && + sortval->type == REDIS_SET && + (storekey || c->flags & REDIS_LUA_CLIENT)) { /* Force ALPHA sorting */ dontsort = 0; diff --git a/src/sparkline.c b/src/sparkline.c index 3f05b43fe6e6f890672eda437f64861af73f5b8c..80f691b84140eb558956a6c09d74e174f62c8733 100644 --- a/src/sparkline.c +++ b/src/sparkline.c @@ -49,7 +49,7 @@ static int label_margin_top = 1; * sparklineSequenceAddSample(seq, 10, NULL); * sparklineSequenceAddSample(seq, 20, NULL); * sparklineSequenceAddSample(seq, 30, "last sample label"); - * sds output = sparklineRender(seq, 80, 4); + * sds output = sparklineRender(sdsempty(), seq, 80, 4, SPARKLINE_FILL); * freeSparklineSequence(seq); * ------------------------------------------------------------------------- */ @@ -63,6 +63,7 @@ struct sequence *createSparklineSequence(void) { /* Add a new sample into a sequence. */ void sparklineSequenceAddSample(struct sequence *seq, double value, char *label) { + label = (label == NULL || label[0] == '\0') ? NULL : zstrdup(label); if (seq->length == 0) { seq->min = seq->max = value; } else { diff --git a/src/version.h b/src/version.h index 9a736509eac3a1b552547ce42cce95c47bcdf388..c4bd3045a59880ea2de85f7055a4c50d765b9bee 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define REDIS_VERSION "2.8.18" +#define REDIS_VERSION "2.8.19" diff --git a/src/zipmap.c b/src/zipmap.c index a157a075bb560bb0c8c4cf5e00282c67956bba3c..4946dcbd3e000883adf268a16f96a9c9b9c3bff4 100644 --- a/src/zipmap.c +++ b/src/zipmap.c @@ -51,10 +51,9 @@ * is the length of the following string (key or value). * lengths are encoded in a single value or in a 5 bytes value. * If the first byte value (as an unsigned 8 bit value) is between 0 and - * 252, it's a single-byte length. If it is 253 then a four bytes unsigned + * 253, it's a single-byte length. If it is 254 then a four bytes unsigned * integer follows (in the host byte ordering). A value of 255 is used to - * signal the end of the hash. The special value 254 is used to mark - * empty space that can be used to add new key/value pairs. + * signal the end of the hash. * * is the number of free unused bytes after the string, resulting * from modification of values associated to a key. For instance if "foo" diff --git a/tests/unit/sort.tcl b/tests/unit/sort.tcl index 9903a183fbe0d2085f7d5d5e539fbb67cefca4ad..a25ffeb5ce76f68d3b2fde76f40d8b3582e23823 100644 --- a/tests/unit/sort.tcl +++ b/tests/unit/sort.tcl @@ -238,6 +238,24 @@ start_server { r sort mylist by num get x:*-> } {100} + test "SORT by nosort retains native order for lists" { + r del testa + r lpush testa 2 1 4 3 5 + r sort testa by nosort + } {5 3 4 1 2} + + test "SORT by nosort plus store retains native order for lists" { + r del testa + r lpush testa 2 1 4 3 5 + r sort testa by nosort store testb + r lrange testb 0 -1 + } {5 3 4 1 2} + + test "SORT by nosort with limit returns based on original list order" { + r sort testa by nosort limit 0 3 store testb + r lrange testb 0 -1 + } {5 3 4} + tags {"slow"} { set num 100 set res [create_random_dataset $num lpush] diff --git a/utils/redis_init_script.tpl b/utils/redis_init_script.tpl index d650863126a1743661505a3cef7a6f1fc8a3deb7..2e5b61301d5ff49802bb20234c217f56e96eb587 100755 --- a/utils/redis_init_script.tpl +++ b/utils/redis_init_script.tpl @@ -26,11 +26,12 @@ case "$1" in fi ;; status) - if [ ! -f $PIDFILE ] + PID=$(cat $PIDFILE) + if [ ! -x /proc/${PID} ] then echo 'Redis is not running' else - echo "Redis is running ($(<$PIDFILE))" + echo "Redis is running ($PID)" fi ;; restart) diff --git a/utils/whatisdoing.sh b/utils/whatisdoing.sh index 8f441cfc01a0a3065c279931365243b2b6e9f906..e4059caeddc7ce7a340fd856097d1f92489ff9fe 100755 --- a/utils/whatisdoing.sh +++ b/utils/whatisdoing.sh @@ -1,9 +1,15 @@ # This script is from http://poormansprofiler.org/ +# +# NOTE: Instead of using this script, you should use the Redis +# Software Watchdog, which provides a similar functionality but in +# a more reliable / easy to use way. +# +# Check http://redis.io/topics/latency for more information. #!/bin/bash nsamples=1 sleeptime=0 -pid=$(pidof redis-server) +pid=$(ps auxww | grep '[r]edis-server' | awk '{print $2}') for x in $(seq 1 $nsamples) do