@nxtedition/rocksdb 7.0.5 → 7.0.8
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.
- package/binding.cc +363 -329
- package/chained-batch.js +6 -1
- package/deps/rocksdb/rocksdb/CMakeLists.txt +8 -3
- package/deps/rocksdb/rocksdb/Makefile +10 -4
- package/deps/rocksdb/rocksdb/TARGETS +6 -4
- package/deps/rocksdb/rocksdb/cache/cache_bench_tool.cc +9 -0
- package/deps/rocksdb/rocksdb/cache/cache_test.cc +14 -0
- package/deps/rocksdb/rocksdb/cache/clock_cache.cc +8 -8
- package/deps/rocksdb/rocksdb/cache/fast_lru_cache.cc +272 -174
- package/deps/rocksdb/rocksdb/cache/fast_lru_cache.h +201 -57
- package/deps/rocksdb/rocksdb/cache/lru_cache.cc +19 -19
- package/deps/rocksdb/rocksdb/cache/lru_cache.h +2 -1
- package/deps/rocksdb/rocksdb/cmake/modules/CxxFlags.cmake +7 -0
- package/deps/rocksdb/rocksdb/cmake/modules/FindJeMalloc.cmake +29 -0
- package/deps/rocksdb/rocksdb/cmake/modules/FindNUMA.cmake +29 -0
- package/deps/rocksdb/rocksdb/cmake/modules/FindSnappy.cmake +29 -0
- package/deps/rocksdb/rocksdb/cmake/modules/FindTBB.cmake +33 -0
- package/deps/rocksdb/rocksdb/cmake/modules/Findgflags.cmake +29 -0
- package/deps/rocksdb/rocksdb/cmake/modules/Findlz4.cmake +29 -0
- package/deps/rocksdb/rocksdb/cmake/modules/Finduring.cmake +26 -0
- package/deps/rocksdb/rocksdb/cmake/modules/Findzstd.cmake +29 -0
- package/deps/rocksdb/rocksdb/cmake/modules/ReadVersion.cmake +10 -0
- package/deps/rocksdb/rocksdb/db/blob/blob_source.cc +170 -0
- package/deps/rocksdb/rocksdb/db/blob/blob_source.h +95 -0
- package/deps/rocksdb/rocksdb/db/blob/blob_source_test.cc +298 -0
- package/deps/rocksdb/rocksdb/db/blob/db_blob_basic_test.cc +172 -0
- package/deps/rocksdb/rocksdb/db/column_family.cc +8 -3
- package/deps/rocksdb/rocksdb/db/column_family.h +6 -3
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job.cc +10 -0
- package/deps/rocksdb/rocksdb/db/compaction/compaction_job_test.cc +6 -6
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_level.cc +22 -2
- package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_test.cc +38 -0
- package/deps/rocksdb/rocksdb/db/db_basic_test.cc +17 -5
- package/deps/rocksdb/rocksdb/db/db_block_cache_test.cc +4 -7
- package/deps/rocksdb/rocksdb/db/db_bloom_filter_test.cc +74 -71
- package/deps/rocksdb/rocksdb/db/db_compaction_test.cc +70 -1
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl.cc +13 -12
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +36 -0
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_compaction_flush.cc +11 -4
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_files.cc +1 -1
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +139 -91
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_write.cc +48 -14
- package/deps/rocksdb/rocksdb/db/db_kv_checksum_test.cc +90 -55
- package/deps/rocksdb/rocksdb/db/db_rate_limiter_test.cc +9 -4
- package/deps/rocksdb/rocksdb/db/db_test.cc +3 -1
- package/deps/rocksdb/rocksdb/db/db_wal_test.cc +12 -7
- package/deps/rocksdb/rocksdb/db/db_write_test.cc +35 -0
- package/deps/rocksdb/rocksdb/db/dbformat.cc +3 -1
- package/deps/rocksdb/rocksdb/db/dbformat.h +5 -3
- package/deps/rocksdb/rocksdb/db/flush_job_test.cc +1 -1
- package/deps/rocksdb/rocksdb/db/memtable.cc +1 -0
- package/deps/rocksdb/rocksdb/db/memtable_list_test.cc +4 -2
- package/deps/rocksdb/rocksdb/db/repair.cc +1 -1
- package/deps/rocksdb/rocksdb/db/version_builder.cc +43 -1
- package/deps/rocksdb/rocksdb/db/version_edit.cc +13 -5
- package/deps/rocksdb/rocksdb/db/version_edit.h +22 -1
- package/deps/rocksdb/rocksdb/db/version_edit_handler.cc +4 -5
- package/deps/rocksdb/rocksdb/db/version_set.cc +109 -41
- package/deps/rocksdb/rocksdb/db/version_set.h +36 -3
- package/deps/rocksdb/rocksdb/db/version_set_sync_and_async.h +1 -4
- package/deps/rocksdb/rocksdb/db/version_set_test.cc +10 -10
- package/deps/rocksdb/rocksdb/db/version_util.h +1 -1
- package/deps/rocksdb/rocksdb/db/wal_manager_test.cc +1 -1
- package/deps/rocksdb/rocksdb/db/write_batch.cc +34 -10
- package/deps/rocksdb/rocksdb/db/write_batch_internal.h +2 -0
- package/deps/rocksdb/rocksdb/db/write_callback_test.cc +4 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/batched_ops_stress.cc +2 -0
- package/deps/rocksdb/rocksdb/db_stress_tool/cf_consistency_stress.cc +4 -1
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.h +1 -1
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_gflags.cc +7 -5
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.cc +5 -10
- package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_tool.cc +0 -7
- package/deps/rocksdb/rocksdb/db_stress_tool/no_batched_ops_stress.cc +2 -0
- package/deps/rocksdb/rocksdb/file/random_access_file_reader.cc +24 -3
- package/deps/rocksdb/rocksdb/file/writable_file_writer.cc +8 -0
- package/deps/rocksdb/rocksdb/file/writable_file_writer.h +10 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/advanced_options.h +5 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/cache.h +4 -4
- package/deps/rocksdb/rocksdb/include/rocksdb/options.h +9 -5
- package/deps/rocksdb/rocksdb/include/rocksdb/statistics.h +5 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/types.h +1 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/utilities/write_batch_with_index.h +1 -1
- package/deps/rocksdb/rocksdb/include/rocksdb/version.h +1 -1
- package/deps/rocksdb/rocksdb/include/rocksdb/write_batch.h +0 -3
- package/deps/rocksdb/rocksdb/microbench/ribbon_bench.cc +8 -6
- package/deps/rocksdb/rocksdb/monitoring/statistics.cc +3 -1
- package/deps/rocksdb/rocksdb/options/options_helper.cc +4 -2
- package/deps/rocksdb/rocksdb/options/options_test.cc +1 -11
- package/deps/rocksdb/rocksdb/port/port_posix.h +7 -0
- package/deps/rocksdb/rocksdb/port/win/port_win.h +11 -3
- package/deps/rocksdb/rocksdb/src.mk +6 -2
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_builder.cc +4 -33
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.h +3 -3
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.cc +38 -118
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.h +6 -8
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +10 -13
- package/deps/rocksdb/rocksdb/table/block_based/block_like_traits.h +4 -9
- package/deps/rocksdb/rocksdb/table/block_based/block_type.h +0 -1
- package/deps/rocksdb/rocksdb/table/block_based/filter_block.h +10 -28
- package/deps/rocksdb/rocksdb/table/block_based/filter_block_reader_common.cc +2 -3
- package/deps/rocksdb/rocksdb/table/block_based/filter_policy.cc +0 -91
- package/deps/rocksdb/rocksdb/table/block_based/filter_policy_internal.h +2 -30
- package/deps/rocksdb/rocksdb/table/block_based/full_filter_block.cc +6 -27
- package/deps/rocksdb/rocksdb/table/block_based/full_filter_block.h +11 -13
- package/deps/rocksdb/rocksdb/table/block_based/full_filter_block_test.cc +28 -40
- package/deps/rocksdb/rocksdb/table/block_based/mock_block_based_table.h +0 -1
- package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block.cc +22 -43
- package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block.h +11 -22
- package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block_test.cc +24 -25
- package/deps/rocksdb/rocksdb/table/block_fetcher.cc +0 -1
- package/deps/rocksdb/rocksdb/table/get_context.h +0 -1
- package/deps/rocksdb/rocksdb/table/table_test.cc +3 -18
- package/deps/rocksdb/rocksdb/tools/db_bench_tool.cc +3 -16
- package/deps/rocksdb/rocksdb/tools/ldb_cmd.cc +3 -3
- package/deps/rocksdb/rocksdb/tools/ldb_cmd_test.cc +1 -1
- package/deps/rocksdb/rocksdb/util/bloom_test.cc +0 -201
- package/deps/rocksdb/rocksdb/util/distributed_mutex.h +48 -0
- package/deps/rocksdb/rocksdb/util/filter_bench.cc +5 -11
- package/deps/rocksdb/rocksdb/utilities/backup/backup_engine.cc +3 -0
- package/deps/rocksdb/rocksdb/utilities/cache_dump_load_impl.cc +7 -21
- package/deps/rocksdb/rocksdb/utilities/cache_dump_load_impl.h +1 -1
- package/deps/rocksdb/rocksdb/utilities/checkpoint/checkpoint_test.cc +45 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction_db.h +21 -14
- package/deps/rocksdb/rocksdb/utilities/transactions/transaction_base.cc +10 -1
- package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn.cc +3 -1
- package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn_db.cc +9 -0
- package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn.cc +3 -2
- package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn_db.cc +3 -1
- package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +5 -4
- package/deps/rocksdb/rocksdb.gyp +1 -1
- package/index.js +36 -14
- package/package-lock.json +23687 -0
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/prebuilds/darwin-x64/node.napi.node +0 -0
- package/prebuilds/linux-x64/node.napi.node +0 -0
- package/deps/liburing/liburing/README +0 -46
- package/deps/liburing/liburing/test/232c93d07b74-test.c +0 -305
- package/deps/liburing/liburing/test/35fa71a030ca-test.c +0 -329
- package/deps/liburing/liburing/test/500f9fbadef8-test.c +0 -89
- package/deps/liburing/liburing/test/7ad0e4b2f83c-test.c +0 -93
- package/deps/liburing/liburing/test/8a9973408177-test.c +0 -106
- package/deps/liburing/liburing/test/917257daa0fe-test.c +0 -53
- package/deps/liburing/liburing/test/Makefile +0 -312
- package/deps/liburing/liburing/test/a0908ae19763-test.c +0 -58
- package/deps/liburing/liburing/test/a4c0b3decb33-test.c +0 -180
- package/deps/liburing/liburing/test/accept-link.c +0 -251
- package/deps/liburing/liburing/test/accept-reuse.c +0 -164
- package/deps/liburing/liburing/test/accept-test.c +0 -79
- package/deps/liburing/liburing/test/accept.c +0 -476
- package/deps/liburing/liburing/test/across-fork.c +0 -283
- package/deps/liburing/liburing/test/b19062a56726-test.c +0 -53
- package/deps/liburing/liburing/test/b5837bd5311d-test.c +0 -77
- package/deps/liburing/liburing/test/ce593a6c480a-test.c +0 -135
- package/deps/liburing/liburing/test/close-opath.c +0 -122
- package/deps/liburing/liburing/test/config +0 -10
- package/deps/liburing/liburing/test/connect.c +0 -398
- package/deps/liburing/liburing/test/cq-full.c +0 -96
- package/deps/liburing/liburing/test/cq-overflow.c +0 -294
- package/deps/liburing/liburing/test/cq-peek-batch.c +0 -102
- package/deps/liburing/liburing/test/cq-ready.c +0 -94
- package/deps/liburing/liburing/test/cq-size.c +0 -58
- package/deps/liburing/liburing/test/d4ae271dfaae-test.c +0 -96
- package/deps/liburing/liburing/test/d77a67ed5f27-test.c +0 -65
- package/deps/liburing/liburing/test/defer.c +0 -307
- package/deps/liburing/liburing/test/double-poll-crash.c +0 -186
- package/deps/liburing/liburing/test/eeed8b54e0df-test.c +0 -114
- package/deps/liburing/liburing/test/empty-eownerdead.c +0 -42
- package/deps/liburing/liburing/test/eventfd-disable.c +0 -151
- package/deps/liburing/liburing/test/eventfd-ring.c +0 -97
- package/deps/liburing/liburing/test/eventfd.c +0 -112
- package/deps/liburing/liburing/test/fadvise.c +0 -202
- package/deps/liburing/liburing/test/fallocate.c +0 -249
- package/deps/liburing/liburing/test/fc2a85cb02ef-test.c +0 -138
- package/deps/liburing/liburing/test/file-register.c +0 -843
- package/deps/liburing/liburing/test/file-update.c +0 -173
- package/deps/liburing/liburing/test/files-exit-hang-poll.c +0 -128
- package/deps/liburing/liburing/test/files-exit-hang-timeout.c +0 -134
- package/deps/liburing/liburing/test/fixed-link.c +0 -90
- package/deps/liburing/liburing/test/fsync.c +0 -224
- package/deps/liburing/liburing/test/hardlink.c +0 -136
- package/deps/liburing/liburing/test/helpers.c +0 -135
- package/deps/liburing/liburing/test/helpers.h +0 -67
- package/deps/liburing/liburing/test/io-cancel.c +0 -537
- package/deps/liburing/liburing/test/io_uring_enter.c +0 -296
- package/deps/liburing/liburing/test/io_uring_register.c +0 -664
- package/deps/liburing/liburing/test/io_uring_setup.c +0 -192
- package/deps/liburing/liburing/test/iopoll.c +0 -366
- package/deps/liburing/liburing/test/lfs-openat-write.c +0 -117
- package/deps/liburing/liburing/test/lfs-openat.c +0 -273
- package/deps/liburing/liburing/test/link-timeout.c +0 -1107
- package/deps/liburing/liburing/test/link.c +0 -496
- package/deps/liburing/liburing/test/link_drain.c +0 -229
- package/deps/liburing/liburing/test/madvise.c +0 -195
- package/deps/liburing/liburing/test/mkdir.c +0 -108
- package/deps/liburing/liburing/test/multicqes_drain.c +0 -383
- package/deps/liburing/liburing/test/nop-all-sizes.c +0 -107
- package/deps/liburing/liburing/test/nop.c +0 -115
- package/deps/liburing/liburing/test/open-close.c +0 -146
- package/deps/liburing/liburing/test/openat2.c +0 -240
- package/deps/liburing/liburing/test/personality.c +0 -204
- package/deps/liburing/liburing/test/pipe-eof.c +0 -81
- package/deps/liburing/liburing/test/pipe-reuse.c +0 -105
- package/deps/liburing/liburing/test/poll-cancel-ton.c +0 -139
- package/deps/liburing/liburing/test/poll-cancel.c +0 -135
- package/deps/liburing/liburing/test/poll-link.c +0 -227
- package/deps/liburing/liburing/test/poll-many.c +0 -208
- package/deps/liburing/liburing/test/poll-mshot-update.c +0 -273
- package/deps/liburing/liburing/test/poll-ring.c +0 -48
- package/deps/liburing/liburing/test/poll-v-poll.c +0 -353
- package/deps/liburing/liburing/test/poll.c +0 -109
- package/deps/liburing/liburing/test/probe.c +0 -137
- package/deps/liburing/liburing/test/read-write.c +0 -876
- package/deps/liburing/liburing/test/register-restrictions.c +0 -633
- package/deps/liburing/liburing/test/rename.c +0 -134
- package/deps/liburing/liburing/test/ring-leak.c +0 -173
- package/deps/liburing/liburing/test/ring-leak2.c +0 -249
- package/deps/liburing/liburing/test/rsrc_tags.c +0 -449
- package/deps/liburing/liburing/test/runtests-loop.sh +0 -16
- package/deps/liburing/liburing/test/runtests.sh +0 -170
- package/deps/liburing/liburing/test/rw_merge_test.c +0 -97
- package/deps/liburing/liburing/test/self.c +0 -91
- package/deps/liburing/liburing/test/send_recv.c +0 -291
- package/deps/liburing/liburing/test/send_recvmsg.c +0 -345
- package/deps/liburing/liburing/test/sendmsg_fs_cve.c +0 -198
- package/deps/liburing/liburing/test/shared-wq.c +0 -84
- package/deps/liburing/liburing/test/short-read.c +0 -75
- package/deps/liburing/liburing/test/shutdown.c +0 -163
- package/deps/liburing/liburing/test/sigfd-deadlock.c +0 -74
- package/deps/liburing/liburing/test/socket-rw-eagain.c +0 -156
- package/deps/liburing/liburing/test/socket-rw.c +0 -147
- package/deps/liburing/liburing/test/splice.c +0 -511
- package/deps/liburing/liburing/test/sq-full-cpp.cc +0 -45
- package/deps/liburing/liburing/test/sq-full.c +0 -45
- package/deps/liburing/liburing/test/sq-poll-dup.c +0 -200
- package/deps/liburing/liburing/test/sq-poll-kthread.c +0 -168
- package/deps/liburing/liburing/test/sq-poll-share.c +0 -137
- package/deps/liburing/liburing/test/sq-space_left.c +0 -159
- package/deps/liburing/liburing/test/sqpoll-cancel-hang.c +0 -159
- package/deps/liburing/liburing/test/sqpoll-disable-exit.c +0 -195
- package/deps/liburing/liburing/test/sqpoll-exit-hang.c +0 -77
- package/deps/liburing/liburing/test/sqpoll-sleep.c +0 -68
- package/deps/liburing/liburing/test/statx.c +0 -172
- package/deps/liburing/liburing/test/stdout.c +0 -232
- package/deps/liburing/liburing/test/submit-link-fail.c +0 -154
- package/deps/liburing/liburing/test/submit-reuse.c +0 -239
- package/deps/liburing/liburing/test/symlink.c +0 -116
- package/deps/liburing/liburing/test/teardowns.c +0 -58
- package/deps/liburing/liburing/test/thread-exit.c +0 -131
- package/deps/liburing/liburing/test/timeout-new.c +0 -246
- package/deps/liburing/liburing/test/timeout-overflow.c +0 -204
- package/deps/liburing/liburing/test/timeout.c +0 -1354
- package/deps/liburing/liburing/test/unlink.c +0 -111
- package/deps/liburing/liburing/test/wakeup-hang.c +0 -162
- package/deps/rocksdb/rocksdb/README.md +0 -32
- package/deps/rocksdb/rocksdb/microbench/README.md +0 -60
- package/deps/rocksdb/rocksdb/plugin/README.md +0 -43
- package/deps/rocksdb/rocksdb/port/README +0 -10
- package/deps/rocksdb/rocksdb/table/block_based/block_based_filter_block.cc +0 -358
- package/deps/rocksdb/rocksdb/table/block_based/block_based_filter_block.h +0 -127
- package/deps/rocksdb/rocksdb/table/block_based/block_based_filter_block_test.cc +0 -219
- package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/README +0 -13
|
@@ -112,9 +112,8 @@ bool FilterBlockReaderCommon<TBlocklike>::RangeMayExist(
|
|
|
112
112
|
return true;
|
|
113
113
|
} else {
|
|
114
114
|
*filter_checked = true;
|
|
115
|
-
return PrefixMayMatch(prefix,
|
|
116
|
-
|
|
117
|
-
lookup_context);
|
|
115
|
+
return PrefixMayMatch(prefix, no_io, const_ikey_ptr,
|
|
116
|
+
/* get_context */ nullptr, lookup_context);
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
#include "rocksdb/rocksdb_namespace.h"
|
|
25
25
|
#include "rocksdb/slice.h"
|
|
26
26
|
#include "rocksdb/utilities/object_registry.h"
|
|
27
|
-
#include "table/block_based/block_based_filter_block.h"
|
|
28
27
|
#include "table/block_based/block_based_table_reader.h"
|
|
29
28
|
#include "table/block_based/filter_policy_internal.h"
|
|
30
29
|
#include "table/block_based/full_filter_block.h"
|
|
@@ -1375,87 +1374,10 @@ const char* ReadOnlyBuiltinFilterPolicy::kClassName() {
|
|
|
1375
1374
|
return kBuiltinFilterMetadataName;
|
|
1376
1375
|
}
|
|
1377
1376
|
|
|
1378
|
-
const char* DeprecatedBlockBasedBloomFilterPolicy::kClassName() {
|
|
1379
|
-
return "rocksdb.internal.DeprecatedBlockBasedBloomFilter";
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
1377
|
std::string BloomLikeFilterPolicy::GetId() const {
|
|
1383
1378
|
return Name() + GetBitsPerKeySuffix();
|
|
1384
1379
|
}
|
|
1385
1380
|
|
|
1386
|
-
DeprecatedBlockBasedBloomFilterPolicy::DeprecatedBlockBasedBloomFilterPolicy(
|
|
1387
|
-
double bits_per_key)
|
|
1388
|
-
: BloomLikeFilterPolicy(bits_per_key) {}
|
|
1389
|
-
|
|
1390
|
-
FilterBitsBuilder* DeprecatedBlockBasedBloomFilterPolicy::GetBuilderWithContext(
|
|
1391
|
-
const FilterBuildingContext&) const {
|
|
1392
|
-
if (GetWholeBitsPerKey() == 0) {
|
|
1393
|
-
// "No filter" special case
|
|
1394
|
-
return nullptr;
|
|
1395
|
-
}
|
|
1396
|
-
// Internal contract: returns a new fake builder that encodes bits per key
|
|
1397
|
-
// into a special value from EstimateEntriesAdded()
|
|
1398
|
-
struct B : public FilterBitsBuilder {
|
|
1399
|
-
explicit B(int bits_per_key) : est(kSecretBitsPerKeyStart + bits_per_key) {}
|
|
1400
|
-
size_t est;
|
|
1401
|
-
size_t EstimateEntriesAdded() override { return est; }
|
|
1402
|
-
void AddKey(const Slice&) override {}
|
|
1403
|
-
using FilterBitsBuilder::Finish; // FIXME
|
|
1404
|
-
Slice Finish(std::unique_ptr<const char[]>*) override { return Slice(); }
|
|
1405
|
-
size_t ApproximateNumEntries(size_t) override { return 0; }
|
|
1406
|
-
};
|
|
1407
|
-
return new B(GetWholeBitsPerKey());
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
void DeprecatedBlockBasedBloomFilterPolicy::CreateFilter(const Slice* keys,
|
|
1411
|
-
int n,
|
|
1412
|
-
int bits_per_key,
|
|
1413
|
-
std::string* dst) {
|
|
1414
|
-
// Compute bloom filter size (in both bits and bytes)
|
|
1415
|
-
uint32_t bits = static_cast<uint32_t>(n * bits_per_key);
|
|
1416
|
-
|
|
1417
|
-
// For small n, we can see a very high false positive rate. Fix it
|
|
1418
|
-
// by enforcing a minimum bloom filter length.
|
|
1419
|
-
if (bits < 64) bits = 64;
|
|
1420
|
-
|
|
1421
|
-
uint32_t bytes = (bits + 7) / 8;
|
|
1422
|
-
bits = bytes * 8;
|
|
1423
|
-
|
|
1424
|
-
int num_probes = LegacyNoLocalityBloomImpl::ChooseNumProbes(bits_per_key);
|
|
1425
|
-
|
|
1426
|
-
const size_t init_size = dst->size();
|
|
1427
|
-
dst->resize(init_size + bytes, 0);
|
|
1428
|
-
dst->push_back(static_cast<char>(num_probes)); // Remember # of probes
|
|
1429
|
-
char* array = &(*dst)[init_size];
|
|
1430
|
-
for (int i = 0; i < n; i++) {
|
|
1431
|
-
LegacyNoLocalityBloomImpl::AddHash(BloomHash(keys[i]), bits, num_probes,
|
|
1432
|
-
array);
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
bool DeprecatedBlockBasedBloomFilterPolicy::KeyMayMatch(
|
|
1437
|
-
const Slice& key, const Slice& bloom_filter) {
|
|
1438
|
-
const size_t len = bloom_filter.size();
|
|
1439
|
-
if (len < 2 || len > 0xffffffffU) {
|
|
1440
|
-
return false;
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
const char* array = bloom_filter.data();
|
|
1444
|
-
const uint32_t bits = static_cast<uint32_t>(len - 1) * 8;
|
|
1445
|
-
|
|
1446
|
-
// Use the encoded k so that we can read filters generated by
|
|
1447
|
-
// bloom filters created using different parameters.
|
|
1448
|
-
const int k = static_cast<uint8_t>(array[len - 1]);
|
|
1449
|
-
if (k > 30) {
|
|
1450
|
-
// Reserved for potentially new encodings for short bloom filters.
|
|
1451
|
-
// Consider it a match.
|
|
1452
|
-
return true;
|
|
1453
|
-
}
|
|
1454
|
-
// NB: using stored k not num_probes for whole_bits_per_key_
|
|
1455
|
-
return LegacyNoLocalityBloomImpl::HashMayMatch(BloomHash(key), bits, k,
|
|
1456
|
-
array);
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
1381
|
BloomFilterPolicy::BloomFilterPolicy(double bits_per_key)
|
|
1460
1382
|
: BloomLikeFilterPolicy(bits_per_key) {}
|
|
1461
1383
|
|
|
@@ -1876,9 +1798,6 @@ std::shared_ptr<const FilterPolicy> BloomLikeFilterPolicy::Create(
|
|
|
1876
1798
|
return std::make_shared<test::FastLocalBloomFilterPolicy>(bits_per_key);
|
|
1877
1799
|
} else if (name == test::Standard128RibbonFilterPolicy::kClassName()) {
|
|
1878
1800
|
return std::make_shared<test::Standard128RibbonFilterPolicy>(bits_per_key);
|
|
1879
|
-
} else if (name == DeprecatedBlockBasedBloomFilterPolicy::kClassName()) {
|
|
1880
|
-
return std::make_shared<DeprecatedBlockBasedBloomFilterPolicy>(
|
|
1881
|
-
bits_per_key);
|
|
1882
1801
|
} else if (name == BloomFilterPolicy::kClassName()) {
|
|
1883
1802
|
// For testing
|
|
1884
1803
|
return std::make_shared<BloomFilterPolicy>(bits_per_key);
|
|
@@ -1996,15 +1915,6 @@ static int RegisterBuiltinFilterPolicies(ObjectLibrary& library,
|
|
|
1996
1915
|
uri));
|
|
1997
1916
|
return guard->get();
|
|
1998
1917
|
});
|
|
1999
|
-
library.AddFactory<const FilterPolicy>(
|
|
2000
|
-
FilterPatternEntryWithBits(
|
|
2001
|
-
DeprecatedBlockBasedBloomFilterPolicy::kClassName()),
|
|
2002
|
-
[](const std::string& uri, std::unique_ptr<const FilterPolicy>* guard,
|
|
2003
|
-
std::string* /* errmsg */) {
|
|
2004
|
-
guard->reset(NewBuiltinFilterPolicyWithBits<
|
|
2005
|
-
DeprecatedBlockBasedBloomFilterPolicy>(uri));
|
|
2006
|
-
return guard->get();
|
|
2007
|
-
});
|
|
2008
1918
|
size_t num_types;
|
|
2009
1919
|
return static_cast<int>(library.GetFactoryCount(&num_types));
|
|
2010
1920
|
}
|
|
@@ -2055,7 +1965,6 @@ const std::vector<std::string>& BloomLikeFilterPolicy::GetAllFixedImpls() {
|
|
|
2055
1965
|
STATIC_AVOID_DESTRUCTION(std::vector<std::string>, impls){
|
|
2056
1966
|
// Match filter_bench -impl=x ordering
|
|
2057
1967
|
test::LegacyBloomFilterPolicy::kClassName(),
|
|
2058
|
-
DeprecatedBlockBasedBloomFilterPolicy::kClassName(),
|
|
2059
1968
|
test::FastLocalBloomFilterPolicy::kClassName(),
|
|
2060
1969
|
test::Standard128RibbonFilterPolicy::kClassName(),
|
|
2061
1970
|
};
|
|
@@ -131,7 +131,7 @@ class BuiltinFilterPolicy : public FilterPolicy {
|
|
|
131
131
|
// Read metadata to determine what kind of FilterBitsReader is needed
|
|
132
132
|
// and return a new one. This must successfully process any filter data
|
|
133
133
|
// generated by a built-in FilterBitsBuilder, regardless of the impl
|
|
134
|
-
// chosen for this BloomFilterPolicy.
|
|
134
|
+
// chosen for this BloomFilterPolicy.
|
|
135
135
|
FilterBitsReader* GetFilterBitsReader(const Slice& contents) const override;
|
|
136
136
|
static const char* kClassName();
|
|
137
137
|
bool IsInstanceOf(const std::string& id) const override;
|
|
@@ -151,12 +151,8 @@ class BuiltinFilterPolicy : public FilterPolicy {
|
|
|
151
151
|
// (An internal convenience function to save boilerplate.)
|
|
152
152
|
static FilterBitsBuilder* GetBuilderFromContext(const FilterBuildingContext&);
|
|
153
153
|
|
|
154
|
-
protected:
|
|
155
|
-
// Deprecated block-based filter only (no longer in public API)
|
|
156
|
-
bool KeyMayMatch(const Slice& key, const Slice& bloom_filter) const;
|
|
157
|
-
|
|
158
154
|
private:
|
|
159
|
-
// For Bloom filter implementation(s)
|
|
155
|
+
// For Bloom filter implementation(s)
|
|
160
156
|
static BuiltinFilterBitsReader* GetBloomBitsReader(const Slice& contents);
|
|
161
157
|
|
|
162
158
|
// For Ribbon filter implementation(s)
|
|
@@ -300,30 +296,6 @@ class RibbonFilterPolicy : public BloomLikeFilterPolicy {
|
|
|
300
296
|
const int bloom_before_level_;
|
|
301
297
|
};
|
|
302
298
|
|
|
303
|
-
// Deprecated block-based filter only. We still support reading old
|
|
304
|
-
// block-based filters from any BuiltinFilterPolicy, but there is no public
|
|
305
|
-
// option to build them. However, this class is used to build them for testing
|
|
306
|
-
// and for a public backdoor to building them by constructing this policy from
|
|
307
|
-
// a string.
|
|
308
|
-
class DeprecatedBlockBasedBloomFilterPolicy : public BloomLikeFilterPolicy {
|
|
309
|
-
public:
|
|
310
|
-
explicit DeprecatedBlockBasedBloomFilterPolicy(double bits_per_key);
|
|
311
|
-
|
|
312
|
-
// Internal contract: returns a new fake builder that encodes bits per key
|
|
313
|
-
// into a special value from EstimateEntriesAdded(), using
|
|
314
|
-
// kSecretBitsPerKeyStart
|
|
315
|
-
FilterBitsBuilder* GetBuilderWithContext(
|
|
316
|
-
const FilterBuildingContext&) const override;
|
|
317
|
-
static constexpr size_t kSecretBitsPerKeyStart = 1234567890U;
|
|
318
|
-
|
|
319
|
-
static const char* kClassName();
|
|
320
|
-
const char* Name() const override { return kClassName(); }
|
|
321
|
-
|
|
322
|
-
static void CreateFilter(const Slice* keys, int n, int bits_per_key,
|
|
323
|
-
std::string* dst);
|
|
324
|
-
static bool KeyMayMatch(const Slice& key, const Slice& bloom_filter);
|
|
325
|
-
};
|
|
326
|
-
|
|
327
299
|
// For testing only, but always constructable with internal names
|
|
328
300
|
namespace test {
|
|
329
301
|
|
|
@@ -125,14 +125,8 @@ FullFilterBlockReader::FullFilterBlockReader(
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
bool FullFilterBlockReader::KeyMayMatch(
|
|
128
|
-
const Slice& key, const
|
|
129
|
-
|
|
130
|
-
const Slice* const /*const_ikey_ptr*/, GetContext* get_context,
|
|
131
|
-
BlockCacheLookupContext* lookup_context) {
|
|
132
|
-
#ifdef NDEBUG
|
|
133
|
-
(void)block_offset;
|
|
134
|
-
#endif
|
|
135
|
-
assert(block_offset == kNotValid);
|
|
128
|
+
const Slice& key, const bool no_io, const Slice* const /*const_ikey_ptr*/,
|
|
129
|
+
GetContext* get_context, BlockCacheLookupContext* lookup_context) {
|
|
136
130
|
if (!whole_key_filtering()) {
|
|
137
131
|
return true;
|
|
138
132
|
}
|
|
@@ -167,14 +161,9 @@ std::unique_ptr<FilterBlockReader> FullFilterBlockReader::Create(
|
|
|
167
161
|
}
|
|
168
162
|
|
|
169
163
|
bool FullFilterBlockReader::PrefixMayMatch(
|
|
170
|
-
const Slice& prefix, const
|
|
171
|
-
uint64_t block_offset, const bool no_io,
|
|
164
|
+
const Slice& prefix, const bool no_io,
|
|
172
165
|
const Slice* const /*const_ikey_ptr*/, GetContext* get_context,
|
|
173
166
|
BlockCacheLookupContext* lookup_context) {
|
|
174
|
-
#ifdef NDEBUG
|
|
175
|
-
(void)block_offset;
|
|
176
|
-
#endif
|
|
177
|
-
assert(block_offset == kNotValid);
|
|
178
167
|
return MayMatch(prefix, no_io, get_context, lookup_context);
|
|
179
168
|
}
|
|
180
169
|
|
|
@@ -204,17 +193,12 @@ bool FullFilterBlockReader::MayMatch(
|
|
|
204
193
|
return false;
|
|
205
194
|
}
|
|
206
195
|
}
|
|
207
|
-
return true;
|
|
196
|
+
return true;
|
|
208
197
|
}
|
|
209
198
|
|
|
210
199
|
void FullFilterBlockReader::KeysMayMatch(
|
|
211
|
-
MultiGetRange* range, const
|
|
212
|
-
uint64_t block_offset, const bool no_io,
|
|
200
|
+
MultiGetRange* range, const bool no_io,
|
|
213
201
|
BlockCacheLookupContext* lookup_context) {
|
|
214
|
-
#ifdef NDEBUG
|
|
215
|
-
(void)block_offset;
|
|
216
|
-
#endif
|
|
217
|
-
assert(block_offset == kNotValid);
|
|
218
202
|
if (!whole_key_filtering()) {
|
|
219
203
|
// Simply return. Don't skip any key - consider all keys as likely to be
|
|
220
204
|
// present
|
|
@@ -225,12 +209,7 @@ void FullFilterBlockReader::KeysMayMatch(
|
|
|
225
209
|
|
|
226
210
|
void FullFilterBlockReader::PrefixesMayMatch(
|
|
227
211
|
MultiGetRange* range, const SliceTransform* prefix_extractor,
|
|
228
|
-
|
|
229
|
-
BlockCacheLookupContext* lookup_context) {
|
|
230
|
-
#ifdef NDEBUG
|
|
231
|
-
(void)block_offset;
|
|
232
|
-
#endif
|
|
233
|
-
assert(block_offset == kNotValid);
|
|
212
|
+
const bool no_io, BlockCacheLookupContext* lookup_context) {
|
|
234
213
|
MayMatch(range, no_io, prefix_extractor, lookup_context);
|
|
235
214
|
}
|
|
236
215
|
|
|
@@ -49,8 +49,6 @@ class FullFilterBlockBuilder : public FilterBlockBuilder {
|
|
|
49
49
|
// directly. and be deleted here
|
|
50
50
|
~FullFilterBlockBuilder() {}
|
|
51
51
|
|
|
52
|
-
virtual bool IsBlockBased() override { return false; }
|
|
53
|
-
virtual void StartBlock(uint64_t /*block_offset*/) override {}
|
|
54
52
|
virtual void Add(const Slice& key_without_ts) override;
|
|
55
53
|
virtual bool IsEmpty() const override { return !any_added_; }
|
|
56
54
|
virtual size_t EstimateEntriesAdded() override;
|
|
@@ -107,28 +105,28 @@ class FullFilterBlockReader
|
|
|
107
105
|
FilePrefetchBuffer* prefetch_buffer, bool use_cache, bool prefetch,
|
|
108
106
|
bool pin, BlockCacheLookupContext* lookup_context);
|
|
109
107
|
|
|
110
|
-
bool
|
|
111
|
-
|
|
112
|
-
bool KeyMayMatch(const Slice& key, const SliceTransform* prefix_extractor,
|
|
113
|
-
uint64_t block_offset, const bool no_io,
|
|
108
|
+
bool KeyMayMatch(const Slice& key, const bool no_io,
|
|
114
109
|
const Slice* const const_ikey_ptr, GetContext* get_context,
|
|
115
110
|
BlockCacheLookupContext* lookup_context) override;
|
|
116
111
|
|
|
117
|
-
bool PrefixMayMatch(const Slice& prefix,
|
|
118
|
-
const SliceTransform* prefix_extractor,
|
|
119
|
-
uint64_t block_offset, const bool no_io,
|
|
112
|
+
bool PrefixMayMatch(const Slice& prefix, const bool no_io,
|
|
120
113
|
const Slice* const const_ikey_ptr,
|
|
121
114
|
GetContext* get_context,
|
|
122
115
|
BlockCacheLookupContext* lookup_context) override;
|
|
123
116
|
|
|
124
|
-
void KeysMayMatch(MultiGetRange* range,
|
|
125
|
-
const SliceTransform* prefix_extractor,
|
|
126
|
-
uint64_t block_offset, const bool no_io,
|
|
117
|
+
void KeysMayMatch(MultiGetRange* range, const bool no_io,
|
|
127
118
|
BlockCacheLookupContext* lookup_context) override;
|
|
119
|
+
// Used in partitioned filter code
|
|
120
|
+
void KeysMayMatch2(MultiGetRange* range,
|
|
121
|
+
const SliceTransform* /*prefix_extractor*/,
|
|
122
|
+
const bool no_io,
|
|
123
|
+
BlockCacheLookupContext* lookup_context) {
|
|
124
|
+
KeysMayMatch(range, no_io, lookup_context);
|
|
125
|
+
}
|
|
128
126
|
|
|
129
127
|
void PrefixesMayMatch(MultiGetRange* range,
|
|
130
128
|
const SliceTransform* prefix_extractor,
|
|
131
|
-
|
|
129
|
+
const bool no_io,
|
|
132
130
|
BlockCacheLookupContext* lookup_context) override;
|
|
133
131
|
size_t ApproximateMemoryUsage() const override;
|
|
134
132
|
private:
|
|
@@ -115,8 +115,7 @@ TEST_F(PluginFullFilterBlockTest, PluginEmptyBuilder) {
|
|
|
115
115
|
|
|
116
116
|
FullFilterBlockReader reader(table_.get(), std::move(block));
|
|
117
117
|
// Remain same symantic with blockbased filter
|
|
118
|
-
ASSERT_TRUE(reader.KeyMayMatch("foo",
|
|
119
|
-
/*block_offset=*/kNotValid,
|
|
118
|
+
ASSERT_TRUE(reader.KeyMayMatch("foo",
|
|
120
119
|
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
121
120
|
/*get_context=*/nullptr,
|
|
122
121
|
/*lookup_context=*/nullptr));
|
|
@@ -137,39 +136,34 @@ TEST_F(PluginFullFilterBlockTest, PluginSingleChunk) {
|
|
|
137
136
|
nullptr /* cache */, nullptr /* cache_handle */, true /* own_value */);
|
|
138
137
|
|
|
139
138
|
FullFilterBlockReader reader(table_.get(), std::move(block));
|
|
140
|
-
ASSERT_TRUE(reader.KeyMayMatch("foo",
|
|
141
|
-
/*block_offset=*/kNotValid,
|
|
139
|
+
ASSERT_TRUE(reader.KeyMayMatch("foo",
|
|
142
140
|
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
143
141
|
/*get_context=*/nullptr,
|
|
144
142
|
/*lookup_context=*/nullptr));
|
|
145
|
-
ASSERT_TRUE(reader.KeyMayMatch("bar",
|
|
146
|
-
/*block_offset=*/kNotValid,
|
|
143
|
+
ASSERT_TRUE(reader.KeyMayMatch("bar",
|
|
147
144
|
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
148
145
|
/*get_context=*/nullptr,
|
|
149
146
|
/*lookup_context=*/nullptr));
|
|
150
|
-
ASSERT_TRUE(reader.KeyMayMatch("box",
|
|
151
|
-
/*block_offset=*/kNotValid,
|
|
147
|
+
ASSERT_TRUE(reader.KeyMayMatch("box",
|
|
152
148
|
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
153
149
|
/*get_context=*/nullptr,
|
|
154
150
|
/*lookup_context=*/nullptr));
|
|
155
|
-
ASSERT_TRUE(reader.KeyMayMatch("hello",
|
|
156
|
-
/*block_offset=*/kNotValid,
|
|
151
|
+
ASSERT_TRUE(reader.KeyMayMatch("hello",
|
|
157
152
|
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
158
153
|
/*get_context=*/nullptr,
|
|
159
154
|
/*lookup_context=*/nullptr));
|
|
160
|
-
ASSERT_TRUE(reader.KeyMayMatch("foo",
|
|
161
|
-
/*block_offset=*/kNotValid,
|
|
155
|
+
ASSERT_TRUE(reader.KeyMayMatch("foo",
|
|
162
156
|
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
163
157
|
/*get_context=*/nullptr,
|
|
164
158
|
/*lookup_context=*/nullptr));
|
|
165
|
-
ASSERT_TRUE(!reader.KeyMayMatch(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
ASSERT_TRUE(!reader.KeyMayMatch(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
159
|
+
ASSERT_TRUE(!reader.KeyMayMatch("missing",
|
|
160
|
+
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
161
|
+
/*get_context=*/nullptr,
|
|
162
|
+
/*lookup_context=*/nullptr));
|
|
163
|
+
ASSERT_TRUE(!reader.KeyMayMatch("other",
|
|
164
|
+
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
165
|
+
/*get_context=*/nullptr,
|
|
166
|
+
/*lookup_context=*/nullptr));
|
|
173
167
|
}
|
|
174
168
|
|
|
175
169
|
class FullFilterBlockTest : public mock::MockBlockBasedTableTester,
|
|
@@ -191,8 +185,7 @@ TEST_F(FullFilterBlockTest, EmptyBuilder) {
|
|
|
191
185
|
|
|
192
186
|
FullFilterBlockReader reader(table_.get(), std::move(block));
|
|
193
187
|
// Remain same symantic with blockbased filter
|
|
194
|
-
ASSERT_TRUE(reader.KeyMayMatch("foo",
|
|
195
|
-
/*block_offset=*/kNotValid,
|
|
188
|
+
ASSERT_TRUE(reader.KeyMayMatch("foo",
|
|
196
189
|
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
197
190
|
/*get_context=*/nullptr,
|
|
198
191
|
/*lookup_context=*/nullptr));
|
|
@@ -292,39 +285,34 @@ TEST_F(FullFilterBlockTest, SingleChunk) {
|
|
|
292
285
|
nullptr /* cache */, nullptr /* cache_handle */, true /* own_value */);
|
|
293
286
|
|
|
294
287
|
FullFilterBlockReader reader(table_.get(), std::move(block));
|
|
295
|
-
ASSERT_TRUE(reader.KeyMayMatch("foo",
|
|
296
|
-
/*block_offset=*/kNotValid,
|
|
288
|
+
ASSERT_TRUE(reader.KeyMayMatch("foo",
|
|
297
289
|
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
298
290
|
/*get_context=*/nullptr,
|
|
299
291
|
/*lookup_context=*/nullptr));
|
|
300
|
-
ASSERT_TRUE(reader.KeyMayMatch("bar",
|
|
301
|
-
/*block_offset=*/kNotValid,
|
|
292
|
+
ASSERT_TRUE(reader.KeyMayMatch("bar",
|
|
302
293
|
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
303
294
|
/*get_context=*/nullptr,
|
|
304
295
|
/*lookup_context=*/nullptr));
|
|
305
|
-
ASSERT_TRUE(reader.KeyMayMatch("box",
|
|
306
|
-
/*block_offset=*/kNotValid,
|
|
296
|
+
ASSERT_TRUE(reader.KeyMayMatch("box",
|
|
307
297
|
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
308
298
|
/*get_context=*/nullptr,
|
|
309
299
|
/*lookup_context=*/nullptr));
|
|
310
|
-
ASSERT_TRUE(reader.KeyMayMatch("hello",
|
|
311
|
-
/*block_offset=*/kNotValid,
|
|
300
|
+
ASSERT_TRUE(reader.KeyMayMatch("hello",
|
|
312
301
|
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
313
302
|
/*get_context=*/nullptr,
|
|
314
303
|
/*lookup_context=*/nullptr));
|
|
315
|
-
ASSERT_TRUE(reader.KeyMayMatch("foo",
|
|
316
|
-
/*block_offset=*/kNotValid,
|
|
304
|
+
ASSERT_TRUE(reader.KeyMayMatch("foo",
|
|
317
305
|
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
318
306
|
/*get_context=*/nullptr,
|
|
319
307
|
/*lookup_context=*/nullptr));
|
|
320
|
-
ASSERT_TRUE(!reader.KeyMayMatch(
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
ASSERT_TRUE(!reader.KeyMayMatch(
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
308
|
+
ASSERT_TRUE(!reader.KeyMayMatch("missing",
|
|
309
|
+
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
310
|
+
/*get_context=*/nullptr,
|
|
311
|
+
/*lookup_context=*/nullptr));
|
|
312
|
+
ASSERT_TRUE(!reader.KeyMayMatch("other",
|
|
313
|
+
/*no_io=*/false, /*const_ikey_ptr=*/nullptr,
|
|
314
|
+
/*get_context=*/nullptr,
|
|
315
|
+
/*lookup_context=*/nullptr));
|
|
328
316
|
}
|
|
329
317
|
|
|
330
318
|
} // namespace ROCKSDB_NAMESPACE
|
|
@@ -216,58 +216,41 @@ std::unique_ptr<FilterBlockReader> PartitionedFilterBlockReader::Create(
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
bool PartitionedFilterBlockReader::KeyMayMatch(
|
|
219
|
-
const Slice& key, const
|
|
220
|
-
uint64_t block_offset, const bool no_io, const Slice* const const_ikey_ptr,
|
|
219
|
+
const Slice& key, const bool no_io, const Slice* const const_ikey_ptr,
|
|
221
220
|
GetContext* get_context, BlockCacheLookupContext* lookup_context) {
|
|
222
221
|
assert(const_ikey_ptr != nullptr);
|
|
223
|
-
assert(block_offset == kNotValid);
|
|
224
222
|
if (!whole_key_filtering()) {
|
|
225
223
|
return true;
|
|
226
224
|
}
|
|
227
225
|
|
|
228
|
-
return MayMatch(key,
|
|
229
|
-
get_context, lookup_context,
|
|
226
|
+
return MayMatch(key, no_io, const_ikey_ptr, get_context, lookup_context,
|
|
230
227
|
&FullFilterBlockReader::KeyMayMatch);
|
|
231
228
|
}
|
|
232
229
|
|
|
233
230
|
void PartitionedFilterBlockReader::KeysMayMatch(
|
|
234
|
-
MultiGetRange* range, const
|
|
235
|
-
uint64_t block_offset, const bool no_io,
|
|
231
|
+
MultiGetRange* range, const bool no_io,
|
|
236
232
|
BlockCacheLookupContext* lookup_context) {
|
|
237
|
-
assert(block_offset == kNotValid);
|
|
238
233
|
if (!whole_key_filtering()) {
|
|
239
234
|
return; // Any/all may match
|
|
240
235
|
}
|
|
241
236
|
|
|
242
|
-
MayMatch(range,
|
|
243
|
-
&FullFilterBlockReader::
|
|
237
|
+
MayMatch(range, nullptr, no_io, lookup_context,
|
|
238
|
+
&FullFilterBlockReader::KeysMayMatch2);
|
|
244
239
|
}
|
|
245
240
|
|
|
246
241
|
bool PartitionedFilterBlockReader::PrefixMayMatch(
|
|
247
|
-
const Slice& prefix, const
|
|
248
|
-
uint64_t block_offset, const bool no_io, const Slice* const const_ikey_ptr,
|
|
242
|
+
const Slice& prefix, const bool no_io, const Slice* const const_ikey_ptr,
|
|
249
243
|
GetContext* get_context, BlockCacheLookupContext* lookup_context) {
|
|
250
244
|
assert(const_ikey_ptr != nullptr);
|
|
251
|
-
|
|
252
|
-
if (!table_prefix_extractor() && !prefix_extractor) {
|
|
253
|
-
return true;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
return MayMatch(prefix, prefix_extractor, block_offset, no_io, const_ikey_ptr,
|
|
257
|
-
get_context, lookup_context,
|
|
245
|
+
return MayMatch(prefix, no_io, const_ikey_ptr, get_context, lookup_context,
|
|
258
246
|
&FullFilterBlockReader::PrefixMayMatch);
|
|
259
247
|
}
|
|
260
248
|
|
|
261
249
|
void PartitionedFilterBlockReader::PrefixesMayMatch(
|
|
262
250
|
MultiGetRange* range, const SliceTransform* prefix_extractor,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
if (!table_prefix_extractor() && !prefix_extractor) {
|
|
267
|
-
return; // Any/all may match
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
MayMatch(range, prefix_extractor, block_offset, no_io, lookup_context,
|
|
251
|
+
const bool no_io, BlockCacheLookupContext* lookup_context) {
|
|
252
|
+
assert(prefix_extractor);
|
|
253
|
+
MayMatch(range, prefix_extractor, no_io, lookup_context,
|
|
271
254
|
&FullFilterBlockReader::PrefixesMayMatch);
|
|
272
255
|
}
|
|
273
256
|
|
|
@@ -331,8 +314,7 @@ Status PartitionedFilterBlockReader::GetFilterPartitionBlock(
|
|
|
331
314
|
}
|
|
332
315
|
|
|
333
316
|
bool PartitionedFilterBlockReader::MayMatch(
|
|
334
|
-
const Slice& slice, const
|
|
335
|
-
uint64_t block_offset, bool no_io, const Slice* const_ikey_ptr,
|
|
317
|
+
const Slice& slice, bool no_io, const Slice* const_ikey_ptr,
|
|
336
318
|
GetContext* get_context, BlockCacheLookupContext* lookup_context,
|
|
337
319
|
FilterFunction filter_function) const {
|
|
338
320
|
CachableEntry<Block> filter_block;
|
|
@@ -364,14 +346,13 @@ bool PartitionedFilterBlockReader::MayMatch(
|
|
|
364
346
|
|
|
365
347
|
FullFilterBlockReader filter_partition(table(),
|
|
366
348
|
std::move(filter_partition_block));
|
|
367
|
-
return (filter_partition.*filter_function)(
|
|
368
|
-
|
|
369
|
-
lookup_context);
|
|
349
|
+
return (filter_partition.*filter_function)(slice, no_io, const_ikey_ptr,
|
|
350
|
+
get_context, lookup_context);
|
|
370
351
|
}
|
|
371
352
|
|
|
372
353
|
void PartitionedFilterBlockReader::MayMatch(
|
|
373
|
-
MultiGetRange* range, const SliceTransform* prefix_extractor,
|
|
374
|
-
|
|
354
|
+
MultiGetRange* range, const SliceTransform* prefix_extractor, bool no_io,
|
|
355
|
+
BlockCacheLookupContext* lookup_context,
|
|
375
356
|
FilterManyFunction filter_function) const {
|
|
376
357
|
CachableEntry<Block> filter_block;
|
|
377
358
|
Status s =
|
|
@@ -399,9 +380,8 @@ void PartitionedFilterBlockReader::MayMatch(
|
|
|
399
380
|
if (!prev_filter_handle.IsNull() &&
|
|
400
381
|
this_filter_handle != prev_filter_handle) {
|
|
401
382
|
MultiGetRange subrange(*range, start_iter_same_handle, iter);
|
|
402
|
-
MayMatchPartition(&subrange, prefix_extractor,
|
|
403
|
-
|
|
404
|
-
filter_function);
|
|
383
|
+
MayMatchPartition(&subrange, prefix_extractor, prev_filter_handle, no_io,
|
|
384
|
+
lookup_context, filter_function);
|
|
405
385
|
range->AddSkipsFrom(subrange);
|
|
406
386
|
start_iter_same_handle = iter;
|
|
407
387
|
}
|
|
@@ -416,16 +396,15 @@ void PartitionedFilterBlockReader::MayMatch(
|
|
|
416
396
|
}
|
|
417
397
|
if (!prev_filter_handle.IsNull()) {
|
|
418
398
|
MultiGetRange subrange(*range, start_iter_same_handle, range->end());
|
|
419
|
-
MayMatchPartition(&subrange, prefix_extractor,
|
|
420
|
-
|
|
421
|
-
filter_function);
|
|
399
|
+
MayMatchPartition(&subrange, prefix_extractor, prev_filter_handle, no_io,
|
|
400
|
+
lookup_context, filter_function);
|
|
422
401
|
range->AddSkipsFrom(subrange);
|
|
423
402
|
}
|
|
424
403
|
}
|
|
425
404
|
|
|
426
405
|
void PartitionedFilterBlockReader::MayMatchPartition(
|
|
427
406
|
MultiGetRange* range, const SliceTransform* prefix_extractor,
|
|
428
|
-
|
|
407
|
+
BlockHandle filter_handle, bool no_io,
|
|
429
408
|
BlockCacheLookupContext* lookup_context,
|
|
430
409
|
FilterManyFunction filter_function) const {
|
|
431
410
|
CachableEntry<ParsedFullFilterBlock> filter_partition_block;
|
|
@@ -439,8 +418,8 @@ void PartitionedFilterBlockReader::MayMatchPartition(
|
|
|
439
418
|
|
|
440
419
|
FullFilterBlockReader filter_partition(table(),
|
|
441
420
|
std::move(filter_partition_block));
|
|
442
|
-
(filter_partition.*filter_function)(range, prefix_extractor,
|
|
443
|
-
|
|
421
|
+
(filter_partition.*filter_function)(range, prefix_extractor, no_io,
|
|
422
|
+
lookup_context);
|
|
444
423
|
}
|
|
445
424
|
|
|
446
425
|
size_t PartitionedFilterBlockReader::ApproximateMemoryUsage() const {
|
|
@@ -109,25 +109,19 @@ class PartitionedFilterBlockReader : public FilterBlockReaderCommon<Block> {
|
|
|
109
109
|
FilePrefetchBuffer* prefetch_buffer, bool use_cache, bool prefetch,
|
|
110
110
|
bool pin, BlockCacheLookupContext* lookup_context);
|
|
111
111
|
|
|
112
|
-
bool
|
|
113
|
-
bool KeyMayMatch(const Slice& key, const SliceTransform* prefix_extractor,
|
|
114
|
-
uint64_t block_offset, const bool no_io,
|
|
112
|
+
bool KeyMayMatch(const Slice& key, const bool no_io,
|
|
115
113
|
const Slice* const const_ikey_ptr, GetContext* get_context,
|
|
116
114
|
BlockCacheLookupContext* lookup_context) override;
|
|
117
|
-
void KeysMayMatch(MultiGetRange* range,
|
|
118
|
-
const SliceTransform* prefix_extractor,
|
|
119
|
-
uint64_t block_offset, const bool no_io,
|
|
115
|
+
void KeysMayMatch(MultiGetRange* range, const bool no_io,
|
|
120
116
|
BlockCacheLookupContext* lookup_context) override;
|
|
121
117
|
|
|
122
|
-
bool PrefixMayMatch(const Slice& prefix,
|
|
123
|
-
const SliceTransform* prefix_extractor,
|
|
124
|
-
uint64_t block_offset, const bool no_io,
|
|
118
|
+
bool PrefixMayMatch(const Slice& prefix, const bool no_io,
|
|
125
119
|
const Slice* const const_ikey_ptr,
|
|
126
120
|
GetContext* get_context,
|
|
127
121
|
BlockCacheLookupContext* lookup_context) override;
|
|
128
122
|
void PrefixesMayMatch(MultiGetRange* range,
|
|
129
123
|
const SliceTransform* prefix_extractor,
|
|
130
|
-
|
|
124
|
+
const bool no_io,
|
|
131
125
|
BlockCacheLookupContext* lookup_context) override;
|
|
132
126
|
|
|
133
127
|
size_t ApproximateMemoryUsage() const override;
|
|
@@ -142,27 +136,22 @@ class PartitionedFilterBlockReader : public FilterBlockReaderCommon<Block> {
|
|
|
142
136
|
CachableEntry<ParsedFullFilterBlock>* filter_block) const;
|
|
143
137
|
|
|
144
138
|
using FilterFunction = bool (FullFilterBlockReader::*)(
|
|
145
|
-
const Slice& slice, const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
BlockCacheLookupContext* lookup_context);
|
|
149
|
-
bool MayMatch(const Slice& slice, const SliceTransform* prefix_extractor,
|
|
150
|
-
uint64_t block_offset, bool no_io, const Slice* const_ikey_ptr,
|
|
139
|
+
const Slice& slice, const bool no_io, const Slice* const const_ikey_ptr,
|
|
140
|
+
GetContext* get_context, BlockCacheLookupContext* lookup_context);
|
|
141
|
+
bool MayMatch(const Slice& slice, bool no_io, const Slice* const_ikey_ptr,
|
|
151
142
|
GetContext* get_context,
|
|
152
143
|
BlockCacheLookupContext* lookup_context,
|
|
153
144
|
FilterFunction filter_function) const;
|
|
154
145
|
using FilterManyFunction = void (FullFilterBlockReader::*)(
|
|
155
146
|
MultiGetRange* range, const SliceTransform* prefix_extractor,
|
|
156
|
-
|
|
157
|
-
BlockCacheLookupContext* lookup_context);
|
|
147
|
+
const bool no_io, BlockCacheLookupContext* lookup_context);
|
|
158
148
|
void MayMatch(MultiGetRange* range, const SliceTransform* prefix_extractor,
|
|
159
|
-
|
|
160
|
-
BlockCacheLookupContext* lookup_context,
|
|
149
|
+
bool no_io, BlockCacheLookupContext* lookup_context,
|
|
161
150
|
FilterManyFunction filter_function) const;
|
|
162
151
|
void MayMatchPartition(MultiGetRange* range,
|
|
163
152
|
const SliceTransform* prefix_extractor,
|
|
164
|
-
|
|
165
|
-
|
|
153
|
+
BlockHandle filter_handle, bool no_io,
|
|
154
|
+
BlockCacheLookupContext* lookup_context,
|
|
166
155
|
FilterManyFunction filter_function) const;
|
|
167
156
|
Status CacheDependencies(const ReadOptions& ro, bool pin) override;
|
|
168
157
|
|