All tests pass single thread
This commit is contained in:
parent
199269bff7
commit
3871725979
@ -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,7 +543,10 @@ int masterTryPartialResynchronization(client *c) {
|
||||
buflen = snprintf(buf,sizeof(buf),"+CONTINUE\r\n");
|
||||
}
|
||||
if (write(c->fd,buf,buflen) != buflen) {
|
||||
freeClientAsync(c);
|
||||
if (FCorrectThread(c))
|
||||
freeClient(c);
|
||||
else
|
||||
freeClientAsync(c);
|
||||
return C_OK;
|
||||
}
|
||||
psync_len = addReplyReplicationBacklog(c,psync_offset);
|
||||
@ -2011,7 +2014,10 @@ void replicationSetMaster(char *ip, int port) {
|
||||
server.masterhost = sdsnew(ip);
|
||||
server.masterport = port;
|
||||
if (server.master) {
|
||||
freeClientAsync(server.master);
|
||||
if (FCorrectThread(server.master))
|
||||
freeClient(server.master);
|
||||
else
|
||||
freeClientAsync(server.master);
|
||||
}
|
||||
disconnectAllBlockedClients(); /* Clients blocked in master, now slave. */
|
||||
|
||||
@ -2626,7 +2632,10 @@ void replicationCron(void) {
|
||||
(time(NULL)-server.master->lastinteraction) > server.repl_timeout)
|
||||
{
|
||||
serverLog(LL_WARNING,"MASTER timeout: no data nor PING received...");
|
||||
freeClientAsync(server.master);
|
||||
if (FCorrectThread(server.master))
|
||||
freeClient(server.master);
|
||||
else
|
||||
freeClientAsync(server.master);
|
||||
}
|
||||
|
||||
/* Check if we should connect to a 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