diff options
| author | Dan Engelbrecht <[email protected]> | 2023-05-16 12:23:42 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-16 12:23:42 +0200 |
| commit | a4ff07d68eeae66c008bfac28cb87c94a92cf257 (patch) | |
| tree | 630940f228c35d29fac31ced2ba7f9fd16fca1c8 /src/zenstore/compactcas.cpp | |
| parent | Added CHANGELOG.md descriptions for recent changes (diff) | |
| download | zen-a4ff07d68eeae66c008bfac28cb87c94a92cf257.tar.xz zen-a4ff07d68eeae66c008bfac28cb87c94a92cf257.zip | |
Add `--gc-projectstore-duration-seconds` option (#281)
* Add `--gc-projectstore-duration-seconds` option
* Cleanup lua gc options parsing
* Remove dead configuration values
* changelog
Diffstat (limited to 'src/zenstore/compactcas.cpp')
| -rw-r--r-- | src/zenstore/compactcas.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/zenstore/compactcas.cpp b/src/zenstore/compactcas.cpp index e4c2c2ecf..0f6f011e1 100644 --- a/src/zenstore/compactcas.cpp +++ b/src/zenstore/compactcas.cpp @@ -645,6 +645,13 @@ CasContainerStrategy::ReadIndexFile(const std::filesystem::path& IndexPath, uint uint64_t CasContainerStrategy::ReadLog(const std::filesystem::path& LogPath, uint64_t SkipEntryCount) { + if (!TCasLogFile<CasDiskIndexEntry>::IsValid(LogPath)) + { + ZEN_WARN("removing invalid cas log at '{}'", LogPath); + std::filesystem::remove(LogPath); + return 0; + } + size_t LogEntryCount = 0; Stopwatch Timer; const auto _ = MakeGuard([&] { @@ -972,7 +979,7 @@ TEST_CASE("compactcas.gc.basic") CHECK(InsertResult.New); Cas.Flush(); - GcContext GcCtx(GcClock::Now() - std::chrono::hours(24)); + GcContext GcCtx(GcClock::Now() - std::chrono::hours(24), GcClock::Now() - std::chrono::hours(24)); GcCtx.CollectSmallObjects(true); Cas.CollectGarbage(GcCtx); @@ -1002,7 +1009,7 @@ TEST_CASE("compactcas.gc.removefile") CasContainerStrategy Cas(Gc); Cas.Initialize(TempDir.Path(), "cb", 65536, 1 << 4, false); - GcContext GcCtx(GcClock::Now() - std::chrono::hours(24)); + GcContext GcCtx(GcClock::Now() - std::chrono::hours(24), GcClock::Now() - std::chrono::hours(24)); GcCtx.CollectSmallObjects(true); Cas.CollectGarbage(GcCtx); @@ -1057,7 +1064,7 @@ TEST_CASE("compactcas.gc.compact") // Keep first and last { - GcContext GcCtx(GcClock::Now() - std::chrono::hours(24)); + GcContext GcCtx(GcClock::Now() - std::chrono::hours(24), GcClock::Now() - std::chrono::hours(24)); GcCtx.CollectSmallObjects(true); std::vector<IoHash> KeepChunks; @@ -1092,7 +1099,7 @@ TEST_CASE("compactcas.gc.compact") // Keep last { - GcContext GcCtx(GcClock::Now() - std::chrono::hours(24)); + GcContext GcCtx(GcClock::Now() - std::chrono::hours(24), GcClock::Now() - std::chrono::hours(24)); GcCtx.CollectSmallObjects(true); std::vector<IoHash> KeepChunks; KeepChunks.push_back(ChunkHashes[8]); @@ -1124,7 +1131,7 @@ TEST_CASE("compactcas.gc.compact") // Keep mixed { - GcContext GcCtx(GcClock::Now() - std::chrono::hours(24)); + GcContext GcCtx(GcClock::Now() - std::chrono::hours(24), GcClock::Now() - std::chrono::hours(24)); GcCtx.CollectSmallObjects(true); std::vector<IoHash> KeepChunks; KeepChunks.push_back(ChunkHashes[1]); @@ -1159,7 +1166,7 @@ TEST_CASE("compactcas.gc.compact") // Keep multiple at end { - GcContext GcCtx(GcClock::Now() - std::chrono::hours(24)); + GcContext GcCtx(GcClock::Now() - std::chrono::hours(24), GcClock::Now() - std::chrono::hours(24)); GcCtx.CollectSmallObjects(true); std::vector<IoHash> KeepChunks; KeepChunks.push_back(ChunkHashes[6]); @@ -1194,7 +1201,7 @@ TEST_CASE("compactcas.gc.compact") // Keep every other { - GcContext GcCtx(GcClock::Now() - std::chrono::hours(24)); + GcContext GcCtx(GcClock::Now() - std::chrono::hours(24), GcClock::Now() - std::chrono::hours(24)); GcCtx.CollectSmallObjects(true); std::vector<IoHash> KeepChunks; KeepChunks.push_back(ChunkHashes[0]); @@ -1273,7 +1280,7 @@ TEST_CASE("compactcas.gc.deleteblockonopen") // GC every other block { - GcContext GcCtx(GcClock::Now() - std::chrono::hours(24)); + GcContext GcCtx(GcClock::Now() - std::chrono::hours(24), GcClock::Now() - std::chrono::hours(24)); GcCtx.CollectSmallObjects(true); std::vector<IoHash> KeepChunks; for (size_t i = 0; i < 20; i += 2) @@ -1340,7 +1347,7 @@ TEST_CASE("compactcas.gc.handleopeniobuffer") Cas.Flush(); // GC everything - GcContext GcCtx(GcClock::Now() - std::chrono::hours(24)); + GcContext GcCtx(GcClock::Now() - std::chrono::hours(24), GcClock::Now() - std::chrono::hours(24)); GcCtx.CollectSmallObjects(true); Cas.CollectGarbage(GcCtx); @@ -1496,7 +1503,7 @@ TEST_CASE("compactcas.threadedinsert") C++; } - GcContext GcCtx(GcClock::Now() - std::chrono::hours(24)); + GcContext GcCtx(GcClock::Now() - std::chrono::hours(24), GcClock::Now() - std::chrono::hours(24)); GcCtx.CollectSmallObjects(true); GcCtx.AddRetainedCids(KeepHashes); Cas.CollectGarbage(GcCtx); @@ -1537,7 +1544,7 @@ TEST_CASE("compactcas.threadedinsert") C++; } - GcContext GcCtx(GcClock::Now() - std::chrono::hours(24)); + GcContext GcCtx(GcClock::Now() - std::chrono::hours(24), GcClock::Now() - std::chrono::hours(24)); GcCtx.CollectSmallObjects(true); GcCtx.AddRetainedCids(KeepHashes); Cas.CollectGarbage(GcCtx); |