Make table_test runnable in ROCKSDB_LITE
Summary: Remove plain table tests from table_test since plain table is not supported in ROCKSDB_LITE Test Plan: table_test Reviewers: igor, sdong, yhchiang Reviewed By: yhchiang Subscribers: dhruba Differential Revision: https://reviews.facebook.net/D42153
This commit is contained in:
parent
f0fe9126f2
commit
4853e228ef
@ -544,9 +544,11 @@ class DBConstructor: public Constructor {
|
|||||||
|
|
||||||
enum TestType {
|
enum TestType {
|
||||||
BLOCK_BASED_TABLE_TEST,
|
BLOCK_BASED_TABLE_TEST,
|
||||||
|
#ifndef ROCKSDB_LITE
|
||||||
PLAIN_TABLE_SEMI_FIXED_PREFIX,
|
PLAIN_TABLE_SEMI_FIXED_PREFIX,
|
||||||
PLAIN_TABLE_FULL_STR_PREFIX,
|
PLAIN_TABLE_FULL_STR_PREFIX,
|
||||||
PLAIN_TABLE_TOTAL_ORDER,
|
PLAIN_TABLE_TOTAL_ORDER,
|
||||||
|
#endif // !ROCKSDB_LITE
|
||||||
BLOCK_TEST,
|
BLOCK_TEST,
|
||||||
MEMTABLE_TEST,
|
MEMTABLE_TEST,
|
||||||
DB_TEST
|
DB_TEST
|
||||||
@ -563,10 +565,14 @@ struct TestArgs {
|
|||||||
static std::vector<TestArgs> GenerateArgList() {
|
static std::vector<TestArgs> GenerateArgList() {
|
||||||
std::vector<TestArgs> test_args;
|
std::vector<TestArgs> test_args;
|
||||||
std::vector<TestType> test_types = {
|
std::vector<TestType> test_types = {
|
||||||
BLOCK_BASED_TABLE_TEST, PLAIN_TABLE_SEMI_FIXED_PREFIX,
|
BLOCK_BASED_TABLE_TEST,
|
||||||
PLAIN_TABLE_FULL_STR_PREFIX, PLAIN_TABLE_TOTAL_ORDER,
|
#ifndef ROCKSDB_LITE
|
||||||
BLOCK_TEST, MEMTABLE_TEST,
|
PLAIN_TABLE_SEMI_FIXED_PREFIX,
|
||||||
DB_TEST};
|
PLAIN_TABLE_FULL_STR_PREFIX,
|
||||||
|
PLAIN_TABLE_TOTAL_ORDER,
|
||||||
|
#endif // !ROCKSDB_LITE
|
||||||
|
BLOCK_TEST,
|
||||||
|
MEMTABLE_TEST, DB_TEST};
|
||||||
std::vector<bool> reverse_compare_types = {false, true};
|
std::vector<bool> reverse_compare_types = {false, true};
|
||||||
std::vector<int> restart_intervals = {16, 1, 1024};
|
std::vector<int> restart_intervals = {16, 1, 1024};
|
||||||
|
|
||||||
@ -593,6 +599,7 @@ static std::vector<TestArgs> GenerateArgList() {
|
|||||||
|
|
||||||
for (auto test_type : test_types) {
|
for (auto test_type : test_types) {
|
||||||
for (auto reverse_compare : reverse_compare_types) {
|
for (auto reverse_compare : reverse_compare_types) {
|
||||||
|
#ifndef ROCKSDB_LITE
|
||||||
if (test_type == PLAIN_TABLE_SEMI_FIXED_PREFIX ||
|
if (test_type == PLAIN_TABLE_SEMI_FIXED_PREFIX ||
|
||||||
test_type == PLAIN_TABLE_FULL_STR_PREFIX) {
|
test_type == PLAIN_TABLE_FULL_STR_PREFIX) {
|
||||||
// Plain table doesn't use restart index or compression.
|
// Plain table doesn't use restart index or compression.
|
||||||
@ -604,6 +611,7 @@ static std::vector<TestArgs> GenerateArgList() {
|
|||||||
test_args.push_back(one_arg);
|
test_args.push_back(one_arg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#endif // !ROCKSDB_LITE
|
||||||
|
|
||||||
for (auto restart_interval : restart_intervals) {
|
for (auto restart_interval : restart_intervals) {
|
||||||
for (auto compression_type : compression_types) {
|
for (auto compression_type : compression_types) {
|
||||||
@ -685,6 +693,8 @@ class HarnessTest : public testing::Test {
|
|||||||
new BlockBasedTableFactory(table_options_));
|
new BlockBasedTableFactory(table_options_));
|
||||||
constructor_ = new TableConstructor(options_.comparator);
|
constructor_ = new TableConstructor(options_.comparator);
|
||||||
break;
|
break;
|
||||||
|
// Plain table is not supported in ROCKSDB_LITE
|
||||||
|
#ifndef ROCKSDB_LITE
|
||||||
case PLAIN_TABLE_SEMI_FIXED_PREFIX:
|
case PLAIN_TABLE_SEMI_FIXED_PREFIX:
|
||||||
support_prev_ = false;
|
support_prev_ = false;
|
||||||
only_support_prefix_seek_ = true;
|
only_support_prefix_seek_ = true;
|
||||||
@ -724,6 +734,7 @@ class HarnessTest : public testing::Test {
|
|||||||
internal_comparator_.reset(
|
internal_comparator_.reset(
|
||||||
new InternalKeyComparator(options_.comparator));
|
new InternalKeyComparator(options_.comparator));
|
||||||
break;
|
break;
|
||||||
|
#endif // !ROCKSDB_LITE
|
||||||
case BLOCK_TEST:
|
case BLOCK_TEST:
|
||||||
table_options_.block_size = 256;
|
table_options_.block_size = 256;
|
||||||
options_.table_factory.reset(
|
options_.table_factory.reset(
|
||||||
@ -1762,6 +1773,8 @@ TEST_F(BlockBasedTableTest, BlockCacheLeak) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Plain table is not supported in ROCKSDB_LITE
|
||||||
|
#ifndef ROCKSDB_LITE
|
||||||
TEST_F(PlainTableTest, BasicPlainTableProperties) {
|
TEST_F(PlainTableTest, BasicPlainTableProperties) {
|
||||||
PlainTableOptions plain_table_options;
|
PlainTableOptions plain_table_options;
|
||||||
plain_table_options.user_key_len = 8;
|
plain_table_options.user_key_len = 8;
|
||||||
@ -1810,6 +1823,7 @@ TEST_F(PlainTableTest, BasicPlainTableProperties) {
|
|||||||
ASSERT_EQ(26ul, props->num_entries);
|
ASSERT_EQ(26ul, props->num_entries);
|
||||||
ASSERT_EQ(1ul, props->num_data_blocks);
|
ASSERT_EQ(1ul, props->num_data_blocks);
|
||||||
}
|
}
|
||||||
|
#endif // !ROCKSDB_LITE
|
||||||
|
|
||||||
TEST_F(GeneralTableTest, ApproximateOffsetOfPlain) {
|
TEST_F(GeneralTableTest, ApproximateOffsetOfPlain) {
|
||||||
TableConstructor c(BytewiseComparator());
|
TableConstructor c(BytewiseComparator());
|
||||||
@ -2068,6 +2082,8 @@ TEST_F(HarnessTest, FooterTests) {
|
|||||||
ASSERT_EQ(decoded_footer.index_handle().size(), index.size());
|
ASSERT_EQ(decoded_footer.index_handle().size(), index.size());
|
||||||
ASSERT_EQ(decoded_footer.version(), 1U);
|
ASSERT_EQ(decoded_footer.version(), 1U);
|
||||||
}
|
}
|
||||||
|
// Plain table is not supported in ROCKSDB_LITE
|
||||||
|
#ifndef ROCKSDB_LITE
|
||||||
{
|
{
|
||||||
// upconvert legacy plain table
|
// upconvert legacy plain table
|
||||||
std::string encoded;
|
std::string encoded;
|
||||||
@ -2107,6 +2123,7 @@ TEST_F(HarnessTest, FooterTests) {
|
|||||||
ASSERT_EQ(decoded_footer.index_handle().size(), index.size());
|
ASSERT_EQ(decoded_footer.index_handle().size(), index.size());
|
||||||
ASSERT_EQ(decoded_footer.version(), 1U);
|
ASSERT_EQ(decoded_footer.version(), 1U);
|
||||||
}
|
}
|
||||||
|
#endif // !ROCKSDB_LITE
|
||||||
{
|
{
|
||||||
// version == 2
|
// version == 2
|
||||||
std::string encoded;
|
std::string encoded;
|
||||||
|
Loading…
Reference in New Issue
Block a user