rocksdb-native 2.2.0 → 2.3.0

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 (261) hide show
  1. package/binding.c +92 -10
  2. package/index.js +9 -0
  3. package/lib/batch.js +11 -1
  4. package/lib/iterator.js +3 -1
  5. package/lib/snapshot.js +21 -0
  6. package/package.json +1 -1
  7. package/prebuilds/darwin-arm64/rocksdb-native.bare +0 -0
  8. package/prebuilds/darwin-arm64/rocksdb-native.node +0 -0
  9. package/prebuilds/darwin-x64/rocksdb-native.bare +0 -0
  10. package/prebuilds/darwin-x64/rocksdb-native.node +0 -0
  11. package/prebuilds/linux-arm64/rocksdb-native.bare +0 -0
  12. package/prebuilds/linux-arm64/rocksdb-native.node +0 -0
  13. package/prebuilds/linux-x64/rocksdb-native.bare +0 -0
  14. package/prebuilds/linux-x64/rocksdb-native.node +0 -0
  15. package/prebuilds/win32-x64/rocksdb-native.bare +0 -0
  16. package/prebuilds/win32-x64/rocksdb-native.node +0 -0
  17. package/vendor/librocksdb/include/rocksdb.h +38 -4
  18. package/vendor/librocksdb/src/rocksdb.cc +114 -14
  19. package/vendor/librocksdb/vendor/rocksdb/CMakeLists.txt +21 -4
  20. package/vendor/librocksdb/vendor/rocksdb/cache/secondary_cache_adapter.cc +6 -3
  21. package/vendor/librocksdb/vendor/rocksdb/db/arena_wrapped_db_iter.cc +4 -4
  22. package/vendor/librocksdb/vendor/rocksdb/db/arena_wrapped_db_iter.h +4 -2
  23. package/vendor/librocksdb/vendor/rocksdb/db/attribute_group_iterator_impl.cc +20 -0
  24. package/vendor/librocksdb/vendor/rocksdb/db/attribute_group_iterator_impl.h +83 -0
  25. package/vendor/librocksdb/vendor/rocksdb/db/builder.cc +9 -5
  26. package/vendor/librocksdb/vendor/rocksdb/db/builder.h +1 -1
  27. package/vendor/librocksdb/vendor/rocksdb/db/c.cc +231 -6
  28. package/vendor/librocksdb/vendor/rocksdb/db/c_test.c +202 -2
  29. package/vendor/librocksdb/vendor/rocksdb/db/coalescing_iterator.cc +47 -0
  30. package/vendor/librocksdb/vendor/rocksdb/db/coalescing_iterator.h +79 -0
  31. package/vendor/librocksdb/vendor/rocksdb/db/column_family.cc +28 -0
  32. package/vendor/librocksdb/vendor/rocksdb/db/column_family.h +17 -0
  33. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction.cc +8 -1
  34. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction.h +11 -9
  35. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_iterator.cc +50 -23
  36. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_iterator.h +13 -0
  37. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_job.cc +22 -25
  38. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_job.h +2 -0
  39. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_outputs.cc +8 -1
  40. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_outputs.h +1 -0
  41. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker.cc +40 -17
  42. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker.h +20 -14
  43. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker_level.cc +11 -6
  44. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker_universal.cc +77 -24
  45. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_service_job.cc +2 -0
  46. package/vendor/librocksdb/vendor/rocksdb/db/convenience.cc +3 -0
  47. package/vendor/librocksdb/vendor/rocksdb/db/db_filesnapshot.cc +125 -31
  48. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl.cc +457 -231
  49. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl.h +172 -73
  50. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_compaction_flush.cc +152 -133
  51. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_debug.cc +5 -0
  52. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_files.cc +58 -52
  53. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_follower.cc +348 -0
  54. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_follower.h +54 -0
  55. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_open.cc +136 -117
  56. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_secondary.cc +4 -3
  57. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_secondary.h +7 -6
  58. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_write.cc +134 -80
  59. package/vendor/librocksdb/vendor/rocksdb/db/db_iter.cc +11 -0
  60. package/vendor/librocksdb/vendor/rocksdb/db/db_test2.cc +1 -1
  61. package/vendor/librocksdb/vendor/rocksdb/db/db_test_util.cc +11 -1
  62. package/vendor/librocksdb/vendor/rocksdb/db/db_test_util.h +11 -7
  63. package/vendor/librocksdb/vendor/rocksdb/db/dbformat.cc +19 -4
  64. package/vendor/librocksdb/vendor/rocksdb/db/dbformat.h +3 -2
  65. package/vendor/librocksdb/vendor/rocksdb/db/error_handler.cc +34 -39
  66. package/vendor/librocksdb/vendor/rocksdb/db/error_handler.h +3 -4
  67. package/vendor/librocksdb/vendor/rocksdb/db/event_helpers.cc +6 -3
  68. package/vendor/librocksdb/vendor/rocksdb/db/experimental.cc +3 -2
  69. package/vendor/librocksdb/vendor/rocksdb/db/external_sst_file_ingestion_job.cc +76 -18
  70. package/vendor/librocksdb/vendor/rocksdb/db/external_sst_file_ingestion_job.h +11 -0
  71. package/vendor/librocksdb/vendor/rocksdb/db/flush_job.cc +37 -5
  72. package/vendor/librocksdb/vendor/rocksdb/db/flush_job.h +14 -0
  73. package/vendor/librocksdb/vendor/rocksdb/db/import_column_family_job.cc +49 -45
  74. package/vendor/librocksdb/vendor/rocksdb/db/internal_stats.cc +60 -1
  75. package/vendor/librocksdb/vendor/rocksdb/db/internal_stats.h +20 -1
  76. package/vendor/librocksdb/vendor/rocksdb/db/log_reader.cc +15 -6
  77. package/vendor/librocksdb/vendor/rocksdb/db/log_writer.cc +59 -10
  78. package/vendor/librocksdb/vendor/rocksdb/db/log_writer.h +8 -0
  79. package/vendor/librocksdb/vendor/rocksdb/db/memtable.cc +24 -40
  80. package/vendor/librocksdb/vendor/rocksdb/db/memtable.h +10 -10
  81. package/vendor/librocksdb/vendor/rocksdb/db/memtable_list.cc +9 -8
  82. package/vendor/librocksdb/vendor/rocksdb/db/multi_cf_iterator_impl.h +296 -0
  83. package/vendor/librocksdb/vendor/rocksdb/db/range_tombstone_fragmenter.h +8 -10
  84. package/vendor/librocksdb/vendor/rocksdb/db/repair.cc +4 -3
  85. package/vendor/librocksdb/vendor/rocksdb/db/seqno_to_time_mapping.cc +30 -0
  86. package/vendor/librocksdb/vendor/rocksdb/db/seqno_to_time_mapping.h +9 -0
  87. package/vendor/librocksdb/vendor/rocksdb/db/table_cache.cc +17 -2
  88. package/vendor/librocksdb/vendor/rocksdb/db/table_cache.h +9 -1
  89. package/vendor/librocksdb/vendor/rocksdb/db/table_properties_collector.h +9 -2
  90. package/vendor/librocksdb/vendor/rocksdb/db/transaction_log_impl.cc +3 -3
  91. package/vendor/librocksdb/vendor/rocksdb/db/transaction_log_impl.h +7 -7
  92. package/vendor/librocksdb/vendor/rocksdb/db/version_edit.cc +0 -1
  93. package/vendor/librocksdb/vendor/rocksdb/db/version_edit_handler.cc +39 -5
  94. package/vendor/librocksdb/vendor/rocksdb/db/version_edit_handler.h +24 -15
  95. package/vendor/librocksdb/vendor/rocksdb/db/version_set.cc +117 -64
  96. package/vendor/librocksdb/vendor/rocksdb/db/version_set.h +27 -10
  97. package/vendor/librocksdb/vendor/rocksdb/db/wal_manager.cc +37 -29
  98. package/vendor/librocksdb/vendor/rocksdb/db/wal_manager.h +6 -5
  99. package/vendor/librocksdb/vendor/rocksdb/db/wide/wide_columns.cc +2 -3
  100. package/vendor/librocksdb/vendor/rocksdb/db/wide/wide_columns_helper.cc +6 -0
  101. package/vendor/librocksdb/vendor/rocksdb/db/write_batch.cc +89 -31
  102. package/vendor/librocksdb/vendor/rocksdb/db/write_thread.cc +53 -5
  103. package/vendor/librocksdb/vendor/rocksdb/db/write_thread.h +36 -4
  104. package/vendor/librocksdb/vendor/rocksdb/env/composite_env_wrapper.h +21 -0
  105. package/vendor/librocksdb/vendor/rocksdb/env/env.cc +15 -0
  106. package/vendor/librocksdb/vendor/rocksdb/env/fs_on_demand.cc +331 -0
  107. package/vendor/librocksdb/vendor/rocksdb/env/fs_on_demand.h +139 -0
  108. package/vendor/librocksdb/vendor/rocksdb/env/io_posix.cc +8 -6
  109. package/vendor/librocksdb/vendor/rocksdb/env/io_posix.h +1 -1
  110. package/vendor/librocksdb/vendor/rocksdb/file/delete_scheduler.cc +130 -27
  111. package/vendor/librocksdb/vendor/rocksdb/file/delete_scheduler.h +61 -8
  112. package/vendor/librocksdb/vendor/rocksdb/file/file_util.cc +25 -4
  113. package/vendor/librocksdb/vendor/rocksdb/file/file_util.h +15 -0
  114. package/vendor/librocksdb/vendor/rocksdb/file/sequence_file_reader.cc +1 -0
  115. package/vendor/librocksdb/vendor/rocksdb/file/sequence_file_reader.h +9 -4
  116. package/vendor/librocksdb/vendor/rocksdb/file/sst_file_manager_impl.cc +18 -0
  117. package/vendor/librocksdb/vendor/rocksdb/file/sst_file_manager_impl.h +31 -4
  118. package/vendor/librocksdb/vendor/rocksdb/file/writable_file_writer.cc +40 -38
  119. package/vendor/librocksdb/vendor/rocksdb/file/writable_file_writer.h +48 -15
  120. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/advanced_options.h +12 -3
  121. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/attribute_groups.h +114 -0
  122. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/c.h +90 -0
  123. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/cache.h +5 -0
  124. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/comparator.h +27 -0
  125. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/db.h +71 -12
  126. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/env.h +9 -0
  127. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/experimental.h +5 -0
  128. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/file_system.h +14 -0
  129. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/iterator.h +9 -71
  130. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/iterator_base.h +90 -0
  131. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/listener.h +21 -0
  132. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/options.h +125 -12
  133. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/perf_context.h +1 -1
  134. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/sst_file_reader.h +11 -1
  135. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/table.h +6 -6
  136. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/table_properties.h +19 -0
  137. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/transaction_log.h +12 -6
  138. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/types.h +12 -0
  139. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/universal_compaction.h +31 -0
  140. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/user_write_callback.h +29 -0
  141. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/cache_dump_load.h +4 -0
  142. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/checkpoint.h +4 -2
  143. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/customizable_util.h +0 -1
  144. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/env_mirror.h +1 -1
  145. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/ldb_cmd.h +24 -7
  146. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/option_change_migration.h +4 -4
  147. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/stackable_db.h +24 -5
  148. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/table_properties_collectors.h +46 -0
  149. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/transaction.h +42 -17
  150. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/transaction_db.h +5 -0
  151. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/types_util.h +36 -0
  152. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/write_batch_with_index.h +71 -3
  153. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/version.h +2 -2
  154. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/wide_columns.h +87 -72
  155. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/write_batch_base.h +1 -1
  156. package/vendor/librocksdb/vendor/rocksdb/memory/memory_allocator.cc +1 -0
  157. package/vendor/librocksdb/vendor/rocksdb/options/cf_options.cc +13 -2
  158. package/vendor/librocksdb/vendor/rocksdb/options/cf_options.h +6 -2
  159. package/vendor/librocksdb/vendor/rocksdb/options/db_options.cc +27 -1
  160. package/vendor/librocksdb/vendor/rocksdb/options/db_options.h +10 -3
  161. package/vendor/librocksdb/vendor/rocksdb/options/options.cc +3 -0
  162. package/vendor/librocksdb/vendor/rocksdb/options/options_helper.cc +1 -0
  163. package/vendor/librocksdb/vendor/rocksdb/port/jemalloc_helper.h +2 -2
  164. package/vendor/librocksdb/vendor/rocksdb/port/stack_trace.cc +1 -0
  165. package/vendor/librocksdb/vendor/rocksdb/port/win/port_win.cc +3 -2
  166. package/vendor/librocksdb/vendor/rocksdb/table/block_based/binary_search_index_reader.cc +1 -2
  167. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_builder.cc +47 -31
  168. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_factory.cc +15 -0
  169. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_iterator.cc +37 -18
  170. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_iterator.h +10 -3
  171. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader.cc +102 -41
  172. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader.h +15 -7
  173. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader_impl.h +1 -3
  174. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +5 -6
  175. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_cache.h +31 -0
  176. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_prefetcher.cc +6 -0
  177. package/vendor/librocksdb/vendor/rocksdb/table/block_based/cachable_entry.h +10 -5
  178. package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_block.h +34 -28
  179. package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_block_reader_common.cc +17 -11
  180. package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_block_reader_common.h +5 -2
  181. package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_policy.cc +12 -3
  182. package/vendor/librocksdb/vendor/rocksdb/table/block_based/full_filter_block.cc +37 -30
  183. package/vendor/librocksdb/vendor/rocksdb/table/block_based/full_filter_block.h +11 -13
  184. package/vendor/librocksdb/vendor/rocksdb/table/block_based/hash_index_reader.cc +1 -2
  185. package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_builder.cc +62 -53
  186. package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_builder.h +60 -38
  187. package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_reader_common.cc +14 -9
  188. package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_reader_common.h +4 -1
  189. package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_filter_block.cc +135 -94
  190. package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_filter_block.h +52 -46
  191. package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_index_reader.cc +51 -13
  192. package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_index_reader.h +2 -0
  193. package/vendor/librocksdb/vendor/rocksdb/table/block_based/uncompression_dict_reader.cc +3 -11
  194. package/vendor/librocksdb/vendor/rocksdb/table/block_based/uncompression_dict_reader.h +2 -3
  195. package/vendor/librocksdb/vendor/rocksdb/table/block_fetcher.cc +8 -10
  196. package/vendor/librocksdb/vendor/rocksdb/table/block_fetcher.h +2 -1
  197. package/vendor/librocksdb/vendor/rocksdb/table/compaction_merging_iterator.cc +9 -10
  198. package/vendor/librocksdb/vendor/rocksdb/table/compaction_merging_iterator.h +3 -2
  199. package/vendor/librocksdb/vendor/rocksdb/table/format.cc +1 -2
  200. package/vendor/librocksdb/vendor/rocksdb/table/iterator.cc +4 -0
  201. package/vendor/librocksdb/vendor/rocksdb/table/merging_iterator.cc +18 -13
  202. package/vendor/librocksdb/vendor/rocksdb/table/merging_iterator.h +5 -3
  203. package/vendor/librocksdb/vendor/rocksdb/table/meta_blocks.cc +18 -4
  204. package/vendor/librocksdb/vendor/rocksdb/table/meta_blocks.h +4 -0
  205. package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_builder.cc +2 -2
  206. package/vendor/librocksdb/vendor/rocksdb/table/sst_file_dumper.cc +6 -6
  207. package/vendor/librocksdb/vendor/rocksdb/table/sst_file_reader.cc +24 -2
  208. package/vendor/librocksdb/vendor/rocksdb/table/sst_file_writer_collectors.h +3 -1
  209. package/vendor/librocksdb/vendor/rocksdb/table/table_builder.h +8 -7
  210. package/vendor/librocksdb/vendor/rocksdb/table/table_iterator.h +69 -0
  211. package/vendor/librocksdb/vendor/rocksdb/table/table_reader.h +9 -0
  212. package/vendor/librocksdb/vendor/rocksdb/test_util/testutil.cc +25 -0
  213. package/vendor/librocksdb/vendor/rocksdb/test_util/testutil.h +12 -0
  214. package/vendor/librocksdb/vendor/rocksdb/tools/db_bench_tool.cc +32 -0
  215. package/vendor/librocksdb/vendor/rocksdb/tools/ldb_cmd.cc +618 -124
  216. package/vendor/librocksdb/vendor/rocksdb/tools/ldb_cmd_impl.h +19 -1
  217. package/vendor/librocksdb/vendor/rocksdb/tools/ldb_tool.cc +9 -0
  218. package/vendor/librocksdb/vendor/rocksdb/util/aligned_storage.h +24 -0
  219. package/vendor/librocksdb/vendor/rocksdb/util/autovector.h +4 -0
  220. package/vendor/librocksdb/vendor/rocksdb/util/comparator.cc +12 -0
  221. package/vendor/librocksdb/vendor/rocksdb/util/filter_bench.cc +1 -1
  222. package/vendor/librocksdb/vendor/rocksdb/util/random.cc +2 -1
  223. package/vendor/librocksdb/vendor/rocksdb/util/stderr_logger.cc +3 -4
  224. package/vendor/librocksdb/vendor/rocksdb/util/stderr_logger.h +1 -1
  225. package/vendor/librocksdb/vendor/rocksdb/util/udt_util.cc +33 -0
  226. package/vendor/librocksdb/vendor/rocksdb/util/udt_util.h +7 -0
  227. package/vendor/librocksdb/vendor/rocksdb/util/write_batch_util.h +5 -0
  228. package/vendor/librocksdb/vendor/rocksdb/util/xxhash.h +36 -29
  229. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_db_impl.h +3 -0
  230. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_db_impl_filesnapshot.cc +20 -0
  231. package/vendor/librocksdb/vendor/rocksdb/utilities/cache_dump_load_impl.cc +29 -9
  232. package/vendor/librocksdb/vendor/rocksdb/utilities/cache_dump_load_impl.h +14 -3
  233. package/vendor/librocksdb/vendor/rocksdb/utilities/debug.cc +16 -4
  234. package/vendor/librocksdb/vendor/rocksdb/utilities/fault_injection_fs.cc +677 -248
  235. package/vendor/librocksdb/vendor/rocksdb/utilities/fault_injection_fs.h +325 -158
  236. package/vendor/librocksdb/vendor/rocksdb/utilities/option_change_migration/option_change_migration.cc +1 -8
  237. package/vendor/librocksdb/vendor/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector.cc +144 -0
  238. package/vendor/librocksdb/vendor/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector.h +45 -0
  239. package/vendor/librocksdb/vendor/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector.cc +12 -0
  240. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +1 -1
  241. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/growable_array.h +3 -3
  242. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction.cc +116 -20
  243. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction.h +33 -1
  244. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction_db.cc +78 -13
  245. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction_db.h +33 -1
  246. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_base.cc +106 -7
  247. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_base.h +68 -10
  248. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_test.h +7 -3
  249. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_util.cc +8 -5
  250. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_util.h +7 -4
  251. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_prepared_txn.cc +18 -12
  252. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_prepared_txn_db.cc +4 -4
  253. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_prepared_txn_db.h +17 -0
  254. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_unprepared_txn.cc +11 -9
  255. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_unprepared_txn_db.cc +2 -1
  256. package/vendor/librocksdb/vendor/rocksdb/utilities/types_util.cc +88 -0
  257. package/vendor/librocksdb/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +313 -14
  258. package/vendor/librocksdb/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.cc +7 -0
  259. package/vendor/librocksdb/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.h +1 -1
  260. package/vendor/librocksdb/vendor/rocksdb/db/multi_cf_iterator.cc +0 -102
  261. package/vendor/librocksdb/vendor/rocksdb/db/multi_cf_iterator.h +0 -159
