@nxtedition/rocksdb 7.0.3 → 7.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/binding.cc +320 -324
  2. package/chained-batch.js +6 -1
  3. package/deps/rocksdb/rocksdb/CMakeLists.txt +8 -3
  4. package/deps/rocksdb/rocksdb/Makefile +10 -4
  5. package/deps/rocksdb/rocksdb/TARGETS +6 -4
  6. package/deps/rocksdb/rocksdb/cache/cache_bench_tool.cc +9 -0
  7. package/deps/rocksdb/rocksdb/cache/cache_test.cc +14 -0
  8. package/deps/rocksdb/rocksdb/cache/clock_cache.cc +8 -8
  9. package/deps/rocksdb/rocksdb/cache/fast_lru_cache.cc +272 -174
  10. package/deps/rocksdb/rocksdb/cache/fast_lru_cache.h +201 -57
  11. package/deps/rocksdb/rocksdb/cache/lru_cache.cc +19 -19
  12. package/deps/rocksdb/rocksdb/cache/lru_cache.h +2 -1
  13. package/deps/rocksdb/rocksdb/db/blob/blob_source.cc +170 -0
  14. package/deps/rocksdb/rocksdb/db/blob/blob_source.h +95 -0
  15. package/deps/rocksdb/rocksdb/db/blob/blob_source_test.cc +298 -0
  16. package/deps/rocksdb/rocksdb/db/blob/db_blob_basic_test.cc +172 -0
  17. package/deps/rocksdb/rocksdb/db/column_family.cc +8 -3
  18. package/deps/rocksdb/rocksdb/db/column_family.h +6 -3
  19. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.cc +10 -0
  20. package/deps/rocksdb/rocksdb/db/compaction/compaction_job_test.cc +6 -6
  21. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_level.cc +22 -2
  22. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_test.cc +38 -0
  23. package/deps/rocksdb/rocksdb/db/db_basic_test.cc +17 -5
  24. package/deps/rocksdb/rocksdb/db/db_block_cache_test.cc +4 -7
  25. package/deps/rocksdb/rocksdb/db/db_bloom_filter_test.cc +74 -71
  26. package/deps/rocksdb/rocksdb/db/db_compaction_test.cc +70 -1
  27. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.cc +13 -12
  28. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +36 -0
  29. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_compaction_flush.cc +11 -4
  30. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_files.cc +1 -1
  31. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +139 -91
  32. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_write.cc +48 -14
  33. package/deps/rocksdb/rocksdb/db/db_kv_checksum_test.cc +90 -55
  34. package/deps/rocksdb/rocksdb/db/db_rate_limiter_test.cc +9 -4
  35. package/deps/rocksdb/rocksdb/db/db_test.cc +3 -1
  36. package/deps/rocksdb/rocksdb/db/db_wal_test.cc +12 -7
  37. package/deps/rocksdb/rocksdb/db/db_write_test.cc +35 -0
  38. package/deps/rocksdb/rocksdb/db/dbformat.cc +3 -1
  39. package/deps/rocksdb/rocksdb/db/dbformat.h +5 -3
  40. package/deps/rocksdb/rocksdb/db/flush_job_test.cc +1 -1
  41. package/deps/rocksdb/rocksdb/db/memtable.cc +1 -0
  42. package/deps/rocksdb/rocksdb/db/memtable_list_test.cc +4 -2
  43. package/deps/rocksdb/rocksdb/db/repair.cc +1 -1
  44. package/deps/rocksdb/rocksdb/db/version_builder.cc +43 -1
  45. package/deps/rocksdb/rocksdb/db/version_edit.cc +13 -5
  46. package/deps/rocksdb/rocksdb/db/version_edit.h +22 -1
  47. package/deps/rocksdb/rocksdb/db/version_edit_handler.cc +4 -5
  48. package/deps/rocksdb/rocksdb/db/version_set.cc +109 -41
  49. package/deps/rocksdb/rocksdb/db/version_set.h +36 -3
  50. package/deps/rocksdb/rocksdb/db/version_set_sync_and_async.h +1 -4
  51. package/deps/rocksdb/rocksdb/db/version_set_test.cc +10 -10
  52. package/deps/rocksdb/rocksdb/db/version_util.h +1 -1
  53. package/deps/rocksdb/rocksdb/db/wal_manager_test.cc +1 -1
  54. package/deps/rocksdb/rocksdb/db/write_batch.cc +34 -10
  55. package/deps/rocksdb/rocksdb/db/write_batch_internal.h +2 -0
  56. package/deps/rocksdb/rocksdb/db/write_callback_test.cc +4 -0
  57. package/deps/rocksdb/rocksdb/db_stress_tool/batched_ops_stress.cc +2 -0
  58. package/deps/rocksdb/rocksdb/db_stress_tool/cf_consistency_stress.cc +4 -1
  59. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.h +1 -1
  60. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_gflags.cc +7 -5
  61. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.cc +5 -10
  62. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_tool.cc +0 -7
  63. package/deps/rocksdb/rocksdb/db_stress_tool/no_batched_ops_stress.cc +2 -0
  64. package/deps/rocksdb/rocksdb/file/random_access_file_reader.cc +24 -3
  65. package/deps/rocksdb/rocksdb/file/writable_file_writer.cc +8 -0
  66. package/deps/rocksdb/rocksdb/file/writable_file_writer.h +10 -0
  67. package/deps/rocksdb/rocksdb/include/rocksdb/advanced_options.h +5 -0
  68. package/deps/rocksdb/rocksdb/include/rocksdb/cache.h +4 -4
  69. package/deps/rocksdb/rocksdb/include/rocksdb/options.h +9 -5
  70. package/deps/rocksdb/rocksdb/include/rocksdb/statistics.h +5 -0
  71. package/deps/rocksdb/rocksdb/include/rocksdb/types.h +1 -0
  72. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/write_batch_with_index.h +1 -1
  73. package/deps/rocksdb/rocksdb/include/rocksdb/version.h +1 -1
  74. package/deps/rocksdb/rocksdb/include/rocksdb/write_batch.h +0 -3
  75. package/deps/rocksdb/rocksdb/microbench/ribbon_bench.cc +8 -6
  76. package/deps/rocksdb/rocksdb/monitoring/statistics.cc +3 -1
  77. package/deps/rocksdb/rocksdb/options/options_helper.cc +4 -2
  78. package/deps/rocksdb/rocksdb/options/options_test.cc +1 -11
  79. package/deps/rocksdb/rocksdb/port/port_posix.h +7 -0
  80. package/deps/rocksdb/rocksdb/port/win/port_win.h +11 -3
  81. package/deps/rocksdb/rocksdb/src.mk +6 -2
  82. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_builder.cc +4 -33
  83. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.h +3 -3
  84. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.cc +38 -118
  85. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.h +6 -8
  86. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +10 -13
  87. package/deps/rocksdb/rocksdb/table/block_based/block_like_traits.h +4 -9
  88. package/deps/rocksdb/rocksdb/table/block_based/block_type.h +0 -1
  89. package/deps/rocksdb/rocksdb/table/block_based/filter_block.h +10 -28
  90. package/deps/rocksdb/rocksdb/table/block_based/filter_block_reader_common.cc +2 -3
  91. package/deps/rocksdb/rocksdb/table/block_based/filter_policy.cc +0 -91
  92. package/deps/rocksdb/rocksdb/table/block_based/filter_policy_internal.h +2 -30
  93. package/deps/rocksdb/rocksdb/table/block_based/full_filter_block.cc +6 -27
  94. package/deps/rocksdb/rocksdb/table/block_based/full_filter_block.h +11 -13
  95. package/deps/rocksdb/rocksdb/table/block_based/full_filter_block_test.cc +28 -40
  96. package/deps/rocksdb/rocksdb/table/block_based/mock_block_based_table.h +0 -1
  97. package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block.cc +22 -43
  98. package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block.h +11 -22
  99. package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block_test.cc +24 -25
  100. package/deps/rocksdb/rocksdb/table/block_fetcher.cc +0 -1
  101. package/deps/rocksdb/rocksdb/table/get_context.h +0 -1
  102. package/deps/rocksdb/rocksdb/table/table_test.cc +3 -18
  103. package/deps/rocksdb/rocksdb/tools/db_bench_tool.cc +3 -16
  104. package/deps/rocksdb/rocksdb/tools/ldb_cmd.cc +3 -3
  105. package/deps/rocksdb/rocksdb/tools/ldb_cmd_test.cc +1 -1
  106. package/deps/rocksdb/rocksdb/util/bloom_test.cc +0 -201
  107. package/deps/rocksdb/rocksdb/util/distributed_mutex.h +48 -0
  108. package/deps/rocksdb/rocksdb/util/filter_bench.cc +5 -11
  109. package/deps/rocksdb/rocksdb/utilities/backup/backup_engine.cc +3 -0
  110. package/deps/rocksdb/rocksdb/utilities/cache_dump_load_impl.cc +7 -21
  111. package/deps/rocksdb/rocksdb/utilities/cache_dump_load_impl.h +1 -1
  112. package/deps/rocksdb/rocksdb/utilities/checkpoint/checkpoint_test.cc +45 -0
  113. package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction_db.h +21 -14
  114. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_base.cc +10 -1
  115. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn.cc +3 -1
  116. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn_db.cc +9 -0
  117. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn.cc +3 -2
  118. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn_db.cc +3 -1
  119. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +5 -4
  120. package/deps/rocksdb/rocksdb.gyp +1 -1
  121. package/index.js +36 -14
  122. package/package-lock.json +2 -2
  123. package/package.json +1 -1
  124. package/prebuilds/darwin-arm64/node.napi.node +0 -0
  125. package/prebuilds/linux-x64/node.napi.node +0 -0
  126. package/deps/rocksdb/rocksdb/table/block_based/block_based_filter_block.cc +0 -358
  127. package/deps/rocksdb/rocksdb/table/block_based/block_based_filter_block.h +0 -127
  128. package/deps/rocksdb/rocksdb/table/block_based/block_based_filter_block_test.cc +0 -219
