diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-12-03 17:36:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-03 17:36:51 +0100 |
commit | 8716b35d7f86d2633d822f5909adc0148a6129bc (patch) | |
tree | 302a6f89cc2a3c659b59164ec48c317a60776bf3 | |
parent | d40ad68987516db67166e57f2e75bb5dbc91208f (diff) | |
parent | 973879559cdd2fb1d14682a23bb58914471cff54 (diff) |
Merge pull request #20360 from vespa-engine/balder/iterate-loop-before-taking-lock
Iterate outside of the loop
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp | 4 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/docstore/writeablefilechunk.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp index 6d71b81cb8b..4e0cf3f9059 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp @@ -56,8 +56,8 @@ SummaryCompactTarget::getApproxMemoryGain() const IFlushTarget::DiskGain SummaryCompactTarget::getApproxDiskGain() const { - uint64_t total(_docStore.getDiskFootprint()); - return DiskGain(total, total - std::min(total, static_cast<uint64_t>(_docStore.getMaxCompactGain()))); + size_t total(_docStore.getDiskFootprint()); + return DiskGain(total, total - std::min(total, _docStore.getMaxCompactGain())); } IFlushTarget::Time 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)); } |