]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Fix a issue with initializing blob header buffer (#8537)
authoryangzaorang <yangzaorang@didiglobal.com>
Tue, 3 Aug 2021 00:13:36 +0000 (17:13 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 3 Aug 2021 00:15:06 +0000 (17:15 -0700)
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

index f8e1c02bdbc3d50ab54f8b7f1dc9336ec7063367..98afa8518b374c754c24cb1ccd59b91648d4ad40 100644 (file)
@@ -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