diff options
| author | Dan Engelbrecht <[email protected]> | 2025-05-30 11:51:05 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-05-30 11:51:05 +0200 |
| commit | 42aa2c9a8124ada33c88f5c608e4865b1ff84c64 (patch) | |
| tree | 4c237a2e515f73a256ee290e8f9a113f0a2060f2 /src/zenstore/include | |
| parent | frequent disk space check (#407) (diff) | |
| download | zen-42aa2c9a8124ada33c88f5c608e4865b1ff84c64.tar.xz zen-42aa2c9a8124ada33c88f5c608e4865b1ff84c64.zip | |
faster oplog validate (#408)
Improvement: Faster oplog validate to reduce GC wall time and disk I/O pressure
Diffstat (limited to 'src/zenstore/include')
| -rw-r--r-- | src/zenstore/include/zenstore/blockstore.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/zenstore/include/zenstore/blockstore.h b/src/zenstore/include/zenstore/blockstore.h index 0c72a13aa..b0713fea1 100644 --- a/src/zenstore/include/zenstore/blockstore.h +++ b/src/zenstore/include/zenstore/blockstore.h @@ -94,7 +94,7 @@ struct BlockStoreFile : public RefCounted IoBuffer GetChunk(uint64_t Offset, uint64_t Size); void Read(void* Data, uint64_t Size, uint64_t FileOffset); void Write(const void* Data, uint64_t Size, uint64_t FileOffset); - void Flush(); + void Flush(uint64_t FinalSize = (uint64_t)-1); BasicFile& GetBasicFile(); void StreamByteRange(uint64_t FileOffset, uint64_t Size, std::function<void(const void* Data, uint64_t Size)>&& ChunkFun); bool IsOpen() const; @@ -107,7 +107,7 @@ private: const std::filesystem::path m_Path; IoBuffer m_IoBuffer; BasicFile m_File; - uint64_t m_CachedFileSize = 0; + std::atomic<uint64_t> m_CachedFileSize = 0; }; class BlockStoreCompactState; @@ -158,6 +158,7 @@ public: typedef std::function<void(std::span<BlockStoreLocation> Locations)> WriteChunksCallback; void WriteChunks(std::span<const IoBuffer> Datas, uint32_t Alignment, const WriteChunksCallback& Callback); + bool HasChunk(const BlockStoreLocation& Location) const; IoBuffer TryGetChunk(const BlockStoreLocation& Location) const; void Flush(bool ForceNewBlock); |