From 973879559cdd2fb1d14682a23bb58914471cff54 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 3 Dec 2021 15:47:49 +0000 Subject: Iterate outside of the loop --- .../src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp | 4 ++-- 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(_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)); } -- cgit v1.2.3