Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ray6080 committed Mar 26, 2023
1 parent d1d8a7e commit f839af7
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/storage/buffer_manager/buffer_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,9 @@ void BufferManager::optimisticRead(
}
} break;
case PageState::EVICTED: {
// lock and claim a frame.
if (pageState->tryLock(currStateAndVersion)) {
// claim a frame.
if (!claimAFrame(fileHandle, pageIdx, PageReadPolicy::READ_PAGE)) {
pageState->unlock();
throw BufferManagerException("Failed to claim a frame.");
}
pageState->unlock();
}
auto frame = pin(fileHandle, pageIdx, PageReadPolicy::READ_PAGE);
func(frame);
unpin(fileHandle, pageIdx);
} break;
default: {
// When locked, continue the spinning.
Expand Down

0 comments on commit f839af7

Please sign in to comment.