aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2026-03-14 14:52:48 +0100
committerDan Engelbrecht <[email protected]>2026-03-14 14:52:48 +0100
commit5487dcb98d3b9690b7954b258a6d806872dfdf56 (patch)
tree7f3ec078e79ada2436f933503241e0da173be2f7 /src
parentBlockComposer tests (diff)
downloadzen-5487dcb98d3b9690b7954b258a6d806872dfdf56.tar.xz
zen-5487dcb98d3b9690b7954b258a6d806872dfdf56.zip
remove redundant asserts
Diffstat (limited to 'src')
-rw-r--r--src/zenremotestore/projectstore/remoteprojectstore.cpp44
1 files changed, 5 insertions, 39 deletions
diff --git a/src/zenremotestore/projectstore/remoteprojectstore.cpp b/src/zenremotestore/projectstore/remoteprojectstore.cpp
index 9bc762bc3..406229dff 100644
--- a/src/zenremotestore/projectstore/remoteprojectstore.cpp
+++ b/src/zenremotestore/projectstore/remoteprojectstore.cpp
@@ -287,34 +287,22 @@ namespace remotestore_impl {
break;
}
}
-
SortedUploadAttachmentsIndex += CurrentOpChunkSizes.size();
- ZEN_ASSERT(PendingBlockSize < m_UsableBlockSize);
- ZEN_ASSERT(PendingChunkHashes.size() < m_Config.MaxChunksPerBlock);
- ZEN_ASSERT(CurrentOpRawHashes.size() == CurrentOpChunkSizes.size());
- // ZEN_ASSERT(CurrentOpAttachmentsSize == std::accumulate(CurrentOpChunkSizes.begin(),
- // CurrentOpChunkSizes.end(), uint64_t(0u)));
-
while (!CurrentOpChunkSizes.empty())
{
ZEN_ASSERT(CurrentOpRawHashes.size() == CurrentOpChunkSizes.size());
-
- size_t CurrentOpAttachmentCount = CurrentOpChunkSizes.size();
ZEN_ASSERT(CurrentOpAttachmentsSize <= m_UsableBlockSize);
ZEN_ASSERT(CurrentOpAttachmentCount <= m_Config.MaxChunksPerBlock);
+ size_t CurrentOpAttachmentCount = CurrentOpChunkSizes.size();
+
// Path A: gathered chunks exactly fill one block -- emit as a standalone block immediately.
if (CurrentOpFillFullBlock)
{
- ZEN_ASSERT(CurrentOpAttachmentsSize <= m_UsableBlockSize);
- ZEN_ASSERT(CurrentOpRawHashes.size() <= m_Config.MaxChunksPerBlock);
OnNewBlock(std::move(CurrentOpRawHashes));
CurrentOpChunkSizes.clear();
CurrentOpAttachmentsSize = 0;
-
- ZEN_ASSERT(PendingBlockSize < m_UsableBlockSize);
- ZEN_ASSERT(PendingChunkHashes.size() < m_Config.MaxChunksPerBlock);
}
else if ((PendingBlockSize + CurrentOpAttachmentsSize) <= m_UsableBlockSize &&
(PendingChunkHashes.size() + CurrentOpAttachmentCount) <= m_Config.MaxChunksPerBlock)
@@ -322,35 +310,27 @@ namespace remotestore_impl {
// Path B: all gathered chunks fit in the pending block -- merge them in.
PendingChunkHashes.insert(PendingChunkHashes.end(), CurrentOpRawHashes.begin(), CurrentOpRawHashes.end());
PendingBlockSize += CurrentOpAttachmentsSize;
+ ZEN_ASSERT(PendingBlockSize <= m_UsableBlockSize);
+ ZEN_ASSERT(PendingChunkHashes.size() <= m_Config.MaxChunksPerBlock);
CurrentOpRawHashes.clear();
CurrentOpChunkSizes.clear();
CurrentOpAttachmentsSize = 0;
- ZEN_ASSERT(PendingBlockSize <= m_UsableBlockSize);
- ZEN_ASSERT(PendingChunkHashes.size() <= m_Config.MaxChunksPerBlock);
if (PendingBlockSize == m_UsableBlockSize || PendingChunkHashes.size() == m_Config.MaxChunksPerBlock)
{
OnNewBlock(std::move(PendingChunkHashes));
PendingChunkHashes.clear();
PendingBlockSize = 0;
}
-
- ZEN_ASSERT(PendingBlockSize < m_UsableBlockSize);
- ZEN_ASSERT(PendingChunkHashes.size() < m_Config.MaxChunksPerBlock);
}
else if (PendingBlockSize > (m_UsableBlockSize * 3) / 4)
{
// Path C: gathered chunks don't fit AND pending block is >75% full by bytes -- flush pending
// block now; loop to re-evaluate gathered chunks against the freshly emptied pending block.
- ZEN_ASSERT(PendingChunkHashes.size() <= m_Config.MaxChunksPerBlock);
- ZEN_ASSERT(PendingBlockSize <= m_UsableBlockSize);
OnNewBlock(std::move(PendingChunkHashes));
PendingChunkHashes.clear();
PendingBlockSize = 0;
-
- ZEN_ASSERT(PendingBlockSize < m_UsableBlockSize);
- ZEN_ASSERT(PendingChunkHashes.size() < m_Config.MaxChunksPerBlock);
}
else
{
@@ -359,9 +339,6 @@ namespace remotestore_impl {
// chunks as fit, flush it, remove them from the current-op buffers, and loop with the
// remaining gathered chunks in the next iteration.
- ZEN_ASSERT(PendingBlockSize < m_UsableBlockSize);
- ZEN_ASSERT(PendingChunkHashes.size() < m_Config.MaxChunksPerBlock);
-
size_t AddedChunkCount = 0;
uint64_t AddedChunkSize = 0;
@@ -387,7 +364,6 @@ namespace remotestore_impl {
ZEN_ASSERT(PendingBlockSize <= m_UsableBlockSize);
ZEN_ASSERT(PendingChunkHashes.size() <= m_Config.MaxChunksPerBlock);
-
ZEN_ASSERT(AddedChunkCount < CurrentOpRawHashes.size());
OnNewBlock(std::move(PendingChunkHashes));
@@ -397,23 +373,13 @@ namespace remotestore_impl {
CurrentOpRawHashes.erase(CurrentOpRawHashes.begin(), CurrentOpRawHashes.begin() + AddedChunkCount);
CurrentOpChunkSizes.erase(CurrentOpChunkSizes.begin(), CurrentOpChunkSizes.begin() + AddedChunkCount);
CurrentOpAttachmentsSize -= AddedChunkSize;
-
- ZEN_ASSERT(CurrentOpRawHashes.size() == CurrentOpChunkSizes.size());
- ZEN_ASSERT(PendingBlockSize < m_UsableBlockSize);
- ZEN_ASSERT(PendingChunkHashes.size() < m_Config.MaxChunksPerBlock);
- }
-
- ZEN_ASSERT(PendingBlockSize < m_UsableBlockSize);
- ZEN_ASSERT(PendingChunkHashes.size() < m_Config.MaxChunksPerBlock);
+ };
}
}
if (!PendingChunkHashes.empty())
{
ZEN_ASSERT(PendingBlockSize < m_UsableBlockSize);
ZEN_ASSERT(PendingChunkHashes.size() < m_Config.MaxChunksPerBlock);
-
- ZEN_ASSERT(PendingBlockSize <= m_UsableBlockSize);
- ZEN_ASSERT(PendingChunkHashes.size() <= m_Config.MaxChunksPerBlock);
OnNewBlock(std::move(PendingChunkHashes));
PendingChunkHashes.clear();
}