@nxtedition/rocksdb 9.0.0 → 10.0.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 (307) hide show
  1. package/binding.cc +244 -177
  2. package/deps/rocksdb/rocksdb/CMakeLists.txt +13 -9
  3. package/deps/rocksdb/rocksdb/Makefile +15 -6
  4. package/deps/rocksdb/rocksdb/README.md +29 -0
  5. package/deps/rocksdb/rocksdb/TARGETS +17 -2
  6. package/deps/rocksdb/rocksdb/cache/cache.cc +35 -0
  7. package/deps/rocksdb/rocksdb/cache/cache_bench_tool.cc +74 -15
  8. package/deps/rocksdb/rocksdb/cache/cache_helpers.cc +2 -1
  9. package/deps/rocksdb/rocksdb/cache/cache_reservation_manager.h +4 -3
  10. package/deps/rocksdb/rocksdb/cache/cache_test.cc +16 -4
  11. package/deps/rocksdb/rocksdb/cache/charged_cache.cc +4 -2
  12. package/deps/rocksdb/rocksdb/cache/charged_cache.h +5 -3
  13. package/deps/rocksdb/rocksdb/cache/clock_cache.cc +2024 -14
  14. package/deps/rocksdb/rocksdb/cache/clock_cache.h +349 -23
  15. package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache.cc +126 -51
  16. package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache.h +9 -0
  17. package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache_test.cc +202 -7
  18. package/deps/rocksdb/rocksdb/cache/lru_cache_test.cc +31 -14
  19. package/deps/rocksdb/rocksdb/cache/secondary_cache.cc +0 -33
  20. package/deps/rocksdb/rocksdb/cache/secondary_cache_adapter.cc +314 -25
  21. package/deps/rocksdb/rocksdb/cache/secondary_cache_adapter.h +29 -4
  22. package/deps/rocksdb/rocksdb/cache/sharded_cache.cc +10 -0
  23. package/deps/rocksdb/rocksdb/cache/sharded_cache.h +8 -3
  24. package/deps/rocksdb/rocksdb/cache/tiered_secondary_cache.cc +119 -0
  25. package/deps/rocksdb/rocksdb/cache/tiered_secondary_cache.h +155 -0
  26. package/deps/rocksdb/rocksdb/cache/tiered_secondary_cache_test.cc +711 -0
  27. package/deps/rocksdb/rocksdb/cache/typed_cache.h +17 -11
  28. package/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.cc +25 -11
  29. package/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.h +1 -0
  30. package/deps/rocksdb/rocksdb/db/blob/blob_contents.h +2 -1
  31. package/deps/rocksdb/rocksdb/db/blob/blob_file_reader.cc +2 -1
  32. package/deps/rocksdb/rocksdb/db/blob/db_blob_basic_test.cc +8 -0
  33. package/deps/rocksdb/rocksdb/db/blob/db_blob_index_test.cc +7 -3
  34. package/deps/rocksdb/rocksdb/db/builder.cc +3 -3
  35. package/deps/rocksdb/rocksdb/db/c.cc +64 -0
  36. package/deps/rocksdb/rocksdb/db/c_test.c +36 -0
  37. package/deps/rocksdb/rocksdb/db/column_family.cc +23 -15
  38. package/deps/rocksdb/rocksdb/db/column_family.h +9 -0
  39. package/deps/rocksdb/rocksdb/db/column_family_test.cc +101 -5
  40. package/deps/rocksdb/rocksdb/db/compaction/compaction.cc +36 -23
  41. package/deps/rocksdb/rocksdb/db/compaction/compaction.h +24 -10
  42. package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.cc +3 -5
  43. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.cc +42 -18
  44. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.h +7 -3
  45. package/deps/rocksdb/rocksdb/db/compaction/compaction_job_test.cc +4 -2
  46. package/deps/rocksdb/rocksdb/db/compaction/compaction_outputs.cc +8 -6
  47. package/deps/rocksdb/rocksdb/db/compaction/compaction_outputs.h +1 -1
  48. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_fifo.cc +3 -0
  49. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_test.cc +61 -0
  50. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_universal.cc +146 -64
  51. package/deps/rocksdb/rocksdb/db/compaction/tiered_compaction_test.cc +13 -39
  52. package/deps/rocksdb/rocksdb/db/comparator_db_test.cc +1 -0
  53. package/deps/rocksdb/rocksdb/db/db_basic_test.cc +29 -7
  54. package/deps/rocksdb/rocksdb/db/db_block_cache_test.cc +8 -3
  55. package/deps/rocksdb/rocksdb/db/db_bloom_filter_test.cc +59 -0
  56. package/deps/rocksdb/rocksdb/db/db_compaction_filter_test.cc +27 -3
  57. package/deps/rocksdb/rocksdb/db/db_compaction_test.cc +186 -2
  58. package/deps/rocksdb/rocksdb/db/db_flush_test.cc +1 -0
  59. package/deps/rocksdb/rocksdb/db/db_impl/compacted_db_impl.cc +17 -5
  60. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.cc +519 -240
  61. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +104 -43
  62. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_compaction_flush.cc +169 -66
  63. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_debug.cc +2 -1
  64. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_files.cc +12 -4
  65. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +50 -14
  66. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_readonly.cc +85 -53
  67. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_readonly.h +3 -7
  68. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.cc +99 -82
  69. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.h +4 -14
  70. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_write.cc +24 -21
  71. package/deps/rocksdb/rocksdb/db/db_info_dumper.cc +6 -0
  72. package/deps/rocksdb/rocksdb/db/db_iter.cc +83 -55
  73. package/deps/rocksdb/rocksdb/db/db_iter.h +10 -2
  74. package/deps/rocksdb/rocksdb/db/db_iter_test.cc +29 -0
  75. package/deps/rocksdb/rocksdb/db/db_iterator_test.cc +276 -21
  76. package/deps/rocksdb/rocksdb/db/db_log_iter_test.cc +35 -0
  77. package/deps/rocksdb/rocksdb/db/db_merge_operator_test.cc +187 -1
  78. package/deps/rocksdb/rocksdb/db/db_options_test.cc +258 -0
  79. package/deps/rocksdb/rocksdb/db/db_range_del_test.cc +258 -0
  80. package/deps/rocksdb/rocksdb/db/db_rate_limiter_test.cc +1 -0
  81. package/deps/rocksdb/rocksdb/db/db_readonly_with_timestamp_test.cc +52 -0
  82. package/deps/rocksdb/rocksdb/db/db_secondary_test.cc +74 -1
  83. package/deps/rocksdb/rocksdb/db/db_sst_test.cc +22 -4
  84. package/deps/rocksdb/rocksdb/db/db_tailing_iter_test.cc +3 -1
  85. package/deps/rocksdb/rocksdb/db/db_test.cc +134 -30
  86. package/deps/rocksdb/rocksdb/db/db_test2.cc +3 -0
  87. package/deps/rocksdb/rocksdb/db/db_test_util.cc +11 -6
  88. package/deps/rocksdb/rocksdb/db/db_test_util.h +5 -2
  89. package/deps/rocksdb/rocksdb/db/db_universal_compaction_test.cc +1 -0
  90. package/deps/rocksdb/rocksdb/db/db_wal_test.cc +12 -0
  91. package/deps/rocksdb/rocksdb/db/db_with_timestamp_basic_test.cc +337 -1
  92. package/deps/rocksdb/rocksdb/db/deletefile_test.cc +2 -0
  93. package/deps/rocksdb/rocksdb/db/error_handler.cc +51 -34
  94. package/deps/rocksdb/rocksdb/db/error_handler.h +7 -6
  95. package/deps/rocksdb/rocksdb/db/external_sst_file_test.cc +58 -0
  96. package/deps/rocksdb/rocksdb/db/flush_job.cc +17 -19
  97. package/deps/rocksdb/rocksdb/db/flush_job.h +3 -3
  98. package/deps/rocksdb/rocksdb/db/flush_job_test.cc +2 -1
  99. package/deps/rocksdb/rocksdb/db/manual_compaction_test.cc +2 -0
  100. package/deps/rocksdb/rocksdb/db/memtable.cc +18 -70
  101. package/deps/rocksdb/rocksdb/db/memtable_list.cc +1 -1
  102. package/deps/rocksdb/rocksdb/db/memtable_list.h +11 -1
  103. package/deps/rocksdb/rocksdb/db/memtable_list_test.cc +1 -1
  104. package/deps/rocksdb/rocksdb/db/merge_helper.cc +330 -115
  105. package/deps/rocksdb/rocksdb/db/merge_helper.h +100 -12
  106. package/deps/rocksdb/rocksdb/db/merge_operator.cc +82 -0
  107. package/deps/rocksdb/rocksdb/db/merge_test.cc +267 -0
  108. package/deps/rocksdb/rocksdb/db/perf_context_test.cc +3 -0
  109. package/deps/rocksdb/rocksdb/db/periodic_task_scheduler.h +4 -4
  110. package/deps/rocksdb/rocksdb/db/plain_table_db_test.cc +2 -0
  111. package/deps/rocksdb/rocksdb/db/prefix_test.cc +1 -0
  112. package/deps/rocksdb/rocksdb/db/range_del_aggregator.h +4 -0
  113. package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter.h +4 -0
  114. package/deps/rocksdb/rocksdb/db/repair.cc +4 -3
  115. package/deps/rocksdb/rocksdb/db/seqno_time_test.cc +454 -70
  116. package/deps/rocksdb/rocksdb/db/seqno_to_time_mapping.cc +105 -69
  117. package/deps/rocksdb/rocksdb/db/seqno_to_time_mapping.h +83 -46
  118. package/deps/rocksdb/rocksdb/db/table_cache.cc +32 -19
  119. package/deps/rocksdb/rocksdb/db/table_cache.h +12 -6
  120. package/deps/rocksdb/rocksdb/db/version_edit.h +10 -4
  121. package/deps/rocksdb/rocksdb/db/version_set.cc +75 -73
  122. package/deps/rocksdb/rocksdb/db/version_set.h +8 -8
  123. package/deps/rocksdb/rocksdb/db/version_set_sync_and_async.h +2 -5
  124. package/deps/rocksdb/rocksdb/db/version_set_test.cc +22 -11
  125. package/deps/rocksdb/rocksdb/db/wide/db_wide_basic_test.cc +525 -0
  126. package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization.cc +6 -22
  127. package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization.h +0 -20
  128. package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization_test.cc +0 -29
  129. package/deps/rocksdb/rocksdb/db/wide/wide_columns_helper.cc +46 -0
  130. package/deps/rocksdb/rocksdb/db/wide/wide_columns_helper.h +40 -0
  131. package/deps/rocksdb/rocksdb/db/wide/wide_columns_helper_test.cc +39 -0
  132. package/deps/rocksdb/rocksdb/db/write_batch.cc +44 -20
  133. package/deps/rocksdb/rocksdb/db_stress_tool/CMakeLists.txt +1 -0
  134. package/deps/rocksdb/rocksdb/db_stress_tool/batched_ops_stress.cc +4 -4
  135. package/deps/rocksdb/rocksdb/db_stress_tool/cf_consistency_stress.cc +4 -7
  136. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.cc +88 -10
  137. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.h +15 -10
  138. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_driver.cc +108 -58
  139. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_gflags.cc +36 -14
  140. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_listener.h +34 -0
  141. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_shared_state.h +1 -1
  142. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.cc +195 -130
  143. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.h +4 -2
  144. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_tool.cc +12 -12
  145. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_wide_merge_operator.cc +51 -0
  146. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_wide_merge_operator.h +27 -0
  147. package/deps/rocksdb/rocksdb/db_stress_tool/expected_state.cc +3 -6
  148. package/deps/rocksdb/rocksdb/db_stress_tool/multi_ops_txns_stress.cc +14 -11
  149. package/deps/rocksdb/rocksdb/db_stress_tool/no_batched_ops_stress.cc +44 -38
  150. package/deps/rocksdb/rocksdb/env/env.cc +5 -0
  151. package/deps/rocksdb/rocksdb/env/unique_id_gen.cc +1 -0
  152. package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.cc +50 -29
  153. package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.h +32 -2
  154. package/deps/rocksdb/rocksdb/file/prefetch_test.cc +513 -30
  155. package/deps/rocksdb/rocksdb/file/random_access_file_reader.cc +8 -0
  156. package/deps/rocksdb/rocksdb/include/rocksdb/advanced_cache.h +38 -13
  157. package/deps/rocksdb/rocksdb/include/rocksdb/advanced_options.h +14 -7
  158. package/deps/rocksdb/rocksdb/include/rocksdb/c.h +42 -0
  159. package/deps/rocksdb/rocksdb/include/rocksdb/cache.h +65 -12
  160. package/deps/rocksdb/rocksdb/include/rocksdb/compaction_filter.h +11 -0
  161. package/deps/rocksdb/rocksdb/include/rocksdb/comparator.h +26 -0
  162. package/deps/rocksdb/rocksdb/include/rocksdb/db.h +37 -4
  163. package/deps/rocksdb/rocksdb/include/rocksdb/env.h +2 -0
  164. package/deps/rocksdb/rocksdb/include/rocksdb/file_system.h +1 -0
  165. package/deps/rocksdb/rocksdb/include/rocksdb/filter_policy.h +8 -3
  166. package/deps/rocksdb/rocksdb/include/rocksdb/iterator.h +10 -4
  167. package/deps/rocksdb/rocksdb/include/rocksdb/listener.h +4 -0
  168. package/deps/rocksdb/rocksdb/include/rocksdb/memory_allocator.h +1 -1
  169. package/deps/rocksdb/rocksdb/include/rocksdb/merge_operator.h +55 -4
  170. package/deps/rocksdb/rocksdb/include/rocksdb/options.h +45 -5
  171. package/deps/rocksdb/rocksdb/include/rocksdb/port_defs.h +4 -0
  172. package/deps/rocksdb/rocksdb/include/rocksdb/rate_limiter.h +9 -0
  173. package/deps/rocksdb/rocksdb/include/rocksdb/secondary_cache.h +79 -8
  174. package/deps/rocksdb/rocksdb/include/rocksdb/statistics.h +16 -0
  175. package/deps/rocksdb/rocksdb/include/rocksdb/status.h +35 -0
  176. package/deps/rocksdb/rocksdb/include/rocksdb/system_clock.h +15 -0
  177. package/deps/rocksdb/rocksdb/include/rocksdb/table_properties.h +14 -3
  178. package/deps/rocksdb/rocksdb/include/rocksdb/thread_status.h +2 -0
  179. package/deps/rocksdb/rocksdb/include/rocksdb/types.h +7 -0
  180. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/ldb_cmd.h +6 -1
  181. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/options_type.h +2 -1
  182. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/transaction.h +9 -0
  183. package/deps/rocksdb/rocksdb/include/rocksdb/version.h +2 -2
  184. package/deps/rocksdb/rocksdb/include/rocksdb/wide_columns.h +53 -2
  185. package/deps/rocksdb/rocksdb/include/rocksdb/write_batch.h +0 -2
  186. package/deps/rocksdb/rocksdb/memory/jemalloc_nodump_allocator.cc +2 -2
  187. package/deps/rocksdb/rocksdb/memory/jemalloc_nodump_allocator.h +1 -1
  188. package/deps/rocksdb/rocksdb/microbench/README.md +60 -0
  189. package/deps/rocksdb/rocksdb/monitoring/instrumented_mutex.h +1 -1
  190. package/deps/rocksdb/rocksdb/monitoring/statistics.cc +6 -0
  191. package/deps/rocksdb/rocksdb/monitoring/stats_history_test.cc +18 -7
  192. package/deps/rocksdb/rocksdb/monitoring/thread_status_util_debug.cc +4 -0
  193. package/deps/rocksdb/rocksdb/options/customizable_test.cc +4 -0
  194. package/deps/rocksdb/rocksdb/options/db_options.cc +47 -2
  195. package/deps/rocksdb/rocksdb/options/db_options.h +3 -0
  196. package/deps/rocksdb/rocksdb/options/options_helper.cc +12 -0
  197. package/deps/rocksdb/rocksdb/options/options_settable_test.cc +3 -1
  198. package/deps/rocksdb/rocksdb/options/options_test.cc +6 -1
  199. package/deps/rocksdb/rocksdb/plugin/README.md +43 -0
  200. package/deps/rocksdb/rocksdb/port/README +10 -0
  201. package/deps/rocksdb/rocksdb/port/port_example.h +1 -1
  202. package/deps/rocksdb/rocksdb/port/port_posix.cc +1 -1
  203. package/deps/rocksdb/rocksdb/port/port_posix.h +7 -4
  204. package/deps/rocksdb/rocksdb/port/stack_trace.cc +5 -0
  205. package/deps/rocksdb/rocksdb/port/win/port_win.h +5 -2
  206. package/deps/rocksdb/rocksdb/src.mk +7 -1
  207. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_builder.cc +1 -1
  208. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_factory.cc +3 -1
  209. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.cc +275 -61
  210. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.h +96 -4
  211. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.cc +179 -62
  212. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.h +35 -22
  213. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_impl.h +12 -8
  214. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +14 -9
  215. package/deps/rocksdb/rocksdb/table/block_based/block_cache.cc +3 -1
  216. package/deps/rocksdb/rocksdb/table/block_based/block_cache.h +26 -7
  217. package/deps/rocksdb/rocksdb/table/block_based/block_prefetcher.cc +15 -12
  218. package/deps/rocksdb/rocksdb/table/block_based/block_prefetcher.h +10 -5
  219. package/deps/rocksdb/rocksdb/table/block_based/block_test.cc +39 -18
  220. package/deps/rocksdb/rocksdb/table/block_based/filter_block_reader_common.cc +6 -6
  221. package/deps/rocksdb/rocksdb/table/block_based/filter_policy.cc +44 -26
  222. package/deps/rocksdb/rocksdb/table/block_based/filter_policy_internal.h +2 -1
  223. package/deps/rocksdb/rocksdb/table/block_based/index_reader_common.cc +1 -1
  224. package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block.cc +10 -8
  225. package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_iterator.cc +4 -2
  226. package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_reader.cc +3 -2
  227. package/deps/rocksdb/rocksdb/table/block_based/uncompression_dict_reader.cc +1 -1
  228. package/deps/rocksdb/rocksdb/table/block_fetcher.cc +3 -2
  229. package/deps/rocksdb/rocksdb/table/block_fetcher.h +4 -0
  230. package/deps/rocksdb/rocksdb/table/block_fetcher_test.cc +6 -2
  231. package/deps/rocksdb/rocksdb/table/get_context.cc +52 -89
  232. package/deps/rocksdb/rocksdb/table/get_context.h +12 -3
  233. package/deps/rocksdb/rocksdb/table/internal_iterator.h +11 -0
  234. package/deps/rocksdb/rocksdb/table/iterator_wrapper.h +29 -1
  235. package/deps/rocksdb/rocksdb/table/merging_iterator.cc +12 -0
  236. package/deps/rocksdb/rocksdb/table/sst_file_dumper.cc +33 -6
  237. package/deps/rocksdb/rocksdb/table/sst_file_reader_test.cc +1 -0
  238. package/deps/rocksdb/rocksdb/table/sst_file_writer.cc +2 -4
  239. package/deps/rocksdb/rocksdb/table/table_reader.h +6 -0
  240. package/deps/rocksdb/rocksdb/test_util/mock_time_env.h +31 -0
  241. package/deps/rocksdb/rocksdb/test_util/secondary_cache_test_util.cc +2 -1
  242. package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_pysim.py +3 -3
  243. package/deps/rocksdb/rocksdb/tools/db_bench_tool.cc +26 -43
  244. package/deps/rocksdb/rocksdb/tools/ldb_cmd.cc +213 -28
  245. package/deps/rocksdb/rocksdb/tools/ldb_cmd_impl.h +36 -0
  246. package/deps/rocksdb/rocksdb/tools/ldb_tool.cc +0 -1
  247. package/deps/rocksdb/rocksdb/tools/sst_dump_test.cc +33 -10
  248. package/deps/rocksdb/rocksdb/util/bloom_test.cc +32 -11
  249. package/deps/rocksdb/rocksdb/util/cast_util.h +10 -0
  250. package/deps/rocksdb/rocksdb/util/comparator.cc +26 -1
  251. package/deps/rocksdb/rocksdb/util/compression.h +9 -3
  252. package/deps/rocksdb/rocksdb/util/crc32c.cc +7 -1
  253. package/deps/rocksdb/rocksdb/util/distributed_mutex.h +1 -1
  254. package/deps/rocksdb/rocksdb/util/overload.h +23 -0
  255. package/deps/rocksdb/rocksdb/util/rate_limiter.cc +53 -18
  256. package/deps/rocksdb/rocksdb/util/rate_limiter_impl.h +6 -1
  257. package/deps/rocksdb/rocksdb/util/rate_limiter_test.cc +90 -19
  258. package/deps/rocksdb/rocksdb/util/slice_test.cc +30 -0
  259. package/deps/rocksdb/rocksdb/util/status.cc +1 -0
  260. package/deps/rocksdb/rocksdb/util/string_util.cc +39 -0
  261. package/deps/rocksdb/rocksdb/util/string_util.h +10 -0
  262. package/deps/rocksdb/rocksdb/util/thread_operation.h +2 -0
  263. package/deps/rocksdb/rocksdb/util/udt_util.cc +42 -0
  264. package/deps/rocksdb/rocksdb/util/udt_util.h +19 -0
  265. package/deps/rocksdb/rocksdb/util/udt_util_test.cc +14 -0
  266. package/deps/rocksdb/rocksdb/util/xxhash.h +0 -3
  267. package/deps/rocksdb/rocksdb/util/xxph3.h +0 -4
  268. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db_impl.cc +2 -1
  269. package/deps/rocksdb/rocksdb/utilities/fault_injection_env.h +1 -0
  270. package/deps/rocksdb/rocksdb/utilities/fault_injection_fs.cc +19 -15
  271. package/deps/rocksdb/rocksdb/utilities/fault_injection_fs.h +11 -7
  272. package/deps/rocksdb/rocksdb/utilities/fault_injection_secondary_cache.h +5 -0
  273. package/deps/rocksdb/rocksdb/utilities/merge_operators/string_append/stringappend_test.cc +3 -0
  274. package/deps/rocksdb/rocksdb/utilities/option_change_migration/option_change_migration_test.cc +9 -0
  275. package/deps/rocksdb/rocksdb/utilities/simulator_cache/sim_cache.cc +7 -4
  276. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/README +13 -0
  277. package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction_test.cc +41 -0
  278. package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction.cc +15 -9
  279. package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction.h +4 -0
  280. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.cc +155 -0
  281. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.h +6 -0
  282. package/deps/rocksdb/rocksdb/utilities/transactions/write_committed_transaction_ts_test.cc +81 -1
  283. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn.cc +2 -6
  284. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn_db.cc +7 -5
  285. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn.cc +2 -1
  286. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn_db.cc +3 -2
  287. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +57 -27
  288. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.cc +127 -120
  289. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.h +129 -59
  290. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_test.cc +105 -8
  291. package/deps/rocksdb/rocksdb.gyp +4 -2
  292. package/index.js +38 -55
  293. package/package.json +4 -4
  294. package/prebuilds/darwin-arm64/@nxtedition+rocksdb.node +0 -0
  295. package/util.h +7 -1
  296. package/deps/rocksdb/rocksdb/cmake/modules/CxxFlags.cmake +0 -7
  297. package/deps/rocksdb/rocksdb/cmake/modules/FindJeMalloc.cmake +0 -29
  298. package/deps/rocksdb/rocksdb/cmake/modules/FindNUMA.cmake +0 -29
  299. package/deps/rocksdb/rocksdb/cmake/modules/FindSnappy.cmake +0 -29
  300. package/deps/rocksdb/rocksdb/cmake/modules/FindTBB.cmake +0 -33
  301. package/deps/rocksdb/rocksdb/cmake/modules/Findgflags.cmake +0 -29
  302. package/deps/rocksdb/rocksdb/cmake/modules/Findlz4.cmake +0 -29
  303. package/deps/rocksdb/rocksdb/cmake/modules/Finduring.cmake +0 -26
  304. package/deps/rocksdb/rocksdb/cmake/modules/Findzstd.cmake +0 -29
  305. package/deps/rocksdb/rocksdb/cmake/modules/ReadVersion.cmake +0 -10
  306. package/prebuilds/darwin-arm64/node.napi.node +0 -0
  307. package/prebuilds/linux-x64/node.napi.node +0 -0
