RocksDB 2.8 to be able to read files generated by 2.6

Summary:
From 2.6 to 2.7, property block name is renamed from rocksdb.stats to rocksdb.properties. Older properties were not able to be loaded. In 2.8, we seem to have added some logic that uses property block without checking null pointers, which create segment faults.

In this patch, we fix it by:
(1) try rocksdb.stats if rocksdb.properties is not found
(2) add some null checking before consuming rep->table_properties

Test Plan: make sure a file generated in 2.7 couldn't be opened now can be opened.

Reviewers: haobo, igor, yhchiang

Reviewed By: igor

CC: ljin, xjin, dhruba, kailiu, leveldb

Differential Revision: https://reviews.facebook.net/D17961
This commit is contained in:
sdong
2014-04-16 19:30:33 -07:00
parent 161d9e586b
commit 5cef458a2c
4 changed files with 33 additions and 7 deletions

View File

@@ -12,6 +12,7 @@
#include <stdint.h>
#include <memory>
#include <utility>
#include <string>
#include "rocksdb/statistics.h"
#include "rocksdb/status.h"
@@ -198,4 +199,8 @@ class BlockBasedTable : public TableReader {
void operator=(const TableReader&) = delete;
};
// Backward compatible properties block name. Limited in block based
// table.
extern const std::string kPropertiesBlockOldName;
} // namespace rocksdb