aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-08-19 14:03:19 +0200
committerGitHub Enterprise <[email protected]>2024-08-19 14:03:19 +0200
commitee129c0a8c667b10b0a66759d87871bdcff514a0 (patch)
tree84d8d8a9f2a4475f521dedd1c870d85b6f2ef42a
parentif disk space is low, set the last gc time to avoid spamming retries (#124) (diff)
downloadzen-ee129c0a8c667b10b0a66759d87871bdcff514a0.tar.xz
zen-ee129c0a8c667b10b0a66759d87871bdcff514a0.zip
verify that project oplog dir exists before trying to iterate it (#123)
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/zenserver/projectstore/projectstore.cpp16
2 files changed, 12 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6dc148e81..bf4da9788 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,7 @@
##
- Bugfix: If we fail to get information on a cache chunk for a partial chunk request - treat it as a cache miss
- Bugfix: Set last GC time when we skip GC due to low disk space to avoid spam-running GC
+- Bugfix: Make sure we lock project and verify directory exists before trying to iterate to find oplogs
## 5.5.4
- Feature: Added new option to zenserver for GC V2
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp
index 77a064618..1454eab01 100644
--- a/src/zenserver/projectstore/projectstore.cpp
+++ b/src/zenserver/projectstore/projectstore.cpp
@@ -2353,14 +2353,20 @@ ProjectStore::Project::DeleteOplog(std::string_view OplogId)
std::vector<std::string>
ProjectStore::Project::ScanForOplogs() const
{
- DirectoryContent DirContent;
- GetDirectoryContent(m_OplogStoragePath, DirectoryContent::IncludeDirsFlag, DirContent);
+ RwLock::SharedLockScope _(m_ProjectLock);
+
std::vector<std::string> Oplogs;
- Oplogs.reserve(DirContent.Directories.size());
- for (const std::filesystem::path& DirPath : DirContent.Directories)
+ if (Project::Exists(m_OplogStoragePath))
{
- Oplogs.push_back(DirPath.filename().string());
+ DirectoryContent DirContent;
+ GetDirectoryContent(m_OplogStoragePath, DirectoryContent::IncludeDirsFlag, DirContent);
+ Oplogs.reserve(DirContent.Directories.size());
+ for (const std::filesystem::path& DirPath : DirContent.Directories)
+ {
+ Oplogs.push_back(DirPath.filename().string());
+ }
}
+
return Oplogs;
}