aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore/compactcas.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-12-07 15:10:17 +0100
committerGitHub <[email protected]>2023-12-07 15:10:17 +0100
commitc0e9eb69a212bc448b542007184b5fa1a050d798 (patch)
tree1e5ad2df30c7e29ef61578fdb237332533902657 /src/zenstore/compactcas.cpp
parentlogging configuration via command line options (#589) (diff)
downloadzen-c0e9eb69a212bc448b542007184b5fa1a050d798.tar.xz
zen-c0e9eb69a212bc448b542007184b5fa1a050d798.zip
fixed bug in CasContainerStrategy::ReadIndexFile (#595)
this was introduced in a recent optimization and would cause CAS items to not be found after a shutdown/restart cycle
Diffstat (limited to 'src/zenstore/compactcas.cpp')
-rw-r--r--src/zenstore/compactcas.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/zenstore/compactcas.cpp b/src/zenstore/compactcas.cpp
index 42302c4a9..96ab65a5f 100644
--- a/src/zenstore/compactcas.cpp
+++ b/src/zenstore/compactcas.cpp
@@ -989,13 +989,14 @@ CasContainerStrategy::ReadIndexFile(const std::filesystem::path& IndexPath, uint
Entries.resize(128 * 1024 / sizeof(CasDiskIndexEntry));
uint64_t RemainingEntries = Header.EntryCount;
+ uint64_t ReadOffset = sizeof(CasDiskIndexHeader);
do
{
const uint64_t NumToRead = Min(RemainingEntries, Entries.size());
Entries.resize(NumToRead);
- ObjectIndexFile.Read(Entries.data(), Entries.size() * sizeof(CasDiskIndexEntry), sizeof(CasDiskIndexHeader));
+ ObjectIndexFile.Read(Entries.data(), Entries.size() * sizeof(CasDiskIndexEntry), ReadOffset);
std::string InvalidEntryReason;
for (const CasDiskIndexEntry& Entry : Entries)
@@ -1011,6 +1012,7 @@ CasContainerStrategy::ReadIndexFile(const std::filesystem::path& IndexPath, uint
}
RemainingEntries -= NumToRead;
+ ReadOffset += NumToRead * sizeof(CasDiskIndexEntry);
} while (RemainingEntries);
OutVersion = CasDiskIndexHeader::CurrentVersion;