diff --git a/.circleci/config.yml b/.circleci/config.yml index 15fd6ef4d..ec6d63a5b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -572,6 +572,16 @@ jobs: gtest-parallel $(Truncate(size); } + void PrepareWrite(size_t offset, size_t len) override { + base_->PrepareWrite(offset, len); + } + void SetPreallocationBlockSize(size_t size) override { + base_->SetPreallocationBlockSize(size); + } Status Close() override { // SyncPoint is not supported in Released Windows Mode. #if !(defined NDEBUG) || !defined(OS_WIN) // Check preallocation size - // preallocation size is never passed to base file. - size_t preallocation_size = preallocation_block_size(); + size_t block_size, last_allocated_block; + base_->GetPreallocationStatus(&block_size, &last_allocated_block); TEST_SYNC_POINT_CALLBACK("DBTestWalFile.GetPreallocationStatus", - &preallocation_size); + &block_size); #endif // !(defined NDEBUG) || !defined(OS_WIN) return base_->Close(); diff --git a/env/env_encryption.cc b/env/env_encryption.cc index d34125314..a5670ad78 100644 --- a/env/env_encryption.cc +++ b/env/env_encryption.cc @@ -362,6 +362,17 @@ void EncryptedWritableFile::PrepareWrite(size_t offset, size_t len, file_->PrepareWrite(offset + prefixLength_, len, options, dbg); } +void EncryptedWritableFile::SetPreallocationBlockSize(size_t size) { + // the size here doesn't need to include prefixLength_, as it's a + // configuration will be use for `PrepareWrite()`. + file_->SetPreallocationBlockSize(size); +} + +void EncryptedWritableFile::GetPreallocationStatus( + size_t* block_size, size_t* last_allocated_block) { + file_->GetPreallocationStatus(block_size, last_allocated_block); +} + // Pre-allocates space for a file. IOStatus EncryptedWritableFile::Allocate(uint64_t offset, uint64_t len, const IOOptions& options, diff --git a/include/rocksdb/env_encryption.h b/include/rocksdb/env_encryption.h index 8ac5da973..7a76ec867 100644 --- a/include/rocksdb/env_encryption.h +++ b/include/rocksdb/env_encryption.h @@ -366,6 +366,11 @@ class EncryptedWritableFile : public FSWritableFile { void PrepareWrite(size_t offset, size_t len, const IOOptions& options, IODebugContext* dbg) override; + void SetPreallocationBlockSize(size_t size) override; + + void GetPreallocationStatus(size_t* block_size, + size_t* last_allocated_block) override; + // Pre-allocates space for a file. IOStatus Allocate(uint64_t offset, uint64_t len, const IOOptions& options, IODebugContext* dbg) override;