aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md4
-rw-r--r--zencore/include/zencore/scopeguard.h12
-rw-r--r--zenstore/blockstore.cpp5
3 files changed, 20 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 985248c77..e8da122a2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,8 @@
##
+- Bugfix: Verify that there are blocks to GC for block store garbage collect (void division by zero)
+- Bugfix: Log ERROR in scope guard if function throws exception, throwing exception causes application abort
+
+## 0.2.7
- Bugfix: Safely handle missing blocks when doing garbage collection in block store data
- Bugfix: Only strip uri accept type suffix if it can be parsed to a known type
- Bugfix: Keep system error code on Windows when file mapping fails and propagate to log/exception
diff --git a/zencore/include/zencore/scopeguard.h b/zencore/include/zencore/scopeguard.h
index 13fed4ac5..d04c8ed9c 100644
--- a/zencore/include/zencore/scopeguard.h
+++ b/zencore/include/zencore/scopeguard.h
@@ -3,6 +3,7 @@
#pragma once
#include <type_traits>
+#include "logging.h"
#include "zencore.h"
namespace zen {
@@ -15,7 +16,16 @@ public:
~ScopeGuardImpl()
{
if (!m_dismissed)
- m_guardFunc();
+ {
+ try
+ {
+ m_guardFunc();
+ }
+ catch (std::exception& Ex)
+ {
+ ZEN_ERROR("scope guard threw exception: '{}'", Ex.what());
+ }
+ }
}
void Dismiss() { m_dismissed = true; }
diff --git a/zenstore/blockstore.cpp b/zenstore/blockstore.cpp
index 2894244fe..9738df729 100644
--- a/zenstore/blockstore.cpp
+++ b/zenstore/blockstore.cpp
@@ -353,6 +353,11 @@ BlockStore::ReclaimSpace(const ReclaimSnapshotState& Snapshot,
});
size_t BlockCount = Snapshot.BlockCount;
+ if (BlockCount == 0)
+ {
+ ZEN_DEBUG("garbage collect for '{}' SKIPPED, no blocks to process", m_BlocksBasePath);
+ return;
+ }
std::unordered_set<size_t> KeepChunkMap;
KeepChunkMap.reserve(KeepChunkIndexes.size());