aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-05-19 10:13:16 +0200
committerStefan Boberg <[email protected]>2023-05-19 10:13:16 +0200
commitdc4d9d5b294c33462bbeb6a6572e59e2993dc302 (patch)
treecb0f704231c11d47b2e20024400591370c94134f
parentfix for commented-out code which was never meant to be checked in (diff)
downloadzen-dc4d9d5b294c33462bbeb6a6572e59e2993dc302.tar.xz
zen-dc4d9d5b294c33462bbeb6a6572e59e2993dc302.zip
fixed bug where an oplog delete would not actually delete the oplog
this would manifest itself if an oplog delete was attempted right after zenserver startup, when the oplog has not yet been instantiated. This fix checks for on-disk state as well as in-memory
-rw-r--r--src/zenserver/projectstore/projectstore.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp
index 08b4a6db5..4b0c801bc 100644
--- a/src/zenserver/projectstore/projectstore.cpp
+++ b/src/zenserver/projectstore/projectstore.cpp
@@ -1255,9 +1255,16 @@ ProjectStore::Project::DeleteOplog(std::string_view OplogId)
{
RwLock::ExclusiveLockScope _(m_ProjectLock);
- auto OplogIt = m_Oplogs.find(std::string(OplogId));
+ if (auto OplogIt = m_Oplogs.find(std::string(OplogId)); OplogIt == m_Oplogs.end())
+ {
+ std::filesystem::path OplogBasePath = BasePathForOplog(OplogId);
- if (OplogIt != m_Oplogs.end())
+ if (Oplog::ExistsAt(OplogBasePath))
+ {
+ DeletePath = OplogBasePath;
+ }
+ }
+ else
{
std::unique_ptr<Oplog>& Oplog = OplogIt->second;
DeletePath = Oplog->PrepareForDelete(true);