mirror of
https://github.com/fluencelabs/redis
synced 2025-06-23 22:11:33 +00:00
Lazyfree: ability to free whole DBs in background.
This commit is contained in:
13
src/bio.c
13
src/bio.c
@ -85,6 +85,8 @@ struct bio_job {
|
||||
|
||||
void *bioProcessBackgroundJobs(void *arg);
|
||||
void lazyfreeFreeObjectFromBioThread(robj *o);
|
||||
void lazyfreeFreeDatabaseFromBioThread(dict *ht1, dict *ht2);
|
||||
void lazyfreeFreeSlotsMapFromBioThread(zskiplist *sl);
|
||||
|
||||
/* Make sure we have enough stack to perform all the things we do in the
|
||||
* main thread. */
|
||||
@ -187,7 +189,16 @@ void *bioProcessBackgroundJobs(void *arg) {
|
||||
} else if (type == BIO_AOF_FSYNC) {
|
||||
aof_fsync((long)job->arg1);
|
||||
} else if (type == BIO_LAZY_FREE) {
|
||||
lazyfreeFreeObjectFromBioThread(job->arg1);
|
||||
/* What we free changes depending on what arguments are set:
|
||||
* arg1 -> free the object at pointer.
|
||||
* arg2 & arg3 -> free two dictionaries (a Redis DB).
|
||||
* only arg3 -> free the skiplist. */
|
||||
if (job->arg1)
|
||||
lazyfreeFreeObjectFromBioThread(job->arg1);
|
||||
else if (job->arg2 && job->arg3)
|
||||
lazyfreeFreeDatabaseFromBioThread(job->arg2,job->arg3);
|
||||
else if (job->arg3)
|
||||
lazyfreeFreeSlotsMapFromBioThread(job->arg3);
|
||||
} else {
|
||||
serverPanic("Wrong job type in bioProcessBackgroundJobs().");
|
||||
}
|
||||
|
Reference in New Issue
Block a user