@@ -156,4 +156,35 @@ template <typename TUse, typename TBlocklike>
156
156
  using WithBlocklikeCheck = std::enable_if_t<
157
157
  TBlocklike::kCacheEntryRole == CacheEntryRole::kMisc || true, TUse>;
158
158
 
159
+ // Helper for the uncache_aggressiveness option
160
+ class UncacheAggressivenessAdvisor {
161
+ public:
162
+ UncacheAggressivenessAdvisor(uint32_t uncache_aggressiveness) {
163
+ assert(uncache_aggressiveness > 0);
164
+ allowance_ = std::min(uncache_aggressiveness, uint32_t{3});
165
+ threshold_ = std::pow(0.99, uncache_aggressiveness - 1);
166
+ }
167
+ void Report(bool erased) { ++(erased ? useful_ : not_useful_); }
168
+ bool ShouldContinue() {
169
+ if (not_useful_ < allowance_) {
170
+ return true;
171
+ } else {
172
+ // See UncacheAggressivenessAdvisor unit test
173
+ return (useful_ + 1.0) / (useful_ + not_useful_ - allowance_ + 1.5) >=
174
+ threshold_;
175
+ }
176
+ }
177
+
178
+ private:
179
+ // Baseline minimum number of "not useful" to consider stopping, to allow
180
+ // sufficient evidence for checking the threshold. Actual minimum will be
181
+ // higher as threshold gets well below 1.0.
182
+ int allowance_;
183
+ // After allowance, stop if useful ratio is below this threshold
184
+ double threshold_;
185
+ // Counts
186
+ int useful_ = 0;
187
+ int not_useful_ = 0;
188
+ };
189
+
159
190
  } // namespace ROCKSDB_NAMESPACE
