aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/compactcas.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-09-26 17:01:18 +0200
committerGitHub Enterprise <[email protected]>2025-09-26 17:01:18 +0200
commit1a79d480823af2b8c7bf1b46f7c2f5ab21ed45ad (patch)
treea1170c36f46b9afabea40f375fed4c6faa1959b3 /src/zenstore/compactcas.cpp
parentMake sure we call the previous terminate handle if present when we intercept ... (diff)
downloadzen-1a79d480823af2b8c7bf1b46f7c2f5ab21ed45ad.tar.xz
zen-1a79d480823af2b8c7bf1b46f7c2f5ab21ed45ad.zip
more iterate chunk logging (#516)
* add log warnings when we can't read payloads in cas when we thing we should have them * fix misleading option help
Diffstat (limited to 'src/zenstore/compactcas.cpp')
-rw-r--r--src/zenstore/compactcas.cpp56
1 files changed, 44 insertions, 12 deletions
diff --git a/src/zenstore/compactcas.cpp b/src/zenstore/compactcas.cpp
index b7bfbd188..b534a5c72 100644
--- a/src/zenstore/compactcas.cpp
+++ b/src/zenstore/compactcas.cpp
@@ -368,6 +368,14 @@ CasContainerStrategy::IterateChunks(std::span<const IoHash> ChunkHas
{
IoBuffer Chunk = m_BlockStore.TryGetChunk(FoundChunkLocations[Index]);
size_t OuterIndex = FoundChunkIndexes[Index];
+ if (!Chunk)
+ {
+ ZEN_WARN("Failed to fetch chunk {} from block {}, Offset {}, Size {}",
+ ChunkHashes[OuterIndex],
+ FoundChunkLocations[Index].BlockIndex,
+ FoundChunkLocations[Index].Offset,
+ FoundChunkLocations[Index].Size);
+ }
if (!AsyncCallback(OuterIndex, Chunk))
{
return false;
@@ -376,17 +384,26 @@ CasContainerStrategy::IterateChunks(std::span<const IoHash> ChunkHas
return true;
}
- auto DoOneBlock = [this](const std::function<bool(size_t Index, const IoBuffer& Payload)>& AsyncCallback,
- uint64_t LargeSizeLimit,
- std::span<const size_t> FoundChunkIndexes,
- std::span<const BlockStoreLocation> FoundChunkLocations,
- std::span<const size_t> ChunkIndexes) {
+ auto DoOneBlock = [this, &ChunkHashes](const std::function<bool(size_t Index, const IoBuffer& Payload)>& AsyncCallback,
+ uint64_t LargeSizeLimit,
+ std::span<const size_t> FoundChunkIndexes,
+ std::span<const BlockStoreLocation> FoundChunkLocations,
+ std::span<const size_t> ChunkIndexes) {
if (ChunkIndexes.size() < 4)
{
for (size_t ChunkIndex : ChunkIndexes)
{
- IoBuffer Chunk = m_BlockStore.TryGetChunk(FoundChunkLocations[ChunkIndex]);
- if (!AsyncCallback(FoundChunkIndexes[ChunkIndex], Chunk))
+ size_t OuterIndex = FoundChunkIndexes[ChunkIndex];
+ IoBuffer Chunk = m_BlockStore.TryGetChunk(FoundChunkLocations[ChunkIndex]);
+ if (!Chunk)
+ {
+ ZEN_WARN("Failed to fetch chunk {} from block {}, Offset {}, Size {}",
+ ChunkHashes[OuterIndex],
+ FoundChunkLocations[ChunkIndex].BlockIndex,
+ FoundChunkLocations[ChunkIndex].Offset,
+ FoundChunkLocations[ChunkIndex].Size);
+ }
+ if (!AsyncCallback(OuterIndex, Chunk))
{
return false;
}
@@ -396,15 +413,30 @@ CasContainerStrategy::IterateChunks(std::span<const IoHash> ChunkHas
return m_BlockStore.IterateBlock(
FoundChunkLocations,
ChunkIndexes,
- [AsyncCallback, FoundChunkIndexes](size_t ChunkIndex, const void* Data, uint64_t Size) {
+ [this, &ChunkHashes, AsyncCallback, FoundChunkIndexes](size_t ChunkIndex, const void* Data, uint64_t Size) {
+ size_t OuterIndex = FoundChunkIndexes[ChunkIndex];
if (Data == nullptr)
{
- return AsyncCallback(FoundChunkIndexes[ChunkIndex], IoBuffer());
+ ZEN_WARN("Failed to fetch chunk {}, Size {}", ChunkHashes[OuterIndex], Size);
+ return AsyncCallback(OuterIndex, IoBuffer());
}
- return AsyncCallback(FoundChunkIndexes[ChunkIndex], IoBuffer(IoBuffer::Wrap, Data, Size));
+ return AsyncCallback(OuterIndex, IoBuffer(IoBuffer::Wrap, Data, Size));
},
- [AsyncCallback, FoundChunkIndexes](size_t ChunkIndex, BlockStoreFile& File, uint64_t Offset, uint64_t Size) {
- return AsyncCallback(FoundChunkIndexes[ChunkIndex], File.GetChunk(Offset, Size));
+ [this, &ChunkHashes, AsyncCallback, FoundChunkIndexes](size_t ChunkIndex,
+ BlockStoreFile& File,
+ uint64_t Offset,
+ uint64_t Size) {
+ size_t OuterIndex = FoundChunkIndexes[ChunkIndex];
+ IoBuffer Chunk = File.GetChunk(Offset, Size);
+ if (!Chunk)
+ {
+ ZEN_WARN("Failed to fetch chunk {} from '{}', Offset {}, Size {}",
+ ChunkHashes[OuterIndex],
+ File.GetPath(),
+ Offset,
+ Size);
+ }
+ return AsyncCallback(OuterIndex, Chunk);
},
LargeSizeLimit);
};