summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-12-03 15:47:49 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-12-03 15:47:49 +0000
commit973879559cdd2fb1d14682a23bb58914471cff54 (patch)
tree7fe6e9c3e85265e01f43727b7754712087e770e0 /searchlib
parentad4219f3c80db0f4448f7028757cd75b7c4028f0 (diff)
Iterate outside of the loop
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp
index 2c0d10abd33..8c76a4477f5 100644
--- a/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp
+++ b/searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp
@@ -483,11 +483,11 @@ WriteableFileChunk::writeData(const ProcessedChunkQ & chunks, size_t sz)
void
WriteableFileChunk::updateChunkInfo(const ProcessedChunkQ & chunks, const ChunkMetaV & cmetaV, size_t sz)
{
- std::lock_guard guard(_lock);
uint32_t maxChunkId(0);
for (const auto & chunk : chunks) {
maxChunkId = std::max(chunk->getChunkId(), maxChunkId);
}
+ std::lock_guard guard(_lock);
if (maxChunkId >= _chunkInfo.size()) {
_chunkInfo.reserve(vespalib::roundUp2inN(maxChunkId+1));
}