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
@@ -369,7 +369,7 @@ class WALDumperCommand : public LDBCommand {
369
369
  const std::map<std::string, std::string>& options,
370
370
  const std::vector<std::string>& flags);
371
371
 
372
- bool NoDBOpen() override { return true; }
372
+ bool NoDBOpen() override { return no_db_open_; }
373
373
 
374
374
  static void Help(std::string& ret);
375
375
 
@@ -380,6 +380,7 @@ class WALDumperCommand : public LDBCommand {
380
380
  std::string wal_file_;
381
381
  bool print_values_;
382
382
  bool is_write_committed_; // default will be set to true
383
+ bool no_db_open_ = true;
383
384
 
384
385
  static const std::string ARG_WAL_FILE;
385
386
  static const std::string ARG_WRITE_COMMITTED;
@@ -435,6 +436,22 @@ class GetEntityCommand : public LDBCommand {
435
436
  std::string key_;
436
437
  };
437
438
 
439
+ class MultiGetEntityCommand : public LDBCommand {
440
+ public:
441
+ static std::string Name() { return "multi_get_entity"; }
442
+
443
+ MultiGetEntityCommand(const std::vector<std::string>& params,
444
+ const std::map<std::string, std::string>& options,
445
+ const std::vector<std::string>& flags);
446
+
447
+ void DoCommand() override;
448
+
449
+ static void Help(std::string& ret);
450
+
451
+ private:
452
+ std::vector<std::string> keys_;
453
+ };
454
+
438
455
  class ApproxSizeCommand : public LDBCommand {
439
456
  public:
440
457
  static std::string Name() { return "approxsize"; }
@@ -603,6 +620,7 @@ class DBQuerierCommand : public LDBCommand {
603
620
  static const char* GET_CMD;
604
621
  static const char* PUT_CMD;
605
622
  static const char* DELETE_CMD;
623
+ static const char* COUNT_CMD;
606
624
  };
607
625
 
608
626
  class CheckConsistencyCommand : public LDBCommand {
@@ -28,6 +28,9 @@ void LDBCommandRunner::PrintHelp(const LDBOptions& ldb_options,
28
28
  ret.append(" --" + LDBCommand::ARG_SECONDARY_PATH +
29
29
  "=<secondary_path> to open DB as secondary instance. Operations "
30
30
  "not supported in secondary instance will fail.\n\n");
31
+ ret.append(" --" + LDBCommand::ARG_LEADER_PATH +
32
+ "=<leader_path> to open DB as a follower instance. Operations "
33
+ "not supported in follower instance will fail.\n\n");
31
34
  ret.append(
32
35
  "The following optional parameters control if keys/values are "
33
36
  "input/output as hex or as plain strings:\n");
@@ -85,12 +88,18 @@ void LDBCommandRunner::PrintHelp(const LDBOptions& ldb_options,
85
88
  "=<double,e.g.:0.25>\n");
86
89
  ret.append(" --" + LDBCommand::ARG_BLOB_COMPACTION_READAHEAD_SIZE +
87
90
  "=<int,e.g.:2097152>\n");
91
+ ret.append(" --" + LDBCommand::ARG_READ_TIMESTAMP +
92
+ "=<uint64_ts, e.g.:323> : read timestamp, required if column "
93
+ "family enables timestamp, otherwise invalid if provided.");
88
94
 
89
95
  ret.append("\n\n");
90
96
  ret.append("Data Access Commands:\n");
91
97
  PutCommand::Help(ret);
98
+ PutEntityCommand::Help(ret);
92
99
  GetCommand::Help(ret);
100
+ GetEntityCommand::Help(ret);
93
101
  MultiGetCommand::Help(ret);
102
+ MultiGetEntityCommand::Help(ret);
94
103
  BatchPutCommand::Help(ret);
95
104
  ScanCommand::Help(ret);
96
105
  DeleteCommand::Help(ret);
@@ -0,0 +1,24 @@
1
+ // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2
+ // This source code is licensed under both the GPLv2 (found in the
3
+ // COPYING file in the root directory) and Apache 2.0 License
4
+ // (found in the LICENSE.Apache file in the root directory).
5
+ //
6
+ // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
7
+ // Use of this source code is governed by a BSD-style license that can be
8
+ // found in the LICENSE file. See the AUTHORS file for names of contributors.
9
+ #pragma once
10
+
11
+ #include <cstddef>
12
+
13
+ #include "rocksdb/rocksdb_namespace.h"
14
+
15
+ namespace ROCKSDB_NAMESPACE {
16
+
17
+ template <typename T, std::size_t Align = alignof(T)>
18
+ struct aligned_storage {
19
+ struct type {
20
+ alignas(Align) unsigned char data[sizeof(T)];
21
+ };
22
+ };
23
+
24
+ } // namespace ROCKSDB_NAMESPACE
@@ -371,6 +371,9 @@ autovector<T, kSize>& autovector<T, kSize>::assign(
371
371
 
372
372
  // copy array
373
373
  num_stack_items_ = other.num_stack_items_;
374
+ for (size_t i = 0; i < num_stack_items_; ++i) {
375
+ new ((void*)(&values_[i])) value_type();
376
+ }
374
377
  std::copy(other.values_, other.values_ + num_stack_items_, values_);
375
378
 
376
379
  return *this;
@@ -385,6 +388,7 @@ autovector<T, kSize>& autovector<T, kSize>::operator=(
385
388
  num_stack_items_ = n;
386
389
  other.num_stack_items_ = 0;
387
390
  for (size_t i = 0; i < n; ++i) {
391
+ new ((void*)(&values_[i])) value_type();
388
392
  values_[i] = std::move(other.values_[i]);
389
393
  }
390
394
  return *this;
@@ -271,6 +271,18 @@ class ComparatorWithU64TsImpl : public Comparator {
271
271
  return -CompareTimestamp(ExtractTimestampFromUserKey(a, ts_sz),
272
272
  ExtractTimestampFromUserKey(b, ts_sz));
273
273
  }
274
+
275
+ Slice GetMaxTimestamp() const override { return MaxU64Ts(); }
276
+
277
+ Slice GetMinTimestamp() const override { return MinU64Ts(); }
278
+
279
+ std::string TimestampToString(const Slice& timestamp) const override {
280
+ assert(timestamp.size() == sizeof(uint64_t));
281
+ uint64_t ts = 0;
282
+ DecodeU64Ts(timestamp, &ts).PermitUncheckedError();
283
+ return std::to_string(ts);
284
+ }
285
+
274
286
  using Comparator::CompareWithoutTimestamp;
275
287
  int CompareWithoutTimestamp(const Slice& a, bool a_has_ts, const Slice& b,
276
288
  bool b_has_ts) const override {
@@ -726,7 +726,7 @@ double FilterBench::RandomQueryTest(uint32_t inside_threshold, bool dry_run,
726
726
  } else {
727
727
  may_match = info.full_block_reader_->KeyMayMatch(
728
728
  batch_slices[i],
729
- /*no_io=*/false, /*const_ikey_ptr=*/nullptr,
729
+ /*const_ikey_ptr=*/nullptr,
730
730
  /*get_context=*/nullptr,
731
731
  /*lookup_context=*/nullptr, ROCKSDB_NAMESPACE::ReadOptions());
732
732
  }
@@ -13,6 +13,7 @@
13
13
  #include <utility>
14
14
 
15
15
  #include "port/likely.h"
16
+ #include "util/aligned_storage.h"
16
17
  #include "util/thread_local.h"
17
18
 
18
19
  #define STORAGE_DECL static thread_local
@@ -21,7 +22,7 @@ namespace ROCKSDB_NAMESPACE {
21
22
 
22
23
  Random* Random::GetTLSInstance() {
23
24
  STORAGE_DECL Random* tls_instance;
24
- STORAGE_DECL std::aligned_storage<sizeof(Random)>::type tls_instance_bytes;
25
+ STORAGE_DECL aligned_storage<Random>::type tls_instance_bytes;
25
26
 
26
27
  auto rv = tls_instance;
27
28
  if (UNLIKELY(rv == nullptr)) {
@@ -38,12 +38,12 @@ void StderrLogger::Logv(const char* format, va_list ap) {
38
38
 
39
39
  va_list ap_copy;
40
40
  va_copy(ap_copy, ap);
41
- const size_t log_suffix_len = vsnprintf(nullptr, 0, format, ap_copy);
41
+ const size_t log_suffix_len = vsnprintf(nullptr, 0, format, ap_copy) + 1;
42
42
  va_end(ap_copy);
43
43
 
44
44
  // Allocate space for the context, log_prefix, and log itself
45
45
  // Extra byte for null termination
46
- size_t buf_len = ctx_len + log_prefix_len + log_suffix_len + 1;
46
+ size_t buf_len = ctx_len + log_prefix_len + log_suffix_len;
47
47
  std::unique_ptr<char[]> buf(new char[buf_len]);
48
48
 
49
49
  // If the logger was created without a prefix, the prefix is a nullptr
@@ -55,8 +55,7 @@ void StderrLogger::Logv(const char* format, va_list ap) {
55
55
  t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min,
56
56
  t.tm_sec, static_cast<int>(now_tv.tv_usec),
57
57
  static_cast<long long unsigned int>(thread_id), prefix);
58
- written += vsnprintf(buf.get() + written, log_suffix_len, format, ap);
59
- buf[written] = '\0';
58
+ vsnprintf(buf.get() + written, log_suffix_len, format, ap);
60
59
 
61
60
  fprintf(stderr, "%s%c", buf.get(), '\n');
62
61
  }
@@ -17,7 +17,7 @@ namespace ROCKSDB_NAMESPACE {
17
17
  class StderrLogger : public Logger {
18
18
  public:
19
19
  explicit StderrLogger(const InfoLogLevel log_level = InfoLogLevel::INFO_LEVEL)
20
- : Logger(log_level), log_prefix(nullptr) {}
20
+ : Logger(log_level), log_prefix(nullptr), log_prefix_len(0) {}
21
21
  explicit StderrLogger(const InfoLogLevel log_level, const std::string prefix)
22
22
  : Logger(log_level),
23
23
  log_prefix(strdup(prefix.c_str())),
@@ -158,6 +158,39 @@ Status TimestampRecoveryHandler::PutCF(uint32_t cf, const Slice& key,
158
158
  return WriteBatchInternal::Put(new_batch_.get(), cf, new_key, value);
159
159
  }
160
160
 
161
+ Status TimestampRecoveryHandler::PutEntityCF(uint32_t cf, const Slice& key,
162
+ const Slice& entity) {
163
+ std::string new_key_buf;
164
+ Slice new_key;
165
+ Status status = TimestampRecoveryHandler::ReconcileTimestampDiscrepancy(
166
+ cf, key, &new_key_buf, &new_key);
167
+ if (!status.ok()) {
168
+ return status;
169
+ }
170
+ Slice entity_copy = entity;
171
+ WideColumns columns;
172
+ if (!WideColumnSerialization::Deserialize(entity_copy, columns).ok()) {
173
+ return Status::Corruption("Unable to deserialize entity",
174
+ entity.ToString(/* hex */ true));
175
+ }
176
+
177
+ return WriteBatchInternal::PutEntity(new_batch_.get(), cf, new_key, columns);
178
+ }
179
+
180
+ Status TimestampRecoveryHandler::TimedPutCF(uint32_t cf, const Slice& key,
181
+ const Slice& value,
182
+ uint64_t write_time) {
183
+ std::string new_key_buf;
184
+ Slice new_key;
185
+ Status status =
186
+ ReconcileTimestampDiscrepancy(cf, key, &new_key_buf, &new_key);
187
+ if (!status.ok()) {
188
+ return status;
189
+ }
190
+ return WriteBatchInternal::TimedPut(new_batch_.get(), cf, new_key, value,
191
+ write_time);
192
+ }
193
+
161
194
  Status TimestampRecoveryHandler::DeleteCF(uint32_t cf, const Slice& key) {
162
195
  std::string new_key_buf;
163
196
  Slice new_key;
@@ -11,6 +11,7 @@
11
11
  #include <unordered_map>
12
12
  #include <vector>
13
13
 
14
+ #include "db/wide/wide_column_serialization.h"
14
15
  #include "db/write_batch_internal.h"
15
16
  #include "rocksdb/slice.h"
16
17
  #include "rocksdb/status.h"
@@ -116,6 +117,12 @@ class TimestampRecoveryHandler : public WriteBatch::Handler {
116
117
 
117
118
  Status PutCF(uint32_t cf, const Slice& key, const Slice& value) override;
118
119
 
120
+ Status PutEntityCF(uint32_t cf, const Slice& key,
121
+ const Slice& entity) override;
122
+
123
+ Status TimedPutCF(uint32_t cf, const Slice& key, const Slice& value,
124
+ uint64_t write_time) override;
125
+
119
126
  Status DeleteCF(uint32_t cf, const Slice& key) override;
120
127
 
121
128
  Status SingleDeleteCF(uint32_t cf, const Slice& key) override;
@@ -32,6 +32,11 @@ class ColumnFamilyCollector : public WriteBatch::Handler {
32
32
  return AddColumnFamilyId(column_family_id);
33
33
  }
34
34
 
35
+ Status PutEntityCF(uint32_t column_family_id, const Slice&,
36
+ const Slice&) override {
37
+ return AddColumnFamilyId(column_family_id);
38
+ }
39
+
35
40
  Status TimedPutCF(uint32_t column_family_id, const Slice&, const Slice&,
36
41
  uint64_t) override {
37
42
  return AddColumnFamilyId(column_family_id);
@@ -11,6 +11,15 @@
11
11
  #ifndef XXH_NAMESPACE
12
12
  #define XXH_NAMESPACE ROCKSDB_
13
13
  #endif // !defined(XXH_NAMESPACE)
14
+
15
+ #if (defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API) || \
16
+ defined(XXH_IMPLEMENTATION)) && \
17
+ !defined(XXH_IMPLEM_13a8737387)
18
+ #if defined(__cplusplus) && (__cplusplus > 202002L)
19
+ /* C++23 and future versions have std::unreachable() */
20
+ #include <utility> /* std::unreachable() */
21
+ #endif
22
+ #endif
14
23
  /* END RocksDB customizations */
15
24
 
16
25
  // clang-format off
@@ -1294,7 +1303,7 @@ struct XXH3_state_s {
1294
1303
  * Note that this doesn't prepare the state for a streaming operation,
1295
1304
  * it's still necessary to use XXH3_NNbits_reset*() afterwards.
1296
1305
  */
1297
- #define XXH3_INITSTATE(XXH3_state_ptr) { (XXH3_state_ptr)->seed = 0; }
1306
+ #define XXH3_INITSTATE(XXH3_state_ptr) do { (XXH3_state_ptr)->seed = 0; } while (0)
1298
1307
 
1299
1308
 
1300
1309
  /*!
@@ -2064,8 +2073,6 @@ static int XXH_isLittleEndian(void)
2064
2073
  # define XXH_UNREACHABLE() unreachable()
2065
2074
 
2066
2075
  #elif defined(__cplusplus) && (__cplusplus > 202002L)
2067
- /* C++23 and future versions have std::unreachable() */
2068
- # include <utility> /* std::unreachable() */
2069
2076
  # define XXH_UNREACHABLE() std::unreachable()
2070
2077
 
2071
2078
  #elif XXH_HAS_BUILTIN(__builtin_unreachable)
@@ -2329,7 +2336,7 @@ XXH32_finalize(xxh_u32 hash, const xxh_u8* ptr, size_t len, XXH_alignment align)
2329
2336
  hash = XXH_rotl32(hash, 17) * XXH_PRIME32_4; \
2330
2337
  } while (0)
2331
2338
 
2332
- if (ptr==NULL) XXH_ASSERT(len == 0)
2339
+ if (ptr==nullptr) XXH_ASSERT(len == 0)
2333
2340
 
2334
2341
  /* Compact rerolled version; generally faster */
2335
2342
  if (!XXH32_ENDJMP) {
@@ -2409,7 +2416,7 @@ XXH32_endian_align(const xxh_u8* input, size_t len, xxh_u32 seed, XXH_alignment
2409
2416
  {
2410
2417
  xxh_u32 h32;
2411
2418
 
2412
- if (input==NULL) XXH_ASSERT(len == 0)
2419
+ if (input==nullptr) XXH_ASSERT(len == 0)
2413
2420
 
2414
2421
  if (len>=16) {
2415
2422
  const xxh_u8* const bEnd = input + len;
@@ -2495,7 +2502,7 @@ XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, XXH32_hash_t s
2495
2502
  XXH_PUBLIC_API XXH_errorcode
2496
2503
  XXH32_update(XXH32_state_t* state, const void* input, size_t len)
2497
2504
  {
2498
- if (input==NULL) {
2505
+ if (input==nullptr) {
2499
2506
  XXH_ASSERT(len == 0)
2500
2507
  return XXH_OK;
2501
2508
  }
@@ -2802,7 +2809,7 @@ static xxh_u64 XXH64_avalanche(xxh_u64 hash)
2802
2809
  static XXH_PUREF xxh_u64
2803
2810
  XXH64_finalize(xxh_u64 hash, const xxh_u8* ptr, size_t len, XXH_alignment align)
2804
2811
  {
2805
- if (ptr==NULL) XXH_ASSERT(len == 0)
2812
+ if (ptr==nullptr) XXH_ASSERT(len == 0)
2806
2813
  len &= 31;
2807
2814
  while (len >= 8) {
2808
2815
  xxh_u64 const k1 = XXH64_round(0, XXH_get64bits(ptr));
@@ -2847,7 +2854,7 @@ XXH_FORCE_INLINE XXH_PUREF xxh_u64
2847
2854
  XXH64_endian_align(const xxh_u8* input, size_t len, xxh_u64 seed, XXH_alignment align)
2848
2855
  {
2849
2856
  xxh_u64 h64;
2850
- if (input==NULL) XXH_ASSERT(len == 0)
2857
+ if (input==nullptr) XXH_ASSERT(len == 0)
2851
2858
 
2852
2859
  if (len>=32) {
2853
2860
  const xxh_u8* const bEnd = input + len;
@@ -2936,7 +2943,7 @@ XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH_NOESCAPE XXH64_state_t* statePtr, X
2936
2943
  XXH_PUBLIC_API XXH_errorcode
2937
2944
  XXH64_update (XXH_NOESCAPE XXH64_state_t* state, XXH_NOESCAPE const void* input, size_t len)
2938
2945
  {
2939
- if (input==NULL) {
2946
+ if (input==nullptr) {
2940
2947
  XXH_ASSERT(len == 0)
2941
2948
  return XXH_OK;
2942
2949
  }
@@ -5331,7 +5338,7 @@ XXH_PUBLIC_API XXH64_hash_t
5331
5338
  XXH3_64bits_withSecretandSeed(XXH_NOESCAPE const void* input, size_t length, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed)
5332
5339
  {
5333
5340
  if (length <= XXH3_MIDSIZE_MAX)
5334
- return XXH3_64bits_internal(input, length, seed, XXH3_kSecret, sizeof(XXH3_kSecret), NULL);
5341
+ return XXH3_64bits_internal(input, length, seed, XXH3_kSecret, sizeof(XXH3_kSecret), nullptr);
5335
5342
  return XXH3_hashLong_64b_withSecret(input, length, seed, (const xxh_u8*)secret, secretSize);
5336
5343
  }
5337
5344
 
@@ -5368,7 +5375,7 @@ static XXH_MALLOCF void* XXH_alignedMalloc(size_t s, size_t align)
5368
5375
  XXH_ASSERT(s != 0 && s < (s + align)) /* empty/overflow */
5369
5376
  { /* Overallocate to make room for manual realignment and an offset byte */
5370
5377
  xxh_u8* base = (xxh_u8*)XXH_malloc(s + align);
5371
- if (base != NULL) {
5378
+ if (base != nullptr) {
5372
5379
  /*
5373
5380
  * Get the offset needed to align this pointer.
5374
5381
  *
@@ -5385,7 +5392,7 @@ static XXH_MALLOCF void* XXH_alignedMalloc(size_t s, size_t align)
5385
5392
  ptr[-1] = (xxh_u8)offset;
5386
5393
  return ptr;
5387
5394
  }
5388
- return NULL;
5395
+ return nullptr;
5389
5396
  }
5390
5397
  }
5391
5398
  /*
@@ -5394,7 +5401,7 @@ static XXH_MALLOCF void* XXH_alignedMalloc(size_t s, size_t align)
5394
5401
  */
5395
5402
  static void XXH_alignedFree(void* p)
5396
5403
  {
5397
- if (p != NULL) {
5404
+ if (p != nullptr) {
5398
5405
  xxh_u8* ptr = (xxh_u8*)p;
5399
5406
  /* Get the offset byte we added in XXH_malloc. */
5400
5407
  xxh_u8 offset = ptr[-1];
@@ -5407,7 +5414,7 @@ static void XXH_alignedFree(void* p)
5407
5414
  XXH_PUBLIC_API XXH3_state_t* XXH3_createState(void)
5408
5415
  {
5409
5416
  XXH3_state_t* const state = (XXH3_state_t*)XXH_alignedMalloc(sizeof(XXH3_state_t), 64);
5410
- if (state==NULL) return NULL;
5417
+ if (state==nullptr) return nullptr;
5411
5418
  XXH3_INITSTATE(state);
5412
5419
  return state;
5413
5420
  }
@@ -5457,7 +5464,7 @@ XXH3_reset_internal(XXH3_state_t* statePtr,
5457
5464
  XXH_PUBLIC_API XXH_errorcode
5458
5465
  XXH3_64bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr)
5459
5466
  {
5460
- if (statePtr == NULL) return XXH_ERROR;
5467
+ if (statePtr == nullptr) return XXH_ERROR;
5461
5468
  XXH3_reset_internal(statePtr, 0, XXH3_kSecret, XXH_SECRET_DEFAULT_SIZE);
5462
5469
  return XXH_OK;
5463
5470
  }
@@ -5466,9 +5473,9 @@ XXH3_64bits_reset(XXH_NOESCAPE XXH3_state_t* statePtr)
5466
5473
  XXH_PUBLIC_API XXH_errorcode
5467
5474
  XXH3_64bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize)
5468
5475
  {
5469
- if (statePtr == NULL) return XXH_ERROR;
5476
+ if (statePtr == nullptr) return XXH_ERROR;
5470
5477
  XXH3_reset_internal(statePtr, 0, secret, secretSize);
5471
- if (secret == NULL) return XXH_ERROR;
5478
+ if (secret == nullptr) return XXH_ERROR;
5472
5479
  if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR;
5473
5480
  return XXH_OK;
5474
5481
  }
@@ -5477,11 +5484,11 @@ XXH3_64bits_reset_withSecret(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE c
5477
5484
  XXH_PUBLIC_API XXH_errorcode
5478
5485
  XXH3_64bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t seed)
5479
5486
  {
5480
- if (statePtr == NULL) return XXH_ERROR;
5487
+ if (statePtr == nullptr) return XXH_ERROR;
5481
5488
  if (seed==0) return XXH3_64bits_reset(statePtr);
5482
- if ((seed != statePtr->seed) || (statePtr->extSecret != NULL))
5489
+ if ((seed != statePtr->seed) || (statePtr->extSecret != nullptr))
5483
5490
  XXH3_initCustomSecret(statePtr->customSecret, seed);
5484
- XXH3_reset_internal(statePtr, seed, NULL, XXH_SECRET_DEFAULT_SIZE);
5491
+ XXH3_reset_internal(statePtr, seed, nullptr, XXH_SECRET_DEFAULT_SIZE);
5485
5492
  return XXH_OK;
5486
5493
  }
5487
5494
 
@@ -5489,8 +5496,8 @@ XXH3_64bits_reset_withSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH64_hash_t see
5489
5496
  XXH_PUBLIC_API XXH_errorcode
5490
5497
  XXH3_64bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3_state_t* statePtr, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed64)
5491
5498
  {
5492
- if (statePtr == NULL) return XXH_ERROR;
5493
- if (secret == NULL) return XXH_ERROR;
5499
+ if (statePtr == nullptr) return XXH_ERROR;
5500
+ if (secret == nullptr) return XXH_ERROR;
5494
5501
  if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR;
5495
5502
  XXH3_reset_internal(statePtr, seed64, secret, secretSize);
5496
5503
  statePtr->useSeed = 1; /* always, even if seed64==0 */
@@ -5538,14 +5545,14 @@ XXH3_update(XXH3_state_t* XXH_RESTRICT const state,
5538
5545
  XXH3_f_accumulate f_acc,
5539
5546
  XXH3_f_scrambleAcc f_scramble)
5540
5547
  {
5541
- if (input==NULL) {
5548
+ if (input==nullptr) {
5542
5549
  XXH_ASSERT(len == 0)
5543
5550
  return XXH_OK;
5544
5551
  }
5545
5552
 
5546
5553
  XXH_ASSERT(state != NULL)
5547
5554
  { const xxh_u8* const bEnd = input + len;
5548
- const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret;
5555
+ const unsigned char* const secret = (state->extSecret == nullptr) ? state->customSecret : state->extSecret;
5549
5556
  #if defined(XXH3_STREAM_USE_STACK) && XXH3_STREAM_USE_STACK >= 1
5550
5557
  /* For some reason, gcc and MSVC seem to suffer greatly
5551
5558
  * when operating accumulators directly into state.
@@ -5693,7 +5700,7 @@ XXH3_digest_long (XXH64_hash_t* acc,
5693
5700
  /*! @ingroup XXH3_family */
5694
5701
  XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_digest (XXH_NOESCAPE const XXH3_state_t* state)
5695
5702
  {
5696
- const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret;
5703
+ const unsigned char* const secret = (state->extSecret == nullptr) ? state->customSecret : state->extSecret;
5697
5704
  if (state->totalLen > XXH3_MIDSIZE_MAX) {
5698
5705
  XXH_ALIGN(XXH_ACC_ALIGN) XXH64_hash_t acc[XXH_ACC_NB];
5699
5706
  XXH3_digest_long(acc, state, secret);
@@ -6131,7 +6138,7 @@ XXH_PUBLIC_API XXH128_hash_t
6131
6138
  XXH3_128bits_withSecretandSeed(XXH_NOESCAPE const void* input, size_t len, XXH_NOESCAPE const void* secret, size_t secretSize, XXH64_hash_t seed)
6132
6139
  {
6133
6140
  if (len <= XXH3_MIDSIZE_MAX)
6134
- return XXH3_128bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), NULL);
6141
+ return XXH3_128bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), nullptr);
6135
6142
  return XXH3_hashLong_128b_withSecret(input, len, seed, secret, secretSize);
6136
6143
  }
6137
6144
 
@@ -6189,7 +6196,7 @@ XXH3_128bits_update(XXH_NOESCAPE XXH3_state_t* state, XXH_NOESCAPE const void* i
6189
6196
  /*! @ingroup XXH3_family */
6190
6197
  XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_digest (XXH_NOESCAPE const XXH3_state_t* state)
6191
6198
  {
6192
- const unsigned char* const secret = (state->extSecret == NULL) ? state->customSecret : state->extSecret;
6199
+ const unsigned char* const secret = (state->extSecret == nullptr) ? state->customSecret : state->extSecret;
6193
6200
  if (state->totalLen > XXH3_MIDSIZE_MAX) {
6194
6201
  XXH_ALIGN(XXH_ACC_ALIGN) XXH64_hash_t acc[XXH_ACC_NB];
6195
6202
  XXH3_digest_long(acc, state, secret);
@@ -6287,7 +6294,7 @@ XXH3_generateSecret(XXH_NOESCAPE void* secretBuffer, size_t secretSize, XXH_NOES
6287
6294
  XXH_ASSERT(secretSize >= XXH3_SECRET_SIZE_MIN)
6288
6295
  #else
6289
6296
  /* production mode, assert() are disabled */
6290
- if (secretBuffer == NULL) return XXH_ERROR;
6297
+ if (secretBuffer == nullptr) return XXH_ERROR;
6291
6298
  if (secretSize < XXH3_SECRET_SIZE_MIN) return XXH_ERROR;
6292
6299
  #endif
6293
6300
 
@@ -6298,7 +6305,7 @@ XXH3_generateSecret(XXH_NOESCAPE void* secretBuffer, size_t secretSize, XXH_NOES
6298
6305
  #if (XXH_DEBUGLEVEL >= 1)
6299
6306
  XXH_ASSERT(customSeed != NULL)
6300
6307
  #else
6301
- if (customSeed == NULL) return XXH_ERROR;
6308
+ if (customSeed == nullptr) return XXH_ERROR;
6302
6309
  #endif
6303
6310
 
6304
6311
  /* Fill secretBuffer with a copy of customSeed - repeat as needed */
@@ -162,6 +162,9 @@ class BlobDBImpl : public BlobDB {
162
162
  Status GetLiveFiles(std::vector<std::string>&, uint64_t* manifest_file_size,
163
163
  bool flush_memtable = true) override;
164
164
  void GetLiveFilesMetaData(std::vector<LiveFileMetaData>*) override;
165
+ Status GetLiveFilesStorageInfo(
166
+ const LiveFilesStorageInfoOptions& opts,
167
+ std::vector<LiveFileStorageInfo>* files) override;
165
168
 
166
169
  ~BlobDBImpl();
167
170
 
@@ -104,4 +104,24 @@ void BlobDBImpl::GetLiveFilesMetaData(std::vector<LiveFileMetaData>* metadata) {
104
104
  }
105
105
  }
106
106
 
107
+ Status BlobDBImpl::GetLiveFilesStorageInfo(
108
+ const LiveFilesStorageInfoOptions& opts,
109
+ std::vector<LiveFileStorageInfo>* files) {
110
+ ReadLock rl(&mutex_);
111
+ Status s = db_->GetLiveFilesStorageInfo(opts, files);
112
+ if (s.ok()) {
113
+ files->reserve(files->size() + blob_files_.size());
114
+ for (const auto& [blob_number, blob_file] : blob_files_) {
115
+ LiveFileStorageInfo file;
116
+ file.size = blob_file->GetFileSize();
117
+ file.directory = blob_dir_;
118
+ file.relative_filename = BlobFileName(blob_number);
119
+ file.file_type = kBlobFile;
120
+ file.trim_to_size = true;
121
+ files->push_back(std::move(file));
122
+ }
123
+ }
124
+ return s;
125
+ }
126
+
107
127
  } // namespace ROCKSDB_NAMESPACE::blob_db
@@ -3,18 +3,20 @@
3
3
  // COPYING file in the root directory) and Apache 2.0 License
4
4
  // (found in the LICENSE.Apache file in the root directory).
5
5
 
6
- #include "cache/cache_key.h"
7
- #include "table/block_based/block_based_table_reader.h"
6
+ #include "utilities/cache_dump_load_impl.h"
7
+
8
+ #include <limits>
8
9
 
9
10
  #include "cache/cache_entry_roles.h"
11
+ #include "cache/cache_key.h"
10
12
  #include "file/writable_file_writer.h"
11
13
  #include "port/lang.h"
12
14
  #include "rocksdb/env.h"
13
15
  #include "rocksdb/file_system.h"
14
16
  #include "rocksdb/utilities/ldb_cmd.h"
17
+ #include "table/block_based/block_based_table_reader.h"
15
18
  #include "table/format.h"
16
19
  #include "util/crc32c.h"
17
- #include "utilities/cache_dump_load_impl.h"
18
20
 
19
21
  namespace ROCKSDB_NAMESPACE {
20
22
 
@@ -24,6 +26,7 @@ namespace ROCKSDB_NAMESPACE {
24
26
  // requirement.
25
27
  Status CacheDumperImpl::SetDumpFilter(std::vector<DB*> db_list) {
26
28
  Status s = Status::OK();
29
+ dump_all_keys_ = false;
27
30
  for (size_t i = 0; i < db_list.size(); i++) {
28
31
  assert(i < db_list.size());
29
32
  TablePropertiesCollection ptc;
@@ -67,6 +70,8 @@ IOStatus CacheDumperImpl::DumpCacheEntriesToWriter() {
67
70
  }
68
71
  clock_ = options_.clock;
69
72
 
73
+ deadline_ = options_.deadline;
74
+
70
75
  // Set the sequence number
71
76
  sequence_num_ = 0;
72
77
 
@@ -117,6 +122,19 @@ CacheDumperImpl::DumpOneBlockCallBack(std::string& buf) {
117
122
  return;
118
123
  }
119
124
 
125
+ if (options_.max_size_bytes > 0 &&
126
+ dumped_size_bytes_ > options_.max_size_bytes) {
127
+ return;
128
+ }
129
+
130
+ uint64_t timestamp = clock_->NowMicros();
131
+ if (deadline_.count()) {
132
+ std::chrono::microseconds now = std::chrono::microseconds(timestamp);
133
+ if (now >= deadline_) {
134
+ return;
135
+ }
136
+ }
137
+
120
138
  CacheEntryRole role = helper->role;
121
139
  CacheDumpUnitType type = CacheDumpUnitType::kBlockTypeMax;
122
140
 
@@ -140,7 +158,7 @@ CacheDumperImpl::DumpOneBlockCallBack(std::string& buf) {
140
158
  }
141
159
 
142
160
  // based on the key prefix, check if the block should be filter out.
143
- if (ShouldFilterOut(key)) {
161
+ if (!dump_all_keys_ && ShouldFilterOut(key)) {
144
162
  return;
145
163
  }
146
164
 
@@ -154,7 +172,8 @@ CacheDumperImpl::DumpOneBlockCallBack(std::string& buf) {
154
172
 
155
173
  if (s.ok()) {
156
174
  // Write it out
157
- WriteBlock(type, key, buf).PermitUncheckedError();
175
+ WriteBlock(type, key, buf, timestamp).PermitUncheckedError();
176
+ dumped_size_bytes_ += len;
158
177
  }
159
178
  };
160
179
  }
@@ -168,8 +187,7 @@ CacheDumperImpl::DumpOneBlockCallBack(std::string& buf) {
168
187
  // First, we write the metadata first, which is a fixed size string. Then, we
169
188
  // Append the dump unit string to the writer.
170
189
  IOStatus CacheDumperImpl::WriteBlock(CacheDumpUnitType type, const Slice& key,
171
- const Slice& value) {
172
- uint64_t timestamp = clock_->NowMicros();
190
+ const Slice& value, uint64_t timestamp) {
173
191
  uint32_t value_checksum = crc32c::Value(value.data(), value.size());
174
192
 
175
193
  // First, serialize the block information in a string
@@ -219,7 +237,8 @@ IOStatus CacheDumperImpl::WriteHeader() {
219
237
  "block_size, block_data, block_checksum> cache_value\n";
220
238
  std::string header_value(s.str());
221
239
  CacheDumpUnitType type = CacheDumpUnitType::kHeader;
222
- return WriteBlock(type, header_key, header_value);
240
+ uint64_t timestamp = clock_->NowMicros();
241
+ return WriteBlock(type, header_key, header_value, timestamp);
223
242
  }
224
243
 
225
244
  // Write the footer after all the blocks are stored to indicate the ending.
@@ -227,7 +246,8 @@ IOStatus CacheDumperImpl::WriteFooter() {
227
246
  std::string footer_key = "footer";
228
247
  std::string footer_value("cache dump completed");
229
248
  CacheDumpUnitType type = CacheDumpUnitType::kFooter;
230
- return WriteBlock(type, footer_key, footer_value);
249
+ uint64_t timestamp = clock_->NowMicros();
250
+ return WriteBlock(type, footer_key, footer_value, timestamp);
231
251
  }
232
252
 
233
253
  // This is the main function to restore the cache entries to secondary cache.