aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore
diff options
context:
space:
mode:
authorzousar <[email protected]>2025-09-22 16:38:15 -0600
committerzousar <[email protected]>2025-09-22 16:38:15 -0600
commit1c591941878e5c5009d51a82ff61986a63bd2e11 (patch)
tree3860ab5ebddf1919aab3cca019422fa76cfcdda4 /src/zenstore
parentChange batch put responses for client reporting (diff)
parent5.7.2-pre1 (diff)
downloadzen-1c591941878e5c5009d51a82ff61986a63bd2e11.tar.xz
zen-1c591941878e5c5009d51a82ff61986a63bd2e11.zip
Merge branch 'main' into zs/put-overwrite-policy-response
Diffstat (limited to 'src/zenstore')
-rw-r--r--src/zenstore/blockstore.cpp13
-rw-r--r--src/zenstore/gc.cpp4
-rw-r--r--src/zenstore/include/zenstore/blockstore.h12
3 files changed, 15 insertions, 14 deletions
diff --git a/src/zenstore/blockstore.cpp b/src/zenstore/blockstore.cpp
index c50f2bb13..b8fa03305 100644
--- a/src/zenstore/blockstore.cpp
+++ b/src/zenstore/blockstore.cpp
@@ -121,6 +121,12 @@ BlockStoreFile::FileSize() const
{
return 0;
}
+ uint64_t Expected = 0;
+ if (!m_CachedFileSize.compare_exchange_strong(Expected, Size))
+ {
+ // Force a new check next time file size is fetched
+ m_CachedFileSize.store(0);
+ }
return Size;
}
return m_CachedFileSize;
@@ -153,13 +159,8 @@ void
BlockStoreFile::Write(const void* Data, uint64_t Size, uint64_t FileOffset)
{
ZEN_TRACE_CPU("BlockStoreFile::Write");
-#if ZEN_BUILD_DEBUG
- if (uint64_t CachedFileSize = m_CachedFileSize.load(); CachedFileSize > 0)
- {
- ZEN_ASSERT(FileOffset + Size <= CachedFileSize);
- }
-#endif // ZEN_BUILD_DEBUG
m_File.Write(Data, Size, FileOffset);
+ m_CachedFileSize.store(0);
}
void
diff --git a/src/zenstore/gc.cpp b/src/zenstore/gc.cpp
index 1ddb25364..185bc2118 100644
--- a/src/zenstore/gc.cpp
+++ b/src/zenstore/gc.cpp
@@ -2858,7 +2858,7 @@ GcScheduler::CollectGarbage(const GcClock::TimePoint& CacheExpireTime,
{
ZEN_WARN("writing gc scheduler state ran out of disk space: '{}'", SystemError.what());
}
- else if (RetryCount == 0)
+ else if (RetryCount == 2)
{
ZEN_ERROR("writing gc scheduler state failed with system error exception: '{}' ({})",
SystemError.what(),
@@ -2877,7 +2877,7 @@ GcScheduler::CollectGarbage(const GcClock::TimePoint& CacheExpireTime,
}
catch (const std::exception& Ex)
{
- if (RetryCount == 0)
+ if (RetryCount == 2)
{
ZEN_ERROR("writing gc scheduler state failed with: '{}'", Ex.what());
}
diff --git a/src/zenstore/include/zenstore/blockstore.h b/src/zenstore/include/zenstore/blockstore.h
index fce05766f..4006f4275 100644
--- a/src/zenstore/include/zenstore/blockstore.h
+++ b/src/zenstore/include/zenstore/blockstore.h
@@ -102,12 +102,12 @@ struct BlockStoreFile : public RefCounted
IoBuffer GetMetaData() const;
private:
- std::filesystem::path GetMetaPath() const;
- void RemoveMeta();
- const std::filesystem::path m_Path;
- IoBuffer m_IoBuffer;
- BasicFile m_File;
- std::atomic<uint64_t> m_CachedFileSize = 0;
+ std::filesystem::path GetMetaPath() const;
+ void RemoveMeta();
+ const std::filesystem::path m_Path;
+ IoBuffer m_IoBuffer;
+ BasicFile m_File;
+ mutable std::atomic<uint64_t> m_CachedFileSize = 0;
};
class BlockStoreCompactState;