Commit dcd83f95 authored by Lucas Hosseini's avatar Lucas Hosseini Committed by Matthijs Douze

Fix race condition in OnDiskInvertedlists. (#464)

parent 28e9f745
...@@ -164,6 +164,7 @@ struct OnDiskInvertedLists::OngoingPrefetch { ...@@ -164,6 +164,7 @@ struct OnDiskInvertedLists::OngoingPrefetch {
static void* prefetch_list (void * arg) { static void* prefetch_list (void * arg) {
Thread *th = static_cast<Thread*>(arg); Thread *th = static_cast<Thread*>(arg);
th->od->locks->lock_1(th->list_no);
size_t n = th->od->list_size(th->list_no); size_t n = th->od->list_size(th->list_no);
const Index::idx_t *idx = th->od->get_ids(th->list_no); const Index::idx_t *idx = th->od->get_ids(th->list_no);
const uint8_t *codes = th->od->get_codes(th->list_no); const uint8_t *codes = th->od->get_codes(th->list_no);
...@@ -177,6 +178,7 @@ struct OnDiskInvertedLists::OngoingPrefetch { ...@@ -177,6 +178,7 @@ struct OnDiskInvertedLists::OngoingPrefetch {
for (size_t i = 0; i < n8;i++) { for (size_t i = 0; i < n8;i++) {
cs += codes8[i]; cs += codes8[i];
} }
th->od->locks->unlock_1(th->list_no);
global_cs += cs & 1; global_cs += cs & 1;
return nullptr; return nullptr;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment