Fix most tests (still some failures)
Former-commit-id: da83e841255487efe0e4b13d42b2dcc55a369838
This commit is contained in:
parent
8e5fe97525
commit
39378f982e
@ -248,12 +248,19 @@ const char *evictPolicyToString(void) {
|
|||||||
* Config file parsing
|
* 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) {
|
int yesnotoi(char *s) {
|
||||||
if (!strcasecmp(s,"yes")) return 1;
|
if (!strcasecmp(s,"yes")) return 1;
|
||||||
else if (!strcasecmp(s,"no")) return 0;
|
else if (!strcasecmp(s,"no")) return 0;
|
||||||
else return -1;
|
else return truefalsetoi(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void appendServerSaveParams(time_t seconds, int changes) {
|
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 = (saveparam*)zrealloc(g_pserver->saveparams,sizeof(struct saveparam)*(g_pserver->saveparamslen+1), MALLOC_LOCAL);
|
||||||
g_pserver->saveparams[g_pserver->saveparamslen].seconds = seconds;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((yn = yesnotoi(argv[1])) == -1) {
|
if ((yn = yesnotoi(argv[1])) == -1) {
|
||||||
|
if ((yn = truefalsetoi(argv[1])) == -1)
|
||||||
*err = "argument must be 'yes' or 'no'";
|
*err = "argument must be 'yes' or 'no'";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2196,6 +2196,7 @@ void processInputBufferAndReplicate(client *c) {
|
|||||||
|
|
||||||
void readQueryFromClient(connection *conn) {
|
void readQueryFromClient(connection *conn) {
|
||||||
client *c = (client*)connGetPrivateData(conn);
|
client *c = (client*)connGetPrivateData(conn);
|
||||||
|
serverAssert(conn == c->conn);
|
||||||
int nread, readlen;
|
int nread, readlen;
|
||||||
size_t qblen;
|
size_t qblen;
|
||||||
|
|
||||||
@ -2385,7 +2386,8 @@ sds catClientInfoString(sds s, client *client) {
|
|||||||
(unsigned long long) listLength(client->reply),
|
(unsigned long long) listLength(client->reply),
|
||||||
(unsigned long long) getClientOutputBufferMemoryUsage(client),
|
(unsigned long long) getClientOutputBufferMemoryUsage(client),
|
||||||
events,
|
events,
|
||||||
client->lastcmd ? client->lastcmd->name : "NULL");
|
client->lastcmd ? client->lastcmd->name : "NULL",
|
||||||
|
client->puser ? client->puser->name : "(superuser)");
|
||||||
}
|
}
|
||||||
|
|
||||||
sds getAllClientsInfoString(int type) {
|
sds getAllClientsInfoString(int type) {
|
||||||
|
@ -1563,7 +1563,10 @@ void replicationCreateMasterClient(redisMaster *mi, connection *conn, int dbid)
|
|||||||
serverAssert(mi->master == nullptr);
|
serverAssert(mi->master == nullptr);
|
||||||
mi->master = createClient(conn, serverTL - g_pserver->rgthreadvar);
|
mi->master = createClient(conn, serverTL - g_pserver->rgthreadvar);
|
||||||
if (conn)
|
if (conn)
|
||||||
|
{
|
||||||
|
serverAssert(connGetPrivateData(mi->master->conn) == mi->master);
|
||||||
connSetReadHandler(mi->master->conn, readQueryFromClient);
|
connSetReadHandler(mi->master->conn, readQueryFromClient);
|
||||||
|
}
|
||||||
mi->master->flags |= CLIENT_MASTER;
|
mi->master->flags |= CLIENT_MASTER;
|
||||||
mi->master->authenticated = 1;
|
mi->master->authenticated = 1;
|
||||||
mi->master->reploff = mi->master_initial_offset;
|
mi->master->reploff = mi->master_initial_offset;
|
||||||
@ -1985,6 +1988,7 @@ void readSyncBulkPayload(connection *conn) {
|
|||||||
|
|
||||||
/* Final setup of the connected slave <- master link */
|
/* Final setup of the connected slave <- master link */
|
||||||
replicationCreateMasterClient(mi,mi->repl_transfer_s,rsi.repl_stream_db);
|
replicationCreateMasterClient(mi,mi->repl_transfer_s,rsi.repl_stream_db);
|
||||||
|
mi->repl_transfer_s = nullptr;
|
||||||
mi->repl_state = REPL_STATE_CONNECTED;
|
mi->repl_state = REPL_STATE_CONNECTED;
|
||||||
mi->repl_down_since = 0;
|
mi->repl_down_since = 0;
|
||||||
|
|
||||||
@ -3129,7 +3133,7 @@ void replicationResurrectCachedMaster(redisMaster *mi, connection *conn) {
|
|||||||
mi->master = mi->cached_master;
|
mi->master = mi->cached_master;
|
||||||
mi->cached_master = NULL;
|
mi->cached_master = NULL;
|
||||||
mi->master->conn = conn;
|
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->flags &= ~(CLIENT_CLOSE_AFTER_REPLY|CLIENT_CLOSE_ASAP);
|
||||||
mi->master->authenticated = 1;
|
mi->master->authenticated = 1;
|
||||||
mi->master->lastinteraction = g_pserver->unixtime;
|
mi->master->lastinteraction = g_pserver->unixtime;
|
||||||
@ -3142,6 +3146,7 @@ void replicationResurrectCachedMaster(redisMaster *mi, connection *conn) {
|
|||||||
|
|
||||||
/* Re-add to the list of clients. */
|
/* Re-add to the list of clients. */
|
||||||
linkClient(mi->master);
|
linkClient(mi->master);
|
||||||
|
serverAssert(connGetPrivateData(mi->master->conn) == mi->master);
|
||||||
if (connSetReadHandler(mi->master->conn, readQueryFromClient)) {
|
if (connSetReadHandler(mi->master->conn, readQueryFromClient)) {
|
||||||
serverLog(LL_WARNING,"Error resurrecting the cached master, impossible to add the readable handler: %s", strerror(errno));
|
serverLog(LL_WARNING,"Error resurrecting the cached master, impossible to add the readable handler: %s", strerror(errno));
|
||||||
freeClientAsync(mi->master); /* Close ASAP. */
|
freeClientAsync(mi->master); /* Close ASAP. */
|
||||||
|
@ -197,7 +197,7 @@ char *redisProtocolToLuaType_Aggregate(lua_State *lua, char *reply, int atype) {
|
|||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
string2ll(reply+1,p-reply-1,&mbulklen);
|
string2ll(reply+1,p-reply-1,&mbulklen);
|
||||||
if (g_pserver->lua_client->resp == 2 || atype == '*') {
|
if (serverTL->lua_client->resp == 2 || atype == '*') {
|
||||||
p += 2;
|
p += 2;
|
||||||
if (mbulklen == -1) {
|
if (mbulklen == -1) {
|
||||||
lua_pushboolean(lua,0);
|
lua_pushboolean(lua,0);
|
||||||
|
@ -198,6 +198,7 @@ public:
|
|||||||
m_data = decltype(m_data)();
|
m_data = decltype(m_data)();
|
||||||
bits = bits_min;
|
bits = bits_min;
|
||||||
m_data.resize(1ULL << bits);
|
m_data.resize(1ULL << bits);
|
||||||
|
celem = 0;
|
||||||
idxRehash = m_data.size();
|
idxRehash = m_data.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1887,7 +1887,6 @@ struct redisServer {
|
|||||||
is down? */
|
is down? */
|
||||||
/* Scripting */
|
/* Scripting */
|
||||||
lua_State *lua; /* The Lua interpreter. We use just one for all clients */
|
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 */
|
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 */
|
char* lua_cur_script = nullptr; /* SHA1 of the script currently running, or NULL */
|
||||||
dict *lua_scripts; /* A dictionary of SHA1 -> Lua scripts */
|
dict *lua_scripts; /* A dictionary of SHA1 -> Lua scripts */
|
||||||
|
@ -13,14 +13,9 @@ tags {"aof"} {
|
|||||||
# cleaned after a child responsible for an AOF rewrite exited. This buffer
|
# cleaned after a child responsible for an AOF rewrite exited. This buffer
|
||||||
# was subsequently appended to the new AOF, resulting in duplicate commands.
|
# was subsequently appended to the new AOF, resulting in duplicate commands.
|
||||||
start_server_aof [list dir $server_path] {
|
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 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
|
after 100
|
||||||
|
|
||||||
# Benchmark should be running by now: start background rewrite
|
# Benchmark should be running by now: start background rewrite
|
||||||
|
@ -37,11 +37,7 @@ start_server {} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set cycle_start_time [clock milliseconds]
|
set cycle_start_time [clock milliseconds]
|
||||||
<<<<<<< HEAD
|
set bench_pid [exec src/keydb-benchmark -s $R_unixsocket(0) -n 10000000 -r 1000 incr __rand_int__ > /dev/null &]
|
||||||
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
|
|
||||||
while 1 {
|
while 1 {
|
||||||
set elapsed [expr {[clock milliseconds]-$cycle_start_time}]
|
set elapsed [expr {[clock milliseconds]-$cycle_start_time}]
|
||||||
if {$elapsed > $duration*1000} break
|
if {$elapsed > $duration*1000} break
|
||||||
|
@ -3,12 +3,8 @@ source tests/support/cli.tcl
|
|||||||
start_server {tags {"cli"}} {
|
start_server {tags {"cli"}} {
|
||||||
proc open_cli {} {
|
proc open_cli {} {
|
||||||
set ::env(TERM) dumb
|
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 cmdline [rediscli [srv port] "-n 9"]
|
||||||
set fd [open "|$cmdline" "r+"]
|
set fd [open "|$cmdline" "r+"]
|
||||||
>>>>>>> redis/6.0
|
|
||||||
fconfigure $fd -buffering none
|
fconfigure $fd -buffering none
|
||||||
fconfigure $fd -blocking false
|
fconfigure $fd -blocking false
|
||||||
fconfigure $fd -translation binary
|
fconfigure $fd -translation binary
|
||||||
@ -61,13 +57,8 @@ start_server {tags {"cli"}} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc _run_cli {opts args} {
|
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]]
|
set cmd [rediscli [srv port] [list -n 9 {*}$args]]
|
||||||
foreach {key value} $args {
|
foreach {key value} $args {
|
||||||
>>>>>>> redis/6.0
|
|
||||||
if {$key eq "pipe"} {
|
if {$key eq "pipe"} {
|
||||||
set cmd "sh -c \"$value | $cmd\""
|
set cmd "sh -c \"$value | $cmd\""
|
||||||
}
|
}
|
||||||
|
@ -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" {
|
test "SDOWN is triggered by non-responding but not crashed instance" {
|
||||||
lassign [S 4 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] host port
|
lassign [S 4 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] host port
|
||||||
ensure_master_up
|
ensure_master_up
|
||||||
<<<<<<< HEAD
|
exec ../../../src/keydb-cli -h $host -p $port {*}[rediscli_tls_config "../../../tests"] debug sleep 10 > /dev/null &
|
||||||
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
|
|
||||||
ensure_master_down
|
ensure_master_down
|
||||||
ensure_master_up
|
ensure_master_up
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ proc rediscli_tls_config {testsdir} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc rediscli {port {opts {}}} {
|
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 {*}[rediscli_tls_config "tests"]
|
||||||
lappend cmd {*}$opts
|
lappend cmd {*}$opts
|
||||||
return $cmd
|
return $cmd
|
||||||
|
@ -94,6 +94,7 @@ start_server {tags {"introspection"}} {
|
|||||||
slaveof
|
slaveof
|
||||||
bind
|
bind
|
||||||
requirepass
|
requirepass
|
||||||
|
multi-master
|
||||||
}
|
}
|
||||||
|
|
||||||
set configs {}
|
set configs {}
|
||||||
|
@ -33,14 +33,9 @@ start_server {} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test {WAIT should not acknowledge 1 additional copy if slave is blocked} {
|
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"]
|
set cmd [rediscli $slave_port "-h $slave_host debug sleep 5"]
|
||||||
exec {*}$cmd > /dev/null 2> /dev/null &
|
exec {*}$cmd > /dev/null 2> /dev/null &
|
||||||
after 1000 ;# Give redis-cli the time to execute the command.
|
after 1000 ;# Give keydb-cli the time to execute the command.
|
||||||
>>>>>>> redis/6.0
|
|
||||||
$master set foo 0
|
$master set foo 0
|
||||||
$master incr foo
|
$master incr foo
|
||||||
$master incr foo
|
$master incr foo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user