diff --git a/src/modules/ndb_redis/doc/ndb_redis_admin.xml b/src/modules/ndb_redis/doc/ndb_redis_admin.xml index 6b74f85691e..f7cc9449056 100644 --- a/src/modules/ndb_redis/doc/ndb_redis_admin.xml +++ b/src/modules/ndb_redis/doc/ndb_redis_admin.xml @@ -292,7 +292,7 @@ if(redis_cmd("srvN", "HMGET foo_key field1 field3", "r")) {
- <function moreinfo="none">redis_execute([srvname])</function> + <function moreinfo="none">redis_execute(srvname)</function> Sends commands to REDIS server identified by srvname. Commands are added @@ -301,10 +301,6 @@ if(redis_cmd("srvN", "HMGET foo_key field1 field3", "r")) { to the REDIS server. - - If this function is called without any parameters, it will iterate through all - existing servers and send the existing pipelined commands for them. - When using redis_cmd together with redis_pipe_cmd it is recommended that a call to redis_execute is made before calling redis_cmd in case there are pipelined commands, @@ -324,12 +320,12 @@ After several redis command calls: redis_pipe_cmd("srvB", "SET ruri $ru", "r2"); - redis_pipe_cmd("srvC", "GET foo", "r3"); + redis_pipe_cmd("srvB", "GET foo", "r3"); Send the data and retrieve the results: redis_execute("srvA"); //send command to srvA and wait for reply. Store the reply in r1 - redis_execute(); //send remaining commands (the set to srvB and get to srvC), wait for replies, and store the replies in r2 and r3 + redis_execute("srvB"); //send command to srvA and wait for reply. Store the replies in r2 (for SET ruri $ru) and r3 (for GET foo) Using both redis_cmd and redis_pipe_cmd: redis_pipe_cmd("srvA", "SET foo bar", "r1"); diff --git a/src/modules/ndb_redis/ndb_redis_mod.c b/src/modules/ndb_redis/ndb_redis_mod.c index d224782d08f..36b4efd3fe3 100644 --- a/src/modules/ndb_redis/ndb_redis_mod.c +++ b/src/modules/ndb_redis/ndb_redis_mod.c @@ -66,7 +66,6 @@ static int w_redis_pipe_cmd5(struct sip_msg* msg, char* ssrv, char* scmd, static int w_redis_pipe_cmd6(struct sip_msg* msg, char* ssrv, char* scmd, char *sargv1, char *sargv2, char *sargv3, char* sres); static int fixup_redis_cmd6(void** param, int param_no); -static int w_redis_execute_noargs(struct sip_msg* msg); static int w_redis_execute(struct sip_msg* msg, char* ssrv); static int w_redis_free_reply(struct sip_msg* msg, char* res); @@ -106,8 +105,6 @@ static cmd_export_t cmds[]={ 0, ANY_ROUTE}, {"redis_execute", (cmd_function)w_redis_execute, 1, fixup_redis_cmd6, 0, ANY_ROUTE}, - {"redis_execute", (cmd_function)w_redis_execute_noargs, 0, 0, - 0, ANY_ROUTE}, {"redis_free", (cmd_function)w_redis_free_reply, 1, fixup_spve_null, 0, ANY_ROUTE}, @@ -543,26 +540,13 @@ static int w_redis_pipe_cmd6(struct sip_msg* msg, char* ssrv, char* scmd, return 1; } -/** - * - */ -static int w_redis_execute_noargs(struct sip_msg* msg) -{ - if (redis_cluster_param) - { - LM_ERR("Pipelining is not supported if cluster parameter is enabled\n"); - return -1; - } - redisc_exec_pipelined_cmd_all(); - return 1; -} - /** * */ static int w_redis_execute(struct sip_msg* msg, char* ssrv) { str s; + int rv; if (redis_cluster_param) { @@ -574,7 +558,9 @@ static int w_redis_execute(struct sip_msg* msg, char* ssrv) LM_ERR("no redis server name\n"); return -1; } - redisc_exec_pipelined_cmd(&s); + rv=redisc_exec_pipelined_cmd(&s); + if (rv) + return rv; return 1; } diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c index 4b90c5f7235..df2b981f09d 100644 --- a/src/modules/ndb_redis/redis_client.c +++ b/src/modules/ndb_redis/redis_client.c @@ -485,26 +485,6 @@ int redisc_exec_pipelined_cmd(str *srv) return redisc_exec_pipelined(rsrv); } -/** - * - */ -int redisc_exec_pipelined_cmd_all() -{ - redisc_server_t *rsrv=NULL; - - rsrv=_redisc_srv_list; - while(rsrv!=NULL) - { - if ((rsrv->ctxRedis != NULL) && (rsrv->pendingReplies != 0)) - { - redisc_exec_pipelined(rsrv); - } - rsrv=rsrv->next; - } - - return 0; -} - /** * */ diff --git a/src/modules/ndb_redis/redis_client.h b/src/modules/ndb_redis/redis_client.h index b99da28b81b..958925c1dc1 100644 --- a/src/modules/ndb_redis/redis_client.h +++ b/src/modules/ndb_redis/redis_client.h @@ -73,7 +73,6 @@ int redisc_reconnect_server(redisc_server_t *rsrv); int redisc_exec(str *srv, str *res, str *cmd, ...); int redisc_append_cmd(str *srv, str *res, str *cmd, ...); int redisc_exec_pipelined_cmd(str *srv); -int redisc_exec_pipelined_cmd_all(); int redisc_exec_pipelined(redisc_server_t *rsrv); redisReply* redisc_exec_argv(redisc_server_t *rsrv, int argc, const char **argv, const size_t *argvlen);