X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Frocksdb%2Ftable%2Fblock_fetcher.h;h=c03352e986f11c45879559237e75fdfccb0fdcf8;hb=20effc670b57271cb089376d6d0800990e5218d5;hp=1b003df1545a72b50afd72b766b5cea7a961f6d6;hpb=a71831dadd1e1f3e0fa70405511f65cc33db0498;p=ceph.git diff --git a/ceph/src/rocksdb/table/block_fetcher.h b/ceph/src/rocksdb/table/block_fetcher.h index 1b003df15..c03352e98 100644 --- a/ceph/src/rocksdb/table/block_fetcher.h +++ b/ceph/src/rocksdb/table/block_fetcher.h @@ -56,6 +56,8 @@ class BlockFetcher { do_uncompress_(do_uncompress), maybe_compressed_(maybe_compressed), block_type_(block_type), + block_size_(static_cast(handle_.size())), + block_size_with_trailer_(block_size(handle_)), uncompression_dict_(uncompression_dict), cache_options_(cache_options), memory_allocator_(memory_allocator), @@ -65,7 +67,21 @@ class BlockFetcher { Status ReadBlockContents(); CompressionType get_compression_type() const { return compression_type_; } +#ifndef NDEBUG + int TEST_GetNumStackBufMemcpy() const { return num_stack_buf_memcpy_; } + int TEST_GetNumHeapBufMemcpy() const { return num_heap_buf_memcpy_; } + int TEST_GetNumCompressedBufMemcpy() const { + return num_compressed_buf_memcpy_; + } + +#endif private: +#ifndef NDEBUG + int num_stack_buf_memcpy_ = 0; + int num_heap_buf_memcpy_ = 0; + int num_compressed_buf_memcpy_ = 0; + +#endif static const uint32_t kDefaultStackBufferSize = 5000; RandomAccessFileReader* file_; @@ -75,9 +91,11 @@ class BlockFetcher { const BlockHandle& handle_; BlockContents* contents_; const ImmutableCFOptions& ioptions_; - bool do_uncompress_; - bool maybe_compressed_; - BlockType block_type_; + const bool do_uncompress_; + const bool maybe_compressed_; + const BlockType block_type_; + const size_t block_size_; + const size_t block_size_with_trailer_; const UncompressionDict& uncompression_dict_; const PersistentCacheOptions& cache_options_; MemoryAllocator* memory_allocator_; @@ -85,12 +103,12 @@ class BlockFetcher { Status status_; Slice slice_; char* used_buf_ = nullptr; - size_t block_size_; + AlignedBuf direct_io_buf_; CacheAllocationPtr heap_buf_; CacheAllocationPtr compressed_buf_; char stack_buf_[kDefaultStackBufferSize]; bool got_from_prefetch_buffer_ = false; - ROCKSDB_NAMESPACE::CompressionType compression_type_; + CompressionType compression_type_; bool for_compaction_ = false; // return true if found @@ -99,8 +117,10 @@ class BlockFetcher { bool TryGetFromPrefetchBuffer(); bool TryGetCompressedBlockFromPersistentCache(); void PrepareBufferForBlockFromFile(); - // Copy content from used_buf_ to new heap buffer. - void CopyBufferToHeap(); + // Copy content from used_buf_ to new heap_buf_. + void CopyBufferToHeapBuf(); + // Copy content from used_buf_ to new compressed_buf_. + void CopyBufferToCompressedBuf(); void GetBlockContents(); void InsertCompressedBlockToPersistentCacheIfNeeded(); void InsertUncompressedBlockToPersistentCacheIfNeeded();