diff options
| author | Dan Engelbrecht <[email protected]> | 2023-11-27 11:16:01 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-11-27 17:16:01 +0100 |
| commit | 8f93ed186d11ec01e14af38751bc2b08e13bd2b7 (patch) | |
| tree | f839466825dd36c0ba57800b7900e6b5acb0a6ec /src/zenstore/compactcas.cpp | |
| parent | gcv2 tests for project store and bugfixes (#571) (diff) | |
| download | zen-8f93ed186d11ec01e14af38751bc2b08e13bd2b7.tar.xz zen-8f93ed186d11ec01e14af38751bc2b08e13bd2b7.zip | |
fix missing locks/sync of log position when writing index snapshots (#572)
* fix missing locks/sync of log position when writing index snapshots
* changelog
Diffstat (limited to 'src/zenstore/compactcas.cpp')
| -rw-r--r-- | src/zenstore/compactcas.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/zenstore/compactcas.cpp b/src/zenstore/compactcas.cpp index 95198fd59..c4f9ff2c6 100644 --- a/src/zenstore/compactcas.cpp +++ b/src/zenstore/compactcas.cpp @@ -884,9 +884,11 @@ CasContainerStrategy::MakeIndexSnapshot() // Write the current state of the location map to a new index state std::vector<CasDiskIndexEntry> Entries; + uint64_t IndexLogPosition = 0; { RwLock::SharedLockScope ___(m_LocationMapLock); + IndexLogPosition = m_CasLog.GetLogCount(); Entries.resize(m_LocationMap.size()); uint64_t EntryIndex = 0; @@ -901,7 +903,7 @@ CasContainerStrategy::MakeIndexSnapshot() BasicFile ObjectIndexFile; ObjectIndexFile.Open(IndexPath, BasicFile::Mode::kTruncate); CasDiskIndexHeader Header = {.EntryCount = Entries.size(), - .LogPosition = LogCount, + .LogPosition = IndexLogPosition, .PayloadAlignment = gsl::narrow<uint32_t>(m_PayloadAlignment)}; Header.Checksum = CasDiskIndexHeader::ComputeChecksum(Header); @@ -911,7 +913,7 @@ CasContainerStrategy::MakeIndexSnapshot() ObjectIndexFile.Flush(); ObjectIndexFile.Close(); EntryCount = Entries.size(); - m_LogFlushPosition = LogCount; + m_LogFlushPosition = IndexLogPosition; } catch (std::exception& Err) { |