From aa734ce9abcab3ff6a7e54c3bab28f337e03078f Mon Sep 17 00:00:00 2001 From: kailiu Date: Tue, 11 Feb 2014 14:12:58 -0800 Subject: [PATCH] Fix a member variables initialization order issue Summary: In MacOS, I got issue with `Footer`'s default constructor, which initialized the magic number with some random number instead of 0. With investigation, I found we forgot to make the kInvalidTableMagicNumber to be static. As a result, kInvalidTableMagicNumber was assgined to `table_magic_number_` before it is initialized (which will be populated with random number). Test Plan: passed current unit tests; also passed the unit tests for the incoming diff which used the default footer. Reviewers: yhchiang CC: leveldb Differential Revision: https://reviews.facebook.net/D16077 --- table/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/table/format.h b/table/format.h index 64fa3fbe82..ed292347e3 100644 --- a/table/format.h +++ b/table/format.h @@ -109,7 +109,7 @@ class Footer { kEncodedLength = 2 * BlockHandle::kMaxEncodedLength + 8 }; - const uint64_t kInvalidTableMagicNumber = 0; + static const uint64_t kInvalidTableMagicNumber = 0; private: // Set the table_magic_number only when it was not previously