transform tm stores into quasi background threads
This commit is contained in:
@ -13,26 +13,29 @@ PersistentLogTmStoreTask::PersistentLogTmStoreTask(object_id_t objectId, Storage
|
||||
miscStoreContext(persTmStore::DUMP_MISC_STORE_DONE) {}
|
||||
|
||||
ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
|
||||
bool someonesBusy = false;
|
||||
auto stateHandlingForStore = [&](bool storeIsBusy) {
|
||||
if (storeIsBusy) {
|
||||
someonesBusy = true;
|
||||
}
|
||||
if (fileHasSwapped) {
|
||||
someFileWasSwapped = fileHasSwapped;
|
||||
}
|
||||
};
|
||||
while (true) {
|
||||
if (not cyclicStoreCheck()) {
|
||||
continue;
|
||||
}
|
||||
bool someonesBusy = false;
|
||||
bool busy = false;
|
||||
busy = handleOneStore(stores.okStore, okStoreContext);
|
||||
if (busy) {
|
||||
someonesBusy = true;
|
||||
}
|
||||
busy = handleOneStore(stores.notOkStore, notOkStoreContext);
|
||||
if (busy) {
|
||||
someonesBusy = true;
|
||||
}
|
||||
busy = handleOneStore(stores.miscStore, miscStoreContext);
|
||||
if (busy) {
|
||||
someonesBusy = true;
|
||||
}
|
||||
someFileWasSwapped = false;
|
||||
bool busy = handleOneStore(stores.okStore, okStoreContext);
|
||||
stateHandlingForStore(busy);
|
||||
stateHandlingForStore(handleOneStore(stores.notOkStore, notOkStoreContext));
|
||||
stateHandlingForStore(handleOneStore(stores.miscStore, miscStoreContext));
|
||||
if (not someonesBusy) {
|
||||
TaskFactory::delayTask(40);
|
||||
} else if (someFileWasSwapped and graceDelayDuringDumping.hasTimedOut()) {
|
||||
TaskFactory::delayTask(2);
|
||||
graceDelayDuringDumping.resetTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user