diff options
| author | Dan Engelbrecht <[email protected]> | 2024-09-05 16:56:10 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-09-05 16:56:10 +0200 |
| commit | 8a9f98c9a10d0587f608225b187b34a3014a3cfa (patch) | |
| tree | 87dada0096e5903bfee39dc4e2248dc5493f4f12 /src | |
| parent | fix oplog index snapshot reading (#146) (diff) | |
| download | zen-8a9f98c9a10d0587f608225b187b34a3014a3cfa.tar.xz zen-8a9f98c9a10d0587f608225b187b34a3014a3cfa.zip | |
cleanup oplog logging (#147)
* clean up logging
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenserver/projectstore/projectstore.cpp | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp index cc6f231d7..d5570e8d4 100644 --- a/src/zenserver/projectstore/projectstore.cpp +++ b/src/zenserver/projectstore/projectstore.cpp @@ -378,16 +378,23 @@ struct ProjectStore::OplogStorage : public RefCounted { ZEN_TRACE_CPU("Store::OplogStorage::Open"); - ZEN_INFO("oplog '{}/{}': initializing storage at '{}'", - m_OwnerOplog->GetOuterProject()->Identifier, - m_OwnerOplog->OplogId(), - m_OplogStoragePath); - if (IsCreate) { + ZEN_INFO("oplog '{}/{}': initializing storage at '{}'", + m_OwnerOplog->GetOuterProject()->Identifier, + m_OwnerOplog->OplogId(), + m_OplogStoragePath); + DeleteDirectories(m_OplogStoragePath); CreateDirectories(m_OplogStoragePath); } + else + { + ZEN_INFO("oplog '{}/{}': opening storage at '{}'", + m_OwnerOplog->GetOuterProject()->Identifier, + m_OwnerOplog->OplogId(), + m_OplogStoragePath); + } m_Oplog.Open(GetLogPath(m_OplogStoragePath), IsCreate ? CasLogFile::Mode::kTruncate : CasLogFile::Mode::kWrite); m_Oplog.Initialize(); @@ -605,10 +612,15 @@ struct ProjectStore::OplogStorage : public RefCounted { ZEN_TRACE_CPU("Store::OplogStorage::ReplayLog"); - uint64_t OpsBlockSize = m_OpBlobs.FileSize(); + if (m_Oplog.GetLogCount() == SkipEntryCount) + { + return; + } Stopwatch Timer; + uint64_t OpsBlockSize = m_OpBlobs.FileSize(); + std::vector<OplogEntry> OpLogEntries; uint64_t InvalidEntries = 0; @@ -1147,6 +1159,8 @@ ProjectStore::Oplog::Read() ZEN_TRACE_CPU("Oplog::Read"); ZEN_LOG_SCOPE("Oplog::Read '{}'", m_OplogId); + ZEN_DEBUG("oplog '{}': reading config from '{}'", m_OuterProject->Identifier, m_OplogId, m_BasePath); + std::optional<CbObject> Config = ReadStateFile(m_BasePath, [this]() { return Log(); }); if (Config.has_value()) { @@ -2681,7 +2695,7 @@ ProjectStore::Project::Read() std::filesystem::path ProjectStateFilePath = m_OplogStoragePath / "Project.zcb"sv; - ZEN_INFO("project '{}': reading config from '{}'", Identifier, ProjectStateFilePath); + ZEN_DEBUG("project '{}': reading config from '{}'", Identifier, ProjectStateFilePath); BasicFile Blob; Blob.Open(ProjectStateFilePath, BasicFile::Mode::kRead); @@ -2745,7 +2759,7 @@ ProjectStore::Project::ReadAccessTimes() return; } - ZEN_INFO("project '{}': reading access times '{}'", Identifier, ProjectAccessTimesFilePath); + ZEN_DEBUG("project '{}': reading access times '{}'", Identifier, ProjectAccessTimesFilePath); BasicFile Blob; Blob.Open(ProjectAccessTimesFilePath, BasicFile::Mode::kRead); @@ -2829,7 +2843,7 @@ ProjectStore::Project::WriteAccessTimes() std::filesystem::path ProjectAccessTimesFilePath = m_OplogStoragePath / "AccessTimes.zcb"sv; - ZEN_INFO("project '{}': persisting access times for '{}'", Identifier, ProjectAccessTimesFilePath); + ZEN_DEBUG("project '{}': persisting access times for '{}'", Identifier, ProjectAccessTimesFilePath); TemporaryFile::SafeWriteFile(ProjectAccessTimesFilePath, Data.GetView()); } @@ -2860,6 +2874,8 @@ ProjectStore::Project::NewOplog(std::string_view OplogId, const std::filesystem: try { + ZEN_INFO("oplog '{}/{}': creating oplog at '{}'", Identifier, OplogId, OplogBasePath); + Oplog* Log = m_Oplogs .try_emplace(std::string{OplogId}, std::make_unique<ProjectStore::Oplog>(OplogId, this, m_CidStore, OplogBasePath, MarkerPath)) @@ -2914,6 +2930,8 @@ ProjectStore::Project::OpenOplog(std::string_view OplogId, bool AllowCompact) { try { + ZEN_INFO("oplog '{}/{}': opening oplog at '{}'", Identifier, OplogId, OplogBasePath); + Oplog* Log = m_Oplogs .try_emplace(std::string{OplogId}, @@ -3701,6 +3719,8 @@ ProjectStore::NewProject(const std::filesystem::path& BasePath, RwLock::ExclusiveLockScope _(m_ProjectsLock); + ZEN_INFO("project '{}': creating project at '{}'", ProjectId, BasePath); + Ref<Project>& Prj = m_Projects.try_emplace(std::string{ProjectId}, Ref<ProjectStore::Project>(new ProjectStore::Project(this, m_CidStore, BasePath))) .first->second; |