All tests pass single thread
This commit is contained in:
parent
cfabd4f666
commit
554012085c
@ -1155,24 +1155,19 @@ static void freeClientArgv(client *c) {
|
||||
* resync with us as well. */
|
||||
void disconnectSlaves(void) {
|
||||
serverAssert(aeThreadOwnsLock());
|
||||
std::vector<client*> vecfreeImmediate;
|
||||
listNode *ln;
|
||||
listIter li;
|
||||
listNode *ln;
|
||||
|
||||
listRewind(server.slaves, &li);
|
||||
while ((ln = listNext(&li))) {
|
||||
client *c = (client*)ln->value;
|
||||
if (c->iel == serverTL - server.rgthreadvar)
|
||||
{
|
||||
vecfreeImmediate.push_back(c);
|
||||
client *c = (client*)listNodeValue(ln);
|
||||
if (FCorrectThread(c)) {
|
||||
freeClient(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
freeClientAsync(c);
|
||||
}
|
||||
}
|
||||
|
||||
for (client *c : vecfreeImmediate)
|
||||
freeClient(c);
|
||||
}
|
||||
|
||||
/* Remove the specified client from global lists where the client could
|
||||
|
@ -986,6 +986,8 @@ struct redisMemOverhead *getMemoryOverheadData(void) {
|
||||
listRewind(server.slaves,&li);
|
||||
while((ln = listNext(&li))) {
|
||||
client *c = listNodeValue(ln);
|
||||
if (c->flags & CLIENT_CLOSE_ASAP)
|
||||
continue;
|
||||
mem += getClientOutputBufferMemoryUsage(c);
|
||||
mem += sdsAllocSize(c->querybuf);
|
||||
mem += sizeof(client);
|
||||
|
@ -543,6 +543,9 @@ int masterTryPartialResynchronization(client *c) {
|
||||
buflen = snprintf(buf,sizeof(buf),"+CONTINUE\r\n");
|
||||
}
|
||||
if (write(c->fd,buf,buflen) != buflen) {
|
||||
if (FCorrectThread(c))
|
||||
freeClient(c);
|
||||
else
|
||||
freeClientAsync(c);
|
||||
return C_OK;
|
||||
}
|
||||
@ -2011,6 +2014,9 @@ void replicationSetMaster(char *ip, int port) {
|
||||
server.masterhost = sdsnew(ip);
|
||||
server.masterport = port;
|
||||
if (server.master) {
|
||||
if (FCorrectThread(server.master))
|
||||
freeClient(server.master);
|
||||
else
|
||||
freeClientAsync(server.master);
|
||||
}
|
||||
disconnectAllBlockedClients(); /* Clients blocked in master, now slave. */
|
||||
@ -2626,6 +2632,9 @@ void replicationCron(void) {
|
||||
(time(NULL)-server.master->lastinteraction) > server.repl_timeout)
|
||||
{
|
||||
serverLog(LL_WARNING,"MASTER timeout: no data nor PING received...");
|
||||
if (FCorrectThread(server.master))
|
||||
freeClient(server.master);
|
||||
else
|
||||
freeClientAsync(server.master);
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ start_server {tags {"lazyfree"}} {
|
||||
}
|
||||
|
||||
test "FLUSHDB ASYNC can reclaim memory in background" {
|
||||
after 500 # Sometimes Redis is busy with a prior operation
|
||||
set orig_mem [s used_memory]
|
||||
set args {}
|
||||
for {set i 0} {$i < 100000} {incr i} {
|
||||
|
Loading…
x
Reference in New Issue
Block a user