In low load async rehash may not complete in time, do it in the cron
Former-commit-id: 0a27d30753d887b6251e645abe26118068c55587
This commit is contained in:
parent
9e986e7a63
commit
9ea8843e14
@ -2157,6 +2157,14 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
|
|||||||
UNUSED(id);
|
UNUSED(id);
|
||||||
UNUSED(clientData);
|
UNUSED(clientData);
|
||||||
|
|
||||||
|
if (serverTL->rehashCtl != nullptr && !serverTL->rehashCtl->done) {
|
||||||
|
aeReleaseLock();
|
||||||
|
// If there is not enough lock contention we may not have made enough progress on the async
|
||||||
|
// rehash. Ensure we finish it outside the lock.
|
||||||
|
dictRehashSomeAsync(serverTL->rehashCtl, serverTL->rehashCtl->queue.size());
|
||||||
|
aeAcquireLock();
|
||||||
|
}
|
||||||
|
|
||||||
/* If another threads unblocked one of our clients, and this thread has been idle
|
/* If another threads unblocked one of our clients, and this thread has been idle
|
||||||
then beforeSleep won't have a chance to process the unblocking. So we also
|
then beforeSleep won't have a chance to process the unblocking. So we also
|
||||||
process them here in the cron job to ensure they don't starve.
|
process them here in the cron job to ensure they don't starve.
|
||||||
@ -2448,6 +2456,14 @@ int serverCronLite(struct aeEventLoop *eventLoop, long long id, void *clientData
|
|||||||
UNUSED(id);
|
UNUSED(id);
|
||||||
UNUSED(clientData);
|
UNUSED(clientData);
|
||||||
|
|
||||||
|
if (serverTL->rehashCtl != nullptr && !serverTL->rehashCtl->done) {
|
||||||
|
aeReleaseLock();
|
||||||
|
// If there is not enough lock contention we may not have made enough progress on the async
|
||||||
|
// rehash. Ensure we finish it outside the lock.
|
||||||
|
dictRehashSomeAsync(serverTL->rehashCtl, serverTL->rehashCtl->queue.size());
|
||||||
|
aeAcquireLock();
|
||||||
|
}
|
||||||
|
|
||||||
int iel = ielFromEventLoop(eventLoop);
|
int iel = ielFromEventLoop(eventLoop);
|
||||||
serverAssert(iel != IDX_EVENT_LOOP_MAIN);
|
serverAssert(iel != IDX_EVENT_LOOP_MAIN);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user