@@ -18,6 +18,12 @@ void BlockPrefetcher::PrefetchIfNeeded(
18
18
  const bool no_sequential_checking, const ReadOptions& read_options,
19
19
  const std::function<void(bool, uint64_t&, uint64_t&)>& readaheadsize_cb,
20
20
  bool is_async_io_prefetch) {
21
+ if (read_options.read_tier == ReadTier::kBlockCacheTier) {
22
+ // Disable prefetching when IO disallowed. (Note that we haven't allocated
23
+ // any buffers yet despite the various tracked settings.)
24
+ return;
25
+ }
26
+
21
27
  ReadaheadParams readahead_params;
22
28
  readahead_params.initial_readahead_size = readahead_size;
23
29
  readahead_params.max_readahead_size = readahead_size;
@@ -78,7 +78,7 @@ class CachableEntry {
78
78
  return *this;
79
79
  }
80
80
 
81
- ReleaseResource();
81
+ ReleaseResource(/*erase_if_last_ref=*/false);
82
82
 
83
83
  value_ = rhs.value_;
84
84
  cache_ = rhs.cache_;
@@ -95,7 +95,7 @@ class CachableEntry {
95
95
  return *this;
96
96
  }
97
97
 
98
- ~CachableEntry() { ReleaseResource(); }
98
+ ~CachableEntry() { ReleaseResource(/*erase_if_last_ref=*/false); }
99
99
 
100
100
  bool IsEmpty() const {
101
101
  return value_ == nullptr && cache_ == nullptr && cache_handle_ == nullptr &&
@@ -114,7 +114,12 @@ class CachableEntry {
114
114
  bool GetOwnValue() const { return own_value_; }
115
115
 
116
116
  void Reset() {
117
- ReleaseResource();
117
+ ReleaseResource(/*erase_if_last_ref=*/false);
118
+ ResetFields();
119
+ }
120
+
121
+ void ResetEraseIfLastRef() {
122
+ ReleaseResource(/*erase_if_last_ref=*/true);
118
123
  ResetFields();
119
124
  }
120
125
 
@@ -200,10 +205,10 @@ class CachableEntry {
200
205
  }
201
206
 
202
207
  private:
203
- void ReleaseResource() noexcept {
208
+ void ReleaseResource(bool erase_if_last_ref) noexcept {
204
209
  if (LIKELY(cache_handle_ != nullptr)) {
205
210
  assert(cache_ != nullptr);
206
- cache_->Release(cache_handle_);
211
+ cache_->Release(cache_handle_, erase_if_last_ref);
207
212
  } else if (own_value_) {
208
213
  delete value_;
209
214
  }
@@ -57,22 +57,22 @@ class FilterBlockBuilder {
57
57
  virtual bool IsEmpty() const = 0; // Empty == none added
58
58
  // For reporting stats on how many entries the builder considered unique
59
59
  virtual size_t EstimateEntriesAdded() = 0;
60
- Slice Finish() { // Generate Filter
61
- const BlockHandle empty_handle;
62
- Status dont_care_status;
63
- auto ret = Finish(empty_handle, &dont_care_status);
64
- assert(dont_care_status.ok());
65
- return ret;
66
- }
67
- // If filter_data is not nullptr, Finish() may transfer ownership of
60
+
61
+ // Generate a filter block. Returns OK if finished, or Incomplete if more
62
+ // filters are needed (partitioned filter). In the latter case, subsequent
63
+ // calls require the BlockHandle of the most recently generated and written
64
+ // filter, in last_partition_block_handle.
65
+ //
66
+ // If filter_owner is not nullptr, Finish() may transfer ownership of
68
67
  // underlying filter data to the caller, so that it can be freed as soon as
69
68
  // possible. BlockBasedFilterBlock will ignore this parameter.
70
69
  //
71
- virtual Slice Finish(
72
- const BlockHandle& tmp /* only used in PartitionedFilterBlock as
73
- last_partition_block_handle */
74
- ,
75
- Status* status, std::unique_ptr<const char[]>* filter_data = nullptr) = 0;
70
+ // For either OK or Incomplete, *filter is set to point to the next filter
71
+ // bytes, which survive until either this is destroyed, *filter_owner is
72
+ // destroyed, or next call to Finish.
73
+ virtual Status Finish(
74
+ const BlockHandle& last_partition_block_handle, Slice* filter,
75
+ std::unique_ptr<const char[]>* filter_owner = nullptr) = 0;
76
76
 
77
77
  // This is called when finishes using the FilterBitsBuilder
78
78
  // in order to release memory usage and cache charge
@@ -85,6 +85,16 @@ class FilterBlockBuilder {
85
85
  virtual Status MaybePostVerifyFilter(const Slice& /* filter_content */) {
86
86
  return Status::OK();
87
87
  }
88
+
89
+ #ifndef NDEBUG
90
+ Slice TEST_Finish() { // Generate Filter
91
+ const BlockHandle empty_handle;
92
+ Slice filter;
93
+ Status status = Finish(empty_handle, &filter);
94
+ assert(status.ok());
95
+ return filter;
96
+ }
97
+ #endif // NDEBUG
88
98
  };
89
99
 
90
100
  // A FilterBlockReader is used to parse filter from SST table.
@@ -100,39 +110,34 @@ class FilterBlockReader {
100
110
  FilterBlockReader& operator=(const FilterBlockReader&) = delete;
101
111
 
102
112
  /**
103
- * If no_io is set, then it returns true if it cannot answer the query without
104
- * reading data from disk. This is used in PartitionedFilterBlockReader to
105
- * avoid reading partitions that are not in block cache already
106
- *
107
113
  * Normally filters are built on only the user keys and the InternalKey is not
108
114
  * needed for a query. The index in PartitionedFilterBlockReader however is
109
115
  * built upon InternalKey and must be provided via const_ikey_ptr when running
110
116
  * queries.
111
117
  */
112
- virtual bool KeyMayMatch(const Slice& key, const bool no_io,
113
- const Slice* const const_ikey_ptr,
118
+ virtual bool KeyMayMatch(const Slice& key, const Slice* const const_ikey_ptr,
114
119
  GetContext* get_context,
115
120
  BlockCacheLookupContext* lookup_context,
116
121
  const ReadOptions& read_options) = 0;
117
122
 
118
- virtual void KeysMayMatch(MultiGetRange* range, const bool no_io,
123
+ virtual void KeysMayMatch(MultiGetRange* range,
119
124
  BlockCacheLookupContext* lookup_context,
120
125
  const ReadOptions& read_options) {
121
126
  for (auto iter = range->begin(); iter != range->end(); ++iter) {
122
127
  const Slice ukey_without_ts = iter->ukey_without_ts;
123
128
  const Slice ikey = iter->ikey;
124
129
  GetContext* const get_context = iter->get_context;
125
- if (!KeyMayMatch(ukey_without_ts, no_io, &ikey, get_context,
126
- lookup_context, read_options)) {
130
+ if (!KeyMayMatch(ukey_without_ts, &ikey, get_context, lookup_context,
131
+ read_options)) {
127
132
  range->SkipKey(iter);
128
133
  }
129
134
  }
130
135
  }
131
136
 
132
137
  /**
133
- * no_io and const_ikey_ptr here means the same as in KeyMayMatch
138
+ * Similar to KeyMayMatch
134
139
  */
135
- virtual bool PrefixMayMatch(const Slice& prefix, const bool no_io,
140
+ virtual bool PrefixMayMatch(const Slice& prefix,
136
141
  const Slice* const const_ikey_ptr,
137
142
  GetContext* get_context,
138
143
  BlockCacheLookupContext* lookup_context,
@@ -140,7 +145,6 @@ class FilterBlockReader {
140
145
 
141
146
  virtual void PrefixesMayMatch(MultiGetRange* range,
142
147
  const SliceTransform* prefix_extractor,
143
- const bool no_io,
144
148
  BlockCacheLookupContext* lookup_context,
145
149
  const ReadOptions& read_options) {
146
150
  for (auto iter = range->begin(); iter != range->end(); ++iter) {
@@ -148,8 +152,8 @@ class FilterBlockReader {
148
152
  const Slice ikey = iter->ikey;
149
153
  GetContext* const get_context = iter->get_context;
150
154
  if (prefix_extractor->InDomain(ukey_without_ts) &&
151
- !PrefixMayMatch(prefix_extractor->Transform(ukey_without_ts), no_io,
152
- &ikey, get_context, lookup_context, read_options)) {
155
+ !PrefixMayMatch(prefix_extractor->Transform(ukey_without_ts), &ikey,
156
+ get_context, lookup_context, read_options)) {
153
157
  range->SkipKey(iter);
154
158
  }
155
159
  }
@@ -169,13 +173,15 @@ class FilterBlockReader {
169
173
  return Status::OK();
170
174
  }
171
175
 
176
+ virtual void EraseFromCacheBeforeDestruction(
177
+ uint32_t /*uncache_aggressiveness*/) {}
178
+
172
179
  virtual bool RangeMayExist(const Slice* /*iterate_upper_bound*/,
173
180
  const Slice& user_key_without_ts,
174
181
  const SliceTransform* prefix_extractor,
175
182
  const Comparator* /*comparator*/,
176
183
  const Slice* const const_ikey_ptr,
177
184
  bool* filter_checked, bool need_upper_bound_check,
178
- bool no_io,
179
185
  BlockCacheLookupContext* lookup_context,
180
186
  const ReadOptions& read_options) = 0;
181
187
  };
@@ -67,8 +67,7 @@ bool FilterBlockReaderCommon<TBlocklike>::cache_filter_blocks() const {
67
67
 
68
68
  template <typename TBlocklike>
69
69
  Status FilterBlockReaderCommon<TBlocklike>::GetOrReadFilterBlock(
70
- bool no_io, GetContext* get_context,
71
- BlockCacheLookupContext* lookup_context,
70
+ GetContext* get_context, BlockCacheLookupContext* lookup_context,
72
71
  CachableEntry<TBlocklike>* filter_block,
73
72
  const ReadOptions& read_options) const {
74
73
  assert(filter_block);
@@ -78,12 +77,7 @@ Status FilterBlockReaderCommon<TBlocklike>::GetOrReadFilterBlock(
78
77
  return Status::OK();
79
78
  }
80
79
 
81
- ReadOptions ro = read_options;
82
- if (no_io) {
83
- ro.read_tier = kBlockCacheTier;
84
- }
85
-
86
- return ReadFilterBlock(table_, nullptr /* prefetch_buffer */, ro,
80
+ return ReadFilterBlock(table_, nullptr /* prefetch_buffer */, read_options,
87
81
  cache_filter_blocks(), get_context, lookup_context,
88
82
  filter_block);
89
83
  }
@@ -102,8 +96,8 @@ bool FilterBlockReaderCommon<TBlocklike>::RangeMayExist(
102
96
  const Slice* iterate_upper_bound, const Slice& user_key_without_ts,
103
97
  const SliceTransform* prefix_extractor, const Comparator* comparator,
104
98
  const Slice* const const_ikey_ptr, bool* filter_checked,
105
- bool need_upper_bound_check, bool no_io,
106
- BlockCacheLookupContext* lookup_context, const ReadOptions& read_options) {
99
+ bool need_upper_bound_check, BlockCacheLookupContext* lookup_context,
100
+ const ReadOptions& read_options) {
107
101
  if (!prefix_extractor || !prefix_extractor->InDomain(user_key_without_ts)) {
108
102
  *filter_checked = false;
109
103
  return true;
@@ -115,7 +109,7 @@ bool FilterBlockReaderCommon<TBlocklike>::RangeMayExist(
115
109
  return true;
116
110
  } else {
117
111
  *filter_checked = true;
118
- return PrefixMayMatch(prefix, no_io, const_ikey_ptr,
112
+ return PrefixMayMatch(prefix, const_ikey_ptr,
119
113
  /* get_context */ nullptr, lookup_context,
120
114
  read_options);
121
115
  }
@@ -155,6 +149,18 @@ bool FilterBlockReaderCommon<TBlocklike>::IsFilterCompatible(
155
149
  }
156
150
  }
157
151
 
152
+ template <typename TBlocklike>
153
+ void FilterBlockReaderCommon<TBlocklike>::EraseFromCacheBeforeDestruction(
154
+ uint32_t uncache_aggressiveness) {
155
+ if (uncache_aggressiveness > 0) {
156
+ if (filter_block_.IsCached()) {
157
+ filter_block_.ResetEraseIfLastRef();
158
+ } else {
159
+ table()->EraseFromCache(table()->get_rep()->filter_handle);
160
+ }
161
+ }
162
+ }
163
+
158
164
  // Explicitly instantiate templates for both "blocklike" types we use.
159
165
  // This makes it possible to keep the template definitions in the .cc file.
160
166
  template class FilterBlockReaderCommon<Block_kFilterPartitionIndex>;
@@ -38,10 +38,13 @@ class FilterBlockReaderCommon : public FilterBlockReader {
38
38
  const SliceTransform* prefix_extractor,
39
39
  const Comparator* comparator,
40
40
  const Slice* const const_ikey_ptr, bool* filter_checked,
41
- bool need_upper_bound_check, bool no_io,
41
+ bool need_upper_bound_check,
42
42
  BlockCacheLookupContext* lookup_context,
43
43
  const ReadOptions& read_options) override;
44
44
 
45
+ void EraseFromCacheBeforeDestruction(
46
+ uint32_t /*uncache_aggressiveness*/) override;
47
+
45
48
  protected:
46
49
  static Status ReadFilterBlock(const BlockBasedTable* table,
47
50
  FilePrefetchBuffer* prefetch_buffer,
@@ -55,7 +58,7 @@ class FilterBlockReaderCommon : public FilterBlockReader {
55
58
  bool whole_key_filtering() const;
56
59
  bool cache_filter_blocks() const;
57
60
 
58
- Status GetOrReadFilterBlock(bool no_io, GetContext* get_context,
61
+ Status GetOrReadFilterBlock(GetContext* get_context,
59
62
  BlockCacheLookupContext* lookup_context,
60
63
  CachableEntry<TBlocklike>* filter_block,
61
64
  const ReadOptions& read_options) const;
@@ -425,6 +425,9 @@ class FastLocalBloomBitsBuilder : public XXPH3FilterBitsBuilder {
425
425
  }
426
426
 
427
427
  double EstimatedFpRate(size_t keys, size_t len_with_metadata) override {
428
+ if (len_with_metadata <= kMetadataLen) {
429
+ return keys > 0 ? 1.0 : 0.0;
430
+ }
428
431
  int num_probes = GetNumProbes(keys, len_with_metadata);
429
432
  return FastLocalBloomImpl::EstimatedFpRate(
430
433
  keys, len_with_metadata - kMetadataLen, num_probes, /*hash bits*/ 64);
@@ -891,6 +894,9 @@ class Standard128RibbonBitsBuilder : public XXPH3FilterBitsBuilder {
891
894
 
892
895
  double EstimatedFpRate(size_t num_entries,
893
896
  size_t len_with_metadata) override {
897
+ if (len_with_metadata <= kMetadataLen) {
898
+ return num_entries > 0 ? 1.0 : 0.0;
899
+ }
894
900
  if (num_entries > kMaxRibbonEntries) {
895
901
  // More entries than supported by this Ribbon
896
902
  return bloom_fallback_.EstimatedFpRate(num_entries, len_with_metadata);
@@ -1030,9 +1036,12 @@ class LegacyBloomBitsBuilder : public BuiltinFilterBitsBuilder {
1030
1036
  return CalculateSpace(num_entries, &dont_care1, &dont_care2);
1031
1037
  }
1032
1038
 
1033
- double EstimatedFpRate(size_t keys, size_t bytes) override {
1034
- return LegacyBloomImpl::EstimatedFpRate(keys, bytes - kMetadataLen,
1035
- num_probes_);
1039
+ double EstimatedFpRate(size_t keys, size_t len_with_metadata) override {
1040
+ if (len_with_metadata <= kMetadataLen) {
1041
+ return keys > 0 ? 1.0 : 0.0;
1042
+ }
1043
+ return LegacyBloomImpl::EstimatedFpRate(
1044
+ keys, len_with_metadata - kMetadataLen, num_probes_);
1036
1045
  }
1037
1046
 
1038
1047
  size_t ApproximateNumEntries(size_t bytes) override;
@@ -20,7 +20,8 @@ namespace ROCKSDB_NAMESPACE {
20
20
  FullFilterBlockBuilder::FullFilterBlockBuilder(
21
21
  const SliceTransform* _prefix_extractor, bool whole_key_filtering,
22
22
  FilterBitsBuilder* filter_bits_builder)
23
- : prefix_extractor_(_prefix_extractor),
23
+ : need_last_prefix_(whole_key_filtering && _prefix_extractor != nullptr),
24
+ prefix_extractor_(_prefix_extractor),
24
25
  whole_key_filtering_(whole_key_filtering),
25
26
  last_whole_key_recorded_(false),
26
27
  last_prefix_recorded_(false),
@@ -38,7 +39,7 @@ void FullFilterBlockBuilder::Add(const Slice& key_without_ts) {
38
39
  const bool add_prefix =
39
40
  prefix_extractor_ && prefix_extractor_->InDomain(key_without_ts);
40
41
 
41
- if (!last_prefix_recorded_ && last_key_in_domain_) {
42
+ if (need_last_prefix_ && !last_prefix_recorded_ && last_key_in_domain_) {
42
43
  // We can reach here when a new filter partition starts in partitioned
43
44
  // filter. The last prefix in the previous partition should be added if
44
45
  // necessary regardless of key_without_ts, to support prefix SeekForPrev.
@@ -82,7 +83,15 @@ inline void FullFilterBlockBuilder::AddKey(const Slice& key) {
82
83
  void FullFilterBlockBuilder::AddPrefix(const Slice& key) {
83
84
  assert(prefix_extractor_ && prefix_extractor_->InDomain(key));
84
85
  Slice prefix = prefix_extractor_->Transform(key);
85
- if (whole_key_filtering_) {
86
+ if (need_last_prefix_) {
87
+ // WART/FIXME: Because last_prefix_str_ is needed above to make
88
+ // SeekForPrev work with partitioned + prefix filters, we are currently
89
+ // use this inefficient code in that case (in addition to prefix+whole
90
+ // key). Hopefully this can be optimized with some refactoring up the call
91
+ // chain to BlockBasedTableBuilder. Even in PartitionedFilterBlockBuilder,
92
+ // we don't currently have access to the previous key/prefix by the time we
93
+ // know we are starting a new partition.
94
+
86
95
  // if both whole_key and prefix are added to bloom then we will have whole
87
96
  // key and prefix addition being interleaved and thus cannot rely on the
88
97
  // bits builder to properly detect the duplicates by comparing with the last
@@ -103,19 +112,19 @@ void FullFilterBlockBuilder::Reset() {
103
112
  last_prefix_recorded_ = false;
104
113
  }
105
114
 
106
- Slice FullFilterBlockBuilder::Finish(
107
- const BlockHandle& /*tmp*/, Status* status,
108
- std::unique_ptr<const char[]>* filter_data) {
115
+ Status FullFilterBlockBuilder::Finish(
116
+ const BlockHandle& /*last_partition_block_handle*/, Slice* filter,
117
+ std::unique_ptr<const char[]>* filter_owner) {
109
118
  Reset();
110
- // In this impl we ignore BlockHandle
111
- *status = Status::OK();
119
+ Status s = Status::OK();
112
120
  if (any_added_) {
113
121
  any_added_ = false;
114
- Slice filter_content = filter_bits_builder_->Finish(
115
- filter_data ? filter_data : &filter_data_, status);
116
- return filter_content;
122
+ *filter = filter_bits_builder_->Finish(
123
+ filter_owner ? filter_owner : &filter_data_, &s);
124
+ } else {
125
+ *filter = Slice{};
117
126
  }
118
- return Slice();
127
+ return s;
119
128
  }
120
129
 
121
130
  FullFilterBlockReader::FullFilterBlockReader(
@@ -123,7 +132,7 @@ FullFilterBlockReader::FullFilterBlockReader(
123
132
  CachableEntry<ParsedFullFilterBlock>&& filter_block)
124
133
  : FilterBlockReaderCommon(t, std::move(filter_block)) {}
125
134
 
126
- bool FullFilterBlockReader::KeyMayMatch(const Slice& key, const bool no_io,
135
+ bool FullFilterBlockReader::KeyMayMatch(const Slice& key,
127
136
  const Slice* const /*const_ikey_ptr*/,
128
137
  GetContext* get_context,
129
138
  BlockCacheLookupContext* lookup_context,
@@ -131,7 +140,7 @@ bool FullFilterBlockReader::KeyMayMatch(const Slice& key, const bool no_io,
131
140
  if (!whole_key_filtering()) {
132
141
  return true;
133
142
  }
134
- return MayMatch(key, no_io, get_context, lookup_context, read_options);
143
+ return MayMatch(key, get_context, lookup_context, read_options);
135
144
  }
136
145
 
137
146
  std::unique_ptr<FilterBlockReader> FullFilterBlockReader::Create(
@@ -162,19 +171,19 @@ std::unique_ptr<FilterBlockReader> FullFilterBlockReader::Create(
162
171
  }
163
172
 
164
173
  bool FullFilterBlockReader::PrefixMayMatch(
165
- const Slice& prefix, const bool no_io,
166
- const Slice* const /*const_ikey_ptr*/, GetContext* get_context,
167
- BlockCacheLookupContext* lookup_context, const ReadOptions& read_options) {
168
- return MayMatch(prefix, no_io, get_context, lookup_context, read_options);
174
+ const Slice& prefix, const Slice* const /*const_ikey_ptr*/,
175
+ GetContext* get_context, BlockCacheLookupContext* lookup_context,
176
+ const ReadOptions& read_options) {
177
+ return MayMatch(prefix, get_context, lookup_context, read_options);
169
178
  }
170
179
 
171
- bool FullFilterBlockReader::MayMatch(const Slice& entry, bool no_io,
180
+ bool FullFilterBlockReader::MayMatch(const Slice& entry,
172
181
  GetContext* get_context,
173
182
  BlockCacheLookupContext* lookup_context,
174
183
  const ReadOptions& read_options) const {
175
184
  CachableEntry<ParsedFullFilterBlock> filter_block;
176
185
 
177
- const Status s = GetOrReadFilterBlock(no_io, get_context, lookup_context,
186
+ const Status s = GetOrReadFilterBlock(get_context, lookup_context,
178
187
  &filter_block, read_options);
179
188
  if (!s.ok()) {
180
189
  IGNORE_STATUS_IF_ERROR(s);
@@ -199,32 +208,30 @@ bool FullFilterBlockReader::MayMatch(const Slice& entry, bool no_io,
199
208
  }
200
209
 
201
210
  void FullFilterBlockReader::KeysMayMatch(
202
- MultiGetRange* range, const bool no_io,
203
- BlockCacheLookupContext* lookup_context, const ReadOptions& read_options) {
211
+ MultiGetRange* range, BlockCacheLookupContext* lookup_context,
212
+ const ReadOptions& read_options) {
204
213
  if (!whole_key_filtering()) {
205
214
  // Simply return. Don't skip any key - consider all keys as likely to be
206
215
  // present
207
216
  return;
208
217
  }
209
- MayMatch(range, no_io, nullptr, lookup_context, read_options);
218
+ MayMatch(range, nullptr, lookup_context, read_options);
210
219
  }
211
220
 
212
221
  void FullFilterBlockReader::PrefixesMayMatch(
213
222
  MultiGetRange* range, const SliceTransform* prefix_extractor,
214
- const bool no_io, BlockCacheLookupContext* lookup_context,
215
- const ReadOptions& read_options) {
216
- MayMatch(range, no_io, prefix_extractor, lookup_context, read_options);
223
+ BlockCacheLookupContext* lookup_context, const ReadOptions& read_options) {
224
+ MayMatch(range, prefix_extractor, lookup_context, read_options);
217
225
  }
218
226
 
219
- void FullFilterBlockReader::MayMatch(MultiGetRange* range, bool no_io,
227
+ void FullFilterBlockReader::MayMatch(MultiGetRange* range,
220
228
  const SliceTransform* prefix_extractor,
221
229
  BlockCacheLookupContext* lookup_context,
222
230
  const ReadOptions& read_options) const {
223
231
  CachableEntry<ParsedFullFilterBlock> filter_block;
224
232
 
225
- const Status s =
226
- GetOrReadFilterBlock(no_io, range->begin()->get_context, lookup_context,
227
- &filter_block, read_options);
233
+ const Status s = GetOrReadFilterBlock(
234
+ range->begin()->get_context, lookup_context, &filter_block, read_options);
228
235
  if (!s.ok()) {
229
236
  IGNORE_STATUS_IF_ERROR(s);
230
237
  return;
@@ -52,8 +52,8 @@ class FullFilterBlockBuilder : public FilterBlockBuilder {
52
52
  void Add(const Slice& key_without_ts) override;
53
53
  bool IsEmpty() const override { return !any_added_; }
54
54
  size_t EstimateEntriesAdded() override;
55
- Slice Finish(const BlockHandle& tmp, Status* status,
56
- std::unique_ptr<const char[]>* filter_data = nullptr) override;
55
+ Status Finish(const BlockHandle& last_partition_block_handle, Slice* filter,
56
+ std::unique_ptr<const char[]>* filter_owner = nullptr) override;
57
57
  using FilterBlockBuilder::Finish;
58
58
 
59
59
  void ResetFilterBitsBuilder() override { filter_bits_builder_.reset(); }
@@ -69,6 +69,7 @@ class FullFilterBlockBuilder : public FilterBlockBuilder {
69
69
  void AddPrefix(const Slice& key);
70
70
  const SliceTransform* prefix_extractor() { return prefix_extractor_; }
71
71
  const std::string& last_prefix_str() const { return last_prefix_str_; }
72
+ bool need_last_prefix_;
72
73
 
73
74
  private:
74
75
  // important: all of these might point to invalid addresses
@@ -102,41 +103,38 @@ class FullFilterBlockReader
102
103
  FilePrefetchBuffer* prefetch_buffer, bool use_cache, bool prefetch,
103
104
  bool pin, BlockCacheLookupContext* lookup_context);
104
105
 
105
- bool KeyMayMatch(const Slice& key, const bool no_io,
106
- const Slice* const const_ikey_ptr, GetContext* get_context,
106
+ bool KeyMayMatch(const Slice& key, const Slice* const const_ikey_ptr,
107
+ GetContext* get_context,
107
108
  BlockCacheLookupContext* lookup_context,
108
109
  const ReadOptions& read_options) override;
109
110
 
110
- bool PrefixMayMatch(const Slice& prefix, const bool no_io,
111
- const Slice* const const_ikey_ptr,
111
+ bool PrefixMayMatch(const Slice& prefix, const Slice* const const_ikey_ptr,
112
112
  GetContext* get_context,
113
113
  BlockCacheLookupContext* lookup_context,
114
114
  const ReadOptions& read_options) override;
115
115
 
116
- void KeysMayMatch(MultiGetRange* range, const bool no_io,
116
+ void KeysMayMatch(MultiGetRange* range,
117
117
  BlockCacheLookupContext* lookup_context,
118
118
  const ReadOptions& read_options) override;
119
119
  // Used in partitioned filter code
120
120
  void KeysMayMatch2(MultiGetRange* range,
121
121
  const SliceTransform* /*prefix_extractor*/,
122
- const bool no_io, BlockCacheLookupContext* lookup_context,
122
+ BlockCacheLookupContext* lookup_context,
123
123
  const ReadOptions& read_options) {
124
- KeysMayMatch(range, no_io, lookup_context, read_options);
124
+ KeysMayMatch(range, lookup_context, read_options);
125
125
  }
126
126
 
127
127
  void PrefixesMayMatch(MultiGetRange* range,
128
128
  const SliceTransform* prefix_extractor,
129
- const bool no_io,
130
129
  BlockCacheLookupContext* lookup_context,
131
130
  const ReadOptions& read_options) override;
132
131
  size_t ApproximateMemoryUsage() const override;
133
132
 
134
133
  private:
135
- bool MayMatch(const Slice& entry, bool no_io, GetContext* get_context,
134
+ bool MayMatch(const Slice& entry, GetContext* get_context,
136
135
  BlockCacheLookupContext* lookup_context,
137
136
  const ReadOptions& read_options) const;
138
- void MayMatch(MultiGetRange* range, bool no_io,
139
- const SliceTransform* prefix_extractor,
137
+ void MayMatch(MultiGetRange* range, const SliceTransform* prefix_extractor,
140
138
  BlockCacheLookupContext* lookup_context,
141
139
  const ReadOptions& read_options) const;
142
140
  };
@@ -114,9 +114,8 @@ InternalIteratorBase<IndexValue>* HashIndexReader::NewIterator(
114
114
  IndexBlockIter* iter, GetContext* get_context,
115
115
  BlockCacheLookupContext* lookup_context) {
116
116
  const BlockBasedTable::Rep* rep = table()->get_rep();
117
- const bool no_io = (read_options.read_tier == kBlockCacheTier);
118
117
  CachableEntry<Block> index_block;
119
- const Status s = GetOrReadIndexBlock(no_io, get_context, lookup_context,
118
+ const Status s = GetOrReadIndexBlock(get_context, lookup_context,
120
119
  &index_block, read_options);
121
120
  if (!s.ok()) {
122
121
  if (iter != nullptr) {