@@ -1,127 +0,0 @@
1
- // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2
- // This source code is licensed under both the GPLv2 (found in the
3
- // COPYING file in the root directory) and Apache 2.0 License
4
- // (found in the LICENSE.Apache file in the root directory).
5
- //
6
- // Copyright (c) 2012 The LevelDB Authors. All rights reserved.
7
- // Use of this source code is governed by a BSD-style license that can be
8
- // found in the LICENSE file. See the AUTHORS file for names of contributors.
9
- //
10
- // A filter block is stored near the end of a Table file. It contains
11
- // filters (e.g., bloom filters) for all data blocks in the table combined
12
- // into a single filter block.
13
-
14
- #pragma once
15
-
16
- #include <stddef.h>
17
- #include <stdint.h>
18
-
19
- #include <memory>
20
- #include <string>
21
- #include <vector>
22
-
23
- #include "rocksdb/options.h"
24
- #include "rocksdb/slice.h"
25
- #include "rocksdb/slice_transform.h"
26
- #include "table/block_based/filter_block_reader_common.h"
27
- #include "table/block_based/filter_policy_internal.h"
28
- #include "table/format.h"
29
- #include "util/hash.h"
30
-
31
- namespace ROCKSDB_NAMESPACE {
32
-
33
- // A BlockBasedFilterBlockBuilder is used to construct all of the filters for a
34
- // particular Table. It generates a single string which is stored as
35
- // a special block in the Table.
36
- //
37
- // The sequence of calls to BlockBasedFilterBlockBuilder must match the regexp:
38
- // (StartBlock Add*)* Finish
39
- class BlockBasedFilterBlockBuilder : public FilterBlockBuilder {
40
- public:
41
- BlockBasedFilterBlockBuilder(const SliceTransform* prefix_extractor,
42
- const BlockBasedTableOptions& table_opt,
43
- int bits_per_key);
44
- // No copying allowed
45
- BlockBasedFilterBlockBuilder(const BlockBasedFilterBlockBuilder&) = delete;
46
- void operator=(const BlockBasedFilterBlockBuilder&) = delete;
47
-
48
- virtual bool IsBlockBased() override { return true; }
49
- virtual void StartBlock(uint64_t block_offset) override;
50
- virtual void Add(const Slice& key_without_ts) override;
51
- virtual bool IsEmpty() const override {
52
- return start_.empty() && filter_offsets_.empty();
53
- }
54
- virtual size_t EstimateEntriesAdded() override;
55
- virtual Slice Finish(
56
- const BlockHandle& tmp, Status* status,
57
- std::unique_ptr<const char[]>* filter_data = nullptr) override;
58
- using FilterBlockBuilder::Finish;
59
-
60
- private:
61
- void AddKey(const Slice& key);
62
- void AddPrefix(const Slice& key);
63
- void GenerateFilter();
64
-
65
- // important: all of these might point to invalid addresses
66
- // at the time of destruction of this filter block. destructor
67
- // should NOT dereference them.
68
- const SliceTransform* prefix_extractor_;
69
- bool whole_key_filtering_;
70
- int bits_per_key_;
71
-
72
- size_t prev_prefix_start_; // the position of the last appended prefix
73
- // to "entries_".
74
- size_t prev_prefix_size_; // the length of the last appended prefix to
75
- // "entries_".
76
- std::string entries_; // Flattened entry contents
77
- std::vector<size_t> start_; // Starting index in entries_ of each entry
78
- std::string result_; // Filter data computed so far
79
- std::vector<Slice> tmp_entries_; // policy_->CreateFilter() argument
80
- std::vector<uint32_t> filter_offsets_;
81
- uint64_t total_added_in_built_; // Total keys added to filters built so far
82
- };
83
-
84
- // A FilterBlockReader is used to parse filter from SST table.
85
- // KeyMayMatch and PrefixMayMatch would trigger filter checking
86
- class BlockBasedFilterBlockReader
87
- : public FilterBlockReaderCommon<BlockContents> {
88
- public:
89
- BlockBasedFilterBlockReader(const BlockBasedTable* t,
90
- CachableEntry<BlockContents>&& filter_block);
91
- // No copying allowed
92
- BlockBasedFilterBlockReader(const BlockBasedFilterBlockReader&) = delete;
93
- void operator=(const BlockBasedFilterBlockReader&) = delete;
94
-
95
- static std::unique_ptr<FilterBlockReader> Create(
96
- const BlockBasedTable* table, const ReadOptions& ro,
97
- FilePrefetchBuffer* prefetch_buffer, bool use_cache, bool prefetch,
98
- bool pin, BlockCacheLookupContext* lookup_context);
99
-
100
- bool IsBlockBased() override { return true; }
101
-
102
- bool KeyMayMatch(const Slice& key, const SliceTransform* prefix_extractor,
103
- uint64_t block_offset, const bool no_io,
104
- const Slice* const const_ikey_ptr, GetContext* get_context,
105
- BlockCacheLookupContext* lookup_context) override;
106
- bool PrefixMayMatch(const Slice& prefix,
107
- const SliceTransform* prefix_extractor,
108
- uint64_t block_offset, const bool no_io,
109
- const Slice* const const_ikey_ptr,
110
- GetContext* get_context,
111
- BlockCacheLookupContext* lookup_context) override;
112
- size_t ApproximateMemoryUsage() const override;
113
-
114
- // convert this object to a human readable form
115
- std::string ToString() const override;
116
-
117
- private:
118
- static bool ParseFieldsFromBlock(const BlockContents& contents,
119
- const char** data, const char** offset,
120
- size_t* num, size_t* base_lg);
121
-
122
- bool MayMatch(const Slice& entry, uint64_t block_offset, bool no_io,
123
- GetContext* get_context,
124
- BlockCacheLookupContext* lookup_context) const;
125
- };
126
-
127
- } // namespace ROCKSDB_NAMESPACE
@@ -1,219 +0,0 @@
1
- // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2
- // This source code is licensed under both the GPLv2 (found in the
3
- // COPYING file in the root directory) and Apache 2.0 License
4
- // (found in the LICENSE.Apache file in the root directory).
5
- //
6
- // Copyright (c) 2012 The LevelDB Authors. All rights reserved.
7
- // Use of this source code is governed by a BSD-style license that can be
8
- // found in the LICENSE file. See the AUTHORS file for names of contributors.
9
-
10
- #include "table/block_based/block_based_filter_block.h"
11
- #include "rocksdb/filter_policy.h"
12
- #include "table/block_based/block_based_table_reader.h"
13
- #include "table/block_based/mock_block_based_table.h"
14
- #include "test_util/testharness.h"
15
- #include "test_util/testutil.h"
16
- #include "util/coding.h"
17
- #include "util/hash.h"
18
- #include "util/string_util.h"
19
-
20
- namespace ROCKSDB_NAMESPACE {
21
-
22
- // Test for block based filter block
23
- // use new interface in FilterPolicy to create filter builder/reader
24
- class BlockBasedFilterBlockTest : public mock::MockBlockBasedTableTester,
25
- public testing::Test {
26
- public:
27
- BlockBasedFilterBlockTest()
28
- : mock::MockBlockBasedTableTester(NewBloomFilterPolicy(10, true)) {}
29
- };
30
-
31
- TEST_F(BlockBasedFilterBlockTest, BlockBasedEmptyBuilder) {
32
- FilterBlockBuilder* builder =
33
- new BlockBasedFilterBlockBuilder(nullptr, table_options_, 10);
34
- Slice slice(builder->Finish());
35
- ASSERT_EQ("\\x00\\x00\\x00\\x00\\x0b", EscapeString(slice));
36
-
37
- CachableEntry<BlockContents> block(
38
- new BlockContents(slice), nullptr /* cache */, nullptr /* cache_handle */,
39
- true /* own_value */);
40
-
41
- FilterBlockReader* reader =
42
- new BlockBasedFilterBlockReader(table_.get(), std::move(block));
43
- ASSERT_TRUE(reader->KeyMayMatch(
44
- "foo", /*prefix_extractor=*/nullptr, /*block_offset=*/uint64_t{0},
45
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
46
- /*lookup_context=*/nullptr));
47
- ASSERT_TRUE(reader->KeyMayMatch(
48
- "foo", /*prefix_extractor=*/nullptr, /*block_offset=*/10000,
49
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
50
- /*lookup_context=*/nullptr));
51
-
52
- delete builder;
53
- delete reader;
54
- }
55
-
56
- TEST_F(BlockBasedFilterBlockTest, BlockBasedSingleChunk) {
57
- FilterBlockBuilder* builder =
58
- new BlockBasedFilterBlockBuilder(nullptr, table_options_, 10);
59
- builder->StartBlock(100);
60
- builder->Add("foo");
61
- builder->Add("bar");
62
- builder->Add("box");
63
- builder->StartBlock(200);
64
- builder->Add("box");
65
- builder->StartBlock(300);
66
- builder->Add("hello");
67
- Slice slice(builder->Finish());
68
-
69
- CachableEntry<BlockContents> block(
70
- new BlockContents(slice), nullptr /* cache */, nullptr /* cache_handle */,
71
- true /* own_value */);
72
-
73
- FilterBlockReader* reader =
74
- new BlockBasedFilterBlockReader(table_.get(), std::move(block));
75
- ASSERT_TRUE(reader->KeyMayMatch(
76
- "foo", /*prefix_extractor=*/nullptr, /*block_offset=*/100,
77
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
78
- /*lookup_context=*/nullptr));
79
- ASSERT_TRUE(reader->KeyMayMatch(
80
- "bar", /*prefix_extractor=*/nullptr, /*block_offset=*/100,
81
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
82
- /*lookup_context=*/nullptr));
83
- ASSERT_TRUE(reader->KeyMayMatch(
84
- "box", /*prefix_extractor=*/nullptr, /*block_offset=*/100,
85
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
86
- /*lookup_context=*/nullptr));
87
- ASSERT_TRUE(reader->KeyMayMatch(
88
- "hello", /*prefix_extractor=*/nullptr, /*block_offset=*/100,
89
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
90
- /*lookup_context=*/nullptr));
91
- ASSERT_TRUE(reader->KeyMayMatch(
92
- "foo", /*prefix_extractor=*/nullptr, /*block_offset=*/100,
93
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
94
- /*lookup_context=*/nullptr));
95
- ASSERT_TRUE(!reader->KeyMayMatch(
96
- "missing", /*prefix_extractor=*/nullptr, /*block_offset=*/100,
97
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
98
- /*lookup_context=*/nullptr));
99
- ASSERT_TRUE(!reader->KeyMayMatch(
100
- "other", /*prefix_extractor=*/nullptr, /*block_offset=*/100,
101
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
102
- /*lookup_context=*/nullptr));
103
-
104
- delete builder;
105
- delete reader;
106
- }
107
-
108
- TEST_F(BlockBasedFilterBlockTest, BlockBasedMultiChunk) {
109
- FilterBlockBuilder* builder =
110
- new BlockBasedFilterBlockBuilder(nullptr, table_options_, 10);
111
-
112
- // First filter
113
- builder->StartBlock(0);
114
- builder->Add("foo");
115
- builder->StartBlock(2000);
116
- builder->Add("bar");
117
-
118
- // Second filter
119
- builder->StartBlock(3100);
120
- builder->Add("box");
121
-
122
- // Third filter is empty
123
-
124
- // Last filter
125
- builder->StartBlock(9000);
126
- builder->Add("box");
127
- builder->Add("hello");
128
-
129
- Slice slice(builder->Finish());
130
-
131
- CachableEntry<BlockContents> block(
132
- new BlockContents(slice), nullptr /* cache */, nullptr /* cache_handle */,
133
- true /* own_value */);
134
-
135
- FilterBlockReader* reader =
136
- new BlockBasedFilterBlockReader(table_.get(), std::move(block));
137
-
138
- // Check first filter
139
- ASSERT_TRUE(reader->KeyMayMatch(
140
- "foo", /*prefix_extractor=*/nullptr, /*block_offset=*/uint64_t{0},
141
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
142
- /*lookup_context=*/nullptr));
143
- ASSERT_TRUE(reader->KeyMayMatch(
144
- "bar", /*prefix_extractor=*/nullptr, /*block_offset=*/2000,
145
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
146
- /*lookup_context=*/nullptr));
147
- ASSERT_TRUE(!reader->KeyMayMatch(
148
- "box", /*prefix_extractor=*/nullptr, /*block_offset=*/uint64_t{0},
149
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
150
- /*lookup_context=*/nullptr));
151
- ASSERT_TRUE(!reader->KeyMayMatch(
152
- "hello", /*prefix_extractor=*/nullptr, /*block_offset=*/uint64_t{0},
153
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
154
- /*lookup_context=*/nullptr));
155
-
156
- // Check second filter
157
- ASSERT_TRUE(reader->KeyMayMatch(
158
- "box", /*prefix_extractor=*/nullptr, /*block_offset=*/3100,
159
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
160
- /*lookup_context=*/nullptr));
161
- ASSERT_TRUE(!reader->KeyMayMatch(
162
- "foo", /*prefix_extractor=*/nullptr, /*block_offset=*/3100,
163
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
164
- /*lookup_context=*/nullptr));
165
- ASSERT_TRUE(!reader->KeyMayMatch(
166
- "bar", /*prefix_extractor=*/nullptr, /*block_offset=*/3100,
167
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
168
- /*lookup_context=*/nullptr));
169
- ASSERT_TRUE(!reader->KeyMayMatch(
170
- "hello", /*prefix_extractor=*/nullptr, /*block_offset=*/3100,
171
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
172
- /*lookup_context=*/nullptr));
173
-
174
- // Check third filter (empty)
175
- ASSERT_TRUE(!reader->KeyMayMatch(
176
- "foo", /*prefix_extractor=*/nullptr, /*block_offset=*/4100,
177
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
178
- /*lookup_context=*/nullptr));
179
- ASSERT_TRUE(!reader->KeyMayMatch(
180
- "bar", /*prefix_extractor=*/nullptr, /*block_offset=*/4100,
181
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
182
- /*lookup_context=*/nullptr));
183
- ASSERT_TRUE(!reader->KeyMayMatch(
184
- "box", /*prefix_extractor=*/nullptr, /*block_offset=*/4100,
185
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
186
- /*lookup_context=*/nullptr));
187
- ASSERT_TRUE(!reader->KeyMayMatch(
188
- "hello", /*prefix_extractor=*/nullptr, /*block_offset=*/4100,
189
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
190
- /*lookup_context=*/nullptr));
191
-
192
- // Check last filter
193
- ASSERT_TRUE(reader->KeyMayMatch(
194
- "box", /*prefix_extractor=*/nullptr, /*block_offset=*/9000,
195
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
196
- /*lookup_context=*/nullptr));
197
- ASSERT_TRUE(reader->KeyMayMatch(
198
- "hello", /*prefix_extractor=*/nullptr, /*block_offset=*/9000,
199
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
200
- /*lookup_context=*/nullptr));
201
- ASSERT_TRUE(!reader->KeyMayMatch(
202
- "foo", /*prefix_extractor=*/nullptr, /*block_offset=*/9000,
203
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
204
- /*lookup_context=*/nullptr));
205
- ASSERT_TRUE(!reader->KeyMayMatch(
206
- "bar", /*prefix_extractor=*/nullptr, /*block_offset=*/9000,
207
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr, /*get_context=*/nullptr,
208
- /*lookup_context=*/nullptr));
209
-
210
- delete builder;
211
- delete reader;
212
- }
213
-
214
- } // namespace ROCKSDB_NAMESPACE
215
-
216
- int main(int argc, char** argv) {
217
- ::testing::InitGoogleTest(&argc, argv);
218
- return RUN_ALL_TESTS();
219
- }