diff options
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp b/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp index cf159bccaca..46ed6f3cdf4 100644 --- a/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp +++ b/searchlib/src/vespa/searchlib/common/allocatedbitvector.cpp @@ -29,6 +29,12 @@ std::pair<BitVector::Index, BitVector::Index> extract_size_capacity(const AllocatedBitVector & bv) { BitVector::Index size = bv.size(); BitVector::Index capacity = bv.capacity(); + while (capacity < size) { + // Since size and capacity might be changed in another thread we need + // this fallback to avoid inconsistency during shrink. + size = bv.size(); + capacity = bv.capacity(); + } return std::pair<BitVector::Index, BitVector::Index>(size, capacity); } |