diff --git a/src/config.cpp b/src/config.cpp index f9c835149..0fb2ea60a 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -248,12 +248,19 @@ const char *evictPolicyToString(void) { * Config file parsing *----------------------------------------------------------------------------*/ +int truefalsetoi(char *s) { + if (!strcasecmp(s,"true")) return 1; + else if (!strcasecmp(s,"false")) return 0; + else return -1; +} + int yesnotoi(char *s) { if (!strcasecmp(s,"yes")) return 1; else if (!strcasecmp(s,"no")) return 0; - else return -1; + else return truefalsetoi(s); } + void appendServerSaveParams(time_t seconds, int changes) { g_pserver->saveparams = (saveparam*)zrealloc(g_pserver->saveparams,sizeof(struct saveparam)*(g_pserver->saveparamslen+1), MALLOC_LOCAL); g_pserver->saveparams[g_pserver->saveparamslen].seconds = seconds; @@ -1625,6 +1632,7 @@ static int boolConfigLoad(typeData data, sds *argv, int argc, const char **err) return 0; } if ((yn = yesnotoi(argv[1])) == -1) { + if ((yn = truefalsetoi(argv[1])) == -1) *err = "argument must be 'yes' or 'no'"; return 0; } diff --git a/src/networking.cpp b/src/networking.cpp index 5401f7f27..e296fbbec 100644 --- a/src/networking.cpp +++ b/src/networking.cpp @@ -2196,6 +2196,7 @@ void processInputBufferAndReplicate(client *c) { void readQueryFromClient(connection *conn) { client *c = (client*)connGetPrivateData(conn); + serverAssert(conn == c->conn); int nread, readlen; size_t qblen; @@ -2385,7 +2386,8 @@ sds catClientInfoString(sds s, client *client) { (unsigned long long) listLength(client->reply), (unsigned long long) getClientOutputBufferMemoryUsage(client), events, - client->lastcmd ? client->lastcmd->name : "NULL"); + client->lastcmd ? client->lastcmd->name : "NULL", + client->puser ? client->puser->name : "(superuser)"); } sds getAllClientsInfoString(int type) { diff --git a/src/replication.cpp b/src/replication.cpp index 340311634..19067a007 100644 --- a/src/replication.cpp +++ b/src/replication.cpp @@ -1563,7 +1563,10 @@ void replicationCreateMasterClient(redisMaster *mi, connection *conn, int dbid) serverAssert(mi->master == nullptr); mi->master = createClient(conn, serverTL - g_pserver->rgthreadvar); if (conn) + { + serverAssert(connGetPrivateData(mi->master->conn) == mi->master); connSetReadHandler(mi->master->conn, readQueryFromClient); + } mi->master->flags |= CLIENT_MASTER; mi->master->authenticated = 1; mi->master->reploff = mi->master_initial_offset; @@ -1985,6 +1988,7 @@ void readSyncBulkPayload(connection *conn) { /* Final setup of the connected slave <- master link */ replicationCreateMasterClient(mi,mi->repl_transfer_s,rsi.repl_stream_db); + mi->repl_transfer_s = nullptr; mi->repl_state = REPL_STATE_CONNECTED; mi->repl_down_since = 0; @@ -3129,7 +3133,7 @@ void replicationResurrectCachedMaster(redisMaster *mi, connection *conn) { mi->master = mi->cached_master; mi->cached_master = NULL; mi->master->conn = conn; - connSetPrivateData(mi->master->conn, mi); + connSetPrivateData(mi->master->conn, mi->master); mi->master->flags &= ~(CLIENT_CLOSE_AFTER_REPLY|CLIENT_CLOSE_ASAP); mi->master->authenticated = 1; mi->master->lastinteraction = g_pserver->unixtime; @@ -3142,6 +3146,7 @@ void replicationResurrectCachedMaster(redisMaster *mi, connection *conn) { /* Re-add to the list of clients. */ linkClient(mi->master); + serverAssert(connGetPrivateData(mi->master->conn) == mi->master); if (connSetReadHandler(mi->master->conn, readQueryFromClient)) { serverLog(LL_WARNING,"Error resurrecting the cached master, impossible to add the readable handler: %s", strerror(errno)); freeClientAsync(mi->master); /* Close ASAP. */ diff --git a/src/scripting.cpp b/src/scripting.cpp index 1ad2a13f7..e97dfa2e3 100644 --- a/src/scripting.cpp +++ b/src/scripting.cpp @@ -197,7 +197,7 @@ char *redisProtocolToLuaType_Aggregate(lua_State *lua, char *reply, int atype) { int j = 0; string2ll(reply+1,p-reply-1,&mbulklen); - if (g_pserver->lua_client->resp == 2 || atype == '*') { + if (serverTL->lua_client->resp == 2 || atype == '*') { p += 2; if (mbulklen == -1) { lua_pushboolean(lua,0); diff --git a/src/semiorderedset.h b/src/semiorderedset.h index 00a1f1d91..5228150c2 100644 --- a/src/semiorderedset.h +++ b/src/semiorderedset.h @@ -198,6 +198,7 @@ public: m_data = decltype(m_data)(); bits = bits_min; m_data.resize(1ULL << bits); + celem = 0; idxRehash = m_data.size(); } diff --git a/src/server.h b/src/server.h index f7a688e3f..fcd54313a 100644 --- a/src/server.h +++ b/src/server.h @@ -1887,7 +1887,6 @@ struct redisServer { is down? */ /* Scripting */ lua_State *lua; /* The Lua interpreter. We use just one for all clients */ - client *lua_client; /* The "fake client" to query Redis from Lua */ client *lua_caller = nullptr; /* The client running EVAL right now, or NULL */ char* lua_cur_script = nullptr; /* SHA1 of the script currently running, or NULL */ dict *lua_scripts; /* A dictionary of SHA1 -> Lua scripts */ diff --git a/tests/integration/aof-race.tcl b/tests/integration/aof-race.tcl index 1ccb2e9ab..baf02ec40 100644 --- a/tests/integration/aof-race.tcl +++ b/tests/integration/aof-race.tcl @@ -13,14 +13,9 @@ tags {"aof"} { # cleaned after a child responsible for an AOF rewrite exited. This buffer # was subsequently appended to the new AOF, resulting in duplicate commands. start_server_aof [list dir $server_path] { -<<<<<<< HEAD - set client [redis [srv host] [srv port]] - set bench [open "|src/keydb-benchmark -q -p [srv port] -c 20 -n 20000 incr foo" "r+"] -======= set client [redis [srv host] [srv port] 0 $::tls] - set bench [open "|src/redis-benchmark -q -s [srv unixsocket] -c 20 -n 20000 incr foo" "r+"] + set bench [open "|src/keydb-benchmark -q -s [srv unixsocket] -c 20 -n 20000 incr foo" "r+"] ->>>>>>> redis/6.0 after 100 # Benchmark should be running by now: start background rewrite diff --git a/tests/integration/psync2-reg.tcl b/tests/integration/psync2-reg.tcl index aefc32d3f..84ac23dce 100644 --- a/tests/integration/psync2-reg.tcl +++ b/tests/integration/psync2-reg.tcl @@ -37,11 +37,7 @@ start_server {} { } set cycle_start_time [clock milliseconds] -<<<<<<< HEAD - set bench_pid [exec src/keydb-benchmark -p $R_port(0) -n 10000000 -r 1000 incr __rand_int__ > /dev/null &] -======= - set bench_pid [exec src/redis-benchmark -s $R_unixsocket(0) -n 10000000 -r 1000 incr __rand_int__ > /dev/null &] ->>>>>>> redis/6.0 + set bench_pid [exec src/keydb-benchmark -s $R_unixsocket(0) -n 10000000 -r 1000 incr __rand_int__ > /dev/null &] while 1 { set elapsed [expr {[clock milliseconds]-$cycle_start_time}] if {$elapsed > $duration*1000} break diff --git a/tests/integration/redis-cli.tcl b/tests/integration/redis-cli.tcl index 2e2ccf650..5d1635950 100644 --- a/tests/integration/redis-cli.tcl +++ b/tests/integration/redis-cli.tcl @@ -3,12 +3,8 @@ source tests/support/cli.tcl start_server {tags {"cli"}} { proc open_cli {} { set ::env(TERM) dumb -<<<<<<< HEAD - set fd [open [format "|src/keydb-cli -p %d -n 9" [srv port]] "r+"] -======= set cmdline [rediscli [srv port] "-n 9"] set fd [open "|$cmdline" "r+"] ->>>>>>> redis/6.0 fconfigure $fd -buffering none fconfigure $fd -blocking false fconfigure $fd -translation binary @@ -61,13 +57,8 @@ start_server {tags {"cli"}} { } proc _run_cli {opts args} { -<<<<<<< HEAD - set cmd [format "src/keydb-cli -p %d -n 9 $args" [srv port]] - foreach {key value} $opts { -======= set cmd [rediscli [srv port] [list -n 9 {*}$args]] foreach {key value} $args { ->>>>>>> redis/6.0 if {$key eq "pipe"} { set cmd "sh -c \"$value | $cmd\"" } diff --git a/tests/sentinel/tests/07-down-conditions.tcl b/tests/sentinel/tests/07-down-conditions.tcl index c180ec015..1f150ce79 100644 --- a/tests/sentinel/tests/07-down-conditions.tcl +++ b/tests/sentinel/tests/07-down-conditions.tcl @@ -29,11 +29,7 @@ test "Crash the majority of Sentinels to prevent failovers for this unit" { test "SDOWN is triggered by non-responding but not crashed instance" { lassign [S 4 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] host port ensure_master_up -<<<<<<< HEAD - exec ../../../src/keydb-cli -h $host -p $port debug sleep 10 > /dev/null & -======= - exec ../../../src/redis-cli -h $host -p $port {*}[rediscli_tls_config "../../../tests"] debug sleep 10 > /dev/null & ->>>>>>> redis/6.0 + exec ../../../src/keydb-cli -h $host -p $port {*}[rediscli_tls_config "../../../tests"] debug sleep 10 > /dev/null & ensure_master_down ensure_master_up } diff --git a/tests/support/cli.tcl b/tests/support/cli.tcl index 37c902a50..c56dad35e 100644 --- a/tests/support/cli.tcl +++ b/tests/support/cli.tcl @@ -12,7 +12,7 @@ proc rediscli_tls_config {testsdir} { } proc rediscli {port {opts {}}} { - set cmd [list src/redis-cli -p $port] + set cmd [list src/keydb-cli -p $port] lappend cmd {*}[rediscli_tls_config "tests"] lappend cmd {*}$opts return $cmd diff --git a/tests/unit/introspection.tcl b/tests/unit/introspection.tcl index cd905084a..417869bdd 100644 --- a/tests/unit/introspection.tcl +++ b/tests/unit/introspection.tcl @@ -94,6 +94,7 @@ start_server {tags {"introspection"}} { slaveof bind requirepass + multi-master } set configs {} diff --git a/tests/unit/wait.tcl b/tests/unit/wait.tcl index a561a7ef4..5cfc1c8ed 100644 --- a/tests/unit/wait.tcl +++ b/tests/unit/wait.tcl @@ -33,14 +33,9 @@ start_server {} { } test {WAIT should not acknowledge 1 additional copy if slave is blocked} { -<<<<<<< HEAD - exec src/keydb-cli -h $slave_host -p $slave_port debug sleep 5 > /dev/null 2> /dev/null & - after 1000 ;# Give keydb-cli the time to execute the command. -======= set cmd [rediscli $slave_port "-h $slave_host debug sleep 5"] exec {*}$cmd > /dev/null 2> /dev/null & - after 1000 ;# Give redis-cli the time to execute the command. ->>>>>>> redis/6.0 + after 1000 ;# Give keydb-cli the time to execute the command. $master set foo 0 $master incr foo $master incr foo