diff options
| author | Dan Engelbrecht <[email protected]> | 2022-04-04 10:31:15 +0200 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-04-04 11:06:27 +0200 |
| commit | f4901e91cc43346b7904438901adb7d9b8f950ef (patch) | |
| tree | 7af2edacecd2dff850414a6d8490260d55fb95d3 /zenstore/compactcas.cpp | |
| parent | fix logging when using disk reserve in compactcas (diff) | |
| download | zen-f4901e91cc43346b7904438901adb7d9b8f950ef.tar.xz zen-f4901e91cc43346b7904438901adb7d9b8f950ef.zip | |
logging cleanup
Diffstat (limited to 'zenstore/compactcas.cpp')
| -rw-r--r-- | zenstore/compactcas.cpp | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp index 0327e1402..366ea5534 100644 --- a/zenstore/compactcas.cpp +++ b/zenstore/compactcas.cpp @@ -179,7 +179,7 @@ namespace { { Stopwatch Timer; const auto _ = MakeGuard([RootDirectory, ContainerBaseName, &Entries, &Timer] { - ZEN_INFO("read store '{}' index containing {} entries in {}", + ZEN_INFO("read store '{}' index containing #{} entries in {}", RootDirectory / ContainerBaseName, Entries.size(), NiceTimeSpanMs(Timer.GetElapsedTimeMs())); @@ -275,7 +275,7 @@ namespace { { Stopwatch Timer; const auto _ = MakeGuard([RootDirectory, ContainerBaseName, &Entries, &Timer] { - ZEN_INFO("read store '{}' log containing {} entries in {}", + ZEN_INFO("read store '{}' log containing #{} entries in {}", RootDirectory / ContainerBaseName, Entries.size(), NiceTimeSpanMs(Timer.GetElapsedTimeMs())); @@ -308,11 +308,10 @@ namespace { uint64_t MigratedChunkCount = 0; uint32_t MigratedBlockCount = 0; - uint32_t NewBlockIndex = 0; Stopwatch MigrationTimer; uint64_t TotalSize = 0; const auto _ = MakeGuard([RootPath, ContainerBaseName, &MigrationTimer, &MigratedChunkCount, &MigratedBlockCount, &TotalSize] { - ZEN_INFO("migrated store '{}' to {} chunks in {} blocks in {} ({})", + ZEN_INFO("migrated store '{}' to #{} chunks in #{} blocks in {} ({})", RootPath / ContainerBaseName, MigratedChunkCount, MigratedBlockCount, @@ -332,7 +331,7 @@ namespace { DiskSpace Space = DiskSpaceInfo(RootPath, Error); if (Error) { - ZEN_ERROR("get disk space in {} FAILED, reason '{}'", ContainerBaseName, Error.message()); + ZEN_ERROR("get disk space in {} FAILED, reason: '{}'", ContainerBaseName, Error.message()); return Result; } @@ -355,7 +354,7 @@ namespace { { Stopwatch Timer; const auto __ = MakeGuard([RootPath, ContainerBaseName, &LegacyDiskIndex, &Timer] { - ZEN_INFO("read store '{}' legacy index containing {} entries in {}", + ZEN_INFO("read store '{}' legacy index containing #{} entries in {}", RootPath / ContainerBaseName, LegacyDiskIndex.size(), NiceTimeSpanMs(Timer.GetElapsedTimeMs())); @@ -372,7 +371,7 @@ namespace { } if (!ValidateLegacyEntry(Record, InvalidEntryReason)) { - ZEN_WARN("skipping invalid entry in '{}', reason '{}'", LegacyLogPath, InvalidEntryReason); + ZEN_WARN("skipping invalid entry in '{}', reason: '{}'", LegacyLogPath, InvalidEntryReason); return; } if (ExistingChunks.contains(Record.Key)) @@ -430,7 +429,6 @@ namespace { { ZEN_INFO("legacy store migration from '{}' aborted, not enough disk space available {} ({})", RootPath / ContainerBaseName, - NewBlockIndex + 1, NiceBytes(MaxBlockSize + DiskReserve), NiceBytes(Space.Free)); return Result; @@ -442,7 +440,6 @@ namespace { { ZEN_INFO("legacy store migration from '{}' aborted, not enough disk space available {} ({})", RootPath / ContainerBaseName, - NewBlockIndex + 1, NiceBytes(RequiredDiskSpace + DiskReserve), NiceBytes(Space.Free)); return Result; @@ -694,7 +691,8 @@ CasContainerStrategy::InsertChunk(const void* ChunkData, size_t ChunkSize, const RwLock::ExclusiveLockScope __(m_LocationMapLock); if (m_ChunkBlocks.size() == BlockStoreDiskLocation::MaxBlockIndex) { - throw std::runtime_error(fmt::format("unable to allocate a new block in '{}'", m_ContainerBaseName)); + throw std::runtime_error( + fmt::format("unable to allocate a new block in '{}'", m_Config.RootDirectory / m_ContainerBaseName)); } WriteBlockIndex += IsWriting ? 1 : 0; while (m_ChunkBlocks.contains(WriteBlockIndex)) @@ -890,7 +888,7 @@ CasContainerStrategy::Scrub(ScrubContext& Ctx) return; } - ZEN_ERROR("Scrubbing found {} bad chunks in '{}'", BadChunks.size(), m_ContainerBaseName); + ZEN_ERROR("Scrubbing found {} bad chunks in '{}'", BadChunks.size(), m_Config.RootDirectory / m_ContainerBaseName); // Deal with bad chunks by removing them from our lookup map @@ -966,8 +964,9 @@ CasContainerStrategy::CollectGarbage(GcContext& GcCtx) &DeletedSize, OldTotalSize] { ZEN_INFO( - "garbage collect for '{}' DONE after {}, write lock: {} ({}), read lock: {} ({}), collected {} bytes, deleted {} and moved {} " - "of {} " + "garbage collect for '{}' DONE after {}, write lock: {} ({}), read lock: {} ({}), collected {} bytes, deleted #{} and moved " + "#{} " + "of #{} " "chunks ({}).", m_Config.RootDirectory / m_ContainerBaseName, NiceTimeSpanMs(TotalTimer.GetElapsedTimeMs()), @@ -1150,7 +1149,10 @@ CasContainerStrategy::CollectGarbage(GcContext& GcCtx) m_ChunkBlocks[BlockIndex] = nullptr; } DeletedChunks.insert(DeletedChunks.end(), DeleteMap.begin(), DeleteMap.end()); - ZEN_DEBUG("marking cas store file for delete {}, block {}", m_ContainerBaseName, std::to_string(BlockIndex)); + ZEN_DEBUG("marking cas store file for delete '{}', block #{}, '{}'", + m_Config.RootDirectory / m_ContainerBaseName, + BlockIndex, + OldBlockFile->GetPath()); std::error_code Ec; OldBlockFile->MarkAsDeleteOnClose(Ec); if (Ec) @@ -1191,8 +1193,8 @@ CasContainerStrategy::CollectGarbage(GcContext& GcCtx) UpdateLocations(LogEntries); if (m_ChunkBlocks.size() == BlockStoreDiskLocation::MaxBlockIndex) { - ZEN_ERROR("unable to allocate a new block in {}, count limit {} exeeded", - m_ContainerBaseName, + ZEN_ERROR("unable to allocate a new block in '{}', count limit {} exeeded", + m_Config.RootDirectory / m_ContainerBaseName, static_cast<uint64_t>(std::numeric_limits<uint32_t>::max()) + 1); return; } @@ -1212,7 +1214,7 @@ CasContainerStrategy::CollectGarbage(GcContext& GcCtx) DiskSpace Space = DiskSpaceInfo(m_Config.RootDirectory, Error); if (Error) { - ZEN_ERROR("get disk space in {} FAILED, reason '{}'", m_ContainerBaseName, Error.message()); + ZEN_ERROR("get disk space in '{}' FAILED, reason: '{}'", m_Config.RootDirectory, Error.message()); return; } if (Space.Free < m_MaxBlockSize) @@ -1235,8 +1237,9 @@ CasContainerStrategy::CollectGarbage(GcContext& GcCtx) return; } - ZEN_INFO("using gc reserve for '{}', disk free {}", + ZEN_INFO("using gc reserve for '{}', reclaimed {}, disk free {}", m_Config.RootDirectory / m_ContainerBaseName, + ReclaimedSpace, NiceBytes(Space.Free + ReclaimedSpace)); } NewBlockFile->Create(m_MaxBlockSize); @@ -1277,7 +1280,10 @@ CasContainerStrategy::CollectGarbage(GcContext& GcCtx) DeletedChunks.insert(DeletedChunks.end(), DeleteMap.begin(), DeleteMap.end()); MovedBlockChunks.clear(); - ZEN_DEBUG("marking cas store file for delete {}, block index {}", m_ContainerBaseName, BlockIndex); + ZEN_DEBUG("marking cas store file for delete '{}', block index #{}, '{}'", + m_Config.RootDirectory / m_ContainerBaseName, + BlockIndex, + OldBlockFile->GetPath()); std::error_code Ec; OldBlockFile->MarkAsDeleteOnClose(Ec); if (Ec) @@ -1302,7 +1308,7 @@ CasContainerStrategy::MakeIndexSnapshot() uint64_t EntryCount = 0; Stopwatch Timer; const auto _ = MakeGuard([this, &EntryCount, &Timer] { - ZEN_INFO("write store snapshot for '{}' containing {} entries in {}", + ZEN_INFO("write store snapshot for '{}' containing #{} entries in {}", m_Config.RootDirectory / m_ContainerBaseName, EntryCount, NiceTimeSpanMs(Timer.GetElapsedTimeMs())); @@ -1373,7 +1379,7 @@ CasContainerStrategy::MakeIndexSnapshot() } catch (std::exception& Err) { - ZEN_ERROR("snapshot FAILED, reason '{}'", Err.what()); + ZEN_ERROR("snapshot FAILED, reason: '{}'", Err.what()); // Reconstruct the log from old log and any added log entries RwLock::ExclusiveLockScope __(m_LocationMapLock); @@ -1453,7 +1459,7 @@ CasContainerStrategy::OpenContainer(bool IsNewStore) { if (!ValidateEntry(Entry, InvalidEntryReason)) { - ZEN_WARN("skipping invalid entry in '{}', reason '{}'", + ZEN_WARN("skipping invalid entry in '{}', reason: '{}'", GetIndexPath(m_Config.RootDirectory, m_ContainerBaseName), InvalidEntryReason); continue; @@ -1474,7 +1480,7 @@ CasContainerStrategy::OpenContainer(bool IsNewStore) } if (!ValidateEntry(Entry, InvalidEntryReason)) { - ZEN_WARN("skipping invalid entry in '{}', reason '{}'", + ZEN_WARN("skipping invalid entry in '{}', reason: '{}'", GetLogPath(m_Config.RootDirectory, m_ContainerBaseName), InvalidEntryReason); continue; |