Skip to content

Commit

Permalink
Fix race condition causing an infinite loop in the eviction queue (#4187
Browse files Browse the repository at this point in the history
)
  • Loading branch information
benjaminwinger authored and ray6080 committed Oct 11, 2024
1 parent bf9b38b commit b2f0bb1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/storage/buffer_manager/buffer_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ std::atomic<EvictionCandidate>* EvictionQueue::next() {
// Since the buffer pool size is a power of two (as is the page size), (UINT64_MAX + 1) %
// size == 0, which means no entries will be skipped when the cursor overflows
candidate = &data[evictionCursor.fetch_add(1, std::memory_order_relaxed) % capacity];
} while (candidate->load() == EMPTY);
} while (candidate->load() == EMPTY && size > 0);
return candidate;
}

Expand Down

0 comments on commit b2f0bb1

Please sign in to comment.