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
@@ -0,0 +1,29 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ //
3
+ // This source code is licensed under both the GPLv2 (found in the
4
+ // COPYING file in the root directory) and Apache 2.0 License
5
+ // (found in the LICENSE.Apache file in the root directory).
6
+
7
+ #pragma once
8
+
9
+ #include "rocksdb/status.h"
10
+
11
+ namespace ROCKSDB_NAMESPACE {
12
+
13
+ // Custom callback functions to support users to plug in logic while data is
14
+ // being written to the DB. It's intended for better synchronization between
15
+ // concurrent writes. Note that these callbacks are in the write's critical path
16
+ // It's desirable to keep them fast and minimum to not affect the write's
17
+ // latency. These callbacks may be called in the context of a different thread.
18
+ class UserWriteCallback {
19
+ public:
20
+ virtual ~UserWriteCallback() {}
21
+
22
+ // This function will be called after the write is enqueued.
23
+ virtual void OnWriteEnqueued() = 0;
24
+
25
+ // This function will be called after wal write finishes if it applies.
26
+ virtual void OnWalWriteFinish() = 0;
27
+ };
28
+
29
+ } // namespace ROCKSDB_NAMESPACE
@@ -67,6 +67,10 @@ class CacheDumpReader {
67
67
  // dump or load process related control variables can be added here.
68
68
  struct CacheDumpOptions {
69
69
  SystemClock* clock;
70
+ // Deadline for dumper or loader in microseconds
71
+ std::chrono::microseconds deadline = std::chrono::microseconds::zero();
72
+ // Max size bytes for dumper or loader
73
+ uint64_t max_size_bytes = 0;
70
74
  };
71
75
 
72
76
  // NOTE that: this class is EXPERIMENTAL! May be changed in the future!
@@ -32,8 +32,10 @@ class Checkpoint {
32
32
  // same filesystem as the database, and copied otherwise.
33
33
  // (2) other required files (like MANIFEST) are always copied.
34
34
  // log_size_for_flush: if the total log file size is equal or larger than
35
- // this value, then a flush is triggered for all the column families. The
36
- // default value is 0, which means flush is always triggered. If you move
35
+ // this value, then a flush is triggered for all the column families.
36
+ // The archived log size will not be included when calculating the total log
37
+ // size.
38
+ // The default value is 0, which means flush is always triggered. If you move
37
39
  // away from the default, the checkpoint may not contain up-to-date data
38
40
  // if WAL writing is not always enabled.
39
41
  // Flush will always trigger if it is 2PC.
@@ -16,7 +16,6 @@
16
16
  #include <memory>
17
17
  #include <unordered_map>
18
18
 
19
- #include "options/configurable_helper.h"
20
19
  #include "rocksdb/convenience.h"
21
20
  #include "rocksdb/customizable.h"
22
21
  #include "rocksdb/status.h"
@@ -83,7 +83,7 @@ class EnvMirror : public EnvWrapper {
83
83
  std::sort(ar.begin(), ar.end());
84
84
  std::sort(br.begin(), br.end());
85
85
  if (!as.ok() || ar != br) {
86
- assert(0 == "getchildren results don't match");
86
+ assert(nullptr == "getchildren results don't match");
87
87
  }
88
88
  *r = ar;
89
89
  return as;
@@ -35,6 +35,7 @@ class LDBCommand {
35
35
  static const std::string ARG_DB;
36
36
  static const std::string ARG_PATH;
37
37
  static const std::string ARG_SECONDARY_PATH;
38
+ static const std::string ARG_LEADER_PATH;
38
39
  static const std::string ARG_HEX;
39
40
  static const std::string ARG_KEY_HEX;
40
41
  static const std::string ARG_VALUE_HEX;
@@ -72,6 +73,7 @@ class LDBCommand {
72
73
  static const std::string ARG_PREPOPULATE_BLOB_CACHE;
73
74
  static const std::string ARG_DECODE_BLOB_INDEX;
74
75
  static const std::string ARG_DUMP_UNCOMPRESSED_BLOBS;
76
+ static const std::string ARG_READ_TIMESTAMP;
75
77
 
76
78
  struct ParsedParams {
77
79
  std::string cmd;
@@ -82,6 +84,10 @@ class LDBCommand {
82
84
 
83
85
  static LDBCommand* SelectCommand(const ParsedParams& parsed_parms);
84
86
 
87
+ static void ParseSingleParam(const std::string& param,
88
+ ParsedParams& parsed_params,
89
+ std::vector<std::string>& cmd_tokens);
90
+
85
91
  static LDBCommand* InitFromCmdLineArgs(
86
92
  const std::vector<std::string>& args, const Options& options,
87
93
  const LDBOptions& ldb_options,
@@ -155,10 +161,12 @@ class LDBCommand {
155
161
  // with this secondary path. When running against a database opened by
156
162
  // another process, ldb wll leave the source directory completely intact.
157
163
  std::string secondary_path_;
164
+ std::string leader_path_;
158
165
  std::string column_family_name_;
159
166
  DB* db_;
160
167
  DBWithTTL* db_ttl_;
161
168
  std::map<std::string, ColumnFamilyHandle*> cf_handles_;
169
+ std::map<uint32_t, const Comparator*> ucmps_;
162
170
 
163
171
  /**
164
172
  * true implies that this command can work if the db is opened in read-only
@@ -190,6 +198,9 @@ class LDBCommand {
190
198
 
191
199
  bool create_if_missing_;
192
200
 
201
+ /** Encoded user provided uint64_t read timestamp. */
202
+ std::string read_timestamp_;
203
+
193
204
  /**
194
205
  * Map of options passed on the command-line.
195
206
  */
@@ -220,17 +231,19 @@ class LDBCommand {
220
231
  ColumnFamilyHandle* GetCfHandle();
221
232
 
222
233
  static std::string PrintKeyValue(const std::string& key,
234
+ const std::string& timestamp,
223
235
  const std::string& value, bool is_key_hex,
224
- bool is_value_hex);
236
+ bool is_value_hex, const Comparator* ucmp);
225
237
 
226
238
  static std::string PrintKeyValue(const std::string& key,
227
- const std::string& value, bool is_hex);
239
+ const std::string& timestamp,
240
+ const std::string& value, bool is_hex,
241
+ const Comparator* ucmp);
228
242
 
229
- static std::string PrintKeyValueOrWideColumns(const Slice& key,
230
- const Slice& value,
231
- const WideColumns& wide_columns,
232
- bool is_key_hex,
233
- bool is_value_hex);
243
+ static std::string PrintKeyValueOrWideColumns(
244
+ const Slice& key, const Slice& timestamp, const Slice& value,
245
+ const WideColumns& wide_columns, bool is_key_hex, bool is_value_hex,
246
+ const Comparator* ucmp);
234
247
 
235
248
  /**
236
249
  * Return true if the specified flag is present in the specified flags vector
@@ -275,6 +288,10 @@ class LDBCommand {
275
288
  bool ParseBooleanOption(const std::map<std::string, std::string>& options,
276
289
  const std::string& option, bool default_val);
277
290
 
291
+ /* Populate `ropts.timestamp` from command line flag --read_timestamp */
292
+ Status MaybePopulateReadTimestamp(ColumnFamilyHandle* cfh, ReadOptions& ropts,
293
+ Slice* read_timestamp);
294
+
278
295
  Options options_;
279
296
  std::vector<ColumnFamilyDescriptor> column_families_;
280
297
  ConfigOptions config_options_;
@@ -15,10 +15,10 @@ namespace ROCKSDB_NAMESPACE {
15
15
  // Multiple column families is not supported.
16
16
  // It is best-effort. No guarantee to succeed.
17
17
  // A full compaction may be executed.
18
- // If the target options use FIFO compaction, the FIFO condition might be
19
- // sacrificed: for data migrated, data inserted later might be dropped
20
- // earlier. This is to gurantee FIFO compaction won't drop all the
21
- // migrated data to fit max_table_files_size.
18
+ // WARNING: using this to migrate from non-FIFO to FIFO compaction
19
+ // with `Options::compaction_options_fifo.max_table_files_size` > 0 can cause
20
+ // the whole DB to be dropped right after migration if the migrated data is
21
+ // larger than `max_table_files_size`
22
22
  Status OptionChangeMigration(std::string dbname, const Options& old_opts,
23
23
  const Options& new_opts);
24
24
  } // namespace ROCKSDB_NAMESPACE
@@ -103,12 +103,18 @@ class StackableDB : public DB {
103
103
  }
104
104
 
105
105
  using DB::GetEntity;
106
+
106
107
  Status GetEntity(const ReadOptions& options,
107
108
  ColumnFamilyHandle* column_family, const Slice& key,
108
109
  PinnableWideColumns* columns) override {
109
110
  return db_->GetEntity(options, column_family, key, columns);
110
111
  }
111
112
 
113
+ Status GetEntity(const ReadOptions& options, const Slice& key,
114
+ PinnableAttributeGroups* result) override {
115
+ return db_->GetEntity(options, key, result);
116
+ }
117
+
112
118
  using DB::GetMergeOperands;
113
119
  Status GetMergeOperands(const ReadOptions& options,
114
120
  ColumnFamilyHandle* column_family, const Slice& key,
@@ -147,6 +153,12 @@ class StackableDB : public DB {
147
153
  statuses, sorted_input);
148
154
  }
149
155
 
156
+ void MultiGetEntity(const ReadOptions& options, size_t num_keys,
157
+ const Slice* keys,
158
+ PinnableAttributeGroups* results) override {
159
+ db_->MultiGetEntity(options, num_keys, keys, results);
160
+ }
161
+
150
162
  using DB::IngestExternalFile;
151
163
  Status IngestExternalFile(ColumnFamilyHandle* column_family,
152
164
  const std::vector<std::string>& external_files,
@@ -259,11 +271,18 @@ class StackableDB : public DB {
259
271
  return db_->NewIterators(options, column_families, iterators);
260
272
  }
261
273
 
262
- using DB::NewMultiCfIterator;
263
- std::unique_ptr<Iterator> NewMultiCfIterator(
274
+ using DB::NewCoalescingIterator;
275
+ std::unique_ptr<Iterator> NewCoalescingIterator(
276
+ const ReadOptions& options,
277
+ const std::vector<ColumnFamilyHandle*>& column_families) override {
278
+ return db_->NewCoalescingIterator(options, column_families);
279
+ }
280
+
281
+ using DB::NewAttributeGroupIterator;
282
+ std::unique_ptr<AttributeGroupIterator> NewAttributeGroupIterator(
264
283
  const ReadOptions& options,
265
284
  const std::vector<ColumnFamilyHandle*>& column_families) override {
266
- return db_->NewMultiCfIterator(options, column_families);
285
+ return db_->NewAttributeGroupIterator(options, column_families);
267
286
  }
268
287
 
269
288
  const Snapshot* GetSnapshot() override { return db_->GetSnapshot(); }
@@ -482,12 +501,12 @@ class StackableDB : public DB {
482
501
  return db_->GetFullHistoryTsLow(column_family, ts_low);
483
502
  }
484
503
 
485
- Status GetSortedWalFiles(VectorLogPtr& files) override {
504
+ Status GetSortedWalFiles(VectorWalPtr& files) override {
486
505
  return db_->GetSortedWalFiles(files);
487
506
  }
488
507
 
489
508
  Status GetCurrentWalFile(
490
- std::unique_ptr<LogFile>* current_log_file) override {
509
+ std::unique_ptr<WalFile>* current_log_file) override {
491
510
  return db_->GetCurrentWalFile(current_log_file);
492
511
  }
493
512
 
@@ -84,4 +84,50 @@ std::shared_ptr<CompactOnDeletionCollectorFactory>
84
84
  NewCompactOnDeletionCollectorFactory(size_t sliding_window_size,
85
85
  size_t deletion_trigger,
86
86
  double deletion_ratio = 0);
87
+
88
+ // A factory of a table property collector that marks a SST file as
89
+ // need-compaction when for the tiering use case, it observes, among all the
90
+ // data entries, the ratio of entries that are already eligible to be placed on
91
+ // the last level but are not yet on the last level is equal to or higher than
92
+ // the configured `compaction_trigger_ratio_`.
93
+ // 1) Setting the ratio to be equal to or smaller than 0 disables this collector
94
+ // 2) Setting the ratio to be within (0, 1] will write the number of
95
+ // observed eligible entries into a user property and marks a file as
96
+ // need-compaction when aforementioned condition is met.
97
+ // 3) Setting the ratio to be higher than 1 can be used to just writes the user
98
+ // table property, and not mark any file as need compaction.
99
+ // For a column family that does not enable tiering feature, even if an
100
+ // effective configuration is provided, this collector is still disabled.
101
+ class CompactForTieringCollectorFactory
102
+ : public TablePropertiesCollectorFactory {
103
+ public:
104
+ // @param compaction_trigger_ratio: the triggering threshold for the ratio of
105
+ // eligible entries to the total number of entries. See class documentation
106
+ // for what entry is eligible.
107
+ CompactForTieringCollectorFactory(double compaction_trigger_ratio);
108
+
109
+ ~CompactForTieringCollectorFactory() {}
110
+
111
+ TablePropertiesCollector* CreateTablePropertiesCollector(
112
+ TablePropertiesCollectorFactory::Context context) override;
113
+
114
+ void SetCompactionTriggerRatio(double new_ratio) {
115
+ compaction_trigger_ratio_.store(new_ratio);
116
+ }
117
+
118
+ double GetCompactionTriggerRatio() const {
119
+ return compaction_trigger_ratio_.load();
120
+ }
121
+
122
+ static const char* kClassName() { return "CompactForTieringCollector"; }
123
+ const char* Name() const override { return kClassName(); }
124
+
125
+ std::string ToString() const override;
126
+
127
+ private:
128
+ std::atomic<double> compaction_trigger_ratio_;
129
+ };
130
+
131
+ std::shared_ptr<CompactForTieringCollectorFactory>
132
+ NewCompactForTieringCollectorFactory(double compaction_trigger_ratio);
87
133
  } // namespace ROCKSDB_NAMESPACE
@@ -5,7 +5,6 @@
5
5
 
6
6
  #pragma once
7
7
 
8
-
9
8
  #include <limits>
10
9
  #include <string>
11
10
  #include <vector>
@@ -165,7 +164,7 @@ class Transaction {
165
164
  virtual void SetSnapshot() = 0;
166
165
 
167
166
  // Similar to SetSnapshot(), but will not change the current snapshot
168
- // until Put/Merge/Delete/GetForUpdate/MultigetForUpdate is called.
167
+ // until Put/PutEntity/Merge/Delete/GetForUpdate/MultigetForUpdate is called.
169
168
  // By calling this function, the transaction will essentially call
170
169
  // SetSnapshot() for you right before performing the next write/GetForUpdate.
171
170
  //
@@ -268,10 +267,10 @@ class Transaction {
268
267
  // points.
269
268
  virtual void SetSavePoint() = 0;
270
269
 
271
- // Undo all operations in this transaction (Put, Merge, Delete, PutLogData)
272
- // since the most recent call to SetSavePoint() and removes the most recent
273
- // SetSavePoint().
274
- // If there is no previous call to SetSavePoint(), returns Status::NotFound()
270
+ // Undo all operations in this transaction (Put, PutEntity, Merge, Delete,
271
+ // PutLogData) since the most recent call to SetSavePoint() and removes the
272
+ // most recent SetSavePoint(). If there is no previous call to SetSavePoint(),
273
+ // returns Status::NotFound()
275
274
  virtual Status RollbackToSavePoint() = 0;
276
275
 
277
276
  // Pop the most recent save point.
@@ -318,6 +317,10 @@ class Transaction {
318
317
  return s;
319
318
  }
320
319
 
320
+ virtual Status GetEntity(const ReadOptions& options,
321
+ ColumnFamilyHandle* column_family, const Slice& key,
322
+ PinnableWideColumns* columns) = 0;
323
+
321
324
  virtual std::vector<Status> MultiGet(
322
325
  const ReadOptions& options,
323
326
  const std::vector<ColumnFamilyHandle*>& column_family,
@@ -354,6 +357,12 @@ class Transaction {
354
357
  }
355
358
  }
356
359
 
360
+ virtual void MultiGetEntity(const ReadOptions& options,
361
+ ColumnFamilyHandle* column_family,
362
+ size_t num_keys, const Slice* keys,
363
+ PinnableWideColumns* results, Status* statuses,
364
+ bool sorted_input = false) = 0;
365
+
357
366
  // Read this key and ensure that this transaction will only
358
367
  // be able to be committed if this key is not written outside this
359
368
  // transaction after it has first been read (or after the snapshot if a
@@ -434,6 +443,13 @@ class Transaction {
434
443
  }
435
444
  }
436
445
 
446
+ virtual Status GetEntityForUpdate(const ReadOptions& read_options,
447
+ ColumnFamilyHandle* column_family,
448
+ const Slice& key,
449
+ PinnableWideColumns* columns,
450
+ bool exclusive = true,
451
+ bool do_validate = true) = 0;
452
+
437
453
  virtual std::vector<Status> MultiGetForUpdate(
438
454
  const ReadOptions& options,
439
455
  const std::vector<ColumnFamilyHandle*>& column_family,
@@ -461,9 +477,9 @@ class Transaction {
461
477
  virtual Iterator* GetIterator(const ReadOptions& read_options,
462
478
  ColumnFamilyHandle* column_family) = 0;
463
479
 
464
- // Put, Merge, Delete, and SingleDelete behave similarly to the corresponding
465
- // functions in WriteBatch, but will also do conflict checking on the
466
- // keys being written.
480
+ // Put, PutEntity, Merge, Delete, and SingleDelete behave similarly to the
481
+ // corresponding functions in WriteBatch, but will also do conflict checking
482
+ // on the keys being written.
467
483
  //
468
484
  // assume_tracked=true expects the key be already tracked. More
469
485
  // specifically, it means the the key was previous tracked in the same
@@ -489,6 +505,10 @@ class Transaction {
489
505
  const bool assume_tracked = false) = 0;
490
506
  virtual Status Put(const SliceParts& key, const SliceParts& value) = 0;
491
507
 
508
+ virtual Status PutEntity(ColumnFamilyHandle* column_family, const Slice& key,
509
+ const WideColumns& columns,
510
+ bool assume_tracked = false) = 0;
511
+
492
512
  virtual Status Merge(ColumnFamilyHandle* column_family, const Slice& key,
493
513
  const Slice& value,
494
514
  const bool assume_tracked = false) = 0;
@@ -528,6 +548,10 @@ class Transaction {
528
548
  virtual Status PutUntracked(const SliceParts& key,
529
549
  const SliceParts& value) = 0;
530
550
 
551
+ virtual Status PutEntityUntracked(ColumnFamilyHandle* column_family,
552
+ const Slice& key,
553
+ const WideColumns& columns) = 0;
554
+
531
555
  virtual Status MergeUntracked(ColumnFamilyHandle* column_family,
532
556
  const Slice& key, const Slice& value) = 0;
533
557
  virtual Status MergeUntracked(const Slice& key, const Slice& value) = 0;
@@ -556,18 +580,18 @@ class Transaction {
556
580
  // Similar to WriteBatch::PutLogData
557
581
  virtual void PutLogData(const Slice& blob) = 0;
558
582
 
559
- // By default, all Put/Merge/Delete operations will be indexed in the
560
- // transaction so that Get/GetForUpdate/GetIterator can search for these
583
+ // By default, all Put/PutEntity/Merge/Delete operations will be indexed in
584
+ // the transaction so that Get/GetForUpdate/GetIterator can search for these
561
585
  // keys.
562
586
  //
563
587
  // If the caller does not want to fetch the keys about to be written,
564
588
  // they may want to avoid indexing as a performance optimization.
565
589
  // Calling DisableIndexing() will turn off indexing for all future
566
- // Put/Merge/Delete operations until EnableIndexing() is called.
590
+ // Put/PutEntity/Merge/Delete operations until EnableIndexing() is called.
567
591
  //
568
- // If a key is Put/Merge/Deleted after DisableIndexing is called and then
569
- // is fetched via Get/GetForUpdate/GetIterator, the result of the fetch is
570
- // undefined.
592
+ // If a key is written (using Put/PutEntity/Merge/Delete) after
593
+ // DisableIndexing is called and then is fetched via
594
+ // Get/GetForUpdate/GetIterator, the result of the fetch is undefined.
571
595
  virtual void DisableIndexing() = 0;
572
596
  virtual void EnableIndexing() = 0;
573
597
 
@@ -578,9 +602,10 @@ class Transaction {
578
602
  // number of keys that need to be checked for conflicts at commit time.
579
603
  virtual uint64_t GetNumKeys() const = 0;
580
604
 
581
- // Returns the number of Puts/Deletes/Merges that have been applied to this
582
- // transaction so far.
605
+ // Returns the number of Put/PutEntity/Delete/Merge operations that have been
606
+ // applied to this transaction so far.
583
607
  virtual uint64_t GetNumPuts() const = 0;
608
+ virtual uint64_t GetNumPutEntities() const = 0;
584
609
  virtual uint64_t GetNumDeletes() const = 0;
585
610
  virtual uint64_t GetNumMerges() const = 0;
586
611
 
@@ -235,6 +235,11 @@ struct TransactionDBOptions {
235
235
  const Slice& /*key*/)>
236
236
  rollback_deletion_type_callback;
237
237
 
238
+ // A flag to control for the whole DB whether user-defined timestamp based
239
+ // validation are enabled when applicable. Only WriteCommittedTxn support
240
+ // user-defined timestamps so this option only applies in this case.
241
+ bool enable_udt_validation = true;
242
+
238
243
  private:
239
244
  // 128 entries
240
245
  // Should the default value change, please also update wp_snapshot_cache_bits
@@ -0,0 +1,36 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ //
3
+ // This source code is licensed under both the GPLv2 (found in the
4
+ // COPYING file in the root directory) and Apache 2.0 License
5
+ // (found in the LICENSE.Apache file in the root directory).
6
+
7
+ #pragma once
8
+
9
+ #include "rocksdb/comparator.h"
10
+ #include "rocksdb/slice.h"
11
+ #include "rocksdb/status.h"
12
+ #include "rocksdb/types.h"
13
+
14
+ namespace ROCKSDB_NAMESPACE {
15
+
16
+ // Given a user key, creates the internal key used for `Seek` operation for a
17
+ // raw table iterator. The internal key is stored in `buf`.
18
+ // `comparator` should be the same as the `Options.comparator` used to create
19
+ // the column family or the `SstFileWriter`.
20
+ Status GetInternalKeyForSeek(const Slice& user_key,
21
+ const Comparator* comparator, std::string* buf);
22
+
23
+ // Given a user key, creates the internal key used for `SeekForPrev` operation
24
+ // for a raw table iterator. The internal key is stored in `buf`.
25
+ // `comparator`: see doc for `GetInternalKeyForSeek`.
26
+ Status GetInternalKeyForSeekForPrev(const Slice& user_key,
27
+ const Comparator* comparator,
28
+ std::string* buf);
29
+
30
+ // Util method that takes an internal key and parse it to get `ParsedEntryInfo`.
31
+ // Such an internal key usually comes from a table iterator.
32
+ // `comparator`: see doc for `GetInternalKeyForSeek`.
33
+ Status ParseEntry(const Slice& internal_key, const Comparator* comparator,
34
+ ParsedEntryInfo* parsed_entry);
35
+
36
+ } // namespace ROCKSDB_NAMESPACE
@@ -130,7 +130,7 @@ class WriteBatchWithIndex : public WriteBatchBase {
130
130
  "Cannot call this method without attribute groups");
131
131
  }
132
132
  return Status::NotSupported(
133
- "PutEntity not supported by WriteBatchWithIndex");
133
+ "PutEntity with AttributeGroups not supported by WriteBatchWithIndex");
134
134
  }
135
135
 
136
136
  using WriteBatchBase::Merge;
@@ -268,7 +268,28 @@ class WriteBatchWithIndex : public WriteBatchBase {
268
268
  ColumnFamilyHandle* column_family, const Slice& key,
269
269
  PinnableSlice* value);
270
270
 
271
- // TODO: implement GetEntityFromBatchAndDB
271
+ // Similar to DB::GetEntity() but also reads writes from this batch.
272
+ //
273
+ // This method queries the batch for the key and if the result can be
274
+ // determined based on the batch alone, it is returned (assuming the key is
275
+ // found, in the form of a wide-column entity). If the batch does not contain
276
+ // enough information to determine the result (the key is not present in the
277
+ // batch at all or a merge is in progress), the DB is queried and the result
278
+ // is merged with the entries from the batch if necessary.
279
+ //
280
+ // Setting read_options.snapshot will affect what is read from the DB
281
+ // but will NOT change which keys are read from the batch (the keys in
282
+ // this batch do not yet belong to any snapshot and will be fetched
283
+ // regardless).
284
+ Status GetEntityFromBatchAndDB(DB* db, const ReadOptions& read_options,
285
+ ColumnFamilyHandle* column_family,
286
+ const Slice& key,
287
+ PinnableWideColumns* columns) {
288
+ constexpr ReadCallback* callback = nullptr;
289
+
290
+ return GetEntityFromBatchAndDB(db, read_options, column_family, key,
291
+ columns, callback);
292
+ }
272
293
 
273
294
  void MultiGetFromBatchAndDB(DB* db, const ReadOptions& read_options,
274
295
  ColumnFamilyHandle* column_family,
@@ -276,7 +297,31 @@ class WriteBatchWithIndex : public WriteBatchBase {
276
297
  PinnableSlice* values, Status* statuses,
277
298
  bool sorted_input);
278
299
 
279
- // TODO: implement MultiGetEntityFromBatchAndDB
300
+ // Similar to DB::MultiGetEntity() but also reads writes from this batch.
301
+ //
302
+ // For each key, this method queries the batch and if the result can be
303
+ // determined based on the batch alone, it is returned in the appropriate
304
+ // PinnableWideColumns object (assuming the key is found). For all keys for
305
+ // which the batch does not contain enough information to determine the result
306
+ // (the key is not present in the batch at all or a merge is in progress), the
307
+ // DB is queried and the result is merged with the entries from the batch if
308
+ // necessary.
309
+ //
310
+ // Setting read_options.snapshot will affect what is read from the DB
311
+ // but will NOT change which keys are read from the batch (the keys in
312
+ // this batch do not yet belong to any snapshot and will be fetched
313
+ // regardless).
314
+ void MultiGetEntityFromBatchAndDB(DB* db, const ReadOptions& read_options,
315
+ ColumnFamilyHandle* column_family,
316
+ size_t num_keys, const Slice* keys,
317
+ PinnableWideColumns* results,
318
+ Status* statuses, bool sorted_input) {
319
+ constexpr ReadCallback* callback = nullptr;
320
+
321
+ MultiGetEntityFromBatchAndDB(db, read_options, column_family, num_keys,
322
+ keys, results, statuses, sorted_input,
323
+ callback);
324
+ }
280
325
 
281
326
  // Records the state of the batch for future calls to RollbackToSavePoint().
282
327
  // May be called multiple times to set multiple save points.
@@ -314,11 +359,23 @@ class WriteBatchWithIndex : public WriteBatchBase {
314
359
  // last sub-batch.
315
360
  size_t SubBatchCnt();
316
361
 
362
+ void MergeAcrossBatchAndDBImpl(ColumnFamilyHandle* column_family,
363
+ const Slice& key,
364
+ const PinnableWideColumns& existing,
365
+ const MergeContext& merge_context,
366
+ std::string* value,
367
+ PinnableWideColumns* columns, Status* status);
317
368
  void MergeAcrossBatchAndDB(ColumnFamilyHandle* column_family,
318
369
  const Slice& key,
319
370
  const PinnableWideColumns& existing,
320
371
  const MergeContext& merge_context,
321
372
  PinnableSlice* value, Status* status);
373
+ void MergeAcrossBatchAndDB(ColumnFamilyHandle* column_family,
374
+ const Slice& key,
375
+ const PinnableWideColumns& existing,
376
+ const MergeContext& merge_context,
377
+ PinnableWideColumns* columns, Status* status);
378
+
322
379
  Status GetFromBatchAndDB(DB* db, const ReadOptions& read_options,
323
380
  ColumnFamilyHandle* column_family, const Slice& key,
324
381
  PinnableSlice* value, ReadCallback* callback);
@@ -327,6 +384,17 @@ class WriteBatchWithIndex : public WriteBatchBase {
327
384
  const size_t num_keys, const Slice* keys,
328
385
  PinnableSlice* values, Status* statuses,
329
386
  bool sorted_input, ReadCallback* callback);
387
+ Status GetEntityFromBatchAndDB(DB* db, const ReadOptions& read_options,
388
+ ColumnFamilyHandle* column_family,
389
+ const Slice& key, PinnableWideColumns* columns,
390
+ ReadCallback* callback);
391
+ void MultiGetEntityFromBatchAndDB(DB* db, const ReadOptions& read_options,
392
+ ColumnFamilyHandle* column_family,
393
+ size_t num_keys, const Slice* keys,
394
+ PinnableWideColumns* results,
395
+ Status* statuses, bool sorted_input,
396
+ ReadCallback* callback);
397
+
330
398
  struct Rep;
331
399
  std::unique_ptr<Rep> rep;
332
400
  };
@@ -12,8 +12,8 @@
12
12
  // NOTE: in 'main' development branch, this should be the *next*
13
13
  // minor or major version number planned for release.
14
14
  #define ROCKSDB_MAJOR 9
15
- #define ROCKSDB_MINOR 1
16
- #define ROCKSDB_PATCH 1
15
+ #define ROCKSDB_MINOR 6
16
+ #define ROCKSDB_PATCH 0
17
17
 
18
18
  // Do not use these. We made the mistake of declaring macros starting with
19
19
  // double underscore. Now we have to live with our choice. We'll deprecate these