Commit a83e3663 authored by Oran Agra's avatar Oran Agra
Browse files

Merge remote-tracking branch 'origin/unstable' into 7.0

parents d5915a16 5860fa3d
...@@ -125,6 +125,7 @@ static struct config { ...@@ -125,6 +125,7 @@ static struct config {
int enable_tracking; int enable_tracking;
pthread_mutex_t liveclients_mutex; pthread_mutex_t liveclients_mutex;
pthread_mutex_t is_updating_slots_mutex; pthread_mutex_t is_updating_slots_mutex;
int resp3; /* use RESP3 */
} config; } config;
typedef struct _client { typedef struct _client {
...@@ -632,6 +633,9 @@ static void writeHandler(aeEventLoop *el, int fd, void *privdata, int mask) { ...@@ -632,6 +633,9 @@ static void writeHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
fprintf(stderr, "Error writing to the server: %s\n", strerror(errno)); fprintf(stderr, "Error writing to the server: %s\n", strerror(errno));
freeClient(c); freeClient(c);
return; return;
} else if (nwritten > 0) {
c->written += nwritten;
return;
} }
} else { } else {
aeDeleteFileEvent(el,c->context->fd,AE_WRITABLE); aeDeleteFileEvent(el,c->context->fd,AE_WRITABLE);
...@@ -748,6 +752,15 @@ static client createClient(char *cmd, size_t len, client from, int thread_id) { ...@@ -748,6 +752,15 @@ static client createClient(char *cmd, size_t len, client from, int thread_id) {
(int)sdslen(config.input_dbnumstr),config.input_dbnumstr); (int)sdslen(config.input_dbnumstr),config.input_dbnumstr);
c->prefix_pending++; c->prefix_pending++;
} }
if (config.resp3) {
char *buf = NULL;
int len = redisFormatCommand(&buf, "HELLO 3");
c->obuf = sdscatlen(c->obuf, buf, len);
free(buf);
c->prefix_pending++;
}
c->prefixlen = sdslen(c->obuf); c->prefixlen = sdslen(c->obuf);
/* Append the request itself. */ /* Append the request itself. */
if (from) { if (from) {
...@@ -1440,6 +1453,8 @@ int parseOptions(int argc, char **argv) { ...@@ -1440,6 +1453,8 @@ int parseOptions(int argc, char **argv) {
} else if (!strcmp(argv[i],"-u") && !lastarg) { } else if (!strcmp(argv[i],"-u") && !lastarg) {
parseRedisUri(argv[++i],"redis-benchmark",&config.conn_info,&config.tls); parseRedisUri(argv[++i],"redis-benchmark",&config.conn_info,&config.tls);
config.input_dbnumstr = sdsfromlonglong(config.conn_info.input_dbnum); config.input_dbnumstr = sdsfromlonglong(config.conn_info.input_dbnum);
} else if (!strcmp(argv[i],"-3")) {
config.resp3 = 1;
} else if (!strcmp(argv[i],"-d")) { } else if (!strcmp(argv[i],"-d")) {
if (lastarg) goto invalid; if (lastarg) goto invalid;
config.datasize = atoi(argv[++i]); config.datasize = atoi(argv[++i]);
...@@ -1566,6 +1581,7 @@ usage: ...@@ -1566,6 +1581,7 @@ usage:
" -n <requests> Total number of requests (default 100000)\n" " -n <requests> Total number of requests (default 100000)\n"
" -d <size> Data size of SET/GET value in bytes (default 3)\n" " -d <size> Data size of SET/GET value in bytes (default 3)\n"
" --dbnum <db> SELECT the specified db number (default 0)\n" " --dbnum <db> SELECT the specified db number (default 0)\n"
" -3 Start session in RESP3 protocol mode.\n"
" --threads <num> Enable multi-thread mode.\n" " --threads <num> Enable multi-thread mode.\n"
" --cluster Enable cluster mode.\n" " --cluster Enable cluster mode.\n"
" If the command is supplied on the command line in cluster\n" " If the command is supplied on the command line in cluster\n"
...@@ -1739,6 +1755,7 @@ int main(int argc, char **argv) { ...@@ -1739,6 +1755,7 @@ int main(int argc, char **argv) {
config.is_updating_slots = 0; config.is_updating_slots = 0;
config.slots_last_update = 0; config.slots_last_update = 0;
config.enable_tracking = 0; config.enable_tracking = 0;
config.resp3 = 0;
i = parseOptions(argc,argv); i = parseOptions(argc,argv);
argc -= i; argc -= i;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -58,6 +58,13 @@ ...@@ -58,6 +58,13 @@
#define REGISTRY_SET_GLOBALS_PROTECTION_NAME "__GLOBAL_PROTECTION__" #define REGISTRY_SET_GLOBALS_PROTECTION_NAME "__GLOBAL_PROTECTION__"
#define REDIS_API_NAME "redis" #define REDIS_API_NAME "redis"
typedef struct errorInfo {
sds msg;
sds source;
sds line;
int ignore_err_stats_update;
}errorInfo;
void luaRegisterRedisAPI(lua_State* lua); void luaRegisterRedisAPI(lua_State* lua);
sds luaGetStringSds(lua_State *lua, int index); sds luaGetStringSds(lua_State *lua, int index);
void luaEnableGlobalsProtection(lua_State *lua, int is_eval); void luaEnableGlobalsProtection(lua_State *lua, int is_eval);
...@@ -65,11 +72,14 @@ void luaRegisterGlobalProtectionFunction(lua_State *lua); ...@@ -65,11 +72,14 @@ void luaRegisterGlobalProtectionFunction(lua_State *lua);
void luaSetGlobalProtection(lua_State *lua); void luaSetGlobalProtection(lua_State *lua);
void luaRegisterLogFunction(lua_State* lua); void luaRegisterLogFunction(lua_State* lua);
void luaRegisterVersion(lua_State* lua); void luaRegisterVersion(lua_State* lua);
void luaPushError(lua_State *lua, char *error); void luaPushErrorBuff(lua_State *lua, sds err_buff);
int luaRaiseError(lua_State *lua); void luaPushError(lua_State *lua, const char *error);
int luaError(lua_State *lua);
void luaSaveOnRegistry(lua_State* lua, const char* name, void* ptr); void luaSaveOnRegistry(lua_State* lua, const char* name, void* ptr);
void* luaGetFromRegistry(lua_State* lua, const char* name); void* luaGetFromRegistry(lua_State* lua, const char* name);
void luaCallFunction(scriptRunCtx* r_ctx, lua_State *lua, robj** keys, size_t nkeys, robj** args, size_t nargs, int debug_enabled); void luaCallFunction(scriptRunCtx* r_ctx, lua_State *lua, robj** keys, size_t nkeys, robj** args, size_t nargs, int debug_enabled);
void luaExtractErrorInformation(lua_State *lua, errorInfo *err_info);
void luaErrorInformationDiscard(errorInfo *err_info);
unsigned long luaMemory(lua_State *lua); unsigned long luaMemory(lua_State *lua);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment