diff --git a/include/rocksdb/sst_file_manager.h b/include/rocksdb/sst_file_manager.h index d1133d871..439537e2a 100644 --- a/include/rocksdb/sst_file_manager.h +++ b/include/rocksdb/sst_file_manager.h @@ -104,7 +104,6 @@ extern SstFileManager* NewSstFileManager( Env* env, std::shared_ptr info_log = nullptr, std::string trash_dir = "", int64_t rate_bytes_per_sec = 0, bool delete_existing_trash = true, Status* status = nullptr, - double max_trash_db_ratio = 0.25, - uint64_t bytes_max_delete_chunk = 0); + double max_trash_db_ratio = 0.25, uint64_t bytes_max_delete_chunk = 0); } // namespace rocksdb diff --git a/table/block_fetcher.cc b/table/block_fetcher.cc index e893c9592..8a35137c5 100644 --- a/table/block_fetcher.cc +++ b/table/block_fetcher.cc @@ -166,10 +166,11 @@ void BlockFetcher::GetBlockContents() { *contents_ = BlockContents(Slice(slice_.data(), block_size_), immortal_source_, compression_type); } else { - // page is uncompressed, the buffer either stack or heap provided + // page can be either uncompressed or compressed, the buffer either stack + // or heap provided. Refer to https://github.com/facebook/rocksdb/pull/4096 if (got_from_prefetch_buffer_ || used_buf_ == &stack_buf_[0]) { - heap_buf_.reset(new char[block_size_]); - memcpy(heap_buf_.get(), used_buf_, block_size_); + heap_buf_.reset(new char[block_size_ + kBlockTrailerSize]); + memcpy(heap_buf_.get(), used_buf_, block_size_ + kBlockTrailerSize); } *contents_ = BlockContents(std::move(heap_buf_), block_size_, true, compression_type);