Fix DBTest2.ChangePrefixExtractor LITE build (#6356)
Summary: DBTest2.ChangePrefixExtractor fails in LITE build because LITE build doesn't support adaptive build. Fix it by removing the stats check but only check correctness. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6356 Test Plan: Run the test with both of LITE and non-LITE build. Differential Revision: D19669537 fbshipit-source-id: 6d7dd6c8a79f18e80ca1636864b9c71922030d8e
This commit is contained in:
parent
01ab882ba3
commit
800d24ddc5
@ -4368,6 +4368,13 @@ TEST_F(DBTest2, ChangePrefixExtractor) {
|
|||||||
BlockBasedTableOptions table_options;
|
BlockBasedTableOptions table_options;
|
||||||
Options options = CurrentOptions();
|
Options options = CurrentOptions();
|
||||||
|
|
||||||
|
// Sometimes filter is checked based on upper bound. Assert counters
|
||||||
|
// for that case. Otherwise, only check data correctness.
|
||||||
|
#ifndef ROCKSDB_LITE
|
||||||
|
bool expect_filter_check = !use_partitioned_filter;
|
||||||
|
#else
|
||||||
|
bool expect_filter_check = false;
|
||||||
|
#endif
|
||||||
table_options.partition_filters = use_partitioned_filter;
|
table_options.partition_filters = use_partitioned_filter;
|
||||||
if (use_partitioned_filter) {
|
if (use_partitioned_filter) {
|
||||||
table_options.index_type =
|
table_options.index_type =
|
||||||
@ -4403,14 +4410,14 @@ TEST_F(DBTest2, ChangePrefixExtractor) {
|
|||||||
ASSERT_EQ("xb", iterator->key().ToString());
|
ASSERT_EQ("xb", iterator->key().ToString());
|
||||||
// It's a bug that the counter BLOOM_FILTER_PREFIX_CHECKED is not
|
// It's a bug that the counter BLOOM_FILTER_PREFIX_CHECKED is not
|
||||||
// correct in this case. So don't check counters in this case.
|
// correct in this case. So don't check counters in this case.
|
||||||
if (!use_partitioned_filter) {
|
if (expect_filter_check) {
|
||||||
ASSERT_EQ(0, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
ASSERT_EQ(0, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator->Seek("xz");
|
iterator->Seek("xz");
|
||||||
ASSERT_TRUE(iterator->Valid());
|
ASSERT_TRUE(iterator->Valid());
|
||||||
ASSERT_EQ("xz1", iterator->key().ToString());
|
ASSERT_EQ("xz1", iterator->key().ToString());
|
||||||
if (!use_partitioned_filter) {
|
if (expect_filter_check) {
|
||||||
ASSERT_EQ(0, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
ASSERT_EQ(0, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4427,7 +4434,7 @@ TEST_F(DBTest2, ChangePrefixExtractor) {
|
|||||||
iterator->SeekForPrev("xg0");
|
iterator->SeekForPrev("xg0");
|
||||||
ASSERT_TRUE(iterator->Valid());
|
ASSERT_TRUE(iterator->Valid());
|
||||||
ASSERT_EQ("xb", iterator->key().ToString());
|
ASSERT_EQ("xb", iterator->key().ToString());
|
||||||
if (!use_partitioned_filter) {
|
if (expect_filter_check) {
|
||||||
ASSERT_EQ(0, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
ASSERT_EQ(0, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4440,14 +4447,14 @@ TEST_F(DBTest2, ChangePrefixExtractor) {
|
|||||||
iterator->Seek("x");
|
iterator->Seek("x");
|
||||||
ASSERT_TRUE(iterator->Valid());
|
ASSERT_TRUE(iterator->Valid());
|
||||||
ASSERT_EQ("xb", iterator->key().ToString());
|
ASSERT_EQ("xb", iterator->key().ToString());
|
||||||
if (!use_partitioned_filter) {
|
if (expect_filter_check) {
|
||||||
ASSERT_EQ(0, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
ASSERT_EQ(0, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator->Seek("xx0");
|
iterator->Seek("xx0");
|
||||||
ASSERT_TRUE(iterator->Valid());
|
ASSERT_TRUE(iterator->Valid());
|
||||||
ASSERT_EQ("xx1", iterator->key().ToString());
|
ASSERT_EQ("xx1", iterator->key().ToString());
|
||||||
if (!use_partitioned_filter) {
|
if (expect_filter_check) {
|
||||||
ASSERT_EQ(1, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
ASSERT_EQ(1, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4465,21 +4472,21 @@ TEST_F(DBTest2, ChangePrefixExtractor) {
|
|||||||
iterator->Seek("x");
|
iterator->Seek("x");
|
||||||
ASSERT_TRUE(iterator->Valid());
|
ASSERT_TRUE(iterator->Valid());
|
||||||
ASSERT_EQ("xb", iterator->key().ToString());
|
ASSERT_EQ("xb", iterator->key().ToString());
|
||||||
if (!use_partitioned_filter) {
|
if (expect_filter_check) {
|
||||||
ASSERT_EQ(2, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
ASSERT_EQ(2, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator->Seek("xg");
|
iterator->Seek("xg");
|
||||||
ASSERT_TRUE(iterator->Valid());
|
ASSERT_TRUE(iterator->Valid());
|
||||||
ASSERT_EQ("xx1", iterator->key().ToString());
|
ASSERT_EQ("xx1", iterator->key().ToString());
|
||||||
if (!use_partitioned_filter) {
|
if (expect_filter_check) {
|
||||||
ASSERT_EQ(3, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
ASSERT_EQ(3, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator->Seek("xz");
|
iterator->Seek("xz");
|
||||||
ASSERT_TRUE(iterator->Valid());
|
ASSERT_TRUE(iterator->Valid());
|
||||||
ASSERT_EQ("xz1", iterator->key().ToString());
|
ASSERT_EQ("xz1", iterator->key().ToString());
|
||||||
if (!use_partitioned_filter) {
|
if (expect_filter_check) {
|
||||||
ASSERT_EQ(4, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
ASSERT_EQ(4, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4489,14 +4496,14 @@ TEST_F(DBTest2, ChangePrefixExtractor) {
|
|||||||
iterator->SeekForPrev("xx0");
|
iterator->SeekForPrev("xx0");
|
||||||
ASSERT_TRUE(iterator->Valid());
|
ASSERT_TRUE(iterator->Valid());
|
||||||
ASSERT_EQ("xb", iterator->key().ToString());
|
ASSERT_EQ("xb", iterator->key().ToString());
|
||||||
if (!use_partitioned_filter) {
|
if (expect_filter_check) {
|
||||||
ASSERT_EQ(5, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
ASSERT_EQ(5, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator->Seek("xx0");
|
iterator->Seek("xx0");
|
||||||
ASSERT_TRUE(iterator->Valid());
|
ASSERT_TRUE(iterator->Valid());
|
||||||
ASSERT_EQ("xx1", iterator->key().ToString());
|
ASSERT_EQ("xx1", iterator->key().ToString());
|
||||||
if (!use_partitioned_filter) {
|
if (expect_filter_check) {
|
||||||
ASSERT_EQ(6, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
ASSERT_EQ(6, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4508,7 +4515,7 @@ TEST_F(DBTest2, ChangePrefixExtractor) {
|
|||||||
iterator->SeekForPrev("xg0");
|
iterator->SeekForPrev("xg0");
|
||||||
ASSERT_TRUE(iterator->Valid());
|
ASSERT_TRUE(iterator->Valid());
|
||||||
ASSERT_EQ("xb", iterator->key().ToString());
|
ASSERT_EQ("xb", iterator->key().ToString());
|
||||||
if (!use_partitioned_filter) {
|
if (expect_filter_check) {
|
||||||
ASSERT_EQ(7, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
ASSERT_EQ(7, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user