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,114 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ // This source code is licensed under both the GPLv2 (found in the
3
+ // COPYING file in the root directory) and Apache 2.0 License
4
+ // (found in the LICENSE.Apache file in the root directory).
5
+
6
+ #pragma once
7
+
8
+ #include "rocksdb/iterator_base.h"
9
+ #include "rocksdb/wide_columns.h"
10
+
11
+ namespace ROCKSDB_NAMESPACE {
12
+
13
+ class ColumnFamilyHandle;
14
+
15
+ // Class representing attribute group. Attribute group is a logical grouping of
16
+ // wide-column entities by leveraging Column Families.
17
+ // Used in Write Path
18
+ class AttributeGroup {
19
+ public:
20
+ explicit AttributeGroup(ColumnFamilyHandle* column_family,
21
+ const WideColumns& columns)
22
+ : column_family_(column_family), columns_(columns) {}
23
+
24
+ ColumnFamilyHandle* column_family() const { return column_family_; }
25
+ const WideColumns& columns() const { return columns_; }
26
+ WideColumns& columns() { return columns_; }
27
+
28
+ private:
29
+ ColumnFamilyHandle* column_family_;
30
+ WideColumns columns_;
31
+ };
32
+
33
+ inline bool operator==(const AttributeGroup& lhs, const AttributeGroup& rhs) {
34
+ return lhs.column_family() == rhs.column_family() &&
35
+ lhs.columns() == rhs.columns();
36
+ }
37
+
38
+ // A collection of Attribute Groups.
39
+ using AttributeGroups = std::vector<AttributeGroup>;
40
+
41
+ // An empty set of Attribute Groups.
42
+ extern const AttributeGroups kNoAttributeGroups;
43
+
44
+ // Used in Read Path. Wide-columns returned from the query are pinnable.
45
+ class PinnableAttributeGroup {
46
+ public:
47
+ explicit PinnableAttributeGroup(ColumnFamilyHandle* column_family)
48
+ : column_family_(column_family), status_(Status::OK()) {}
49
+
50
+ ColumnFamilyHandle* column_family() const { return column_family_; }
51
+ const Status& status() const { return status_; }
52
+ const WideColumns& columns() const { return columns_.columns(); }
53
+
54
+ void SetStatus(const Status& status);
55
+ void SetColumns(PinnableWideColumns&& columns);
56
+
57
+ void Reset();
58
+
59
+ private:
60
+ ColumnFamilyHandle* column_family_;
61
+ Status status_;
62
+ PinnableWideColumns columns_;
63
+ };
64
+
65
+ inline void PinnableAttributeGroup::SetStatus(const Status& status) {
66
+ status_ = status;
67
+ }
68
+ inline void PinnableAttributeGroup::SetColumns(PinnableWideColumns&& columns) {
69
+ columns_ = std::move(columns);
70
+ }
71
+
72
+ inline void PinnableAttributeGroup::Reset() {
73
+ SetStatus(Status::OK());
74
+ columns_.Reset();
75
+ }
76
+
77
+ // A collection of Pinnable Attribute Groups.
78
+ using PinnableAttributeGroups = std::vector<PinnableAttributeGroup>;
79
+
80
+ // Used in Iterator Path. Uses pointers to the columns to avoid having to copy
81
+ // all WideColumns objs during iteration.
82
+ class IteratorAttributeGroup {
83
+ public:
84
+ explicit IteratorAttributeGroup(ColumnFamilyHandle* column_family,
85
+ const WideColumns* columns)
86
+ : column_family_(column_family), columns_(columns) {}
87
+ ColumnFamilyHandle* column_family() const { return column_family_; }
88
+ const WideColumns& columns() const { return *columns_; }
89
+
90
+ private:
91
+ ColumnFamilyHandle* column_family_;
92
+ const WideColumns* columns_;
93
+ };
94
+
95
+ using IteratorAttributeGroups = std::vector<IteratorAttributeGroup>;
96
+
97
+ extern const IteratorAttributeGroups kNoIteratorAttributeGroups;
98
+
99
+ // EXPERIMENTAL
100
+ // A cross-column-family iterator that collects and returns attribute groups for
101
+ // each key in order provided by comparator
102
+ class AttributeGroupIterator : public IteratorBase {
103
+ public:
104
+ AttributeGroupIterator() {}
105
+ ~AttributeGroupIterator() override {}
106
+
107
+ // No copy allowed
108
+ AttributeGroupIterator(const AttributeGroupIterator&) = delete;
109
+ AttributeGroupIterator& operator=(const AttributeGroupIterator&) = delete;
110
+
111
+ virtual const IteratorAttributeGroups& attribute_groups() const = 0;
112
+ };
113
+
114
+ } // namespace ROCKSDB_NAMESPACE
@@ -434,6 +434,9 @@ rocksdb_create_column_family_with_ttl(
434
434
  extern ROCKSDB_LIBRARY_API void rocksdb_drop_column_family(
435
435
  rocksdb_t* db, rocksdb_column_family_handle_t* handle, char** errptr);
436
436
 
437
+ extern ROCKSDB_LIBRARY_API rocksdb_column_family_handle_t*
438
+ rocksdb_get_default_column_family_handle(rocksdb_t* db);
439
+
437
440
  extern ROCKSDB_LIBRARY_API void rocksdb_column_family_handle_destroy(
438
441
  rocksdb_column_family_handle_t*);
439
442
 
@@ -502,6 +505,13 @@ extern ROCKSDB_LIBRARY_API char* rocksdb_get_cf_with_ts(
502
505
  rocksdb_column_family_handle_t* column_family, const char* key,
503
506
  size_t keylen, size_t* vallen, char** ts, size_t* tslen, char** errptr);
504
507
 
508
+ /**
509
+ * Returns a malloc() buffer with the DB identity, assigning the length to
510
+ * *id_len. Returns NULL if an error occurred.
511
+ */
512
+ extern ROCKSDB_LIBRARY_API char* rocksdb_get_db_identity(rocksdb_t* db,
513
+ size_t* id_len);
514
+
505
515
  // if values_list[i] == NULL and errs[i] == NULL,
506
516
  // then we got status.IsNotFound(), which we will not return.
507
517
  // all errors except status status.ok() and status.IsNotFound() are returned.
@@ -640,6 +650,19 @@ extern ROCKSDB_LIBRARY_API void rocksdb_approximate_sizes_cf(
640
650
  const size_t* range_start_key_len, const char* const* range_limit_key,
641
651
  const size_t* range_limit_key_len, uint64_t* sizes, char** errptr);
642
652
 
653
+ enum {
654
+ rocksdb_size_approximation_flags_none = 0,
655
+ rocksdb_size_approximation_flags_include_memtable = 1 << 0,
656
+ rocksdb_size_approximation_flags_include_files = 1 << 1,
657
+ };
658
+
659
+ extern ROCKSDB_LIBRARY_API void rocksdb_approximate_sizes_cf_with_flags(
660
+ rocksdb_t* db, rocksdb_column_family_handle_t* column_family,
661
+ int num_ranges, const char* const* range_start_key,
662
+ const size_t* range_start_key_len, const char* const* range_limit_key,
663
+ const size_t* range_limit_key_len, uint8_t include_flags, uint64_t* sizes,
664
+ char** errptr);
665
+
643
666
  extern ROCKSDB_LIBRARY_API void rocksdb_compact_range(rocksdb_t* db,
644
667
  const char* start_key,
645
668
  size_t start_key_len,
@@ -727,6 +750,8 @@ extern ROCKSDB_LIBRARY_API const char* rocksdb_iter_timestamp(
727
750
  const rocksdb_iterator_t*, size_t* tslen);
728
751
  extern ROCKSDB_LIBRARY_API void rocksdb_iter_get_error(
729
752
  const rocksdb_iterator_t*, char** errptr);
753
+ extern ROCKSDB_LIBRARY_API void rocksdb_iter_refresh(
754
+ const rocksdb_iterator_t* iter, char** errptr);
730
755
 
731
756
  extern ROCKSDB_LIBRARY_API void rocksdb_wal_iter_next(
732
757
  rocksdb_wal_iterator_t* iter);
@@ -747,6 +772,10 @@ extern ROCKSDB_LIBRARY_API rocksdb_writebatch_t* rocksdb_writebatch_create(
747
772
  void);
748
773
  extern ROCKSDB_LIBRARY_API rocksdb_writebatch_t* rocksdb_writebatch_create_from(
749
774
  const char* rep, size_t size);
775
+ extern ROCKSDB_LIBRARY_API rocksdb_writebatch_t*
776
+ rocksdb_writebatch_create_with_params(size_t reserved_bytes, size_t max_bytes,
777
+ size_t protection_bytes_per_key,
778
+ size_t default_cf_ts_sz);
750
779
  extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_destroy(
751
780
  rocksdb_writebatch_t*);
752
781
  extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_clear(rocksdb_writebatch_t*);
@@ -834,6 +863,13 @@ extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_iterate(
834
863
  rocksdb_writebatch_t*, void* state,
835
864
  void (*put)(void*, const char* k, size_t klen, const char* v, size_t vlen),
836
865
  void (*deleted)(void*, const char* k, size_t klen));
866
+ extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_iterate_cf(
867
+ rocksdb_writebatch_t*, void* state,
868
+ void (*put_cf)(void*, uint32_t cfid, const char* k, size_t klen,
869
+ const char* v, size_t vlen),
870
+ void (*deleted_cf)(void*, uint32_t cfid, const char* k, size_t klen),
871
+ void (*merge_cf)(void*, uint32_t cfid, const char* k, size_t klen,
872
+ const char* v, size_t vlen));
837
873
  extern ROCKSDB_LIBRARY_API const char* rocksdb_writebatch_data(
838
874
  rocksdb_writebatch_t*, size_t* size);
839
875
  extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_set_save_point(
@@ -842,6 +878,9 @@ extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_rollback_to_save_point(
842
878
  rocksdb_writebatch_t*, char** errptr);
843
879
  extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_pop_save_point(
844
880
  rocksdb_writebatch_t*, char** errptr);
881
+ extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_update_timestamps(
882
+ rocksdb_writebatch_t* wb, const char* ts, size_t tslen, void* state,
883
+ size_t (*get_ts_size)(void*, uint32_t), char** errptr);
845
884
 
846
885
  /* Write batch with index */
847
886
 
@@ -850,6 +889,11 @@ rocksdb_writebatch_wi_create(size_t reserved_bytes,
850
889
  unsigned char overwrite_keys);
851
890
  extern ROCKSDB_LIBRARY_API rocksdb_writebatch_wi_t*
852
891
  rocksdb_writebatch_wi_create_from(const char* rep, size_t size);
892
+ extern ROCKSDB_LIBRARY_API rocksdb_writebatch_wi_t*
893
+ rocksdb_writebatch_wi_create_with_params(
894
+ rocksdb_comparator_t* backup_index_comparator, size_t reserved_bytes,
895
+ unsigned char overwrite_key, size_t max_bytes,
896
+ size_t protection_bytes_per_key);
853
897
  extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_wi_destroy(
854
898
  rocksdb_writebatch_wi_t*);
855
899
  extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_wi_clear(
@@ -960,6 +1004,9 @@ extern ROCKSDB_LIBRARY_API rocksdb_iterator_t*
960
1004
  rocksdb_writebatch_wi_create_iterator_with_base_cf(
961
1005
  rocksdb_writebatch_wi_t* wbwi, rocksdb_iterator_t* base_iterator,
962
1006
  rocksdb_column_family_handle_t* cf);
1007
+ extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_wi_update_timestamps(
1008
+ rocksdb_writebatch_wi_t* wbwi, const char* ts, size_t tslen, void* state,
1009
+ size_t (*get_ts_size)(void*, uint32_t), char** errptr);
963
1010
 
964
1011
  /* Options utils */
965
1012
 
@@ -1064,6 +1111,21 @@ rocksdb_block_based_options_set_pin_top_level_index_and_filter(
1064
1111
  rocksdb_block_based_table_options_t*, unsigned char);
1065
1112
  extern ROCKSDB_LIBRARY_API void rocksdb_options_set_block_based_table_factory(
1066
1113
  rocksdb_options_t* opt, rocksdb_block_based_table_options_t* table_options);
1114
+ enum {
1115
+ rocksdb_block_based_k_fallback_pinning_tier = 0,
1116
+ rocksdb_block_based_k_none_pinning_tier = 1,
1117
+ rocksdb_block_based_k_flush_and_similar_pinning_tier = 2,
1118
+ rocksdb_block_based_k_all_pinning_tier = 3,
1119
+ };
1120
+ extern ROCKSDB_LIBRARY_API void
1121
+ rocksdb_block_based_options_set_top_level_index_pinning_tier(
1122
+ rocksdb_block_based_table_options_t*, int);
1123
+ extern ROCKSDB_LIBRARY_API void
1124
+ rocksdb_block_based_options_set_partition_pinning_tier(
1125
+ rocksdb_block_based_table_options_t*, int);
1126
+ extern ROCKSDB_LIBRARY_API void
1127
+ rocksdb_block_based_options_set_unpartitioned_pinning_tier(
1128
+ rocksdb_block_based_table_options_t*, int);
1067
1129
  extern ROCKSDB_LIBRARY_API void rocksdb_options_set_write_buffer_manager(
1068
1130
  rocksdb_options_t* opt, rocksdb_write_buffer_manager_t* wbm);
1069
1131
 
@@ -1163,6 +1225,11 @@ extern ROCKSDB_LIBRARY_API int rocksdb_options_get_info_log_level(
1163
1225
  rocksdb_options_t*);
1164
1226
  extern ROCKSDB_LIBRARY_API rocksdb_logger_t*
1165
1227
  rocksdb_logger_create_stderr_logger(int log_level, const char* prefix);
1228
+ extern ROCKSDB_LIBRARY_API rocksdb_logger_t*
1229
+ rocksdb_logger_create_callback_logger(int log_level,
1230
+ void (*)(void* priv, unsigned lev,
1231
+ char* msg, size_t len),
1232
+ void* priv);
1166
1233
  extern ROCKSDB_LIBRARY_API void rocksdb_logger_destroy(
1167
1234
  rocksdb_logger_t* logger);
1168
1235
  extern ROCKSDB_LIBRARY_API void rocksdb_options_set_write_buffer_size(
@@ -1573,6 +1640,17 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_plain_table_factory(
1573
1640
  rocksdb_options_t*, uint32_t, int, double, size_t, size_t, char,
1574
1641
  unsigned char, unsigned char);
1575
1642
 
1643
+ extern ROCKSDB_LIBRARY_API unsigned char
1644
+ rocksdb_options_get_write_dbid_to_manifest(rocksdb_options_t*);
1645
+ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_write_dbid_to_manifest(
1646
+ rocksdb_options_t*, unsigned char);
1647
+
1648
+ extern ROCKSDB_LIBRARY_API unsigned char
1649
+ rocksdb_options_get_track_and_verify_wals_in_manifest(rocksdb_options_t*);
1650
+ extern ROCKSDB_LIBRARY_API void
1651
+ rocksdb_options_set_track_and_verify_wals_in_manifest(rocksdb_options_t*,
1652
+ unsigned char);
1653
+
1576
1654
  extern ROCKSDB_LIBRARY_API void rocksdb_options_set_min_level_to_compress(
1577
1655
  rocksdb_options_t* opt, int level);
1578
1656
 
@@ -1682,6 +1760,18 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_wal_compression(
1682
1760
  extern ROCKSDB_LIBRARY_API int rocksdb_options_get_wal_compression(
1683
1761
  rocksdb_options_t* opt);
1684
1762
 
1763
+ enum {
1764
+ rocksdb_k_by_compensated_size_compaction_pri = 0,
1765
+ rocksdb_k_oldest_largest_seq_first_compaction_pri = 1,
1766
+ rocksdb_k_oldest_smallest_seq_first_compaction_pri = 2,
1767
+ rocksdb_k_min_overlapping_ratio_compaction_pri = 3,
1768
+ rocksdb_k_round_robin_compaction_pri = 4
1769
+ };
1770
+ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_compaction_pri(
1771
+ rocksdb_options_t*, int);
1772
+ extern ROCKSDB_LIBRARY_API int rocksdb_options_get_compaction_pri(
1773
+ rocksdb_options_t*);
1774
+
1685
1775
  /* RateLimiter */
1686
1776
  extern ROCKSDB_LIBRARY_API rocksdb_ratelimiter_t* rocksdb_ratelimiter_create(
1687
1777
  int64_t rate_bytes_per_sec, int64_t refill_period_us, int32_t fairness);
@@ -523,6 +523,11 @@ enum TieredAdmissionPolicy {
523
523
  // compressed secondary, and a compressed local flash (non-volatile) cache.
524
524
  // Each tier is managed as an independent queue.
525
525
  kAdmPolicyThreeQueue,
526
+ // Allow all blocks evicted from the primary block cache into the secondary
527
+ // cache. This may increase CPU overhead due to more blocks being admitted
528
+ // and compressed, but may increase the compressed secondary cache hit rate
529
+ // for some workloads
530
+ kAdmPolicyAllowAll,
526
531
  kAdmPolicyMax,
527
532
  };
528
533
 
@@ -120,6 +120,33 @@ class Comparator : public Customizable, public CompareInterface {
120
120
 
121
121
  inline size_t timestamp_size() const { return timestamp_size_; }
122
122
 
123
+ // Return what this Comparator considers as the maximum timestamp.
124
+ // The default implementation only works for when `timestamp_size_` is 0,
125
+ // subclasses for which this is not the case needs to override this function.
126
+ virtual Slice GetMaxTimestamp() const {
127
+ if (timestamp_size_ == 0) {
128
+ return Slice();
129
+ }
130
+ assert(false);
131
+ return Slice();
132
+ }
133
+
134
+ // Return what this Comparator considers as the min timestamp.
135
+ // The default implementation only works for when `timestamp_size_` is 0,
136
+ // subclasses for which this is not the case needs to override this function.
137
+ virtual Slice GetMinTimestamp() const {
138
+ if (timestamp_size_ == 0) {
139
+ return Slice();
140
+ }
141
+ assert(false);
142
+ return Slice();
143
+ }
144
+
145
+ // Return a human readable user-defined timestamp for debugging.
146
+ virtual std::string TimestampToString(const Slice& /*timestamp*/) const {
147
+ return "";
148
+ }
149
+
123
150
  int CompareWithoutTimestamp(const Slice& a, const Slice& b) const {
124
151
  return CompareWithoutTimestamp(a, /*a_has_ts=*/true, b, /*b_has_ts=*/true);
125
152
  }
@@ -17,6 +17,7 @@
17
17
  #include <unordered_map>
18
18
  #include <vector>
19
19
 
20
+ #include "rocksdb/attribute_groups.h"
20
21
  #include "rocksdb/block_cache_trace_writer.h"
21
22
  #include "rocksdb/iterator.h"
22
23
  #include "rocksdb/listener.h"
@@ -27,6 +28,7 @@
27
28
  #include "rocksdb/thread_status.h"
28
29
  #include "rocksdb/transaction_log.h"
29
30
  #include "rocksdb/types.h"
31
+ #include "rocksdb/user_write_callback.h"
30
32
  #include "rocksdb/version.h"
31
33
  #include "rocksdb/wide_columns.h"
32
34
 
@@ -297,6 +299,29 @@ class DB {
297
299
  const std::vector<ColumnFamilyDescriptor>& column_families,
298
300
  std::vector<ColumnFamilyHandle*>* handles, DB** dbptr);
299
301
 
302
+ // EXPERIMENTAL
303
+
304
+ // Open a database as a follower. The difference between this and opening
305
+ // as secondary is that the follower database has its own directory with
306
+ // links to the actual files, and can tolarate obsolete file deletions by
307
+ // the leader to its own database. Another difference is the follower
308
+ // tries to keep up with the leader by periodically tailing the leader's
309
+ // MANIFEST, and (in the future) memtable updates, rather than relying on
310
+ // the user to manually call TryCatchupWithPrimary().
311
+
312
+ // Open as a follower with the default column family
313
+ static Status OpenAsFollower(const Options& options, const std::string& name,
314
+ const std::string& leader_path,
315
+ std::unique_ptr<DB>* dbptr);
316
+
317
+ // Open as a follower with multiple column families
318
+ static Status OpenAsFollower(
319
+ const DBOptions& db_options, const std::string& name,
320
+ const std::string& leader_path,
321
+ const std::vector<ColumnFamilyDescriptor>& column_families,
322
+ std::vector<ColumnFamilyHandle*>* handles, std::unique_ptr<DB>* dbptr);
323
+ // End EXPERIMENTAL
324
+
300
325
  // Open DB and run the compaction.
301
326
  // It's a read-only operation, the result won't be installed to the DB, it
302
327
  // will be output to the `output_directory`. The API should only be used with
@@ -517,6 +542,8 @@ class DB {
517
542
  // 2) Limiting the maximum number of open files in the presence of range
518
543
  // tombstones can degrade read performance. To avoid this problem, set
519
544
  // max_open_files to -1 whenever possible.
545
+ // 3) Incompatible with row_cache, will return Status::NotSupported() if
546
+ // row_cache is configured.
520
547
  virtual Status DeleteRange(const WriteOptions& options,
521
548
  ColumnFamilyHandle* column_family,
522
549
  const Slice& begin_key, const Slice& end_key);
@@ -557,6 +584,15 @@ class DB {
557
584
  // Note: consider setting options.sync = true.
558
585
  virtual Status Write(const WriteOptions& options, WriteBatch* updates) = 0;
559
586
 
587
+ // Same as DB::Write, and takes a `UserWriteCallback` argument to allow
588
+ // users to plug in custom logic in callback functions during the write.
589
+ virtual Status WriteWithCallback(const WriteOptions& /*options*/,
590
+ WriteBatch* /*updates*/,
591
+ UserWriteCallback* /*user_write_cb*/) {
592
+ return Status::NotSupported(
593
+ "WriteWithCallback not implemented for this interface.");
594
+ }
595
+
560
596
  // If the column family specified by "column_family" contains an entry for
561
597
  // "key", return the corresponding value in "*value". If the entry is a plain
562
598
  // key-value, return the value as-is; if it is a wide-column entity, return
@@ -971,12 +1007,28 @@ class DB {
971
1007
  const std::vector<ColumnFamilyHandle*>& column_families,
972
1008
  std::vector<Iterator*>* iterators) = 0;
973
1009
 
974
- // UNDER CONSTRUCTION - DO NOT USE
1010
+ // EXPERIMENTAL
975
1011
  // Return a cross-column-family iterator from a consistent database state.
976
- // When the same key is present in multiple column families, the iterator
977
- // selects the value or columns from the first column family containing the
978
- // key, in the order specified by the `column_families` parameter.
979
- virtual std::unique_ptr<Iterator> NewMultiCfIterator(
1012
+ //
1013
+ // If a key exists in more than one column family, value() will be determined
1014
+ // by the wide column value of kDefaultColumnName after coalesced as described
1015
+ // below.
1016
+ //
1017
+ // Each wide column will be independently shadowed by the CFs.
1018
+ // For example, if CF1 has "key_1" ==> {"col_1": "foo",
1019
+ // "col_2", "baz"} and CF2 has "key_1" ==> {"col_2": "quux", "col_3", "bla"},
1020
+ // and when the iterator is at key_1, columns() will return
1021
+ // {"col_1": "foo", "col_2", "quux", "col_3", "bla"}
1022
+ // In this example, value() will be empty, because none of them have values
1023
+ // for kDefaultColumnName
1024
+ virtual std::unique_ptr<Iterator> NewCoalescingIterator(
1025
+ const ReadOptions& options,
1026
+ const std::vector<ColumnFamilyHandle*>& column_families) = 0;
1027
+
1028
+ // EXPERIMENTAL
1029
+ // A cross-column-family iterator that collects and returns attribute groups
1030
+ // for each key in order provided by comparator
1031
+ virtual std::unique_ptr<AttributeGroupIterator> NewAttributeGroupIterator(
980
1032
  const ReadOptions& options,
981
1033
  const std::vector<ColumnFamilyHandle*>& column_families) = 0;
982
1034
 
@@ -1282,9 +1334,10 @@ class DB {
1282
1334
 
1283
1335
  // DB implementations export properties about their state via this method.
1284
1336
  // If "property" is a valid "string" property understood by this DB
1285
- // implementation (see Properties struct above for valid options), fills
1286
- // "*value" with its current value and returns true. Otherwise, returns
1287
- // false.
1337
+ // implementation (see Properties struct above for valid options) and the DB
1338
+ // is able to get and fill "*value" with its current value, then return true.
1339
+ // In all the other cases (e.g, "property" is an invalid "string" property, IO
1340
+ // errors ..), it returns false.
1288
1341
  virtual bool GetProperty(ColumnFamilyHandle* column_family,
1289
1342
  const Slice& property, std::string* value) = 0;
1290
1343
  virtual bool GetProperty(const Slice& property, std::string* value) {
@@ -1433,6 +1486,9 @@ class DB {
1433
1486
  // move the files back to the minimum level capable of holding the data set
1434
1487
  // or a given level (specified by non-negative options.target_level).
1435
1488
  //
1489
+ // For FIFO compaction, this will trigger a compaction (if available)
1490
+ // based on CompactionOptionsFIFO.
1491
+ //
1436
1492
  // In case of user-defined timestamp, if enabled, `begin` and `end` should
1437
1493
  // not contain timestamp.
1438
1494
  virtual Status CompactRange(const CompactRangeOptions& options,
@@ -1634,8 +1690,8 @@ class DB {
1634
1690
  // Freezes the logical state of the DB (by stopping writes), and if WAL is
1635
1691
  // enabled, ensures that state has been flushed to DB files (as in
1636
1692
  // FlushWAL()). This can be used for taking a Checkpoint at a known DB
1637
- // state, though the user must use options to insure no DB flush is invoked
1638
- // in this frozen state. Other operations allowed on a "read only" DB should
1693
+ // state, though while the WAL is locked, flushes as part of CreateCheckpoint
1694
+ // and simiar are skipped. Other operations allowed on a "read only" DB should
1639
1695
  // work while frozen. Each LockWAL() call that returns OK must eventually be
1640
1696
  // followed by a corresponding call to UnlockWAL(). Where supported, non-OK
1641
1697
  // status is generally only possible with some kind of corruption or I/O
@@ -1786,7 +1842,7 @@ class DB {
1786
1842
  bool flush_memtable = true) = 0;
1787
1843
 
1788
1844
  // Retrieve the sorted list of all wal files with earliest file first
1789
- virtual Status GetSortedWalFiles(VectorLogPtr& files) = 0;
1845
+ virtual Status GetSortedWalFiles(VectorWalPtr& files) = 0;
1790
1846
 
1791
1847
  // Retrieve information about the current wal file
1792
1848
  //
@@ -1796,7 +1852,7 @@ class DB {
1796
1852
  // Additionally, for the sake of optimization current_log_file->StartSequence
1797
1853
  // would always be set to 0
1798
1854
  virtual Status GetCurrentWalFile(
1799
- std::unique_ptr<LogFile>* current_log_file) = 0;
1855
+ std::unique_ptr<WalFile>* current_log_file) = 0;
1800
1856
 
1801
1857
  // IngestExternalFile() will load a list of external SST files (1) into the DB
1802
1858
  // Two primary modes are supported:
@@ -1816,6 +1872,7 @@ class DB {
1816
1872
  // supported. 4) When an ingested file contains point data and range deletion
1817
1873
  // for the same key, the point data currently overrides the range deletion
1818
1874
  // regardless which one has the higher user-defined timestamps.
1875
+ // For FIFO compaction, SST files will always be ingested into L0.
1819
1876
  //
1820
1877
  // (1) External SST files can be created using SstFileWriter
1821
1878
  // (2) We will try to ingest the files to the lowest possible level
@@ -1963,6 +2020,8 @@ class DB {
1963
2020
  return Status::NotSupported("SuggestCompactRange() is not implemented.");
1964
2021
  }
1965
2022
 
2023
+ // Trivially move L0 files to target level. Should not be called with another
2024
+ // PromoteL0() concurrently
1966
2025
  virtual Status PromoteL0(ColumnFamilyHandle* /*column_family*/,
1967
2026
  int /*target_level*/) {
1968
2027
  return Status::NotSupported("PromoteL0() is not implemented.");
@@ -145,6 +145,11 @@ struct EnvOptions {
145
145
  // Exceptions MUST NOT propagate out of overridden functions into RocksDB,
146
146
  // because RocksDB is not exception-safe. This could cause undefined behavior
147
147
  // including data loss, unreported corruption, deadlocks, and more.
148
+ // An interface that abstracts RocksDB's interactions with the operating system
149
+ // environment. There are three main types of APIs:
150
+ // 1) File system operations, like creating a file, writing to a file, etc.
151
+ // 2) Thread management.
152
+ // 3) Misc functions, like getting the current time.
148
153
  class Env : public Customizable {
149
154
  public:
150
155
  static const char* kDefaultName() { return "DefaultEnv"; }
@@ -1209,6 +1214,10 @@ class Logger {
1209
1214
  public:
1210
1215
  static constexpr size_t kDoNotSupportGetLogFileSize = SIZE_MAX;
1211
1216
 
1217
+ // Set to INFO_LEVEL when RocksDB is compiled in release mode, and
1218
+ // DEBUG_LEVEL when compiled in debug mode. See DBOptions::info_log_level.
1219
+ static const InfoLogLevel kDefaultLogLevel;
1220
+
1212
1221
  explicit Logger(const InfoLogLevel log_level = InfoLogLevel::INFO_LEVEL)
1213
1222
  : closed_(false), log_level_(log_level) {}
1214
1223
  // No copying allowed
@@ -238,6 +238,11 @@ class KeySegmentsExtractor {
238
238
  // determined by segment 0 in some way, often the first byte.) The enum
239
239
  // scalar values do not need to be related to key order.
240
240
  KeyCategory category = kDefaultCategory;
241
+
242
+ void Reset() {
243
+ segment_ends.clear();
244
+ category = kDefaultCategory;
245
+ }
241
246
  };
242
247
 
243
248
  virtual ~KeySegmentsExtractor() {}
@@ -702,6 +702,16 @@ class FileSystem : public Customizable {
702
702
  return IOStatus::OK();
703
703
  }
704
704
 
705
+ // EXPERIMENTAL
706
+ // Discard any directory metadata cached in memory for the specified
707
+ // directory and its descendants. Useful for distributed file systems
708
+ // where the local cache may be out of sync with the actual directory state.
709
+ //
710
+ // The implementation is not required to be thread safe. Its the caller's
711
+ // responsibility to ensure that no directory operations happen
712
+ // concurrently.
713
+ virtual void DiscardCacheForDirectory(const std::string& /*path*/) {}
714
+
705
715
  // Indicates to upper layers which FileSystem operations mentioned in
706
716
  // FSSupportedOps are supported by underlying FileSystem. Each bit in
707
717
  // supported_ops argument represent corresponding FSSupportedOps operation.
@@ -1624,6 +1634,10 @@ class FileSystemWrapper : public FileSystem {
1624
1634
  return target_->AbortIO(io_handles);
1625
1635
  }
1626
1636
 
1637
+ void DiscardCacheForDirectory(const std::string& path) override {
1638
+ target_->DiscardCacheForDirectory(path);
1639
+ }
1640
+
1627
1641
  void SupportedOps(int64_t& supported_ops) override {
1628
1642
  return target_->SupportedOps(supported_ops);
1629
1643
  }