From e8dc18fe48c8d1bb234f08f65a16240d0e02a1d3 Mon Sep 17 00:00:00 2001 From: hwware Date: Fri, 5 Apr 2024 15:53:55 -0400 Subject: [PATCH] Update redisReply to serverReply --- deps/hiredis/CHANGELOG.md | 2 +- deps/hiredis/README.md | 20 +- deps/hiredis/async.c | 12 +- deps/hiredis/examples/example-ae.c | 2 +- deps/hiredis/examples/example-glib.c | 2 +- deps/hiredis/examples/example-ivykis.c | 2 +- deps/hiredis/examples/example-libev.c | 2 +- deps/hiredis/examples/example-libevent-ssl.c | 2 +- deps/hiredis/examples/example-libevent.c | 2 +- deps/hiredis/examples/example-libhv.c | 4 +- deps/hiredis/examples/example-libsdevent.c | 4 +- deps/hiredis/examples/example-libuv.c | 4 +- deps/hiredis/examples/example-macosx.c | 2 +- deps/hiredis/examples/example-poll.c | 2 +- deps/hiredis/examples/example-push.c | 8 +- deps/hiredis/examples/example-qt.cpp | 2 +- .../hiredis/examples/example-redismoduleapi.c | 4 +- deps/hiredis/examples/example-ssl.c | 2 +- deps/hiredis/examples/example.c | 4 +- deps/hiredis/hiredis.c | 22 +- deps/hiredis/hiredis.h | 8 +- deps/hiredis/test.c | 208 +++++++-------- src/sentinel.c | 10 +- src/valkey-benchmark.c | 16 +- src/valkey-cli.c | 240 +++++++++--------- 25 files changed, 293 insertions(+), 293 deletions(-) diff --git a/deps/hiredis/CHANGELOG.md b/deps/hiredis/CHANGELOG.md index 801c407293..fa4afab796 100644 --- a/deps/hiredis/CHANGELOG.md +++ b/deps/hiredis/CHANGELOG.md @@ -401,7 +401,7 @@ _Note: There were no changes to code between v1.0.0-rc1 and v1.0.0 so see v1.0. ### 0.14.0 (2018-09-25) **BREAKING CHANGES**: -* Change `redisReply.len` to `size_t`, as it denotes the the size of a string +* Change `serverReply.len` to `size_t`, as it denotes the the size of a string User code should compare this to `size_t` values as well. If it was used to compare to other values, casting might be necessary or can be removed, if casting was applied before. diff --git a/deps/hiredis/README.md b/deps/hiredis/README.md index 74364b4114..1083fa4fb5 100644 --- a/deps/hiredis/README.md +++ b/deps/hiredis/README.md @@ -57,7 +57,7 @@ Bulk and multi-bulk lengths less than -1 or greater than `LLONG_MAX` are now protocol errors. This is consistent with the RESP specification. On 32-bit platforms, the upper bound is lowered to `SIZE_MAX`. -Change `redisReply.len` to `size_t`, as it denotes the the size of a string +Change `serverReply.len` to `size_t`, as it denotes the the size of a string User code should compare this to `size_t` values as well. If it was used to compare to other values, casting might be necessary or can be removed, if @@ -206,8 +206,8 @@ the `err` field in the context will be set (see section on **Errors**). Once an error is returned the context cannot be reused and you should set up a new connection. -The standard replies that `redisCommand` are of the type `redisReply`. The -`type` field in the `redisReply` should be used to test what kind of reply +The standard replies that `redisCommand` are of the type `serverReply`. The +`type` field in the `serverReply` should be used to test what kind of reply was received: ### RESP2 @@ -232,7 +232,7 @@ was received: * **`REDIS_REPLY_ARRAY`**: * A multi bulk reply. The number of elements in the multi bulk reply is stored in - `reply->elements`. Every element in the multi bulk reply is a `redisReply` object as well + `reply->elements`. Every element in the multi bulk reply is a `serverReply` object as well and can be accessed via `reply->element[..index..]`. Redis may reply with nested arrays but this is fully supported. @@ -266,7 +266,7 @@ Hiredis also supports every new `RESP3` data type which are as follows. For mor * **`REDIS_REPLY_BIGNUM`**: * A string representing an arbitrarily large signed or unsigned integer value. - The number will be encoded as a string in the `str` member of `redisReply`. + The number will be encoded as a string in the `str` member of `serverReply`. * **`REDIS_REPLY_VERB`**: * A verbatim string, intended to be presented to the user without modification. @@ -339,7 +339,7 @@ the `err` field in the context can be used to find out what the cause of this er The following examples shows a simple pipeline (resulting in only a single call to `write(2)` and a single call to `read(2)`): ```c -redisReply *reply; +serverReply *reply; redisAppendCommand(context,"SET foo bar"); redisAppendCommand(context,"GET foo"); redisGetReply(context,(void**)&reply); // reply for SET @@ -583,11 +583,11 @@ multi bulk nesting level is higher than this, the parser returns an error. ### Customizing replies -The function `redisReaderGetReply` creates `redisReply` and makes the function -argument `reply` point to the created `redisReply` variable. For instance, if -the response of type `REDIS_REPLY_STATUS` then the `str` field of `redisReply` +The function `redisReaderGetReply` creates `serverReply` and makes the function +argument `reply` point to the created `serverReply` variable. For instance, if +the response of type `REDIS_REPLY_STATUS` then the `str` field of `serverReply` will hold the status as a vanilla C string. However, the functions that are -responsible for creating instances of the `redisReply` can be customized by +responsible for creating instances of the `serverReply` can be customized by setting the `fn` field on the `redisReader` struct. This should be done immediately after creating the `redisReader`. diff --git a/deps/hiredis/async.c b/deps/hiredis/async.c index 3d39cfaf81..6eec9b85e7 100644 --- a/deps/hiredis/async.c +++ b/deps/hiredis/async.c @@ -304,7 +304,7 @@ static int __redisShiftCallback(redisCallbackList *list, redisCallback *target) return REDIS_ERR; } -static void __redisRunCallback(redisAsyncContext *ac, redisCallback *cb, redisReply *reply) { +static void __redisRunCallback(redisAsyncContext *ac, redisCallback *cb, serverReply *reply) { redisContext *c = &(ac->c); if (cb->fn != NULL) { c->flags |= REDIS_IN_CALLBACK; @@ -313,7 +313,7 @@ static void __redisRunCallback(redisAsyncContext *ac, redisCallback *cb, redisRe } } -static void __redisRunPushCallback(redisAsyncContext *ac, redisReply *reply) { +static void __redisRunPushCallback(redisAsyncContext *ac, serverReply *reply) { if (ac->push_cb != NULL) { ac->c.flags |= REDIS_IN_CALLBACK; ac->push_cb(ac, reply); @@ -467,7 +467,7 @@ void redisAsyncDisconnect(redisAsyncContext *ac) { __redisAsyncDisconnect(ac); } -static int __redisGetSubscribeCallback(redisAsyncContext *ac, redisReply *reply, redisCallback *dstcb) { +static int __redisGetSubscribeCallback(redisAsyncContext *ac, serverReply *reply, redisCallback *dstcb) { redisContext *c = &(ac->c); dict *callbacks; redisCallback *cb = NULL; @@ -546,7 +546,7 @@ static int __redisGetSubscribeCallback(redisAsyncContext *ac, redisReply *reply, #define redisIsSpontaneousPushReply(r) \ (redisIsPushReply(r) && !redisIsSubscribeReply(r)) -static int redisIsSubscribeReply(redisReply *reply) { +static int redisIsSubscribeReply(serverReply *reply) { char *str; size_t len, off; @@ -618,9 +618,9 @@ void redisProcessCallbacks(redisAsyncContext *ac) { * In this case we also want to close the connection, and have the * user wait until the server is ready to take our request. */ - if (((redisReply*)reply)->type == REDIS_REPLY_ERROR) { + if (((serverReply*)reply)->type == REDIS_REPLY_ERROR) { c->err = REDIS_ERR_OTHER; - snprintf(c->errstr,sizeof(c->errstr),"%s",((redisReply*)reply)->str); + snprintf(c->errstr,sizeof(c->errstr),"%s",((serverReply*)reply)->str); c->reader->fn->freeObject(reply); __redisAsyncDisconnect(ac); return; diff --git a/deps/hiredis/examples/example-ae.c b/deps/hiredis/examples/example-ae.c index 8efa7306ae..31d6ee761d 100644 --- a/deps/hiredis/examples/example-ae.c +++ b/deps/hiredis/examples/example-ae.c @@ -11,7 +11,7 @@ static aeEventLoop *loop; void getCallback(redisAsyncContext *c, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) return; printf("argv[%s]: %s\n", (char*)privdata, reply->str); diff --git a/deps/hiredis/examples/example-glib.c b/deps/hiredis/examples/example-glib.c index d6e10f8e82..31bec5053f 100644 --- a/deps/hiredis/examples/example-glib.c +++ b/deps/hiredis/examples/example-glib.c @@ -35,7 +35,7 @@ command_cb(redisAsyncContext *ac, gpointer r, gpointer user_data G_GNUC_UNUSED) { - redisReply *reply = r; + serverReply *reply = r; if (reply) { g_print("REPLY: %s\n", reply->str); diff --git a/deps/hiredis/examples/example-ivykis.c b/deps/hiredis/examples/example-ivykis.c index f57dc3887e..670d067d9a 100644 --- a/deps/hiredis/examples/example-ivykis.c +++ b/deps/hiredis/examples/example-ivykis.c @@ -8,7 +8,7 @@ #include void getCallback(redisAsyncContext *c, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) return; printf("argv[%s]: %s\n", (char*)privdata, reply->str); diff --git a/deps/hiredis/examples/example-libev.c b/deps/hiredis/examples/example-libev.c index ec474306bf..1e6830f259 100644 --- a/deps/hiredis/examples/example-libev.c +++ b/deps/hiredis/examples/example-libev.c @@ -8,7 +8,7 @@ #include void getCallback(redisAsyncContext *c, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) return; printf("argv[%s]: %s\n", (char*)privdata, reply->str); diff --git a/deps/hiredis/examples/example-libevent-ssl.c b/deps/hiredis/examples/example-libevent-ssl.c index d0998bab3a..358d82b157 100644 --- a/deps/hiredis/examples/example-libevent-ssl.c +++ b/deps/hiredis/examples/example-libevent-ssl.c @@ -9,7 +9,7 @@ #include void getCallback(redisAsyncContext *c, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) return; printf("argv[%s]: %s\n", (char*)privdata, reply->str); diff --git a/deps/hiredis/examples/example-libevent.c b/deps/hiredis/examples/example-libevent.c index 49bddd0c23..e42ecced9b 100644 --- a/deps/hiredis/examples/example-libevent.c +++ b/deps/hiredis/examples/example-libevent.c @@ -8,7 +8,7 @@ #include void getCallback(redisAsyncContext *c, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) { if (c->errstr) { printf("errstr: %s\n", c->errstr); diff --git a/deps/hiredis/examples/example-libhv.c b/deps/hiredis/examples/example-libhv.c index ac68b0086a..ebcf8ccf43 100644 --- a/deps/hiredis/examples/example-libhv.c +++ b/deps/hiredis/examples/example-libhv.c @@ -8,7 +8,7 @@ #include void getCallback(redisAsyncContext *c, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) return; printf("argv[%s]: %s\n", (char*)privdata, reply->str); @@ -18,7 +18,7 @@ void getCallback(redisAsyncContext *c, void *r, void *privdata) { void debugCallback(redisAsyncContext *c, void *r, void *privdata) { (void)privdata; - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) { printf("`DEBUG SLEEP` error: %s\n", c->errstr ? c->errstr : "unknown error"); diff --git a/deps/hiredis/examples/example-libsdevent.c b/deps/hiredis/examples/example-libsdevent.c index c3b902b4e3..ac0b5fdc74 100644 --- a/deps/hiredis/examples/example-libsdevent.c +++ b/deps/hiredis/examples/example-libsdevent.c @@ -9,7 +9,7 @@ void debugCallback(redisAsyncContext *c, void *r, void *privdata) { (void)privdata; - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) { /* The DEBUG SLEEP command will almost always fail, because we have set a 1 second timeout */ printf("`DEBUG SLEEP` error: %s\n", c->errstr ? c->errstr : "unknown error"); @@ -20,7 +20,7 @@ void debugCallback(redisAsyncContext *c, void *r, void *privdata) { } void getCallback(redisAsyncContext *c, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) { printf("`GET key` error: %s\n", c->errstr ? c->errstr : "unknown error"); return; diff --git a/deps/hiredis/examples/example-libuv.c b/deps/hiredis/examples/example-libuv.c index 53fd04a8e4..e5594a7ea1 100644 --- a/deps/hiredis/examples/example-libuv.c +++ b/deps/hiredis/examples/example-libuv.c @@ -9,7 +9,7 @@ void debugCallback(redisAsyncContext *c, void *r, void *privdata) { (void)privdata; //unused - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) { /* The DEBUG SLEEP command will almost always fail, because we have set a 1 second timeout */ printf("`DEBUG SLEEP` error: %s\n", c->errstr ? c->errstr : "unknown error"); @@ -20,7 +20,7 @@ void debugCallback(redisAsyncContext *c, void *r, void *privdata) { } void getCallback(redisAsyncContext *c, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) { printf("`GET key` error: %s\n", c->errstr ? c->errstr : "unknown error"); return; diff --git a/deps/hiredis/examples/example-macosx.c b/deps/hiredis/examples/example-macosx.c index bc84ed5ba7..78f919041e 100644 --- a/deps/hiredis/examples/example-macosx.c +++ b/deps/hiredis/examples/example-macosx.c @@ -10,7 +10,7 @@ #include void getCallback(redisAsyncContext *c, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) return; printf("argv[%s]: %s\n", (char*)privdata, reply->str); diff --git a/deps/hiredis/examples/example-poll.c b/deps/hiredis/examples/example-poll.c index 954673dacf..f5615a80d8 100644 --- a/deps/hiredis/examples/example-poll.c +++ b/deps/hiredis/examples/example-poll.c @@ -11,7 +11,7 @@ static int exit_loop = 0; void getCallback(redisAsyncContext *c, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) return; printf("argv[%s]: %s\n", (char*)privdata, reply->str); diff --git a/deps/hiredis/examples/example-push.c b/deps/hiredis/examples/example-push.c index 6bc12055e6..e7d5c24b2b 100644 --- a/deps/hiredis/examples/example-push.c +++ b/deps/hiredis/examples/example-push.c @@ -40,7 +40,7 @@ exit(-1); \ } while (0) -static void assertReplyAndFree(redisContext *context, redisReply *reply, int type) { +static void assertReplyAndFree(redisContext *context, serverReply *reply, int type) { if (reply == NULL) panicAbort("NULL reply from server (error: %s)", context->errstr); @@ -56,7 +56,7 @@ static void assertReplyAndFree(redisContext *context, redisReply *reply, int typ /* Switch to the RESP3 protocol and enable client tracking */ static void enableClientTracking(redisContext *c) { - redisReply *reply = redisCommand(c, "HELLO 3"); + serverReply *reply = redisCommand(c, "HELLO 3"); if (reply == NULL || c->err) { panicAbort("NULL reply or server error (error: %s)", c->errstr); } @@ -76,7 +76,7 @@ static void enableClientTracking(redisContext *c) { } void pushReplyHandler(void *privdata, void *r) { - redisReply *reply = r; + serverReply *reply = r; int *invalidations = privdata; /* Sanity check on the invalidation reply */ @@ -106,7 +106,7 @@ void privdata_dtor(void *privdata) { int main(int argc, char **argv) { unsigned int j, invalidations = 0; redisContext *c; - redisReply *reply; + serverReply *reply; const char *hostname = (argc > 1) ? argv[1] : "127.0.0.1"; int port = (argc > 2) ? atoi(argv[2]) : 6379; diff --git a/deps/hiredis/examples/example-qt.cpp b/deps/hiredis/examples/example-qt.cpp index f524c3f3dd..b30d772bd8 100644 --- a/deps/hiredis/examples/example-qt.cpp +++ b/deps/hiredis/examples/example-qt.cpp @@ -8,7 +8,7 @@ using namespace std; void getCallback(redisAsyncContext *, void * r, void * privdata) { - redisReply * reply = static_cast(r); + serverReply * reply = static_cast(r); ExampleQt * ex = static_cast(privdata); if (reply == nullptr || ex == nullptr) return; diff --git a/deps/hiredis/examples/example-redismoduleapi.c b/deps/hiredis/examples/example-redismoduleapi.c index 7d12f8a06b..4a0e0c20c2 100644 --- a/deps/hiredis/examples/example-redismoduleapi.c +++ b/deps/hiredis/examples/example-redismoduleapi.c @@ -9,7 +9,7 @@ void debugCallback(redisAsyncContext *c, void *r, void *privdata) { (void)privdata; //unused - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) { /* The DEBUG SLEEP command will almost always fail, because we have set a 1 second timeout */ printf("`DEBUG SLEEP` error: %s\n", c->errstr ? c->errstr : "unknown error"); @@ -20,7 +20,7 @@ void debugCallback(redisAsyncContext *c, void *r, void *privdata) { } void getCallback(redisAsyncContext *c, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; if (reply == NULL) { if (c->errstr) { printf("errstr: %s\n", c->errstr); diff --git a/deps/hiredis/examples/example-ssl.c b/deps/hiredis/examples/example-ssl.c index 6d1e32e75d..eea06a7699 100644 --- a/deps/hiredis/examples/example-ssl.c +++ b/deps/hiredis/examples/example-ssl.c @@ -14,7 +14,7 @@ int main(int argc, char **argv) { redisSSLContext *ssl; redisSSLContextError ssl_error = REDIS_SSL_CTX_NONE; redisContext *c; - redisReply *reply; + serverReply *reply; if (argc < 4) { printf("Usage: %s [ca]\n", argv[0]); exit(1); diff --git a/deps/hiredis/examples/example.c b/deps/hiredis/examples/example.c index c0a9bb734f..994acdd4ad 100644 --- a/deps/hiredis/examples/example.c +++ b/deps/hiredis/examples/example.c @@ -10,7 +10,7 @@ static void example_argv_command(redisContext *c, size_t n) { char **argv, tmp[42]; size_t *argvlen; - redisReply *reply; + serverReply *reply; /* We're allocating two additional elements for command and key */ argv = malloc(sizeof(*argv) * (2 + n)); @@ -58,7 +58,7 @@ static void example_argv_command(redisContext *c, size_t n) { int main(int argc, char **argv) { unsigned int j, isunix = 0; redisContext *c; - redisReply *reply; + serverReply *reply; const char *hostname = (argc > 1) ? argv[1] : "127.0.0.1"; if (argc > 2) { diff --git a/deps/hiredis/hiredis.c b/deps/hiredis/hiredis.c index 8012035a05..5eec8a7b85 100644 --- a/deps/hiredis/hiredis.c +++ b/deps/hiredis/hiredis.c @@ -56,7 +56,7 @@ static redisContextFuncs redisContextDefaultFuncs = { .write = redisNetWrite }; -static redisReply *createReplyObject(int type); +static serverReply *createReplyObject(int type); static void *createStringObject(const redisReadTask *task, char *str, size_t len); static void *createArrayObject(const redisReadTask *task, size_t elements); static void *createIntegerObject(const redisReadTask *task, long long value); @@ -77,8 +77,8 @@ static redisReplyObjectFunctions defaultFunctions = { }; /* Create a reply object */ -static redisReply *createReplyObject(int type) { - redisReply *r = hi_calloc(1,sizeof(*r)); +static serverReply *createReplyObject(int type) { + serverReply *r = hi_calloc(1,sizeof(*r)); if (r == NULL) return NULL; @@ -89,7 +89,7 @@ static redisReply *createReplyObject(int type) { /* Free a reply object */ void freeReplyObject(void *reply) { - redisReply *r = reply; + serverReply *r = reply; size_t j; if (r == NULL) @@ -123,7 +123,7 @@ void freeReplyObject(void *reply) { } static void *createStringObject(const redisReadTask *task, char *str, size_t len) { - redisReply *r, *parent; + serverReply *r, *parent; char *buf; r = createReplyObject(task->type); @@ -172,14 +172,14 @@ static void *createStringObject(const redisReadTask *task, char *str, size_t len } static void *createArrayObject(const redisReadTask *task, size_t elements) { - redisReply *r, *parent; + serverReply *r, *parent; r = createReplyObject(task->type); if (r == NULL) return NULL; if (elements > 0) { - r->element = hi_calloc(elements,sizeof(redisReply*)); + r->element = hi_calloc(elements,sizeof(serverReply*)); if (r->element == NULL) { freeReplyObject(r); return NULL; @@ -200,7 +200,7 @@ static void *createArrayObject(const redisReadTask *task, size_t elements) { } static void *createIntegerObject(const redisReadTask *task, long long value) { - redisReply *r, *parent; + serverReply *r, *parent; r = createReplyObject(REDIS_REPLY_INTEGER); if (r == NULL) @@ -220,7 +220,7 @@ static void *createIntegerObject(const redisReadTask *task, long long value) { } static void *createDoubleObject(const redisReadTask *task, double value, char *str, size_t len) { - redisReply *r, *parent; + serverReply *r, *parent; if (len == SIZE_MAX) // Prevents hi_malloc(0) if len equals to SIZE_MAX return NULL; @@ -257,7 +257,7 @@ static void *createDoubleObject(const redisReadTask *task, double value, char *s } static void *createNilObject(const redisReadTask *task) { - redisReply *r, *parent; + serverReply *r, *parent; r = createReplyObject(REDIS_REPLY_NIL); if (r == NULL) @@ -275,7 +275,7 @@ static void *createNilObject(const redisReadTask *task) { } static void *createBoolObject(const redisReadTask *task, int bval) { - redisReply *r, *parent; + serverReply *r, *parent; r = createReplyObject(REDIS_REPLY_BOOL); if (r == NULL) diff --git a/deps/hiredis/hiredis.h b/deps/hiredis/hiredis.h index 635988b7e1..82b0000568 100644 --- a/deps/hiredis/hiredis.h +++ b/deps/hiredis/hiredis.h @@ -108,7 +108,7 @@ struct redisAsyncContext; struct redisContext; /* RESP3 push helpers and callback prototypes */ -#define redisIsPushReply(r) (((redisReply*)(r))->type == REDIS_REPLY_PUSH) +#define redisIsPushReply(r) (((serverReply*)(r))->type == REDIS_REPLY_PUSH) typedef void (redisPushFn)(void *, void *); typedef void (redisAsyncPushFn)(struct redisAsyncContext *, void *); @@ -117,7 +117,7 @@ extern "C" { #endif /* This is the reply object returned by redisCommand() */ -typedef struct redisReply { +typedef struct serverReply { int type; /* REDIS_REPLY_* */ long long integer; /* The integer when type is REDIS_REPLY_INTEGER */ double dval; /* The double when type is REDIS_REPLY_DOUBLE */ @@ -128,8 +128,8 @@ typedef struct redisReply { char vtype[4]; /* Used for REDIS_REPLY_VERB, contains the null terminated 3 character content type, such as "txt". */ size_t elements; /* number of elements, for REDIS_REPLY_ARRAY */ - struct redisReply **element; /* elements vector for REDIS_REPLY_ARRAY */ -} redisReply; + struct serverReply **element; /* elements vector for REDIS_REPLY_ARRAY */ +} serverReply; redisReader *redisReaderCreate(void); diff --git a/deps/hiredis/test.c b/deps/hiredis/test.c index f47e9ef2a2..56ae7e4c47 100644 --- a/deps/hiredis/test.c +++ b/deps/hiredis/test.c @@ -107,7 +107,7 @@ static long long usec(void) { /* Helper to extract Redis version information. Aborts on any failure. */ #define REDIS_VERSION_FIELD "redis_version:" void get_redis_version(redisContext *c, int *majorptr, int *minorptr) { - redisReply *reply; + serverReply *reply; char *eptr, *s, *e; int major, minor; @@ -142,7 +142,7 @@ void get_redis_version(redisContext *c, int *majorptr, int *minorptr) { } static redisContext *select_database(redisContext *c) { - redisReply *reply; + serverReply *reply; /* Switch to DB 9 for testing, now that we know we can chat. */ reply = redisCommand(c,"SELECT 9"); @@ -165,7 +165,7 @@ static redisContext *select_database(redisContext *c) { /* Switch protocol */ static void send_hello(redisContext *c, int version) { - redisReply *reply; + serverReply *reply; int expected; reply = redisCommand(c, "HELLO %d", version); @@ -176,7 +176,7 @@ static void send_hello(redisContext *c, int version) { /* Togggle client tracking */ static void send_client_tracking(redisContext *c, const char *str) { - redisReply *reply; + serverReply *reply; reply = redisCommand(c, "CLIENT TRACKING %s", str); assert(reply != NULL && reply->type == REDIS_REPLY_STATUS); @@ -184,7 +184,7 @@ static void send_client_tracking(redisContext *c, const char *str) { } static int disconnect(redisContext *c, int keep_fd) { - redisReply *reply; + serverReply *reply; /* Make sure we're on DB 9. */ reply = redisCommand(c,"SELECT 9"); @@ -385,7 +385,7 @@ static void test_format_commands(void) { static void test_append_formatted_commands(struct config config) { redisContext *c; - redisReply *reply; + serverReply *reply; char *cmd; int len; @@ -459,16 +459,16 @@ static void test_reply_reader(void) { ret = redisReaderGetReply(reader,&reply); root = reply; /* Keep track of the root reply */ test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_ARRAY && - ((redisReply*)reply)->elements == 1); + ((serverReply*)reply)->type == REDIS_REPLY_ARRAY && + ((serverReply*)reply)->elements == 1); test("Can parse arbitrarily nested multi-bulks correctly: "); while(i--) { - assert(reply != NULL && ((redisReply*)reply)->type == REDIS_REPLY_ARRAY); - reply = ((redisReply*)reply)->element[0]; + assert(reply != NULL && ((serverReply*)reply)->type == REDIS_REPLY_ARRAY); + reply = ((serverReply*)reply)->element[0]; } - test_cond(((redisReply*)reply)->type == REDIS_REPLY_STRING && - !memcmp(((redisReply*)reply)->str, "LOLWUT", 6)); + test_cond(((serverReply*)reply)->type == REDIS_REPLY_STRING && + !memcmp(((serverReply*)reply)->str, "LOLWUT", 6)); freeReplyObject(root); redisReaderFree(reader); @@ -477,8 +477,8 @@ static void test_reply_reader(void) { redisReaderFeed(reader, ":9223372036854775807\r\n",22); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_INTEGER && - ((redisReply*)reply)->integer == LLONG_MAX); + ((serverReply*)reply)->type == REDIS_REPLY_INTEGER && + ((serverReply*)reply)->integer == LLONG_MAX); freeReplyObject(reply); redisReaderFree(reader); @@ -496,8 +496,8 @@ static void test_reply_reader(void) { redisReaderFeed(reader, ":-9223372036854775808\r\n",23); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_INTEGER && - ((redisReply*)reply)->integer == LLONG_MIN); + ((serverReply*)reply)->type == REDIS_REPLY_INTEGER && + ((serverReply*)reply)->integer == LLONG_MIN); freeReplyObject(reply); redisReaderFree(reader); @@ -609,8 +609,8 @@ static void test_reply_reader(void) { redisReaderFeed(reader,(char*)"3\r\nval\r\n", 8); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_ARRAY && - ((redisReply*)reply)->elements == 3); + ((serverReply*)reply)->type == REDIS_REPLY_ARRAY && + ((serverReply*)reply)->elements == 3); freeReplyObject(reply); redisReaderFree(reader); @@ -620,8 +620,8 @@ static void test_reply_reader(void) { redisReaderFeed(reader,(char*)"*0\r\n",4); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_ARRAY && - ((redisReply*)reply)->elements == 0); + ((serverReply*)reply)->type == REDIS_REPLY_ARRAY && + ((serverReply*)reply)->elements == 0); freeReplyObject(reply); redisReaderFree(reader); @@ -631,8 +631,8 @@ static void test_reply_reader(void) { redisReaderFeed(reader,(char*)"=10\r\ntxt:LOLWUT\r\n",17); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_VERB && - !memcmp(((redisReply*)reply)->str,"LOLWUT", 6)); + ((serverReply*)reply)->type == REDIS_REPLY_VERB && + !memcmp(((serverReply*)reply)->str,"LOLWUT", 6)); freeReplyObject(reply); redisReaderFree(reader); @@ -642,12 +642,12 @@ static void test_reply_reader(void) { redisReaderFeed(reader,(char*)">2\r\n$6\r\nLOLWUT\r\n:42\r\n",21); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_PUSH && - ((redisReply*)reply)->elements == 2 && - ((redisReply*)reply)->element[0]->type == REDIS_REPLY_STRING && - !memcmp(((redisReply*)reply)->element[0]->str,"LOLWUT",6) && - ((redisReply*)reply)->element[1]->type == REDIS_REPLY_INTEGER && - ((redisReply*)reply)->element[1]->integer == 42); + ((serverReply*)reply)->type == REDIS_REPLY_PUSH && + ((serverReply*)reply)->elements == 2 && + ((serverReply*)reply)->element[0]->type == REDIS_REPLY_STRING && + !memcmp(((serverReply*)reply)->element[0]->str,"LOLWUT",6) && + ((serverReply*)reply)->element[1]->type == REDIS_REPLY_INTEGER && + ((serverReply*)reply)->element[1]->integer == 42); freeReplyObject(reply); redisReaderFree(reader); @@ -656,10 +656,10 @@ static void test_reply_reader(void) { redisReaderFeed(reader, ",3.14159265358979323846\r\n",25); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_DOUBLE && - fabs(((redisReply*)reply)->dval - 3.14159265358979323846) < 0.00000001 && - ((redisReply*)reply)->len == 22 && - strcmp(((redisReply*)reply)->str, "3.14159265358979323846") == 0); + ((serverReply*)reply)->type == REDIS_REPLY_DOUBLE && + fabs(((serverReply*)reply)->dval - 3.14159265358979323846) < 0.00000001 && + ((serverReply*)reply)->len == 22 && + strcmp(((serverReply*)reply)->str, "3.14159265358979323846") == 0); freeReplyObject(reply); redisReaderFree(reader); @@ -677,9 +677,9 @@ static void test_reply_reader(void) { redisReaderFeed(reader, ",inf\r\n",6); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_DOUBLE && - isinf(((redisReply*)reply)->dval) && - ((redisReply*)reply)->dval > 0); + ((serverReply*)reply)->type == REDIS_REPLY_DOUBLE && + isinf(((serverReply*)reply)->dval) && + ((serverReply*)reply)->dval > 0); freeReplyObject(reply); redisReaderFree(reader); @@ -688,8 +688,8 @@ static void test_reply_reader(void) { redisReaderFeed(reader, ",nan\r\n",6); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_DOUBLE && - isnan(((redisReply*)reply)->dval)); + ((serverReply*)reply)->type == REDIS_REPLY_DOUBLE && + isnan(((serverReply*)reply)->dval)); freeReplyObject(reply); redisReaderFree(reader); @@ -698,8 +698,8 @@ static void test_reply_reader(void) { redisReaderFeed(reader, ",-nan\r\n", 7); ret = redisReaderGetReply(reader, &reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_DOUBLE && - isnan(((redisReply*)reply)->dval)); + ((serverReply*)reply)->type == REDIS_REPLY_DOUBLE && + isnan(((serverReply*)reply)->dval)); freeReplyObject(reply); redisReaderFree(reader); @@ -708,7 +708,7 @@ static void test_reply_reader(void) { redisReaderFeed(reader, "_\r\n",3); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_NIL); + ((serverReply*)reply)->type == REDIS_REPLY_NIL); freeReplyObject(reply); redisReaderFree(reader); @@ -726,8 +726,8 @@ static void test_reply_reader(void) { redisReaderFeed(reader, "#t\r\n",4); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_BOOL && - ((redisReply*)reply)->integer); + ((serverReply*)reply)->type == REDIS_REPLY_BOOL && + ((serverReply*)reply)->integer); freeReplyObject(reply); redisReaderFree(reader); @@ -736,8 +736,8 @@ static void test_reply_reader(void) { redisReaderFeed(reader, "#f\r\n",4); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_BOOL && - !((redisReply*)reply)->integer); + ((serverReply*)reply)->type == REDIS_REPLY_BOOL && + !((serverReply*)reply)->integer); freeReplyObject(reply); redisReaderFree(reader); @@ -755,18 +755,18 @@ static void test_reply_reader(void) { redisReaderFeed(reader, "%2\r\n+first\r\n:123\r\n$6\r\nsecond\r\n#t\r\n",34); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_MAP && - ((redisReply*)reply)->elements == 4 && - ((redisReply*)reply)->element[0]->type == REDIS_REPLY_STATUS && - ((redisReply*)reply)->element[0]->len == 5 && - !strcmp(((redisReply*)reply)->element[0]->str,"first") && - ((redisReply*)reply)->element[1]->type == REDIS_REPLY_INTEGER && - ((redisReply*)reply)->element[1]->integer == 123 && - ((redisReply*)reply)->element[2]->type == REDIS_REPLY_STRING && - ((redisReply*)reply)->element[2]->len == 6 && - !strcmp(((redisReply*)reply)->element[2]->str,"second") && - ((redisReply*)reply)->element[3]->type == REDIS_REPLY_BOOL && - ((redisReply*)reply)->element[3]->integer); + ((serverReply*)reply)->type == REDIS_REPLY_MAP && + ((serverReply*)reply)->elements == 4 && + ((serverReply*)reply)->element[0]->type == REDIS_REPLY_STATUS && + ((serverReply*)reply)->element[0]->len == 5 && + !strcmp(((serverReply*)reply)->element[0]->str,"first") && + ((serverReply*)reply)->element[1]->type == REDIS_REPLY_INTEGER && + ((serverReply*)reply)->element[1]->integer == 123 && + ((serverReply*)reply)->element[2]->type == REDIS_REPLY_STRING && + ((serverReply*)reply)->element[2]->len == 6 && + !strcmp(((serverReply*)reply)->element[2]->str,"second") && + ((serverReply*)reply)->element[3]->type == REDIS_REPLY_BOOL && + ((serverReply*)reply)->element[3]->integer); freeReplyObject(reply); redisReaderFree(reader); @@ -775,20 +775,20 @@ static void test_reply_reader(void) { redisReaderFeed(reader, "~5\r\n+orange\r\n$5\r\napple\r\n#f\r\n:100\r\n:999\r\n",40); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_SET && - ((redisReply*)reply)->elements == 5 && - ((redisReply*)reply)->element[0]->type == REDIS_REPLY_STATUS && - ((redisReply*)reply)->element[0]->len == 6 && - !strcmp(((redisReply*)reply)->element[0]->str,"orange") && - ((redisReply*)reply)->element[1]->type == REDIS_REPLY_STRING && - ((redisReply*)reply)->element[1]->len == 5 && - !strcmp(((redisReply*)reply)->element[1]->str,"apple") && - ((redisReply*)reply)->element[2]->type == REDIS_REPLY_BOOL && - !((redisReply*)reply)->element[2]->integer && - ((redisReply*)reply)->element[3]->type == REDIS_REPLY_INTEGER && - ((redisReply*)reply)->element[3]->integer == 100 && - ((redisReply*)reply)->element[4]->type == REDIS_REPLY_INTEGER && - ((redisReply*)reply)->element[4]->integer == 999); + ((serverReply*)reply)->type == REDIS_REPLY_SET && + ((serverReply*)reply)->elements == 5 && + ((serverReply*)reply)->element[0]->type == REDIS_REPLY_STATUS && + ((serverReply*)reply)->element[0]->len == 6 && + !strcmp(((serverReply*)reply)->element[0]->str,"orange") && + ((serverReply*)reply)->element[1]->type == REDIS_REPLY_STRING && + ((serverReply*)reply)->element[1]->len == 5 && + !strcmp(((serverReply*)reply)->element[1]->str,"apple") && + ((serverReply*)reply)->element[2]->type == REDIS_REPLY_BOOL && + !((serverReply*)reply)->element[2]->integer && + ((serverReply*)reply)->element[3]->type == REDIS_REPLY_INTEGER && + ((serverReply*)reply)->element[3]->integer == 100 && + ((serverReply*)reply)->element[4]->type == REDIS_REPLY_INTEGER && + ((serverReply*)reply)->element[4]->integer == 999); freeReplyObject(reply); redisReaderFree(reader); @@ -797,9 +797,9 @@ static void test_reply_reader(void) { redisReaderFeed(reader,"(3492890328409238509324850943850943825024385\r\n",46); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_BIGNUM && - ((redisReply*)reply)->len == 43 && - !strcmp(((redisReply*)reply)->str,"3492890328409238509324850943850943825024385")); + ((serverReply*)reply)->type == REDIS_REPLY_BIGNUM && + ((serverReply*)reply)->len == 43 && + !strcmp(((serverReply*)reply)->str,"3492890328409238509324850943850943825024385")); freeReplyObject(reply); redisReaderFree(reader); @@ -808,12 +808,12 @@ static void test_reply_reader(void) { redisReaderFeed(reader, "*1\r\n,3.14159265358979323846\r\n",31); ret = redisReaderGetReply(reader,&reply); test_cond(ret == REDIS_OK && - ((redisReply*)reply)->type == REDIS_REPLY_ARRAY && - ((redisReply*)reply)->elements == 1 && - ((redisReply*)reply)->element[0]->type == REDIS_REPLY_DOUBLE && - fabs(((redisReply*)reply)->element[0]->dval - 3.14159265358979323846) < 0.00000001 && - ((redisReply*)reply)->element[0]->len == 22 && - strcmp(((redisReply*)reply)->element[0]->str, "3.14159265358979323846") == 0); + ((serverReply*)reply)->type == REDIS_REPLY_ARRAY && + ((serverReply*)reply)->elements == 1 && + ((serverReply*)reply)->element[0]->type == REDIS_REPLY_DOUBLE && + fabs(((serverReply*)reply)->element[0]->dval - 3.14159265358979323846) < 0.00000001 && + ((serverReply*)reply)->element[0]->len == 22 && + strcmp(((serverReply*)reply)->element[0]->str, "3.14159265358979323846") == 0); freeReplyObject(reply); redisReaderFree(reader); } @@ -949,7 +949,7 @@ static void test_blocking_connection_errors(void) { /* Test push handler */ void push_handler(void *privdata, void *r) { struct pushCounters *pcounts = privdata; - redisReply *reply = r, *payload; + serverReply *reply = r, *payload; assert(reply && reply->type == REDIS_REPLY_PUSH && reply->elements == 2); @@ -976,7 +976,7 @@ void push_handler_async(redisAsyncContext *ac, void *reply) { static void test_resp3_push_handler(redisContext *c) { struct pushCounters pc = {0}; redisPushFn *old = NULL; - redisReply *reply; + serverReply *reply; void *privdata; /* Switch to RESP3 and turn on client tracking */ @@ -1115,7 +1115,7 @@ static void test_privdata_hooks(struct config config) { static void test_blocking_connection(struct config config) { redisContext *c; - redisReply *reply; + serverReply *reply; int major; c = do_connect(config); @@ -1213,7 +1213,7 @@ static void test_blocking_connection(struct config config) { /* Send DEBUG SLEEP 0 to detect if we have this command */ static int detect_debug_sleep(redisContext *c) { int detected; - redisReply *reply = redisCommand(c, "DEBUG SLEEP 0\r\n"); + serverReply *reply = redisCommand(c, "DEBUG SLEEP 0\r\n"); if (reply == NULL || c->err) { const char *cause = c->err ? c->errstr : "(none)"; @@ -1229,7 +1229,7 @@ static int detect_debug_sleep(redisContext *c) { static void test_blocking_connection_timeouts(struct config config) { redisContext *c; - redisReply *reply; + serverReply *reply; ssize_t s; const char *sleep_cmd = "DEBUG SLEEP 3\r\n"; struct timeval tv; @@ -1295,7 +1295,7 @@ static void test_blocking_connection_timeouts(struct config config) { static void test_blocking_io_errors(struct config config) { redisContext *c; - redisReply *reply; + serverReply *reply; void *_reply; int major, minor; @@ -1389,7 +1389,7 @@ void *hi_malloc_safe(size_t size) { static void test_throughput(struct config config) { redisContext *c = do_connect(config); - redisReply **replies; + serverReply **replies; int i, num; long long t1, t2; @@ -1398,7 +1398,7 @@ static void test_throughput(struct config config) { freeReplyObject(redisCommand(c,"LPUSH mylist foo")); num = 1000; - replies = hi_malloc_safe(sizeof(redisReply*)*num); + replies = hi_malloc_safe(sizeof(serverReply*)*num); t1 = usec(); for (i = 0; i < num; i++) { replies[i] = redisCommand(c,"PING"); @@ -1409,7 +1409,7 @@ static void test_throughput(struct config config) { hi_free(replies); printf("\t(%dx PING: %.3fs)\n", num, (t2-t1)/1000000.0); - replies = hi_malloc_safe(sizeof(redisReply*)*num); + replies = hi_malloc_safe(sizeof(serverReply*)*num); t1 = usec(); for (i = 0; i < num; i++) { replies[i] = redisCommand(c,"LRANGE mylist 0 499"); @@ -1421,7 +1421,7 @@ static void test_throughput(struct config config) { hi_free(replies); printf("\t(%dx LRANGE with 500 elements: %.3fs)\n", num, (t2-t1)/1000000.0); - replies = hi_malloc_safe(sizeof(redisReply*)*num); + replies = hi_malloc_safe(sizeof(serverReply*)*num); t1 = usec(); for (i = 0; i < num; i++) { replies[i] = redisCommand(c, "INCRBY incrkey %d", 1000000); @@ -1433,7 +1433,7 @@ static void test_throughput(struct config config) { printf("\t(%dx INCRBY: %.3fs)\n", num, (t2-t1)/1000000.0); num = 10000; - replies = hi_malloc_safe(sizeof(redisReply*)*num); + replies = hi_malloc_safe(sizeof(serverReply*)*num); for (i = 0; i < num; i++) redisAppendCommand(c,"PING"); t1 = usec(); @@ -1446,7 +1446,7 @@ static void test_throughput(struct config config) { hi_free(replies); printf("\t(%dx PING (pipelined): %.3fs)\n", num, (t2-t1)/1000000.0); - replies = hi_malloc_safe(sizeof(redisReply*)*num); + replies = hi_malloc_safe(sizeof(serverReply*)*num); for (i = 0; i < num; i++) redisAppendCommand(c,"LRANGE mylist 0 499"); t1 = usec(); @@ -1460,7 +1460,7 @@ static void test_throughput(struct config config) { hi_free(replies); printf("\t(%dx LRANGE with 500 elements (pipelined): %.3fs)\n", num, (t2-t1)/1000000.0); - replies = hi_malloc_safe(sizeof(redisReply*)*num); + replies = hi_malloc_safe(sizeof(serverReply*)*num); for (i = 0; i < num; i++) redisAppendCommand(c,"INCRBY incrkey %d", 1000000); t1 = usec(); @@ -1484,7 +1484,7 @@ static void test_throughput(struct config config) { // __test_callback_flags |= (long)privdata; // } // -// static void __test_reply_callback(redisContext *c, redisReply *reply, void *privdata) { +// static void __test_reply_callback(redisContext *c, serverReply *reply, void *privdata) { // ((void)c); // /* Shift to detect execution order */ // __test_callback_flags <<= 8; @@ -1612,7 +1612,7 @@ void unexpected_cb(redisAsyncContext *ac, void *r, void *privdata) { void publish_msg(redisOptions *options, const char* channel, const char* msg) { redisContext *c = redisConnectWithOptions(options); assert(c != NULL); - redisReply *reply = redisCommand(c,"PUBLISH %s %s",channel,msg); + serverReply *reply = redisCommand(c,"PUBLISH %s %s",channel,msg); assert(reply->type == REDIS_REPLY_INTEGER && reply->integer == 1); freeReplyObject(reply); disconnect(c, 0); @@ -1620,7 +1620,7 @@ void publish_msg(redisOptions *options, const char* channel, const char* msg) { /* Expect a reply of type INTEGER */ void integer_cb(redisAsyncContext *ac, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; TestState *state = privdata; assert(reply != NULL && reply->type == REDIS_REPLY_INTEGER); state->checkpoint++; @@ -1631,7 +1631,7 @@ void integer_cb(redisAsyncContext *ac, void *r, void *privdata) { * - a published message triggers an unsubscribe * - a command is sent before the unsubscribe response is received. */ void subscribe_cb(redisAsyncContext *ac, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; TestState *state = privdata; assert(reply != NULL && @@ -1667,7 +1667,7 @@ void subscribe_cb(redisAsyncContext *ac, void *r, void *privdata) { /* Expect a reply of type ARRAY */ void array_cb(redisAsyncContext *ac, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; TestState *state = privdata; assert(reply != NULL && reply->type == REDIS_REPLY_ARRAY); state->checkpoint++; @@ -1770,7 +1770,7 @@ static void test_pubsub_handling_resp3(struct config config) { * - the published message triggers a command that times out * - the command timeout triggers a disconnect */ void subscribe_with_timeout_cb(redisAsyncContext *ac, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; TestState *state = privdata; /* The non-clean disconnect should trigger the @@ -1845,7 +1845,7 @@ static void test_command_timeout_during_pubsub(struct config config) { /* Subscribe callback for test_pubsub_multiple_channels */ void subscribe_channel_a_cb(redisAsyncContext *ac, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; TestState *state = privdata; assert(reply != NULL && reply->type == REDIS_REPLY_ARRAY && @@ -1882,7 +1882,7 @@ void subscribe_channel_a_cb(redisAsyncContext *ac, void *r, void *privdata) { /* Subscribe callback for test_pubsub_multiple_channels */ void subscribe_channel_b_cb(redisAsyncContext *ac, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; TestState *state = privdata; (void)ac; @@ -1944,7 +1944,7 @@ static void test_pubsub_multiple_channels(struct config config) { /* Command callback for test_monitor() */ void monitor_cb(redisAsyncContext *ac, void *r, void *privdata) { - redisReply *reply = r; + serverReply *reply = r; TestState *state = privdata; /* NULL reply is received when BYE triggers a disconnect. */ @@ -1960,7 +1960,7 @@ void monitor_cb(redisAsyncContext *ac, void *r, void *privdata) { /* Response from MONITOR */ redisContext *c = redisConnectWithOptions(state->options); assert(c != NULL); - redisReply *reply = redisCommand(c,"SET first 1"); + serverReply *reply = redisCommand(c,"SET first 1"); assert(reply->type == REDIS_REPLY_STATUS); freeReplyObject(reply); redisFree(c); @@ -1969,7 +1969,7 @@ void monitor_cb(redisAsyncContext *ac, void *r, void *privdata) { assert(strstr(reply->str,"first") != NULL); redisContext *c = redisConnectWithOptions(state->options); assert(c != NULL); - redisReply *reply = redisCommand(c,"SET second 2"); + serverReply *reply = redisCommand(c,"SET second 2"); assert(reply->type == REDIS_REPLY_STATUS); freeReplyObject(reply); redisFree(c); @@ -2088,7 +2088,7 @@ static void disconnectCallback(const redisAsyncContext *c, int status) { static void commandCallback(struct redisAsyncContext *ac, void* _reply, void* _privdata) { - redisReply *reply = (redisReply*)_reply; + serverReply *reply = (serverReply*)_reply; struct _astest *t = (struct _astest *)ac->data; assert(t == &astest); (void)_privdata; diff --git a/src/sentinel.c b/src/sentinel.c index af27ee9c3b..6d2973814f 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -2767,7 +2767,7 @@ void sentinelRefreshInstanceInfo(sentinelRedisInstance *ri, const char *info) { void sentinelInfoReplyCallback(redisAsyncContext *c, void *reply, void *privdata) { sentinelRedisInstance *ri = privdata; instanceLink *link = c->data; - redisReply *r; + serverReply *r; if (!reply || !link) return; link->pending_commands--; @@ -2792,7 +2792,7 @@ void sentinelDiscardReplyCallback(redisAsyncContext *c, void *reply, void *privd void sentinelPingReplyCallback(redisAsyncContext *c, void *reply, void *privdata) { sentinelRedisInstance *ri = privdata; instanceLink *link = c->data; - redisReply *r; + serverReply *r; if (!reply || !link) return; link->pending_commands--; @@ -2838,7 +2838,7 @@ void sentinelPingReplyCallback(redisAsyncContext *c, void *reply, void *privdata void sentinelPublishReplyCallback(redisAsyncContext *c, void *reply, void *privdata) { sentinelRedisInstance *ri = privdata; instanceLink *link = c->data; - redisReply *r; + serverReply *r; if (!reply || !link) return; link->pending_commands--; @@ -2974,7 +2974,7 @@ void sentinelProcessHelloMessage(char *hello, int hello_len) { * to discover other sentinels attached at the same master. */ void sentinelReceiveHelloMessages(redisAsyncContext *c, void *reply, void *privdata) { sentinelRedisInstance *ri = privdata; - redisReply *r; + serverReply *r; UNUSED(c); if (!reply || !ri) return; @@ -4647,7 +4647,7 @@ void sentinelCheckObjectivelyDown(sentinelRedisInstance *master) { void sentinelReceiveIsMasterDownReply(redisAsyncContext *c, void *reply, void *privdata) { sentinelRedisInstance *ri = privdata; instanceLink *link = c->data; - redisReply *r; + serverReply *r; if (!reply || !link) return; link->pending_commands--; diff --git a/src/valkey-benchmark.c b/src/valkey-benchmark.c index 1a7b9f6c56..29ca7339d8 100644 --- a/src/valkey-benchmark.c +++ b/src/valkey-benchmark.c @@ -239,7 +239,7 @@ static redisContext *getRedisContext(const char *ip, int port, const char *hostsocket) { redisContext *ctx = NULL; - redisReply *reply = NULL; + serverReply *reply = NULL; if (hostsocket == NULL) ctx = redisConnect(ip, port); else @@ -298,7 +298,7 @@ static serverConfig *getServerConfig(const char *ip, int port, serverConfig *cfg = zcalloc(sizeof(*cfg)); if (!cfg) return NULL; redisContext *c = NULL; - redisReply *reply = NULL, *sub_reply = NULL; + serverReply *reply = NULL, *sub_reply = NULL; c = getRedisContext(ip, port, hostsocket); if (c == NULL) { freeServerConfig(cfg); @@ -312,7 +312,7 @@ static serverConfig *getServerConfig(const char *ip, int port, for (; i < 2; i++) { int res = redisGetReply(c, &r); if (reply) freeReplyObject(reply); - reply = res == REDIS_OK ? ((redisReply *) r) : NULL; + reply = res == REDIS_OK ? ((serverReply *) r) : NULL; if (res != REDIS_OK || !r) goto fail; if (reply->type == REDIS_REPLY_ERROR) { goto fail; @@ -484,7 +484,7 @@ static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) { fprintf(stderr,"Unexpected error reply, exiting...\n"); exit(1); } - redisReply *r = reply; + serverReply *r = reply; if (r->type == REDIS_REPLY_ERROR) { /* Try to update slots configuration if reply error is * MOVED/ASK/CLUSTERDOWN and the key(s) used by the command @@ -1101,7 +1101,7 @@ static clusterNode **addClusterNode(clusterNode *node) { static int fetchClusterConfiguration(void) { int success = 1; redisContext *ctx = NULL; - redisReply *reply = NULL; + serverReply *reply = NULL; ctx = getRedisContext(config.conn_info.hostip, config.conn_info.hostport, config.hostsocket); if (ctx == NULL) { exit(1); @@ -1275,7 +1275,7 @@ static int fetchClusterSlotsConfiguration(client c) { c->slots_last_update = last_update; return -1; } - redisReply *reply = NULL; + serverReply *reply = NULL; atomicGetIncr(config.is_fetching_slots, is_fetching_slots, 1); if (is_fetching_slots) return -1; //TODO: use other codes || errno ? atomicSet(config.is_fetching_slots, 1); @@ -1322,13 +1322,13 @@ static int fetchClusterSlotsConfiguration(client c) { } assert(reply->type == REDIS_REPLY_ARRAY); for (i = 0; i < reply->elements; i++) { - redisReply *r = reply->element[i]; + serverReply *r = reply->element[i]; assert(r->type == REDIS_REPLY_ARRAY); assert(r->elements >= 3); int from, to, slot; from = r->element[0]->integer; to = r->element[1]->integer; - redisReply *nr = r->element[2]; + serverReply *nr = r->element[2]; assert(nr->type == REDIS_REPLY_ARRAY && nr->elements >= 3); assert(nr->element[2]->str != NULL); sds name = sdsnew(nr->element[2]->str); diff --git a/src/valkey-cli.c b/src/valkey-cli.c index ba16d03fa7..c3ef5921f8 100644 --- a/src/valkey-cli.c +++ b/src/valkey-cli.c @@ -263,7 +263,7 @@ static struct config { int eval_ldb_end; /* Lua debugging session ended. */ int enable_ldb_on_eval; /* Handle manual SCRIPT DEBUG + EVAL commands. */ int last_cmd_type; - redisReply *last_reply; + serverReply *last_reply; int verbose; int set_errcode; clusterManagerCommand cluster_manager_command; @@ -432,13 +432,13 @@ static int helpEntriesLen = 0; static void cliLegacyIntegrateHelp(void) { if (cliConnect(CC_QUIET) == REDIS_ERR) return; - redisReply *reply = redisCommand(context, "COMMAND"); + serverReply *reply = redisCommand(context, "COMMAND"); if(reply == NULL || reply->type != REDIS_REPLY_ARRAY) return; /* Scan the array reported by COMMAND and fill only the entries that * don't already match what we have. */ for (size_t j = 0; j < reply->elements; j++) { - redisReply *entry = reply->element[j]; + serverReply *entry = reply->element[j]; if (entry->type != REDIS_REPLY_ARRAY || entry->elements < 4 || entry->element[0]->type != REDIS_REPLY_STRING || entry->element[1]->type != REDIS_REPLY_INTEGER || @@ -494,15 +494,15 @@ static sds sdscat_orempty(sds params, const char *value) { static sds makeHint(char **inputargv, int inputargc, int cmdlen, struct commandDocs docs); -static void cliAddCommandDocArg(cliCommandArg *cmdArg, redisReply *argMap); +static void cliAddCommandDocArg(cliCommandArg *cmdArg, serverReply *argMap); -static void cliMakeCommandDocArgs(redisReply *arguments, cliCommandArg *result) { +static void cliMakeCommandDocArgs(serverReply *arguments, cliCommandArg *result) { for (size_t j = 0; j < arguments->elements; j++) { cliAddCommandDocArg(&result[j], arguments->element[j]); } } -static void cliAddCommandDocArg(cliCommandArg *cmdArg, redisReply *argMap) { +static void cliAddCommandDocArg(cliCommandArg *cmdArg, serverReply *argMap) { if (argMap->type != REDIS_REPLY_MAP && argMap->type != REDIS_REPLY_ARRAY) { return; } @@ -542,12 +542,12 @@ static void cliAddCommandDocArg(cliCommandArg *cmdArg, redisReply *argMap) { cmdArg->type = ARG_TYPE_BLOCK; } } else if (!strcmp(key, "arguments")) { - redisReply *arguments = argMap->element[i + 1]; + serverReply *arguments = argMap->element[i + 1]; cmdArg->subargs = zcalloc(arguments->elements * sizeof(cliCommandArg)); cmdArg->numsubargs = arguments->elements; cliMakeCommandDocArgs(arguments, cmdArg->subargs); } else if (!strcmp(key, "flags")) { - redisReply *flags = argMap->element[i + 1]; + serverReply *flags = argMap->element[i + 1]; assert(flags->type == REDIS_REPLY_SET || flags->type == REDIS_REPLY_ARRAY); for (size_t j = 0; j < flags->elements; j++) { assert(flags->element[j]->type == REDIS_REPLY_STATUS); @@ -602,7 +602,7 @@ static void cliFillInCommandHelpEntry(helpEntry *help, char *cmdname, char *subc * If the command has subcommands, this is called recursively for the subcommands. */ static helpEntry *cliInitCommandHelpEntry(char *cmdname, char *subcommandname, - helpEntry *next, redisReply *specs, + helpEntry *next, serverReply *specs, dict *groups) { helpEntry *help = next++; cliFillInCommandHelpEntry(help, cmdname, subcommandname); @@ -612,15 +612,15 @@ static helpEntry *cliInitCommandHelpEntry(char *cmdname, char *subcommandname, assert(specs->element[j]->type == REDIS_REPLY_STRING); char *key = specs->element[j]->str; if (!strcmp(key, "summary")) { - redisReply *reply = specs->element[j + 1]; + serverReply *reply = specs->element[j + 1]; assert(reply->type == REDIS_REPLY_STRING); help->docs.summary = sdsnew(reply->str); } else if (!strcmp(key, "since")) { - redisReply *reply = specs->element[j + 1]; + serverReply *reply = specs->element[j + 1]; assert(reply->type == REDIS_REPLY_STRING); help->docs.since = sdsnew(reply->str); } else if (!strcmp(key, "group")) { - redisReply *reply = specs->element[j + 1]; + serverReply *reply = specs->element[j + 1]; assert(reply->type == REDIS_REPLY_STRING); help->docs.group = sdsnew(reply->str); sds group = sdsdup(help->docs.group); @@ -628,19 +628,19 @@ static helpEntry *cliInitCommandHelpEntry(char *cmdname, char *subcommandname, sdsfree(group); } } else if (!strcmp(key, "arguments")) { - redisReply *arguments = specs->element[j + 1]; + serverReply *arguments = specs->element[j + 1]; assert(arguments->type == REDIS_REPLY_ARRAY); help->docs.args = zcalloc(arguments->elements * sizeof(cliCommandArg)); help->docs.numargs = arguments->elements; cliMakeCommandDocArgs(arguments, help->docs.args); help->docs.params = makeHint(NULL, 0, 0, help->docs); } else if (!strcmp(key, "subcommands")) { - redisReply *subcommands = specs->element[j + 1]; + serverReply *subcommands = specs->element[j + 1]; assert(subcommands->type == REDIS_REPLY_MAP || subcommands->type == REDIS_REPLY_ARRAY); for (size_t i = 0; i < subcommands->elements; i += 2) { assert(subcommands->element[i]->type == REDIS_REPLY_STRING); char *subcommandname = subcommands->element[i]->str; - redisReply *subcommand = subcommands->element[i + 1]; + serverReply *subcommand = subcommands->element[i + 1]; assert(subcommand->type == REDIS_REPLY_MAP || subcommand->type == REDIS_REPLY_ARRAY); next = cliInitCommandHelpEntry(cmdname, subcommandname, next, subcommand, groups); } @@ -650,7 +650,7 @@ static helpEntry *cliInitCommandHelpEntry(char *cmdname, char *subcommandname, } /* Returns the total number of commands and subcommands in the command docs table. */ -static size_t cliCountCommands(redisReply* commandTable) { +static size_t cliCountCommands(serverReply* commandTable) { size_t numCommands = commandTable->elements / 2; /* The command docs table maps command names to a map of their specs. */ @@ -658,12 +658,12 @@ static size_t cliCountCommands(redisReply* commandTable) { assert(commandTable->element[i]->type == REDIS_REPLY_STRING); /* Command name. */ assert(commandTable->element[i + 1]->type == REDIS_REPLY_MAP || commandTable->element[i + 1]->type == REDIS_REPLY_ARRAY); - redisReply *map = commandTable->element[i + 1]; + serverReply *map = commandTable->element[i + 1]; for (size_t j = 0; j < map->elements; j += 2) { assert(map->element[j]->type == REDIS_REPLY_STRING); char *key = map->element[j]->str; if (!strcmp(key, "subcommands")) { - redisReply *subcommands = map->element[j + 1]; + serverReply *subcommands = map->element[j + 1]; assert(subcommands->type == REDIS_REPLY_MAP || subcommands->type == REDIS_REPLY_ARRAY); numCommands += subcommands->elements / 2; } @@ -712,7 +712,7 @@ void cliInitGroupHelpEntries(dict *groups) { } /* Initializes help entries for all commands in the COMMAND DOCS reply. */ -void cliInitCommandHelpEntries(redisReply *commandTable, dict *groups) { +void cliInitCommandHelpEntries(serverReply *commandTable, dict *groups) { helpEntry *next = helpEntries; for (size_t i = 0; i < commandTable->elements; i += 2) { assert(commandTable->element[i]->type == REDIS_REPLY_STRING); @@ -720,7 +720,7 @@ void cliInitCommandHelpEntries(redisReply *commandTable, dict *groups) { assert(commandTable->element[i + 1]->type == REDIS_REPLY_MAP || commandTable->element[i + 1]->type == REDIS_REPLY_ARRAY); - redisReply *cmdspecs = commandTable->element[i + 1]; + serverReply *cmdspecs = commandTable->element[i + 1]; next = cliInitCommandHelpEntry(cmdname, NULL, next, cmdspecs, groups); } } @@ -841,7 +841,7 @@ static size_t cliLegacyCountCommands(struct commandDocs *commands, sds version) * When not connected, or not possible, returns NULL. */ static sds cliGetServerVersion(void) { static const char *key = "\nredis_version:"; - redisReply *serverInfo = NULL; + serverReply *serverInfo = NULL; char *pos; if (config.server_version != NULL) { @@ -902,7 +902,7 @@ static void cliInitHelp(void) { NULL, /* val destructor */ NULL /* allow to expand */ }; - redisReply *commandTable; + serverReply *commandTable; dict *groups; if (cliConnect(CC_QUIET) == REDIS_ERR) { @@ -1557,7 +1557,7 @@ static void cliPressAnyKeyTTY(void) { /* Send AUTH command to the server */ static int cliAuth(redisContext *ctx, char *user, char *auth) { - redisReply *reply; + serverReply *reply; if (auth == NULL) return REDIS_OK; if (user == NULL) @@ -1581,7 +1581,7 @@ static int cliAuth(redisContext *ctx, char *user, char *auth) { /* Send SELECT input_dbnum to the server */ static int cliSelect(void) { - redisReply *reply; + serverReply *reply; if (config.conn_info.input_dbnum == config.dbnum) return REDIS_OK; reply = redisCommand(context,"SELECT %d",config.conn_info.input_dbnum); @@ -1604,7 +1604,7 @@ static int cliSelect(void) { /* Select RESP3 mode if redis-cli was started with the -3 option. */ static int cliSwitchProto(void) { - redisReply *reply; + serverReply *reply; if (!config.resp3 || config.resp2) return REDIS_OK; reply = redisCommand(context,"HELLO 3"); @@ -1718,7 +1718,7 @@ static int cliConnect(int flags) { /* In cluster, if server replies ASK, we will redirect to a different node. * Before sending the real command, we need to send ASKING command first. */ static int cliSendAsking(void) { - redisReply *reply; + serverReply *reply; config.cluster_send_asking = 0; if (context == NULL) { @@ -1743,7 +1743,7 @@ static void cliPrintContextError(void) { fprintf(stderr,"Error: %s\n",context->errstr); } -static int isInvalidateReply(redisReply *reply) { +static int isInvalidateReply(serverReply *reply) { return reply->type == REDIS_REPLY_PUSH && reply->elements == 2 && reply->element[0]->type == REDIS_REPLY_STRING && !strncmp(reply->element[0]->str, "invalidate", 10) && @@ -1753,11 +1753,11 @@ static int isInvalidateReply(redisReply *reply) { /* Special display handler for RESP3 'invalidate' messages. * This function does not validate the reply, so it should * already be confirmed correct */ -static sds cliFormatInvalidateTTY(redisReply *r) { +static sds cliFormatInvalidateTTY(serverReply *r) { sds out = sdsnew("-> invalidate: "); for (size_t i = 0; i < r->element[1]->elements; i++) { - redisReply *key = r->element[1]->element[i]; + serverReply *key = r->element[1]->element[i]; assert(key->type == REDIS_REPLY_STRING); out = sdscatfmt(out, "'%s'", key->str, key->len); @@ -1769,7 +1769,7 @@ static sds cliFormatInvalidateTTY(redisReply *r) { } /* Returns non-zero if cliFormatReplyTTY renders the reply in multiple lines. */ -static int cliIsMultilineValueTTY(redisReply *r) { +static int cliIsMultilineValueTTY(serverReply *r) { switch (r->type) { case REDIS_REPLY_ARRAY: case REDIS_REPLY_SET: @@ -1786,7 +1786,7 @@ static int cliIsMultilineValueTTY(redisReply *r) { } } -static sds cliFormatReplyTTY(redisReply *r, char *prefix) { +static sds cliFormatReplyTTY(serverReply *r, char *prefix) { sds out = sdsempty(); switch (r->type) { case REDIS_REPLY_ERROR: @@ -1905,7 +1905,7 @@ static sds cliFormatReplyTTY(redisReply *r, char *prefix) { } /* Returns 1 if the reply is a pubsub pushed reply. */ -int isPubsubPush(redisReply *r) { +int isPubsubPush(serverReply *r) { if (r == NULL || r->type != (config.current_resp3 ? REDIS_REPLY_PUSH : REDIS_REPLY_ARRAY) || r->elements < 3 || @@ -1967,7 +1967,7 @@ sds sdsCatColorizedLdbReply(sds o, char *s, size_t len) { return sdscatcolor(o,s,len,color); } -static sds cliFormatReplyRaw(redisReply *r) { +static sds cliFormatReplyRaw(serverReply *r) { sds out = sdsempty(), tmp; size_t i; @@ -2040,7 +2040,7 @@ static sds cliFormatReplyRaw(redisReply *r) { return out; } -static sds cliFormatReplyCSV(redisReply *r) { +static sds cliFormatReplyCSV(serverReply *r) { unsigned int i; sds out = sdsempty(); @@ -2109,7 +2109,7 @@ static sds jsonStringOutput(sds out, const char *p, int len, int mode) { } } -static sds cliFormatReplyJson(sds out, redisReply *r, int mode) { +static sds cliFormatReplyJson(sds out, serverReply *r, int mode) { unsigned int i; switch (r->type) { @@ -2149,7 +2149,7 @@ static sds cliFormatReplyJson(sds out, redisReply *r, int mode) { case REDIS_REPLY_MAP: out = sdscat(out,"{"); for (i = 0; i < r->elements; i += 2) { - redisReply *key = r->element[i]; + serverReply *key = r->element[i]; if (key->type == REDIS_REPLY_ERROR || key->type == REDIS_REPLY_STATUS || key->type == REDIS_REPLY_STRING || @@ -2181,7 +2181,7 @@ static sds cliFormatReplyJson(sds out, redisReply *r, int mode) { } /* Generate reply strings in various output modes */ -static sds cliFormatReply(redisReply *reply, int mode, int verbatim) { +static sds cliFormatReply(serverReply *reply, int mode, int verbatim) { sds out; if (verbatim) { @@ -2224,7 +2224,7 @@ static void cliPushHandler(void *privdata, void *reply) { static int cliReadReply(int output_raw_strings) { void *_reply; - redisReply *reply; + serverReply *reply; sds out = NULL; int output = 1; @@ -2259,7 +2259,7 @@ static int cliReadReply(int output_raw_strings) { return REDIS_ERR; /* avoid compiler warning */ } - config.last_reply = reply = (redisReply*)_reply; + config.last_reply = reply = (serverReply*)_reply; config.last_cmd_type = reply->type; @@ -2323,7 +2323,7 @@ static void cliWaitForMessagesOrStdin(void) { cliPressAnyKeyTTY(); while (config.pubsub_mode) { /* First check if there are any buffered replies. */ - redisReply *reply; + serverReply *reply; do { if (redisGetReplyFromReader(context, (void **)&reply) != REDIS_OK) { cliPrintContextError(); @@ -2587,8 +2587,8 @@ static int cliSendCommand(int argc, char **argv, long repeat) { } /* Send a command reconnecting the link if needed. */ -static redisReply *reconnectingRedisCommand(redisContext *c, const char *fmt, ...) { - redisReply *reply = NULL; +static serverReply *reconnectingRedisCommand(redisContext *c, const char *fmt, ...) { + serverReply *reply = NULL; int tries = 0; va_list ap; @@ -3591,7 +3591,7 @@ static int evalMode(int argc, char **argv) { /* If we are debugging a script, enable the Lua debugger. */ if (config.eval_ldb) { - redisReply *reply = redisCommand(context, + serverReply *reply = redisCommand(context, config.eval_ldb_sync ? "SCRIPT DEBUG sync": "SCRIPT DEBUG yes"); if (reply) freeReplyObject(reply); @@ -3721,7 +3721,7 @@ static dictType clusterManagerLinkDictType = { }; typedef int clusterManagerCommandProc(int argc, char **argv); -typedef int (*clusterManagerOnReplyError)(redisReply *reply, +typedef int (*clusterManagerOnReplyError)(serverReply *reply, clusterManagerNode *n, int bulk_idx); /* Cluster Manager helper functions */ @@ -4036,7 +4036,7 @@ static sds clusterManagerGetNodeRDBFilename(clusterManagerNode *node) { * of reply error (it's up to the caller function to free it), elsewhere * the error is directly printed. */ static int clusterManagerCheckRedisReply(clusterManagerNode *n, - redisReply *r, char **err) + serverReply *r, char **err) { int is_err = 0; if (!r || (is_err = (r->type == REDIS_REPLY_ERROR))) { @@ -4053,7 +4053,7 @@ static int clusterManagerCheckRedisReply(clusterManagerNode *n, /* Call MULTI command on a cluster node. */ static int clusterManagerStartTransaction(clusterManagerNode *node) { - redisReply *reply = CLUSTER_MANAGER_COMMAND(node, "MULTI"); + serverReply *reply = CLUSTER_MANAGER_COMMAND(node, "MULTI"); int success = clusterManagerCheckRedisReply(node, reply, NULL); if (reply) freeReplyObject(reply); return success; @@ -4063,7 +4063,7 @@ static int clusterManagerStartTransaction(clusterManagerNode *node) { static int clusterManagerExecTransaction(clusterManagerNode *node, clusterManagerOnReplyError onerror) { - redisReply *reply = CLUSTER_MANAGER_COMMAND(node, "EXEC"); + serverReply *reply = CLUSTER_MANAGER_COMMAND(node, "EXEC"); int success = clusterManagerCheckRedisReply(node, reply, NULL); if (success) { if (reply->type != REDIS_REPLY_ARRAY) { @@ -4072,7 +4072,7 @@ static int clusterManagerExecTransaction(clusterManagerNode *node, } size_t i; for (i = 0; i < reply->elements; i++) { - redisReply *r = reply->element[i]; + serverReply *r = reply->element[i]; char *err = NULL; success = clusterManagerCheckRedisReply(node, r, &err); if (!success && onerror) success = onerror(r, node, i); @@ -4115,7 +4115,7 @@ static int clusterManagerNodeConnect(clusterManagerNode *node) { * errors. */ anetKeepAlive(NULL, node->context->fd, REDIS_CLI_KEEPALIVE_INTERVAL); if (config.conn_info.auth) { - redisReply *reply; + serverReply *reply; if (config.conn_info.user == NULL) reply = redisCommand(node->context,"AUTH %s", config.conn_info.auth); else @@ -4194,10 +4194,10 @@ static void clusterManagerNodeResetSlots(clusterManagerNode *node) { } /* Call "INFO" redis command on the specified node and return the reply. */ -static redisReply *clusterManagerGetNodeRedisInfo(clusterManagerNode *node, +static serverReply *clusterManagerGetNodeRedisInfo(clusterManagerNode *node, char **err) { - redisReply *info = CLUSTER_MANAGER_COMMAND(node, "INFO"); + serverReply *info = CLUSTER_MANAGER_COMMAND(node, "INFO"); if (err != NULL) *err = NULL; if (info == NULL) return NULL; if (info->type == REDIS_REPLY_ERROR) { @@ -4212,7 +4212,7 @@ static redisReply *clusterManagerGetNodeRedisInfo(clusterManagerNode *node, } static int clusterManagerNodeIsCluster(clusterManagerNode *node, char **err) { - redisReply *info = clusterManagerGetNodeRedisInfo(node, err); + serverReply *info = clusterManagerGetNodeRedisInfo(node, err); if (info == NULL) return 0; int is_cluster = (int) getLongInfoField(info->str, "cluster_enabled"); freeReplyObject(info); @@ -4222,7 +4222,7 @@ static int clusterManagerNodeIsCluster(clusterManagerNode *node, char **err) { /* Checks whether the node is empty. Node is considered not-empty if it has * some key or if it already knows other nodes */ static int clusterManagerNodeIsEmpty(clusterManagerNode *node, char **err) { - redisReply *info = clusterManagerGetNodeRedisInfo(node, err); + serverReply *info = clusterManagerGetNodeRedisInfo(node, err); int is_empty = 1; if (info == NULL) return 0; if (strstr(info->str, "db0:") != NULL) { @@ -4644,7 +4644,7 @@ static void clusterManagerShowClusterInfo(void) { if (n->replicate && !strcmp(n->replicate, node->name)) replicas++; } - redisReply *reply = CLUSTER_MANAGER_COMMAND(node, "DBSIZE"); + serverReply *reply = CLUSTER_MANAGER_COMMAND(node, "DBSIZE"); if (reply != NULL && reply->type == REDIS_REPLY_INTEGER) dbsize = reply->integer; if (dbsize < 0) { @@ -4671,7 +4671,7 @@ static void clusterManagerShowClusterInfo(void) { /* Flush dirty slots configuration of the node by calling CLUSTER ADDSLOTS */ static int clusterManagerAddSlots(clusterManagerNode *node, char**err) { - redisReply *reply = NULL; + serverReply *reply = NULL; void *_reply = NULL; int success = 1; /* First two args are used for the command itself. */ @@ -4701,7 +4701,7 @@ static int clusterManagerAddSlots(clusterManagerNode *node, char**err) success = 0; goto cleanup; } - reply = (redisReply*) _reply; + reply = (serverReply*) _reply; success = clusterManagerCheckRedisReply(node, reply, err); cleanup: zfree(argvlen); @@ -4722,18 +4722,18 @@ static clusterManagerNode *clusterManagerGetSlotOwner(clusterManagerNode *n, { assert(slot >= 0 && slot < CLUSTER_MANAGER_SLOTS); clusterManagerNode *owner = NULL; - redisReply *reply = CLUSTER_MANAGER_COMMAND(n, "CLUSTER SLOTS"); + serverReply *reply = CLUSTER_MANAGER_COMMAND(n, "CLUSTER SLOTS"); if (clusterManagerCheckRedisReply(n, reply, err)) { assert(reply->type == REDIS_REPLY_ARRAY); size_t i; for (i = 0; i < reply->elements; i++) { - redisReply *r = reply->element[i]; + serverReply *r = reply->element[i]; assert(r->type == REDIS_REPLY_ARRAY && r->elements >= 3); int from, to; from = r->element[0]->integer; to = r->element[1]->integer; if (slot < from || slot > to) continue; - redisReply *nr = r->element[2]; + serverReply *nr = r->element[2]; assert(nr->type == REDIS_REPLY_ARRAY && nr->elements >= 2); char *name = NULL; if (nr->elements >= 3) @@ -4766,7 +4766,7 @@ static clusterManagerNode *clusterManagerGetSlotOwner(clusterManagerNode *n, static int clusterManagerSetSlot(clusterManagerNode *node1, clusterManagerNode *node2, int slot, const char *status, char **err) { - redisReply *reply = CLUSTER_MANAGER_COMMAND(node1, "CLUSTER " + serverReply *reply = CLUSTER_MANAGER_COMMAND(node1, "CLUSTER " "SETSLOT %d %s %s", slot, status, (char *) node2->name); @@ -4790,7 +4790,7 @@ static int clusterManagerSetSlot(clusterManagerNode *node1, } static int clusterManagerClearSlotStatus(clusterManagerNode *node, int slot) { - redisReply *reply = CLUSTER_MANAGER_COMMAND(node, + serverReply *reply = CLUSTER_MANAGER_COMMAND(node, "CLUSTER SETSLOT %d %s", slot, "STABLE"); int success = clusterManagerCheckRedisReply(node, reply, NULL); if (reply) freeReplyObject(reply); @@ -4800,7 +4800,7 @@ static int clusterManagerClearSlotStatus(clusterManagerNode *node, int slot) { static int clusterManagerDelSlot(clusterManagerNode *node, int slot, int ignore_unassigned_err) { - redisReply *reply = CLUSTER_MANAGER_COMMAND(node, + serverReply *reply = CLUSTER_MANAGER_COMMAND(node, "CLUSTER DELSLOTS %d", slot); char *err = NULL; int success = clusterManagerCheckRedisReply(node, reply, &err); @@ -4827,7 +4827,7 @@ static int clusterManagerDelSlot(clusterManagerNode *node, int slot, } static int clusterManagerAddSlot(clusterManagerNode *node, int slot) { - redisReply *reply = CLUSTER_MANAGER_COMMAND(node, + serverReply *reply = CLUSTER_MANAGER_COMMAND(node, "CLUSTER ADDSLOTS %d", slot); int success = clusterManagerCheckRedisReply(node, reply, NULL); if (reply) freeReplyObject(reply); @@ -4837,7 +4837,7 @@ static int clusterManagerAddSlot(clusterManagerNode *node, int slot) { static signed int clusterManagerCountKeysInSlot(clusterManagerNode *node, int slot) { - redisReply *reply = CLUSTER_MANAGER_COMMAND(node, + serverReply *reply = CLUSTER_MANAGER_COMMAND(node, "CLUSTER COUNTKEYSINSLOT %d", slot); int count = -1; int success = clusterManagerCheckRedisReply(node, reply, NULL); @@ -4847,7 +4847,7 @@ static signed int clusterManagerCountKeysInSlot(clusterManagerNode *node, } static int clusterManagerBumpEpoch(clusterManagerNode *node) { - redisReply *reply = CLUSTER_MANAGER_COMMAND(node, "CLUSTER BUMPEPOCH"); + serverReply *reply = CLUSTER_MANAGER_COMMAND(node, "CLUSTER BUMPEPOCH"); int success = clusterManagerCheckRedisReply(node, reply, NULL); if (reply) freeReplyObject(reply); return success; @@ -4856,7 +4856,7 @@ static int clusterManagerBumpEpoch(clusterManagerNode *node) { /* Callback used by clusterManagerSetSlotOwner transaction. It should ignore * errors except for ADDSLOTS errors. * Return 1 if the error should be ignored. */ -static int clusterManagerOnSetOwnerErr(redisReply *reply, +static int clusterManagerOnSetOwnerErr(serverReply *reply, clusterManagerNode *n, int bulk_idx) { UNUSED(reply); @@ -4888,7 +4888,7 @@ static int clusterManagerSetSlotOwner(clusterManagerNode *owner, * error. */ static int clusterManagerCompareKeysValues(clusterManagerNode *n1, clusterManagerNode *n2, - redisReply *keys_reply, + serverReply *keys_reply, list *diffs) { size_t i, argc = keys_reply->elements + 2; @@ -4900,22 +4900,22 @@ static int clusterManagerCompareKeysValues(clusterManagerNode *n1, argv[1] = "DIGEST-VALUE"; argv_len[1] = 12; for (i = 0; i < keys_reply->elements; i++) { - redisReply *entry = keys_reply->element[i]; + serverReply *entry = keys_reply->element[i]; int idx = i + 2; argv[idx] = entry->str; argv_len[idx] = entry->len; } int success = 0; void *_reply1 = NULL, *_reply2 = NULL; - redisReply *r1 = NULL, *r2 = NULL; + serverReply *r1 = NULL, *r2 = NULL; redisAppendCommandArgv(n1->context,argc, (const char**)argv,argv_len); success = (redisGetReply(n1->context, &_reply1) == REDIS_OK); if (!success) goto cleanup; - r1 = (redisReply *) _reply1; + r1 = (serverReply *) _reply1; redisAppendCommandArgv(n2->context,argc, (const char**)argv,argv_len); success = (redisGetReply(n2->context, &_reply2) == REDIS_OK); if (!success) goto cleanup; - r2 = (redisReply *) _reply2; + r2 = (serverReply *) _reply2; success = (r1->type != REDIS_REPLY_ERROR && r2->type != REDIS_REPLY_ERROR); if (r1->type == REDIS_REPLY_ERROR) { CLUSTER_MANAGER_PRINT_REPLY_ERROR(n1, r1->str); @@ -4948,13 +4948,13 @@ static int clusterManagerCompareKeysValues(clusterManagerNode *n1, /* Migrate keys taken from reply->elements. It returns the reply from the * MIGRATE command, or NULL if something goes wrong. If the argument 'dots' * is not NULL, a dot will be printed for every migrated key. */ -static redisReply *clusterManagerMigrateKeysInReply(clusterManagerNode *source, +static serverReply *clusterManagerMigrateKeysInReply(clusterManagerNode *source, clusterManagerNode *target, - redisReply *reply, + serverReply *reply, int replace, int timeout, char *dots) { - redisReply *migrate_reply = NULL; + serverReply *migrate_reply = NULL; char **argv = NULL; size_t *argv_len = NULL; int c = (replace ? 8 : 7); @@ -5009,7 +5009,7 @@ static redisReply *clusterManagerMigrateKeysInReply(clusterManagerNode *source, argv_len[offset] = 4; offset++; for (i = 0; i < reply->elements; i++) { - redisReply *entry = reply->element[i]; + serverReply *entry = reply->element[i]; size_t idx = i + offset; assert(entry->type == REDIS_REPLY_STRING); argv[idx] = (char *) sdsnewlen(entry->str, entry->len); @@ -5023,7 +5023,7 @@ static redisReply *clusterManagerMigrateKeysInReply(clusterManagerNode *source, int success = (redisGetReply(source->context, &_reply) == REDIS_OK); for (i = 0; i < reply->elements; i++) sdsfree(argv[i + offset]); if (!success) goto cleanup; - migrate_reply = (redisReply *) _reply; + migrate_reply = (serverReply *) _reply; cleanup: zfree(argv); zfree(argv_len); @@ -5044,7 +5044,7 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source, CLUSTER_MANAGER_CMD_FLAG_REPLACE; while (1) { char *dots = NULL; - redisReply *reply = NULL, *migrate_reply = NULL; + serverReply *reply = NULL, *migrate_reply = NULL; reply = CLUSTER_MANAGER_COMMAND(source, "CLUSTER " "GETKEYSINSLOT %d %d", slot, pipeline); @@ -5274,7 +5274,7 @@ static int clusterManagerMoveSlot(clusterManagerNode *source, * adding the slots defined in the masters. */ static int clusterManagerFlushNodeConfig(clusterManagerNode *node, char **err) { if (!node->dirty) return 0; - redisReply *reply = NULL; + serverReply *reply = NULL; int is_err = 0, success = 1; if (err != NULL) *err = NULL; if (node->replicate != NULL) { @@ -5366,7 +5366,7 @@ static void clusterManagerWaitForClusterJoin(void) { static int clusterManagerNodeLoadInfo(clusterManagerNode *node, int opts, char **err) { - redisReply *reply = CLUSTER_MANAGER_COMMAND(node, "CLUSTER NODES"); + serverReply *reply = CLUSTER_MANAGER_COMMAND(node, "CLUSTER NODES"); int success = 1; *err = NULL; if (!clusterManagerCheckRedisReply(node, reply, err)) { @@ -5640,7 +5640,7 @@ static sds clusterManagerGetConfigSignature(clusterManagerNode *node) { sds signature = NULL; int node_count = 0, i = 0, name_len = 0; char **node_configs = NULL; - redisReply *reply = CLUSTER_MANAGER_COMMAND(node, "CLUSTER NODES"); + serverReply *reply = CLUSTER_MANAGER_COMMAND(node, "CLUSTER NODES"); if (reply == NULL || reply->type == REDIS_REPLY_ERROR) goto cleanup; char *lines = reply->str, *p, *line; @@ -5758,7 +5758,7 @@ static int clusterManagerIsConfigConsistent(void) { static list *clusterManagerGetDisconnectedLinks(clusterManagerNode *node) { list *links = NULL; - redisReply *reply = CLUSTER_MANAGER_COMMAND(node, "CLUSTER NODES"); + serverReply *reply = CLUSTER_MANAGER_COMMAND(node, "CLUSTER NODES"); if (!clusterManagerCheckRedisReply(node, reply, NULL)) goto cleanup; links = listCreate(); char *lines = reply->str, *p, *line; @@ -5898,7 +5898,7 @@ static clusterManagerNode * clusterManagerGetNodeWithMostKeysInSlot(list *nodes, clusterManagerNode *n = ln->value; if (n->flags & CLUSTER_MANAGER_FLAG_SLAVE || n->replicate) continue; - redisReply *r = + serverReply *r = CLUSTER_MANAGER_COMMAND(n, "CLUSTER COUNTKEYSINSLOT %d", slot); int success = clusterManagerCheckRedisReply(n, r, err); if (success) { @@ -5994,7 +5994,7 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) { clusterManagerNode *n = ln->value; if (n->flags & CLUSTER_MANAGER_FLAG_SLAVE || n->replicate) continue; - redisReply *reply = CLUSTER_MANAGER_COMMAND(n, + serverReply *reply = CLUSTER_MANAGER_COMMAND(n, "CLUSTER GETKEYSINSLOT %d %d", i, 1); if (!clusterManagerCheckRedisReply(n, reply, NULL)) { fixed = -1; @@ -6204,7 +6204,7 @@ static int clusterManagerFixOpenSlot(int slot) { if (n->slots[slot]) { listAddNodeTail(owners, n); } else { - redisReply *r = CLUSTER_MANAGER_COMMAND(n, + serverReply *r = CLUSTER_MANAGER_COMMAND(n, "CLUSTER COUNTKEYSINSLOT %d", slot); success = clusterManagerCheckRedisReply(n, r, NULL); if (success && r->integer > 0) { @@ -6261,7 +6261,7 @@ static int clusterManagerFixOpenSlot(int slot) { * the owner, then is added to the importing list in case * it has keys in the slot. */ if (!is_migrating && !is_importing && n != owner) { - redisReply *r = CLUSTER_MANAGER_COMMAND(n, + serverReply *r = CLUSTER_MANAGER_COMMAND(n, "CLUSTER COUNTKEYSINSLOT %d", slot); success = clusterManagerCheckRedisReply(n, r, NULL); if (success && r->integer > 0) { @@ -6461,7 +6461,7 @@ static int clusterManagerFixOpenSlot(int slot) { if (try_to_close_slot) { clusterManagerNode *n = listFirst(migrating)->value; if (!owner || owner != n) { - redisReply *r = CLUSTER_MANAGER_COMMAND(n, + serverReply *r = CLUSTER_MANAGER_COMMAND(n, "CLUSTER GETKEYSINSLOT %d %d", slot, 10); success = clusterManagerCheckRedisReply(n, r, NULL); if (r) { @@ -6479,7 +6479,7 @@ static int clusterManagerFixOpenSlot(int slot) { clusterManagerNode *n = listFirst(migrating)->value; clusterManagerLogInfo(">>> Case 4: Closing slot %d on %s:%d\n", slot, n->ip, n->port); - redisReply *r = CLUSTER_MANAGER_COMMAND(n, "CLUSTER SETSLOT %d %s", + serverReply *r = CLUSTER_MANAGER_COMMAND(n, "CLUSTER SETSLOT %d %s", slot, "STABLE"); success = clusterManagerCheckRedisReply(n, r, NULL); if (r) freeReplyObject(r); @@ -7086,7 +7086,7 @@ static int clusterManagerCommandCreate(int argc, char **argv) { listRewind(cluster_manager.nodes, &li); while ((ln = listNext(&li)) != NULL) { clusterManagerNode *node = ln->value; - redisReply *reply = NULL; + serverReply *reply = NULL; reply = CLUSTER_MANAGER_COMMAND(node, "cluster set-config-epoch %d", config_epoch++); @@ -7115,7 +7115,7 @@ static int clusterManagerCommandCreate(int argc, char **argv) { } continue; } - redisReply *reply = NULL; + serverReply *reply = NULL; if (first->bus_port == 0 || (first->bus_port == first->port + CLUSTER_MANAGER_PORT_INCR)) { /* CLUSTER MEET bus-port parameter was added in 4.0. * So if (bus_port == 0) or (bus_port == port + CLUSTER_MANAGER_PORT_INCR), @@ -7192,9 +7192,9 @@ static int clusterManagerCommandCreate(int argc, char **argv) { static int clusterManagerCommandAddNode(int argc, char **argv) { int success = 1; - redisReply *reply = NULL; - redisReply *function_restore_reply = NULL; - redisReply *function_list_reply = NULL; + serverReply *reply = NULL; + serverReply *function_restore_reply = NULL; + serverReply *function_list_reply = NULL; char *ref_ip = NULL, *ip = NULL; int ref_port = 0, port = 0; if (!getClusterHostFromCmdArgs(argc - 1, argv + 1, &ref_ip, &ref_port)) @@ -7390,13 +7390,13 @@ static int clusterManagerCommandDeleteNode(int argc, char **argv) { assert(master != NULL); clusterManagerLogInfo(">>> %s:%d as replica of %s:%d\n", n->ip, n->port, master->ip, master->port); - redisReply *r = CLUSTER_MANAGER_COMMAND(n, "CLUSTER REPLICATE %s", + serverReply *r = CLUSTER_MANAGER_COMMAND(n, "CLUSTER REPLICATE %s", master->name); success = clusterManagerCheckRedisReply(n, r, NULL); if (r) freeReplyObject(r); if (!success) return 0; } - redisReply *r = CLUSTER_MANAGER_COMMAND(n, "CLUSTER FORGET %s", + serverReply *r = CLUSTER_MANAGER_COMMAND(n, "CLUSTER FORGET %s", node_id); success = clusterManagerCheckRedisReply(n, r, NULL); if (r) freeReplyObject(r); @@ -7406,7 +7406,7 @@ static int clusterManagerCommandDeleteNode(int argc, char **argv) { /* Finally send CLUSTER RESET to the node. */ clusterManagerLogInfo(">>> Sending CLUSTER RESET SOFT to the " "deleted node.\n"); - redisReply *r = redisCommand(node->context, "CLUSTER RESET %s", "SOFT"); + serverReply *r = redisCommand(node->context, "CLUSTER RESET %s", "SOFT"); success = clusterManagerCheckRedisReply(node, r, NULL); if (r) freeReplyObject(r); return success; @@ -7852,7 +7852,7 @@ static int clusterManagerCommandSetTimeout(int argc, char **argv) { while ((ln = listNext(&li)) != NULL) { clusterManagerNode *n = ln->value; char *err = NULL; - redisReply *reply = CLUSTER_MANAGER_COMMAND(n, "CONFIG %s %s %d", + serverReply *reply = CLUSTER_MANAGER_COMMAND(n, "CONFIG %s %s %d", "SET", "cluster-node-timeout", timeout); @@ -7914,7 +7914,7 @@ static int clusterManagerCommandImport(int argc, char **argv) { if (!clusterManagerLoadInfoFromNode(refnode)) return 0; if (!clusterManagerCheckCluster(0)) return 0; char *reply_err = NULL; - redisReply *src_reply = NULL; + serverReply *src_reply = NULL; // Connect to the source node. redisContext *src_ctx = redisConnectWrapper(src_ip, src_port, config.connect_timeout); if (src_ctx->err) { @@ -8006,13 +8006,13 @@ static int clusterManagerCommandImport(int argc, char **argv) { cursor = src_reply->element[0]->integer; int keycount = src_reply->element[1]->elements; for (i = 0; i < keycount; i++) { - redisReply *kr = src_reply->element[1]->element[i]; + serverReply *kr = src_reply->element[1]->element[i]; assert(kr->type == REDIS_REPLY_STRING); char *key = kr->str; uint16_t slot = clusterManagerKeyHashSlot(key, kr->len); clusterManagerNode *target = slots_map[slot]; printf("Migrating %s to %s:%d: ", key, target->ip, target->port); - redisReply *r = reconnectingRedisCommand(src_ctx, cmdfmt, + serverReply *r = reconnectingRedisCommand(src_ctx, cmdfmt, target->ip, target->port, key, 0, timeout); if (!r || r->type == REDIS_REPLY_ERROR) { @@ -8066,7 +8066,7 @@ static int clusterManagerCommandCall(int argc, char **argv) { if ((config.cluster_manager_command.flags & CLUSTER_MANAGER_CMD_FLAG_SLAVES_ONLY) && (n->replicate == NULL)) continue; // continue if node is master if (!n->context && !clusterManagerNodeConnect(n)) continue; - redisReply *reply = NULL; + serverReply *reply = NULL; redisAppendCommandArgv(n->context, argc, (const char **) argv, argvlen); int status = redisGetReply(n->context, (void **)(&reply)); if (status != REDIS_OK || reply == NULL ) @@ -8225,7 +8225,7 @@ static void latencyModePrint(long long min, long long max, double avg, long long #define LATENCY_SAMPLE_RATE 10 /* milliseconds. */ #define LATENCY_HISTORY_DEFAULT_INTERVAL 15000 /* milliseconds. */ static void latencyMode(void) { - redisReply *reply; + serverReply *reply; long long start, latency, min = 0, max = 0, tot = 0, count = 0; long long history_interval = config.interval ? config.interval/1000 : @@ -8349,7 +8349,7 @@ void showLatencyDistLegend(void) { } static void latencyDistMode(void) { - redisReply *reply; + serverReply *reply; long long start, latency, count = 0; long long history_interval = config.interval ? config.interval/1000 : @@ -8435,7 +8435,7 @@ static void latencyDistMode(void) { int sendReplconf(const char* arg1, const char* arg2) { int res = 1; fprintf(stderr, "sending REPLCONF %s %s\n", arg1, arg2); - redisReply *reply = redisCommand(context, "REPLCONF %s %s", arg1, arg2); + serverReply *reply = redisCommand(context, "REPLCONF %s %s", arg1, arg2); /* Handle any error conditions */ if(reply == NULL) { @@ -8727,7 +8727,7 @@ static void pipeMode(void) { long long errors = 0, replies = 0, obuf_len = 0, obuf_pos = 0; char obuf[1024*16]; /* Output buffer */ char aneterr[ANET_ERR_LEN]; - redisReply *reply; + serverReply *reply; int eof = 0; /* True once we consumed all the standard input. */ int done = 0; char magic[20]; /* Special reply we recognize. */ @@ -8881,8 +8881,8 @@ static void pipeMode(void) { * Find big keys *--------------------------------------------------------------------------- */ -static redisReply *sendScan(unsigned long long *it) { - redisReply *reply; +static serverReply *sendScan(unsigned long long *it) { + serverReply *reply; if (config.pattern) reply = redisCommand(context, "SCAN %llu MATCH %b COUNT %d", @@ -8917,7 +8917,7 @@ static redisReply *sendScan(unsigned long long *it) { } static int getDbSize(void) { - redisReply *reply; + serverReply *reply; int size; reply = redisCommand(context, "DBSIZE"); @@ -8941,7 +8941,7 @@ static int getDbSize(void) { } static int getDatabases(void) { - redisReply *reply; + serverReply *reply; int dbnum; reply = redisCommand(context, "CONFIG GET databases"); @@ -9007,8 +9007,8 @@ static dictType typeinfoDictType = { NULL /* allow to expand */ }; -static void getKeyTypes(dict *types_dict, redisReply *keys, typeinfo **types) { - redisReply *reply; +static void getKeyTypes(dict *types_dict, serverReply *keys, typeinfo **types) { + serverReply *reply; unsigned int i; /* Pipeline TYPE commands */ @@ -9048,11 +9048,11 @@ static void getKeyTypes(dict *types_dict, redisReply *keys, typeinfo **types) { } } -static void getKeySizes(redisReply *keys, typeinfo **types, +static void getKeySizes(serverReply *keys, typeinfo **types, unsigned long long *sizes, int memkeys, unsigned memkeys_samples) { - redisReply *reply; + serverReply *reply; unsigned int i; /* Pipeline size commands */ @@ -9115,7 +9115,7 @@ static void longStatLoopModeStop(int s) { /* In cluster mode we may need to send the READONLY command. Ignore the error in case the server isn't using cluster mode. */ static void sendReadOnly(void) { - redisReply *read_reply; + serverReply *read_reply; read_reply = redisCommand(context, "READONLY"); if (read_reply == NULL){ fprintf(stderr, "\nI/O error\n"); @@ -9129,7 +9129,7 @@ static void sendReadOnly(void) { static void findBigKeys(int memkeys, unsigned memkeys_samples) { unsigned long long sampled = 0, total_keys, totlen=0, *sizes=NULL, it=0, scan_loops = 0; - redisReply *reply, *keys; + serverReply *reply, *keys; unsigned int arrsize=0, i; dictIterator *di; dictEntry *de; @@ -9267,8 +9267,8 @@ static void findBigKeys(int memkeys, unsigned memkeys_samples) { exit(0); } -static void getKeyFreqs(redisReply *keys, unsigned long long *freqs) { - redisReply *reply; +static void getKeyFreqs(serverReply *keys, unsigned long long *freqs) { + serverReply *reply; unsigned int i; /* Pipeline OBJECT freq commands */ @@ -9305,7 +9305,7 @@ static void getKeyFreqs(redisReply *keys, unsigned long long *freqs) { #define HOTKEYS_SAMPLE 16 static void findHotKeys(void) { - redisReply *keys, *reply; + serverReply *keys, *reply; unsigned long long counters[HOTKEYS_SAMPLE] = {0}; sds hotkeys[HOTKEYS_SAMPLE] = {NULL}; unsigned long long sampled = 0, total_keys, *freqs = NULL, it = 0, scan_loops = 0; @@ -9463,7 +9463,7 @@ void bytesToHuman(char *s, size_t size, long long n) { } static void statMode(void) { - redisReply *reply; + serverReply *reply; long aux, requests = 0; int dbnum = getDatabases(); int i = 0; @@ -9557,7 +9557,7 @@ static void statMode(void) { *--------------------------------------------------------------------------- */ static void scanMode(void) { - redisReply *reply; + serverReply *reply; unsigned long long cur = 0; signal(SIGINT, longStatLoopModeStop); do { @@ -9610,7 +9610,7 @@ void LRUTestGenKey(char *buf, size_t buflen) { #define LRU_CYCLE_PERIOD 1000 /* 1000 milliseconds. */ #define LRU_CYCLE_PIPELINE_SIZE 250 static void LRUTestMode(void) { - redisReply *reply; + serverReply *reply; char key[128]; long long start_cycle; int j;