rocksdb/table
Ziyue Yang 7e2f831924 Fix wrong ExtractUserKey usage in BlockBasedTableBuilder::EnterUnbuff… (#6100)
Summary:
BlockBasedTableBuilder uses ExtractUserKey in EnterUnbuffered. This would
cause index filter building error, since user-provided timestamp is supported
by ExtractUserKeyAndStripTimestamp, and it's used in Add. This commit changes
ExtractUserKey to ExtractUserKeyAndStripTimestamp.

A test case is also added by modifying DBBasicTestWithTimestampWithParam_
PutAndGet test in db_basic_test to cover ExtractUserKeyAndStripTimestamp usage
in both kBuffered and kUnbuffered state of BlockBasedTableBuilder.

Before the ExtractUserKeyAndStripTimstamp fix:

```
$ ./db_basic_test --gtest_filter="*PutAndGet*"
Note: Google Test filter = *PutAndGet*
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from Timestamp/DBBasicTestWithTimestampWithParam
[ RUN      ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/0
db/db_basic_test.cc:2109: Failure
db_->Get(ropts, cfh, "key" + std::to_string(j), &value)
NotFound:
db/db_basic_test.cc:2109: Failure
db_->Get(ropts, cfh, "key" + std::to_string(j), &value)
NotFound:
db/db_basic_test.cc:2109: Failure
db_->Get(ropts, cfh, "key" + std::to_string(j), &value)
NotFound:
db/db_basic_test.cc:2109: Failure
db_->Get(ropts, cfh, "key" + std::to_string(j), &value)
NotFound:
db/db_basic_test.cc:2109: Failure
db_->Get(ropts, cfh, "key" + std::to_string(j), &value)
NotFound:
[  FAILED  ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/0, where GetParam() = false (1177 ms)
[ RUN      ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/1
[       OK ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/1 (1056 ms)
[----------] 2 tests from Timestamp/DBBasicTestWithTimestampWithParam (2233 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (2233 ms total)
[  PASSED  ] 1 test.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/0, where GetParam() = false

 1 FAILED TEST
```

After the ExtractUserKeyAndStripTimstamp fix:

```
$ ./db_basic_test --gtest_filter="*PutAndGet*"
Note: Google Test filter = *PutAndGet*
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from Timestamp/DBBasicTestWithTimestampWithParam
[ RUN      ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/0
[       OK ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/0 (1417 ms)
[ RUN      ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/1
[       OK ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/1 (1041 ms)
[----------] 2 tests from Timestamp/DBBasicTestWithTimestampWithParam (2458 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (2458 ms total)
[  PASSED  ] 2 tests.
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6100

Differential Revision: D18769654

Pulled By: riversand963

fbshipit-source-id: 76c2cf2c9a5e0d85db95d98e812e6af0c2a15c6b
2019-12-09 10:57:02 -08:00
..
adaptive Organizing rocksdb/table directory by format 2019-05-30 14:51:11 -07:00
block_based Fix wrong ExtractUserKey usage in BlockBasedTableBuilder::EnterUnbuff… (#6100) 2019-12-09 10:57:02 -08:00
cuckoo Apply formatter to recent 200+ commits. (#5830) 2019-09-20 12:04:26 -07:00
plain Remove a few unnecessary includes 2019-11-19 08:20:42 -08:00
block_fetcher.cc Divide file_reader_writer.h and .cc (#5803) 2019-09-16 10:33:51 -07:00
block_fetcher.h Combine the read-ahead logic for user reads and compaction reads (#5431) 2019-06-19 14:10:46 -07:00
cleanable_test.cc Move test related files under util/ to test_util/ (#5377) 2019-05-30 11:25:51 -07:00
format.cc Add new persistent 64-bit hash (#5984) 2019-10-31 16:36:35 -07:00
format.h New Bloom filter implementation for full and partitioned filters (#6007) 2019-11-13 16:44:01 -08:00
get_context.cc New API to get all merge operands for a Key (#5604) 2019-08-06 14:26:44 -07:00
get_context.h Fix local includes 2019-08-22 16:21:47 -07:00
internal_iterator.h Revert "Merging iterator to avoid child iterator reseek for some cases (#5286)" (#5871) 2019-10-01 11:22:41 -07:00
iter_heap.h Make InternalKeyComparator final and directly use it in merging iterator 2017-09-11 12:04:21 -07:00
iterator_wrapper.h Revert "Merging iterator to avoid child iterator reseek for some cases (#5286)" (#5871) 2019-10-01 11:22:41 -07:00
iterator.cc Add an option to put first key of each sst block in the index (#5289) 2019-06-24 20:54:04 -07:00
merger_test.cc Move test related files under util/ to test_util/ (#5377) 2019-05-30 11:25:51 -07:00
merging_iterator.cc Fix a timer bug in MergingIterator::Seek() caused by #5871 (#5874) 2019-10-01 19:26:18 -07:00
merging_iterator.h Index value delta encoding (#3983) 2018-08-09 16:58:40 -07:00
meta_blocks.cc Divide file_reader_writer.h and .cc (#5803) 2019-09-16 10:33:51 -07:00
meta_blocks.h Fix comment of function NotifyCollectTableCollectorsOnFinish (#5738) 2019-08-29 10:57:01 -07:00
mock_table.cc Apply formatter to recent 200+ commits. (#5830) 2019-09-20 12:04:26 -07:00
mock_table.h Apply formatter to recent 200+ commits. (#5830) 2019-09-20 12:04:26 -07:00
multiget_context.h Batched MultiGet API for multiple column families (#5816) 2019-11-12 13:52:55 -08:00
persistent_cache_helper.cc Organizing rocksdb/table directory by format 2019-05-30 14:51:11 -07:00
persistent_cache_helper.h Change RocksDB License 2017-07-15 16:11:23 -07:00
persistent_cache_options.h Change RocksDB License 2017-07-15 16:11:23 -07:00
scoped_arena_iterator.h Change RocksDB License 2017-07-15 16:11:23 -07:00
sst_file_reader_test.cc simplify include directive involving inttypes (#5402) 2019-06-06 13:56:07 -07:00
sst_file_reader.cc Divide file_reader_writer.h and .cc (#5803) 2019-09-16 10:33:51 -07:00
sst_file_writer_collectors.h Fix SstFileReader not able to open ingested file (#5097) 2019-03-26 10:25:18 -07:00
sst_file_writer.cc Divide file_reader_writer.h and .cc (#5803) 2019-09-16 10:33:51 -07:00
table_builder.h Divide file_reader_writer.h and .cc (#5803) 2019-09-16 10:33:51 -07:00
table_properties_internal.h Index value delta encoding (#3983) 2018-08-09 16:58:40 -07:00
table_properties.cc Organizing rocksdb/table directory by format 2019-05-30 14:51:11 -07:00
table_reader_bench.cc Divide file_reader_writer.h and .cc (#5803) 2019-09-16 10:33:51 -07:00
table_reader_caller.h Add more callers for table reader. (#5454) 2019-06-20 14:31:48 -07:00
table_reader.h Apply formatter to recent 200+ commits. (#5830) 2019-09-20 12:04:26 -07:00
table_test.cc Charge block cache for cache internal usage (#5797) 2019-09-16 15:26:21 -07:00
two_level_iterator.cc Add an option to put first key of each sst block in the index (#5289) 2019-06-24 20:54:04 -07:00
two_level_iterator.h Add an option to put first key of each sst block in the index (#5289) 2019-06-24 20:54:04 -07:00