@@ -8,10 +8,13 @@
8
8
  #include <deque>
9
9
  #include <memory>
10
10
  #include <string>
11
+ #include <utility>
12
+ #include <variant>
11
13
  #include <vector>
12
14
 
13
15
  #include "rocksdb/customizable.h"
14
16
  #include "rocksdb/slice.h"
17
+ #include "rocksdb/wide_columns.h"
15
18
 
16
19
  namespace ROCKSDB_NAMESPACE {
17
20
 
@@ -33,7 +36,7 @@ class Logger;
33
36
  // into rocksdb); numeric addition and string concatenation are examples;
34
37
  //
35
38
  // b) MergeOperator - the generic class for all the more abstract / complex
36
- // operations; one method (FullMergeV2) to merge a Put/Delete value with a
39
+ // operations; one method (FullMergeV3) to merge a Put/Delete value with a
37
40
  // merge operand; and another method (PartialMerge) that merges multiple
38
41
  // operands together. this is especially useful if your key values have
39
42
  // complex structures but you would still like to support client-specific
@@ -158,6 +161,54 @@ class MergeOperator : public Customizable {
158
161
  virtual bool FullMergeV2(const MergeOperationInput& merge_in,
159
162
  MergeOperationOutput* merge_out) const;
160
163
 
164
+ struct MergeOperationInputV3 {
165
+ using ExistingValue = std::variant<std::monostate, Slice, WideColumns>;
166
+ using OperandList = std::vector<Slice>;
167
+
168
+ explicit MergeOperationInputV3(const Slice& _key,
169
+ ExistingValue&& _existing_value,
170
+ const OperandList& _operand_list,
171
+ Logger* _logger)
172
+ : key(_key),
173
+ existing_value(std::move(_existing_value)),
174
+ operand_list(_operand_list),
175
+ logger(_logger) {}
176
+
177
+ // The user key, including the user-defined timestamp if applicable.
178
+ const Slice& key;
179
+ // The base value of the merge operation. Can be one of three things (see
180
+ // the ExistingValue variant above): no existing value, plain existing
181
+ // value, or wide-column existing value.
182
+ ExistingValue existing_value;
183
+ // The list of operands to apply.
184
+ const OperandList& operand_list;
185
+ // The logger to use in case a failure happens during the merge operation.
186
+ Logger* logger;
187
+ };
188
+
189
+ struct MergeOperationOutputV3 {
190
+ using NewColumns = std::vector<std::pair<std::string, std::string>>;
191
+ using NewValue = std::variant<std::string, NewColumns, Slice>;
192
+
193
+ // The result of the merge operation. Can be one of three things (see the
194
+ // NewValue variant above): a new plain value, a new wide-column value, or
195
+ // an existing merge operand.
196
+ NewValue new_value;
197
+ // The scope of the failure if applicable. See above for more details.
198
+ OpFailureScope op_failure_scope = OpFailureScope::kDefault;
199
+ };
200
+
201
+ // An extended version of FullMergeV2() that supports wide columns on both the
202
+ // input and the output side, enabling the application to perform general
203
+ // transformations during merges. For backward compatibility, the default
204
+ // implementation calls FullMergeV2(). Specifically, if there is no base value
205
+ // or the base value is a plain key-value, the default implementation falls
206
+ // back to FullMergeV2(). If the base value is a wide-column entity, the
207
+ // default implementation invokes FullMergeV2() to perform the merge on the
208
+ // default column, and leaves any other columns unchanged.
209
+ virtual bool FullMergeV3(const MergeOperationInputV3& merge_in,
210
+ MergeOperationOutputV3* merge_out) const;
211
+
161
212
  // This function performs merge(left_op, right_op)
162
213
  // when both the operands are themselves merge operation types
163
214
  // that you would have passed to a DB::Merge() call in the same order
@@ -186,7 +237,7 @@ class MergeOperator : public Customizable {
186
237
  // TODO: Presently there is no way to differentiate between error/corruption
187
238
  // and simply "return false". For now, the client should simply return
188
239
  // false in any case it cannot perform partial-merge, regardless of reason.
189
- // If there is corruption in the data, handle it in the FullMergeV2() function
240
+ // If there is corruption in the data, handle it in the FullMergeV3() function
190
241
  // and return false there. The default implementation of PartialMerge will
191
242
  // always return false.
192
243
  virtual bool PartialMerge(const Slice& /*key*/, const Slice& /*left_operand*/,
@@ -243,8 +294,8 @@ class MergeOperator : public Customizable {
243
294
  // Doesn't help with iterators.
244
295
  //
245
296
  // Note: the merge operands are passed to this function in the reversed order
246
- // relative to how they were merged (passed to FullMerge or FullMergeV2)
247
- // for performance reasons, see also:
297
+ // relative to how they were merged (passed to
298
+ // FullMerge/FullMergeV2/FullMergeV3) for performance reasons, see also:
248
299
  // https://github.com/facebook/rocksdb/issues/3865
249
300
  virtual bool ShouldMerge(const std::vector<Slice>& /*operands*/) const {
250
301
  return false;
@@ -13,6 +13,7 @@
13
13
 
14
14
  #include <limits>
15
15
  #include <memory>
16
+ #include <optional>
16
17
  #include <string>
17
18
  #include <unordered_map>
18
19
  #include <vector>
@@ -206,6 +207,7 @@ struct ColumnFamilyOptions : public AdvancedColumnFamilyOptions {
206
207
  // - kZSTD: 3
207
208
  // - kZlibCompression: Z_DEFAULT_COMPRESSION (currently -1)
208
209
  // - kLZ4HCCompression: 0
210
+ // - kLZ4: -1 (i.e., `acceleration=1`; see `CompressionOptions::level` doc)
209
211
  // - For all others, we do not specify a compression level
210
212
  //
211
213
  // Dynamically changeable through SetOptions() API
@@ -483,7 +485,8 @@ struct DBOptions {
483
485
  // Default: false
484
486
  bool create_if_missing = false;
485
487
 
486
- // If true, missing column families will be automatically created.
488
+ // If true, missing column families will be automatically created on
489
+ // DB::Open().
487
490
  // Default: false
488
491
  bool create_missing_column_families = false;
489
492
 
@@ -1198,11 +1201,11 @@ struct DBOptions {
1198
1201
  // currently.
1199
1202
  WalFilter* wal_filter = nullptr;
1200
1203
 
1201
- // If true, then DB::Open / CreateColumnFamily / DropColumnFamily
1204
+ // If true, then DB::Open, CreateColumnFamily, DropColumnFamily, and
1202
1205
  // SetOptions will fail if options file is not properly persisted.
1203
1206
  //
1204
- // DEFAULT: false
1205
- bool fail_if_options_file_error = false;
1207
+ // DEFAULT: true
1208
+ bool fail_if_options_file_error = true;
1206
1209
 
1207
1210
  // If true, then print malloc stats together with rocksdb.stats
1208
1211
  // when printing to LOG.
@@ -1425,6 +1428,24 @@ struct DBOptions {
1425
1428
  // of the contract leads to undefined behaviors with high possibility of data
1426
1429
  // inconsistency, e.g. deleted old data become visible again, etc.
1427
1430
  bool enforce_single_del_contracts = true;
1431
+
1432
+ // EXPERIMENTAL
1433
+ // Implementing off-peak duration awareness in RocksDB. In this context,
1434
+ // "off-peak time" signifies periods characterized by significantly less read
1435
+ // and write activity compared to other times. By leveraging this knowledge,
1436
+ // we can prevent low-priority tasks, such as TTL-based compactions, from
1437
+ // competing with read and write operations during peak hours. Essentially, we
1438
+ // preprocess these tasks during the preceding off-peak period, just before
1439
+ // the next peak cycle begins. For example, if the TTL is configured for 25
1440
+ // days, we may compact the files during the off-peak hours of the 24th day.
1441
+ //
1442
+ // Time of the day in UTC, start_time-end_time inclusive.
1443
+ // Format - HH:mm-HH:mm (00:00-23:59)
1444
+ // If the start time > end time, it will be considered that the time period
1445
+ // spans to the next day (e.g., 23:30-04:00). To make an entire day off-peak,
1446
+ // use "0:00-23:59". To make an entire day have no offpeak period, leave
1447
+ // this field blank. Default: Empty string (no offpeak).
1448
+ std::string daily_offpeak_time_utc = "";
1428
1449
  };
1429
1450
 
1430
1451
  // Options to control the behavior of a database (passed to DB::Open)
@@ -1551,6 +1572,12 @@ struct ReadOptions {
1551
1572
  // soft limit then all the remaining keys are returned with status Aborted.
1552
1573
  uint64_t value_size_soft_limit = std::numeric_limits<uint64_t>::max();
1553
1574
 
1575
+ // When the number of merge operands applied exceeds this threshold
1576
+ // during a successful query, the operation will return a special OK
1577
+ // Status with subcode kMergeOperandThresholdExceeded. Currently only applies
1578
+ // to point lookups and is disabled by default.
1579
+ std::optional<size_t> merge_operand_count_threshold;
1580
+
1554
1581
  // If true, all data read from underlying storage will be
1555
1582
  // verified against corresponding checksums.
1556
1583
  bool verify_checksums = true;
@@ -1711,14 +1738,27 @@ struct ReadOptions {
1711
1738
  // during scans internally.
1712
1739
  // For this feature to enabled, iterate_upper_bound must also be specified.
1713
1740
  //
1741
+ // NOTE: - Recommended for forward Scans only.
1742
+ // - In case of backward scans like Prev or SeekForPrev, the
1743
+ // cost of these backward operations might increase and affect the
1744
+ // performace. So this option should not be enabled if workload
1745
+ // contains backward scans.
1746
+ // - If there is a backward scans, this option will be
1747
+ // disabled internally and won't be reset if forward scan is done
1748
+ // again.
1749
+ //
1714
1750
  // Default: false
1715
1751
  bool auto_readahead_size = false;
1716
1752
 
1717
1753
  // *** END options only relevant to iterators or scans ***
1718
1754
 
1719
- // ** For RocksDB internal use only **
1755
+ // *** BEGIN options for RocksDB internal use only ***
1756
+
1757
+ // EXPERIMENTAL
1720
1758
  Env::IOActivity io_activity = Env::IOActivity::kUnknown;
1721
1759
 
1760
+ // *** END options for RocksDB internal use only ***
1761
+
1722
1762
  ReadOptions() {}
1723
1763
  ReadOptions(bool _verify_checksums, bool _fill_cache);
1724
1764
  explicit ReadOptions(Env::IOActivity _io_activity);
@@ -12,6 +12,10 @@
12
12
 
13
13
  namespace ROCKSDB_NAMESPACE {
14
14
 
15
+ namespace port {
16
+ class CondVar;
17
+ }
18
+
15
19
  enum class CpuPriority {
16
20
  kIdle = 0,
17
21
  kLow = 1,
@@ -40,6 +40,15 @@ class RateLimiter {
40
40
  // REQUIRED: bytes_per_second > 0
41
41
  virtual void SetBytesPerSecond(int64_t bytes_per_second) = 0;
42
42
 
43
+ // This API allows user to dynamically change the max bytes can be granted in
44
+ // a single refill period (i.e, burst)
45
+ //
46
+ // REQUIRED: single_burst_bytes > 0. Otherwise `Status::InvalidArgument` will
47
+ // be returned.
48
+ virtual Status SetSingleBurstBytes(int64_t /* single_burst_bytes */) {
49
+ return Status::NotSupported();
50
+ }
51
+
43
52
  // Deprecated. New RateLimiter derived classes should override
44
53
  // Request(const int64_t, const Env::IOPriority, Statistics*) or
45
54
  // Request(const int64_t, const Env::IOPriority, Statistics*, OpType)
@@ -11,6 +11,7 @@
11
11
 
12
12
  #include "rocksdb/advanced_cache.h"
13
13
  #include "rocksdb/customizable.h"
14
+ #include "rocksdb/options.h"
14
15
  #include "rocksdb/slice.h"
15
16
  #include "rocksdb/statistics.h"
16
17
  #include "rocksdb/status.h"
@@ -83,15 +84,19 @@ class SecondaryCache : public Customizable {
83
84
  bool force_insert) = 0;
84
85
 
85
86
  // Insert a value from its saved/persistable data (typically uncompressed
86
- // block), as if generated by SaveToCallback/SizeCallback. This can be used
87
- // in "warming up" the cache from some auxiliary source, and like Insert()
88
- // may or may not write it to cache depending on the admission control
89
- // policy, even if the return status is success.
87
+ // block), as if generated by SaveToCallback/SizeCallback. The data can be
88
+ // compressed, in which case the type argument should specify the
89
+ // compression algorithm used. Additionally, the source argument should
90
+ // be set to the appropriate tier that will be responsible for
91
+ // uncompressing the data.
90
92
  //
91
- // The default implementation only assumes the entry helper's create_cb is
92
- // called at Lookup() time and not Insert() time, so should work for all
93
- // foreseeable implementations.
94
- virtual Status InsertSaved(const Slice& key, const Slice& saved);
93
+ // This method can be used in "warming up" the cache from some auxiliary
94
+ // source, and like Insert() may or may not write it to cache depending on
95
+ // the admission control policy, even if the return status is success.
96
+ virtual Status InsertSaved(
97
+ const Slice& key, const Slice& saved,
98
+ CompressionType type = CompressionType::kNoCompression,
99
+ CacheTier source = CacheTier::kVolatileTier) = 0;
95
100
 
96
101
  // Lookup the data for the given key in this cache. The create_cb
97
102
  // will be used to create the object. The handle returned may not be
@@ -148,4 +153,70 @@ class SecondaryCache : public Customizable {
148
153
  virtual Status Inflate(size_t /*increase*/) { return Status::NotSupported(); }
149
154
  };
150
155
 
156
+ // A wrapper around a SecondaryCache object. A derived class may selectively
157
+ // override methods to implement a different behavior.
158
+ class SecondaryCacheWrapper : public SecondaryCache {
159
+ public:
160
+ explicit SecondaryCacheWrapper(std::shared_ptr<SecondaryCache> target)
161
+ : target_(std::move(target)) {}
162
+
163
+ virtual Status Insert(const Slice& key, Cache::ObjectPtr obj,
164
+ const Cache::CacheItemHelper* helper,
165
+ bool force_insert) override {
166
+ return target()->Insert(key, obj, helper, force_insert);
167
+ }
168
+
169
+ virtual Status InsertSaved(
170
+ const Slice& key, const Slice& saved,
171
+ CompressionType type = CompressionType::kNoCompression,
172
+ CacheTier source = CacheTier::kVolatileTier) override {
173
+ return target()->InsertSaved(key, saved, type, source);
174
+ }
175
+
176
+ virtual std::unique_ptr<SecondaryCacheResultHandle> Lookup(
177
+ const Slice& key, const Cache::CacheItemHelper* helper,
178
+ Cache::CreateContext* create_context, bool wait, bool advise_erase,
179
+ bool& kept_in_sec_cache) override {
180
+ return target()->Lookup(key, helper, create_context, wait, advise_erase,
181
+ kept_in_sec_cache);
182
+ }
183
+
184
+ virtual bool SupportForceErase() const override {
185
+ return target()->SupportForceErase();
186
+ }
187
+
188
+ virtual void Erase(const Slice& key) override { target()->Erase(key); }
189
+
190
+ virtual void WaitAll(
191
+ std::vector<SecondaryCacheResultHandle*> handles) override {
192
+ target()->WaitAll(handles);
193
+ }
194
+
195
+ virtual Status SetCapacity(size_t capacity) override {
196
+ return target()->SetCapacity(capacity);
197
+ }
198
+
199
+ virtual Status GetCapacity(size_t& capacity) override {
200
+ return target()->GetCapacity(capacity);
201
+ }
202
+
203
+ virtual Status Deflate(size_t decrease) override {
204
+ return target()->Deflate(decrease);
205
+ }
206
+
207
+ virtual Status Inflate(size_t increase) override {
208
+ return target()->Inflate(increase);
209
+ }
210
+
211
+ protected:
212
+ SecondaryCache* target() const { return target_.get(); }
213
+
214
+ private:
215
+ std::shared_ptr<SecondaryCache> target_;
216
+ };
217
+
218
+ // Useful for cache entries that just need to be copied into a
219
+ // secondary cache, such as compressed blocks
220
+ extern const Cache::CacheItemHelper kSliceCacheItemHelper;
221
+
151
222
  } // namespace ROCKSDB_NAMESPACE
@@ -208,8 +208,11 @@ enum Tickers : uint32_t {
208
208
 
209
209
  // DEPRECATED / unused (see NUMBER_BLOCK_COMPRESSION_*)
210
210
  NUMBER_BLOCK_NOT_COMPRESSED,
211
+
212
+ // Tickers that record cumulative time.
211
213
  MERGE_OPERATION_TOTAL_TIME,
212
214
  FILTER_OPERATION_TOTAL_TIME,
215
+ COMPACTION_CPU_TOTAL_TIME,
213
216
 
214
217
  // Row cache.
215
218
  ROW_CACHE_HIT,
@@ -515,6 +518,19 @@ enum Tickers : uint32_t {
515
518
  // ReadOptions.auto_readahead_size is set.
516
519
  READAHEAD_TRIMMED,
517
520
 
521
+ // Number of FIFO compactions that drop files based on different reasons
522
+ FIFO_MAX_SIZE_COMPACTIONS,
523
+ FIFO_TTL_COMPACTIONS,
524
+
525
+ // Number of bytes prefetched during user initiated scan
526
+ PREFETCH_BYTES,
527
+
528
+ // Number of prefetched bytes that were actually useful
529
+ PREFETCH_BYTES_USEFUL,
530
+
531
+ // Number of FS reads avoided due to scan prefetching
532
+ PREFETCH_HITS,
533
+
518
534
  TICKER_ENUM_MAX
519
535
  };
520
536
 
@@ -114,6 +114,7 @@ class Status {
114
114
  kTxnNotPrepared = 13,
115
115
  kIOFenced = 14,
116
116
  kMergeOperatorFailed = 15,
117
+ kMergeOperandThresholdExceeded = 16,
117
118
  kMaxSubCode
118
119
  };
119
120
 
@@ -150,6 +151,25 @@ class Status {
150
151
  return state_.get();
151
152
  }
152
153
 
154
+ // Override this status with another, unless this status is already non-ok.
155
+ // Returns *this. Thus, the result of `a.UpdateIfOk(b).UpdateIfOk(c)` is
156
+ // non-ok (and `a` modified as such) iff any input was non-ok, with
157
+ // left-most taking precedence as far as the details.
158
+ Status& UpdateIfOk(Status&& s) {
159
+ if (code() == kOk) {
160
+ *this = std::move(s);
161
+ } else {
162
+ // Alright to ignore that status as long as this one is checked
163
+ s.PermitUncheckedError();
164
+ }
165
+ MustCheck();
166
+ return *this;
167
+ }
168
+
169
+ Status& UpdateIfOk(const Status& s) {
170
+ return UpdateIfOk(std::forward<Status>(Status(s)));
171
+ }
172
+
153
173
  // Return a success status.
154
174
  static Status OK() { return Status(); }
155
175
 
@@ -159,6 +179,14 @@ class Status {
159
179
  // changing public APIs.
160
180
  static Status OkOverwritten() { return Status(kOk, kOverwritten); }
161
181
 
182
+ // Successful, though the number of operands merged during the query exceeded
183
+ // the threshold. Note: using variants of OK status for program logic is
184
+ // discouraged, but it can be useful for communicating statistical information
185
+ // without changing public APIs.
186
+ static Status OkMergeOperandThresholdExceeded() {
187
+ return Status(kOk, kMergeOperandThresholdExceeded);
188
+ }
189
+
162
190
  // Return error status of an appropriate type.
163
191
  static Status NotFound(const Slice& msg, const Slice& msg2 = Slice()) {
164
192
  return Status(kNotFound, msg, msg2);
@@ -301,6 +329,13 @@ class Status {
301
329
  return code() == kOk && subcode() == kOverwritten;
302
330
  }
303
331
 
332
+ // Returns true iff the status indicates success *with* the number of operands
333
+ // merged exceeding the threshold
334
+ bool IsOkMergeOperandThresholdExceeded() const {
335
+ MarkChecked();
336
+ return code() == kOk && subcode() == kMergeOperandThresholdExceeded;
337
+ }
338
+
304
339
  // Returns true iff the status indicates a NotFound error.
305
340
  bool IsNotFound() const {
306
341
  MarkChecked();
@@ -9,9 +9,11 @@
9
9
  #pragma once
10
10
  #include <stdint.h>
11
11
 
12
+ #include <chrono>
12
13
  #include <memory>
13
14
 
14
15
  #include "rocksdb/customizable.h"
16
+ #include "rocksdb/port_defs.h"
15
17
  #include "rocksdb/rocksdb_namespace.h"
16
18
  #include "rocksdb/status.h"
17
19
 
@@ -68,6 +70,14 @@ class SystemClock : public Customizable {
68
70
  // Sleep/delay the thread for the prescribed number of micro-seconds.
69
71
  virtual void SleepForMicroseconds(int micros) = 0;
70
72
 
73
+ // For internal use/extension only.
74
+ //
75
+ // Issues a wait on `cv` that times out at `deadline`. May wakeup and return
76
+ // spuriously.
77
+ //
78
+ // Returns true if wait timed out, false otherwise
79
+ virtual bool TimedWait(port::CondVar* cv, std::chrono::microseconds deadline);
80
+
71
81
  // Get the number of seconds since the Epoch, 1970-01-01 00:00:00 (UTC).
72
82
  // Only overwrites *unix_time on success.
73
83
  virtual Status GetCurrentTime(int64_t* unix_time) = 0;
@@ -94,6 +104,11 @@ class SystemClockWrapper : public SystemClock {
94
104
  return target_->SleepForMicroseconds(micros);
95
105
  }
96
106
 
107
+ virtual bool TimedWait(port::CondVar* cv,
108
+ std::chrono::microseconds deadline) override {
109
+ return target_->TimedWait(cv, deadline);
110
+ }
111
+
97
112
  Status GetCurrentTime(int64_t* unix_time) override {
98
113
  return target_->GetCurrentTime(unix_time);
99
114
  }
@@ -219,9 +219,20 @@ struct TableProperties {
219
219
  // by column_family_name.
220
220
  uint64_t column_family_id = ROCKSDB_NAMESPACE::
221
221
  TablePropertiesCollectorFactory::Context::kUnknownColumnFamily;
222
- // Timestamp of the latest key. 0 means unknown.
223
- // TODO(sagar0): Should be changed to latest_key_time ... but don't know the
224
- // full implications of backward compatibility. Hence retaining for now.
222
+
223
+ // Oldest ancester time. 0 means unknown.
224
+ //
225
+ // For flush output file, oldest ancestor time is the oldest key time in the
226
+ // file. If the oldest key time is not available, flush time is used.
227
+ //
228
+ // For compaction output file, oldest ancestor time is the oldest
229
+ // among all the oldest key time of its input files, since the file could be
230
+ // the compaction output from other SST files, which could in turn be outputs
231
+ // for compact older SST files. If that's not available, creation time of this
232
+ // compaction output file is used.
233
+ //
234
+ // TODO(sagar0): Should be changed to oldest_ancester_time ... but don't know
235
+ // the full implications of backward compatibility. Hence retaining for now.
225
236
  uint64_t creation_time = 0;
226
237
 
227
238
  // Timestamp of the earliest key. 0 means unknown.
@@ -62,6 +62,8 @@ struct ThreadStatus {
62
62
  OP_DBITERATOR,
63
63
  OP_VERIFY_DB_CHECKSUM,
64
64
  OP_VERIFY_FILE_CHECKSUMS,
65
+ OP_GETENTITY,
66
+ OP_MULTIGETENTITY,
65
67
  NUM_OP_TYPES
66
68
  };
67
69
 
@@ -7,6 +7,9 @@
7
7
 
8
8
  #include <stdint.h>
9
9
 
10
+ #include <memory>
11
+ #include <unordered_map>
12
+
10
13
  #include "rocksdb/slice.h"
11
14
 
12
15
  namespace ROCKSDB_NAMESPACE {
@@ -18,6 +21,10 @@ using ColumnFamilyId = uint32_t;
18
21
  // Represents a sequence number in a WAL file.
19
22
  using SequenceNumber = uint64_t;
20
23
 
24
+ struct TableProperties;
25
+ using TablePropertiesCollection =
26
+ std::unordered_map<std::string, std::shared_ptr<const TableProperties>>;
27
+
21
28
  const SequenceNumber kMinUnCommittedSeq = 1; // 0 is always committed
22
29
 
23
30
  enum class TableFileCreationReason {
@@ -226,6 +226,12 @@ class LDBCommand {
226
226
  static std::string PrintKeyValue(const std::string& key,
227
227
  const std::string& value, bool is_hex);
228
228
 
229
+ static std::string PrintKeyValueOrWideColumns(const Slice& key,
230
+ const Slice& value,
231
+ const WideColumns& wide_columns,
232
+ bool is_key_hex,
233
+ bool is_value_hex);
234
+
229
235
  /**
230
236
  * Return true if the specified flag is present in the specified flags vector
231
237
  */
@@ -313,4 +319,3 @@ class LDBCommandRunner {
313
319
  };
314
320
 
315
321
  } // namespace ROCKSDB_NAMESPACE
316
-
@@ -40,8 +40,9 @@ enum class OptionType {
40
40
  kUInt32T,
41
41
  kUInt64T,
42
42
  kSizeT,
43
- kString,
44
43
  kDouble,
44
+ kAtomicInt,
45
+ kString,
45
46
  kCompactionStyle,
46
47
  kCompactionPri,
47
48
  kCompressionType,
@@ -527,6 +527,15 @@ class Transaction {
527
527
 
528
528
  virtual Status SingleDeleteUntracked(const Slice& key) = 0;
529
529
 
530
+ // Collpase the merge chain for the given key. This is can be used by the
531
+ // application to trigger an on-demand collpase to a key that has a long
532
+ // merge chain to reduce read amplification, without waiting for compaction
533
+ // to kick in.
534
+ virtual Status CollapseKey(const ReadOptions&, const Slice&,
535
+ ColumnFamilyHandle* = nullptr) {
536
+ return Status::NotSupported("collpase not supported");
537
+ }
538
+
530
539
  // Similar to WriteBatch::PutLogData
531
540
  virtual void PutLogData(const Slice& blob) = 0;
532
541
 
@@ -12,8 +12,8 @@
12
12
  // NOTE: in 'main' development branch, this should be the *next*
13
13
  // minor or major version number planned for release.
14
14
  #define ROCKSDB_MAJOR 8
15
- #define ROCKSDB_MINOR 6
16
- #define ROCKSDB_PATCH 7
15
+ #define ROCKSDB_MINOR 8
16
+ #define ROCKSDB_PATCH 1
17
17
 
18
18
  // Do not use these. We made the mistake of declaring macros starting with
19
19
  // double underscore. Now we have to live with our choice. We'll deprecate these
@@ -16,6 +16,8 @@
16
16
 
17
17
  namespace ROCKSDB_NAMESPACE {
18
18
 
19
+ class ColumnFamilyHandle;
20
+
19
21
  // Class representing a wide column, which is defined as a pair of column name
20
22
  // and column value.
21
23
  class WideColumn {
@@ -74,8 +76,19 @@ inline bool operator!=(const WideColumn& lhs, const WideColumn& rhs) {
74
76
  inline std::ostream& operator<<(std::ostream& os, const WideColumn& column) {
75
77
  const bool hex =
76
78
  (os.flags() & std::ios_base::basefield) == std::ios_base::hex;
77
- os << column.name().ToString(hex) << ':' << column.value().ToString(hex);
78
-
79
+ if (!column.name().empty()) {
80
+ if (hex) {
81
+ os << "0x";
82
+ }
83
+ os << column.name().ToString(hex);
84
+ }
85
+ os << ':';
86
+ if (!column.value().empty()) {
87
+ if (hex) {
88
+ os << "0x";
89
+ }
90
+ os << column.value().ToString(hex);
91
+ }
79
92
  return os;
80
93
  }
81
94
 
@@ -207,4 +220,42 @@ inline bool operator!=(const PinnableWideColumns& lhs,
207
220
  return !(lhs == rhs);
208
221
  }
209
222
 
223
+ // Class representing attribute group. Attribute group is a logical grouping of
224
+ // wide-column entities by leveraging Column Families. Wide-columns returned
225
+ // from the query are pinnable.
226
+ class PinnableAttributeGroup {
227
+ public:
228
+ ColumnFamilyHandle* column_family() const { return column_family_; }
229
+ const Status& status() const { return status_; }
230
+ const WideColumns& columns() const { return columns_.columns(); }
231
+
232
+ explicit PinnableAttributeGroup(ColumnFamilyHandle* column_family)
233
+ : column_family_(column_family), status_(Status::OK()) {}
234
+
235
+ void SetStatus(const Status& status);
236
+ void SetColumns(PinnableWideColumns&& columns);
237
+
238
+ void Reset();
239
+
240
+ private:
241
+ ColumnFamilyHandle* column_family_;
242
+ Status status_;
243
+ PinnableWideColumns columns_;
244
+ };
245
+
246
+ inline void PinnableAttributeGroup::SetStatus(const Status& status) {
247
+ status_ = status;
248
+ }
249
+ inline void PinnableAttributeGroup::SetColumns(PinnableWideColumns&& columns) {
250
+ columns_ = std::move(columns);
251
+ }
252
+
253
+ inline void PinnableAttributeGroup::Reset() {
254
+ SetStatus(Status::OK());
255
+ columns_.Reset();
256
+ }
257
+
258
+ // A collection of Attribute Groups.
259
+ using PinnableAttributeGroups = std::vector<PinnableAttributeGroup>;
260
+
210
261
  } // namespace ROCKSDB_NAMESPACE
@@ -395,8 +395,6 @@ class WriteBatch : public WriteBatchBase {
395
395
  // Returns true if MarkRollback will be called during Iterate
396
396
  bool HasRollback() const;
397
397
 
398
- // Experimental.
399
- //
400
398
  // Update timestamps of existing entries in the write batch if
401
399
  // applicable. If a key is intended for a column family that disables
402
400
  // timestamp, then this API won't set the timestamp for this key.