Parameterize table magic number

Summary:

As we are having different types of tables and they all might share the same structure in block-based table:

[metaindex block]
[index block]
[Footer]

To be able to identify differnt types of tables, we need to parameterize the "magic number" in the `Footer`.

Test Plan:

make check
This commit is contained in:
Kai Liu
2013-12-04 15:09:41 -08:00
parent f040e536e4
commit 3a0e98d558
4 changed files with 19 additions and 9 deletions

View File

@@ -29,6 +29,8 @@
namespace rocksdb {
extern uint64_t kBlockedBasedTableMagicNumber;
// The longest the prefix of the cache key used to identify blocks can be.
// We are using the fact that we know for Posix files the unique ID is three
// varints.
@@ -242,7 +244,7 @@ Status BlockBasedTable::Open(const Options& options,
return Status::InvalidArgument("file is too short to be an sstable");
}
Footer footer;
Footer footer(kBlockedBasedTableMagicNumber);
s = footer.DecodeFrom(&footer_input);
if (!s.ok()) return s;