From 8e91bd90d23f4b4b6d646e61deb8e2947f471010 Mon Sep 17 00:00:00 2001 From: yangzaorang Date: Mon, 2 Aug 2021 17:13:36 -0700 Subject: [PATCH] Fix a issue with initializing blob header buffer (#8537) Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/8537 Reviewed By: ajkr Differential Revision: D29838132 Pulled By: jay-zhuang fbshipit-source-id: e3e78d5f85f240a1800ace417a8b634f74488e41 --- db/blob/blob_log_sequential_reader.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/db/blob/blob_log_sequential_reader.h b/db/blob/blob_log_sequential_reader.h index f8e1c02bd..98afa8518 100644 --- a/db/blob/blob_log_sequential_reader.h +++ b/db/blob/blob_log_sequential_reader.h @@ -10,6 +10,8 @@ #include "db/blob/blob_log_format.h" #include "rocksdb/slice.h" +#define MAX_HEADER_SIZE(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c)) + namespace ROCKSDB_NAMESPACE { class RandomAccessFileReader; @@ -69,10 +71,13 @@ class BlobLogSequentialReader { Statistics* statistics_; Slice buffer_; - char header_buf_[BlobLogRecord::kHeaderSize]; + char header_buf_[MAX_HEADER_SIZE(BlobLogHeader::kSize, BlobLogFooter::kSize, + BlobLogRecord::kHeaderSize)]; // which byte to read next uint64_t next_byte_; }; } // namespace ROCKSDB_NAMESPACE + +#undef MAX_HEADER_SIZE \ No newline at end of file