@nxtedition/rocksdb 7.1.20 → 7.1.21

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 (262) hide show
  1. package/deps/rocksdb/rocksdb/CMakeLists.txt +13 -6
  2. package/deps/rocksdb/rocksdb/Makefile +1 -1
  3. package/deps/rocksdb/rocksdb/TARGETS +2 -0
  4. package/deps/rocksdb/rocksdb/cache/cache_reservation_manager_test.cc +1 -0
  5. package/deps/rocksdb/rocksdb/cache/cache_test.cc +4 -4
  6. package/deps/rocksdb/rocksdb/cache/clock_cache.cc +139 -161
  7. package/deps/rocksdb/rocksdb/cache/clock_cache.h +92 -82
  8. package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache.cc +16 -3
  9. package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache.h +9 -3
  10. package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache_test.cc +73 -30
  11. package/deps/rocksdb/rocksdb/cache/fast_lru_cache.cc +25 -67
  12. package/deps/rocksdb/rocksdb/cache/fast_lru_cache.h +41 -40
  13. package/deps/rocksdb/rocksdb/cache/lru_cache.cc +109 -155
  14. package/deps/rocksdb/rocksdb/cache/lru_cache.h +127 -149
  15. package/deps/rocksdb/rocksdb/cache/lru_cache_test.cc +75 -80
  16. package/deps/rocksdb/rocksdb/cache/sharded_cache.cc +22 -172
  17. package/deps/rocksdb/rocksdb/cache/sharded_cache.h +272 -85
  18. package/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.cc +12 -4
  19. package/deps/rocksdb/rocksdb/db/blob/blob_counting_iterator_test.cc +1 -0
  20. package/deps/rocksdb/rocksdb/db/blob/blob_file_addition_test.cc +1 -0
  21. package/deps/rocksdb/rocksdb/db/blob/blob_file_builder_test.cc +1 -0
  22. package/deps/rocksdb/rocksdb/db/blob/blob_file_cache_test.cc +1 -0
  23. package/deps/rocksdb/rocksdb/db/blob/blob_file_garbage_test.cc +1 -0
  24. package/deps/rocksdb/rocksdb/db/blob/blob_file_reader_test.cc +1 -0
  25. package/deps/rocksdb/rocksdb/db/blob/blob_garbage_meter_test.cc +1 -0
  26. package/deps/rocksdb/rocksdb/db/blob/blob_source_test.cc +13 -4
  27. package/deps/rocksdb/rocksdb/db/builder.cc +1 -1
  28. package/deps/rocksdb/rocksdb/db/column_family.cc +15 -1
  29. package/deps/rocksdb/rocksdb/db/compact_files_test.cc +1 -0
  30. package/deps/rocksdb/rocksdb/db/compaction/clipping_iterator_test.cc +1 -0
  31. package/deps/rocksdb/rocksdb/db/compaction/compaction.cc +25 -7
  32. package/deps/rocksdb/rocksdb/db/compaction/compaction.h +10 -0
  33. package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.cc +22 -8
  34. package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.h +14 -5
  35. package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator_test.cc +1 -0
  36. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.cc +38 -12
  37. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.h +9 -6
  38. package/deps/rocksdb/rocksdb/db/compaction/compaction_job_test.cc +408 -6
  39. package/deps/rocksdb/rocksdb/db/compaction/compaction_outputs.cc +244 -54
  40. package/deps/rocksdb/rocksdb/db/compaction/compaction_outputs.h +27 -6
  41. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker.cc +25 -30
  42. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_fifo.cc +87 -26
  43. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_level.cc +23 -4
  44. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_test.cc +61 -0
  45. package/deps/rocksdb/rocksdb/db/compaction/tiered_compaction_test.cc +294 -21
  46. package/deps/rocksdb/rocksdb/db/comparator_db_test.cc +1 -0
  47. package/deps/rocksdb/rocksdb/db/cuckoo_table_db_test.cc +1 -0
  48. package/deps/rocksdb/rocksdb/db/db_block_cache_test.cc +28 -10
  49. package/deps/rocksdb/rocksdb/db/db_bloom_filter_test.cc +4 -4
  50. package/deps/rocksdb/rocksdb/db/db_compaction_test.cc +272 -0
  51. package/deps/rocksdb/rocksdb/db/db_flush_test.cc +38 -0
  52. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.cc +69 -25
  53. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +7 -3
  54. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_compaction_flush.cc +29 -12
  55. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_debug.cc +0 -12
  56. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_files.cc +10 -4
  57. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +35 -22
  58. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.cc +5 -1
  59. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_write.cc +40 -5
  60. package/deps/rocksdb/rocksdb/db/db_iter.cc +1 -0
  61. package/deps/rocksdb/rocksdb/db/db_iter_stress_test.cc +1 -0
  62. package/deps/rocksdb/rocksdb/db/db_iter_test.cc +1 -0
  63. package/deps/rocksdb/rocksdb/db/db_iterator_test.cc +22 -0
  64. package/deps/rocksdb/rocksdb/db/db_kv_checksum_test.cc +1 -0
  65. package/deps/rocksdb/rocksdb/db/db_logical_block_size_cache_test.cc +1 -0
  66. package/deps/rocksdb/rocksdb/db/db_range_del_test.cc +72 -5
  67. package/deps/rocksdb/rocksdb/db/db_tailing_iter_test.cc +60 -21
  68. package/deps/rocksdb/rocksdb/db/db_test.cc +170 -1
  69. package/deps/rocksdb/rocksdb/db/db_test2.cc +9 -3
  70. package/deps/rocksdb/rocksdb/db/db_test_util.cc +19 -0
  71. package/deps/rocksdb/rocksdb/db/db_test_util.h +32 -0
  72. package/deps/rocksdb/rocksdb/db/db_with_timestamp_basic_test.cc +444 -3
  73. package/deps/rocksdb/rocksdb/db/db_write_test.cc +8 -8
  74. package/deps/rocksdb/rocksdb/db/dbformat.cc +13 -0
  75. package/deps/rocksdb/rocksdb/db/dbformat.h +59 -4
  76. package/deps/rocksdb/rocksdb/db/dbformat_test.cc +1 -0
  77. package/deps/rocksdb/rocksdb/db/experimental.cc +3 -1
  78. package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.cc +24 -3
  79. package/deps/rocksdb/rocksdb/db/fault_injection_test.cc +1 -0
  80. package/deps/rocksdb/rocksdb/db/filename_test.cc +1 -0
  81. package/deps/rocksdb/rocksdb/db/flush_job.cc +4 -3
  82. package/deps/rocksdb/rocksdb/db/flush_job_test.cc +1 -0
  83. package/deps/rocksdb/rocksdb/db/forward_iterator.cc +85 -43
  84. package/deps/rocksdb/rocksdb/db/forward_iterator.h +3 -1
  85. package/deps/rocksdb/rocksdb/db/internal_stats.cc +33 -6
  86. package/deps/rocksdb/rocksdb/db/internal_stats.h +6 -0
  87. package/deps/rocksdb/rocksdb/db/listener_test.cc +1 -0
  88. package/deps/rocksdb/rocksdb/db/log_test.cc +1 -0
  89. package/deps/rocksdb/rocksdb/db/log_writer.cc +1 -1
  90. package/deps/rocksdb/rocksdb/db/log_writer.h +1 -1
  91. package/deps/rocksdb/rocksdb/db/manual_compaction_test.cc +1 -0
  92. package/deps/rocksdb/rocksdb/db/memtable.cc +158 -56
  93. package/deps/rocksdb/rocksdb/db/memtable.h +2 -0
  94. package/deps/rocksdb/rocksdb/db/memtable_list_test.cc +1 -0
  95. package/deps/rocksdb/rocksdb/db/merge_helper_test.cc +1 -0
  96. package/deps/rocksdb/rocksdb/db/options_file_test.cc +1 -0
  97. package/deps/rocksdb/rocksdb/db/perf_context_test.cc +1 -0
  98. package/deps/rocksdb/rocksdb/db/periodic_task_scheduler_test.cc +1 -0
  99. package/deps/rocksdb/rocksdb/db/plain_table_db_test.cc +1 -0
  100. package/deps/rocksdb/rocksdb/db/prefix_test.cc +1 -0
  101. package/deps/rocksdb/rocksdb/db/range_del_aggregator.cc +52 -9
  102. package/deps/rocksdb/rocksdb/db/range_del_aggregator.h +31 -2
  103. package/deps/rocksdb/rocksdb/db/range_del_aggregator_test.cc +1 -0
  104. package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter.cc +81 -42
  105. package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter.h +78 -12
  106. package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter_test.cc +1 -0
  107. package/deps/rocksdb/rocksdb/db/repair_test.cc +1 -0
  108. package/deps/rocksdb/rocksdb/db/seqno_time_test.cc +154 -27
  109. package/deps/rocksdb/rocksdb/db/seqno_to_time_mapping.cc +21 -4
  110. package/deps/rocksdb/rocksdb/db/seqno_to_time_mapping.h +4 -1
  111. package/deps/rocksdb/rocksdb/db/table_cache.cc +18 -6
  112. package/deps/rocksdb/rocksdb/db/table_properties_collector_test.cc +1 -0
  113. package/deps/rocksdb/rocksdb/db/version_builder_test.cc +1 -0
  114. package/deps/rocksdb/rocksdb/db/version_edit_test.cc +1 -0
  115. package/deps/rocksdb/rocksdb/db/version_set.cc +15 -7
  116. package/deps/rocksdb/rocksdb/db/version_set.h +2 -1
  117. package/deps/rocksdb/rocksdb/db/version_set_test.cc +1 -0
  118. package/deps/rocksdb/rocksdb/db/version_util.h +3 -1
  119. package/deps/rocksdb/rocksdb/db/wal_manager_test.cc +1 -0
  120. package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization.cc +28 -9
  121. package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization.h +21 -0
  122. package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization_test.cc +30 -0
  123. package/deps/rocksdb/rocksdb/db/wide/wide_columns.cc +4 -0
  124. package/deps/rocksdb/rocksdb/db/write_batch.cc +30 -7
  125. package/deps/rocksdb/rocksdb/db/write_batch_internal.h +24 -13
  126. package/deps/rocksdb/rocksdb/db/write_batch_test.cc +5 -4
  127. package/deps/rocksdb/rocksdb/db/write_callback_test.cc +1 -0
  128. package/deps/rocksdb/rocksdb/db/write_controller_test.cc +1 -0
  129. package/deps/rocksdb/rocksdb/db_stress_tool/batched_ops_stress.cc +104 -60
  130. package/deps/rocksdb/rocksdb/db_stress_tool/cf_consistency_stress.cc +199 -108
  131. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.cc +39 -0
  132. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.h +8 -0
  133. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_driver.cc +3 -1
  134. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_gflags.cc +19 -0
  135. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_shared_state.h +26 -0
  136. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.cc +247 -118
  137. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.h +24 -4
  138. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_tool.cc +18 -0
  139. package/deps/rocksdb/rocksdb/db_stress_tool/expected_state.cc +129 -1
  140. package/deps/rocksdb/rocksdb/db_stress_tool/multi_ops_txns_stress.cc +22 -0
  141. package/deps/rocksdb/rocksdb/db_stress_tool/multi_ops_txns_stress.h +4 -0
  142. package/deps/rocksdb/rocksdb/db_stress_tool/no_batched_ops_stress.cc +312 -117
  143. package/deps/rocksdb/rocksdb/env/env_basic_test.cc +1 -0
  144. package/deps/rocksdb/rocksdb/env/fs_posix.cc +10 -2
  145. package/deps/rocksdb/rocksdb/env/io_posix_test.cc +1 -0
  146. package/deps/rocksdb/rocksdb/env/mock_env_test.cc +1 -0
  147. package/deps/rocksdb/rocksdb/file/delete_scheduler.cc +5 -1
  148. package/deps/rocksdb/rocksdb/file/delete_scheduler_test.cc +1 -0
  149. package/deps/rocksdb/rocksdb/file/prefetch_test.cc +1 -0
  150. package/deps/rocksdb/rocksdb/file/writable_file_writer.h +1 -1
  151. package/deps/rocksdb/rocksdb/include/rocksdb/advanced_options.h +49 -1
  152. package/deps/rocksdb/rocksdb/include/rocksdb/cache.h +44 -18
  153. package/deps/rocksdb/rocksdb/include/rocksdb/db.h +8 -7
  154. package/deps/rocksdb/rocksdb/include/rocksdb/file_system.h +6 -1
  155. package/deps/rocksdb/rocksdb/include/rocksdb/listener.h +3 -0
  156. package/deps/rocksdb/rocksdb/include/rocksdb/secondary_cache.h +17 -4
  157. package/deps/rocksdb/rocksdb/include/rocksdb/sst_file_reader.h +4 -0
  158. package/deps/rocksdb/rocksdb/include/rocksdb/sst_file_writer.h +7 -0
  159. package/deps/rocksdb/rocksdb/include/rocksdb/universal_compaction.h +1 -1
  160. package/deps/rocksdb/rocksdb/include/rocksdb/wide_columns.h +9 -0
  161. package/deps/rocksdb/rocksdb/include/rocksdb/write_batch.h +3 -6
  162. package/deps/rocksdb/rocksdb/logging/auto_roll_logger_test.cc +1 -0
  163. package/deps/rocksdb/rocksdb/logging/env_logger_test.cc +1 -0
  164. package/deps/rocksdb/rocksdb/logging/event_logger_test.cc +1 -0
  165. package/deps/rocksdb/rocksdb/memory/arena.cc +23 -88
  166. package/deps/rocksdb/rocksdb/memory/arena.h +25 -31
  167. package/deps/rocksdb/rocksdb/memory/arena_test.cc +61 -0
  168. package/deps/rocksdb/rocksdb/memory/memory_allocator_test.cc +1 -0
  169. package/deps/rocksdb/rocksdb/memtable/inlineskiplist_test.cc +1 -0
  170. package/deps/rocksdb/rocksdb/memtable/skiplist_test.cc +1 -0
  171. package/deps/rocksdb/rocksdb/memtable/write_buffer_manager_test.cc +1 -0
  172. package/deps/rocksdb/rocksdb/monitoring/histogram_test.cc +1 -0
  173. package/deps/rocksdb/rocksdb/monitoring/iostats_context_test.cc +1 -0
  174. package/deps/rocksdb/rocksdb/options/cf_options.cc +19 -0
  175. package/deps/rocksdb/rocksdb/options/cf_options.h +8 -0
  176. package/deps/rocksdb/rocksdb/options/configurable_test.cc +1 -0
  177. package/deps/rocksdb/rocksdb/options/options.cc +7 -0
  178. package/deps/rocksdb/rocksdb/options/options_helper.cc +6 -0
  179. package/deps/rocksdb/rocksdb/options/options_settable_test.cc +6 -0
  180. package/deps/rocksdb/rocksdb/options/options_test.cc +63 -40
  181. package/deps/rocksdb/rocksdb/port/mmap.cc +98 -0
  182. package/deps/rocksdb/rocksdb/port/mmap.h +70 -0
  183. package/deps/rocksdb/rocksdb/port/stack_trace.cc +7 -0
  184. package/deps/rocksdb/rocksdb/port/stack_trace.h +4 -1
  185. package/deps/rocksdb/rocksdb/port/win/port_win.h +2 -7
  186. package/deps/rocksdb/rocksdb/src.mk +1 -0
  187. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_factory.cc +7 -7
  188. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.cc +3 -3
  189. package/deps/rocksdb/rocksdb/table/block_based/block_test.cc +1 -0
  190. package/deps/rocksdb/rocksdb/table/block_based/data_block_hash_index_test.cc +1 -0
  191. package/deps/rocksdb/rocksdb/table/block_based/full_filter_block_test.cc +1 -0
  192. package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block_test.cc +1 -0
  193. package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_builder_test.cc +1 -0
  194. package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_reader_test.cc +1 -0
  195. package/deps/rocksdb/rocksdb/table/get_context.cc +19 -1
  196. package/deps/rocksdb/rocksdb/table/get_context.h +9 -0
  197. package/deps/rocksdb/rocksdb/table/merger_test.cc +1 -0
  198. package/deps/rocksdb/rocksdb/table/merging_iterator.cc +10 -11
  199. package/deps/rocksdb/rocksdb/table/mock_table.cc +37 -19
  200. package/deps/rocksdb/rocksdb/table/mock_table.h +5 -1
  201. package/deps/rocksdb/rocksdb/table/sst_file_reader.cc +6 -0
  202. package/deps/rocksdb/rocksdb/table/sst_file_reader_test.cc +33 -0
  203. package/deps/rocksdb/rocksdb/table/sst_file_writer.cc +45 -6
  204. package/deps/rocksdb/rocksdb/test_util/testharness.h +2 -0
  205. package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc +1 -0
  206. package/deps/rocksdb/rocksdb/tools/db_bench_tool.cc +5 -0
  207. package/deps/rocksdb/rocksdb/tools/db_bench_tool_test.cc +1 -0
  208. package/deps/rocksdb/rocksdb/tools/io_tracer_parser_test.cc +1 -0
  209. package/deps/rocksdb/rocksdb/tools/ldb_cmd_test.cc +36 -0
  210. package/deps/rocksdb/rocksdb/tools/reduce_levels_test.cc +1 -0
  211. package/deps/rocksdb/rocksdb/tools/trace_analyzer_test.cc +1 -0
  212. package/deps/rocksdb/rocksdb/trace_replay/block_cache_tracer_test.cc +1 -0
  213. package/deps/rocksdb/rocksdb/trace_replay/io_tracer_test.cc +1 -0
  214. package/deps/rocksdb/rocksdb/util/autovector_test.cc +1 -0
  215. package/deps/rocksdb/rocksdb/util/bloom_test.cc +1 -0
  216. package/deps/rocksdb/rocksdb/util/coding_test.cc +1 -0
  217. package/deps/rocksdb/rocksdb/util/crc32c_test.cc +1 -0
  218. package/deps/rocksdb/rocksdb/util/dynamic_bloom_test.cc +1 -0
  219. package/deps/rocksdb/rocksdb/util/file_reader_writer_test.cc +1 -0
  220. package/deps/rocksdb/rocksdb/util/filelock_test.cc +1 -0
  221. package/deps/rocksdb/rocksdb/util/gflags_compat.h +12 -7
  222. package/deps/rocksdb/rocksdb/util/hash_test.cc +1 -0
  223. package/deps/rocksdb/rocksdb/util/heap_test.cc +4 -2
  224. package/deps/rocksdb/rocksdb/util/random_test.cc +1 -0
  225. package/deps/rocksdb/rocksdb/util/rate_limiter_test.cc +1 -0
  226. package/deps/rocksdb/rocksdb/util/repeatable_thread_test.cc +1 -0
  227. package/deps/rocksdb/rocksdb/util/ribbon_test.cc +1 -0
  228. package/deps/rocksdb/rocksdb/util/slice_transform_test.cc +1 -0
  229. package/deps/rocksdb/rocksdb/util/thread_list_test.cc +1 -0
  230. package/deps/rocksdb/rocksdb/util/thread_local_test.cc +1 -0
  231. package/deps/rocksdb/rocksdb/util/timer_test.cc +1 -0
  232. package/deps/rocksdb/rocksdb/util/work_queue_test.cc +4 -0
  233. package/deps/rocksdb/rocksdb/utilities/agg_merge/agg_merge_test.cc +1 -0
  234. package/deps/rocksdb/rocksdb/utilities/backup/backup_engine.cc +13 -0
  235. package/deps/rocksdb/rocksdb/utilities/backup/backup_engine_test.cc +9 -3
  236. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db_test.cc +1 -0
  237. package/deps/rocksdb/rocksdb/utilities/cassandra/cassandra_format_test.cc +1 -0
  238. package/deps/rocksdb/rocksdb/utilities/cassandra/cassandra_functional_test.cc +1 -0
  239. package/deps/rocksdb/rocksdb/utilities/cassandra/cassandra_row_merge_test.cc +1 -0
  240. package/deps/rocksdb/rocksdb/utilities/cassandra/cassandra_serialize_test.cc +1 -0
  241. package/deps/rocksdb/rocksdb/utilities/env_mirror_test.cc +1 -0
  242. package/deps/rocksdb/rocksdb/utilities/env_timed_test.cc +1 -0
  243. package/deps/rocksdb/rocksdb/utilities/fault_injection_secondary_cache.h +8 -0
  244. package/deps/rocksdb/rocksdb/utilities/memory/memory_test.cc +1 -0
  245. package/deps/rocksdb/rocksdb/utilities/object_registry_test.cc +1 -0
  246. package/deps/rocksdb/rocksdb/utilities/options/options_util_test.cc +1 -0
  247. package/deps/rocksdb/rocksdb/utilities/persistent_cache/hash_table_test.cc +1 -0
  248. package/deps/rocksdb/rocksdb/utilities/persistent_cache/persistent_cache_test.cc +1 -0
  249. package/deps/rocksdb/rocksdb/utilities/simulator_cache/cache_simulator_test.cc +1 -0
  250. package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction_test.cc +1 -0
  251. package/deps/rocksdb/rocksdb/utilities/transactions/timestamped_snapshot_test.cc +1 -0
  252. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.cc +1 -0
  253. package/deps/rocksdb/rocksdb/utilities/transactions/write_committed_transaction_ts_test.cc +1 -0
  254. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_transaction_test.cc +1 -0
  255. package/deps/rocksdb/rocksdb/utilities/ttl/ttl_test.cc +1 -0
  256. package/deps/rocksdb/rocksdb/utilities/util_merge_operators_test.cc +1 -0
  257. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +7 -0
  258. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_test.cc +20 -0
  259. package/index.js +12 -4
  260. package/package.json +1 -1
  261. package/prebuilds/darwin-arm64/node.napi.node +0 -0
  262. package/prebuilds/linux-x64/node.napi.node +0 -0
@@ -10,122 +10,309 @@
10
10
  #pragma once
11
11
 
12
12
  #include <atomic>
13
+ #include <cstdint>
13
14
  #include <string>
14
15
 
16
+ #include "port/lang.h"
15
17
  #include "port/port.h"
16
18
  #include "rocksdb/cache.h"
19
+ #include "util/hash.h"
20
+ #include "util/mutexlock.h"
17
21
 
18
22
  namespace ROCKSDB_NAMESPACE {
19
23
 
20
- // Single cache shard interface.
21
- class CacheShard {
24
+ // Optional base class for classes implementing the CacheShard concept
25
+ class CacheShardBase {
22
26
  public:
23
- explicit CacheShard(CacheMetadataChargePolicy metadata_charge_policy)
27
+ explicit CacheShardBase(CacheMetadataChargePolicy metadata_charge_policy)
24
28
  : metadata_charge_policy_(metadata_charge_policy) {}
25
- virtual ~CacheShard() = default;
26
29
 
27
30
  using DeleterFn = Cache::DeleterFn;
28
- virtual Status Insert(const Slice& key, uint32_t hash, void* value,
29
- size_t charge, DeleterFn deleter,
30
- Cache::Handle** handle, Cache::Priority priority) = 0;
31
- virtual Status Insert(const Slice& key, uint32_t hash, void* value,
32
- const Cache::CacheItemHelper* helper, size_t charge,
33
- Cache::Handle** handle, Cache::Priority priority) = 0;
34
- virtual Cache::Handle* Lookup(const Slice& key, uint32_t hash) = 0;
35
- virtual Cache::Handle* Lookup(const Slice& key, uint32_t hash,
36
- const Cache::CacheItemHelper* helper,
37
- const Cache::CreateCallback& create_cb,
38
- Cache::Priority priority, bool wait,
39
- Statistics* stats) = 0;
40
- virtual bool Release(Cache::Handle* handle, bool useful,
41
- bool erase_if_last_ref) = 0;
42
- virtual bool IsReady(Cache::Handle* handle) = 0;
43
- virtual void Wait(Cache::Handle* handle) = 0;
44
- virtual bool Ref(Cache::Handle* handle) = 0;
45
- virtual bool Release(Cache::Handle* handle, bool erase_if_last_ref) = 0;
46
- virtual void Erase(const Slice& key, uint32_t hash) = 0;
47
- virtual void SetCapacity(size_t capacity) = 0;
48
- virtual void SetStrictCapacityLimit(bool strict_capacity_limit) = 0;
49
- virtual size_t GetUsage() const = 0;
50
- virtual size_t GetPinnedUsage() const = 0;
51
- virtual size_t GetOccupancyCount() const = 0;
52
- virtual size_t GetTableAddressCount() const = 0;
31
+
32
+ // Expected by concept CacheShard (TODO with C++20 support)
33
+ // Some Defaults
34
+ std::string GetPrintableOptions() const { return ""; }
35
+ using HashVal = uint64_t;
36
+ using HashCref = uint64_t;
37
+ static inline HashVal ComputeHash(const Slice& key) {
38
+ return GetSliceNPHash64(key);
39
+ }
40
+ static inline uint32_t HashPieceForSharding(HashCref hash) {
41
+ return Lower32of64(hash);
42
+ }
43
+ void AppendPrintableOptions(std::string& /*str*/) const {}
44
+
45
+ // Must be provided for concept CacheShard (TODO with C++20 support)
46
+ /*
47
+ struct HandleImpl { // for concept HandleImpl
48
+ HashVal hash;
49
+ HashCref GetHash() const;
50
+ ...
51
+ };
52
+ Status Insert(const Slice& key, HashCref hash, void* value, size_t charge,
53
+ DeleterFn deleter, HandleImpl** handle,
54
+ Cache::Priority priority) = 0;
55
+ Status Insert(const Slice& key, HashCref hash, void* value,
56
+ const Cache::CacheItemHelper* helper, size_t charge,
57
+ HandleImpl** handle, Cache::Priority priority) = 0;
58
+ HandleImpl* Lookup(const Slice& key, HashCref hash) = 0;
59
+ HandleImpl* Lookup(const Slice& key, HashCref hash,
60
+ const Cache::CacheItemHelper* helper,
61
+ const Cache::CreateCallback& create_cb,
62
+ Cache::Priority priority, bool wait,
63
+ Statistics* stats) = 0;
64
+ bool Release(HandleImpl* handle, bool useful, bool erase_if_last_ref) = 0;
65
+ bool IsReady(HandleImpl* handle) = 0;
66
+ void Wait(HandleImpl* handle) = 0;
67
+ bool Ref(HandleImpl* handle) = 0;
68
+ void Erase(const Slice& key, HashCref hash) = 0;
69
+ void SetCapacity(size_t capacity) = 0;
70
+ void SetStrictCapacityLimit(bool strict_capacity_limit) = 0;
71
+ size_t GetUsage() const = 0;
72
+ size_t GetPinnedUsage() const = 0;
73
+ size_t GetOccupancyCount() const = 0;
74
+ size_t GetTableAddressCount() const = 0;
53
75
  // Handles iterating over roughly `average_entries_per_lock` entries, using
54
76
  // `state` to somehow record where it last ended up. Caller initially uses
55
- // *state == 0 and implementation sets *state = UINT32_MAX to indicate
77
+ // *state == 0 and implementation sets *state = SIZE_MAX to indicate
56
78
  // completion.
57
- virtual void ApplyToSomeEntries(
79
+ void ApplyToSomeEntries(
58
80
  const std::function<void(const Slice& key, void* value, size_t charge,
59
81
  DeleterFn deleter)>& callback,
60
- uint32_t average_entries_per_lock, uint32_t* state) = 0;
61
- virtual void EraseUnRefEntries() = 0;
62
- virtual std::string GetPrintableOptions() const { return ""; }
82
+ size_t average_entries_per_lock, size_t* state) = 0;
83
+ void EraseUnRefEntries() = 0;
84
+ */
63
85
 
64
86
  protected:
65
87
  const CacheMetadataChargePolicy metadata_charge_policy_;
66
88
  };
67
89
 
68
- // Generic cache interface which shards cache by hash of keys. 2^num_shard_bits
90
+ // Portions of ShardedCache that do not depend on the template parameter
91
+ class ShardedCacheBase : public Cache {
92
+ public:
93
+ ShardedCacheBase(size_t capacity, int num_shard_bits,
94
+ bool strict_capacity_limit,
95
+ std::shared_ptr<MemoryAllocator> memory_allocator);
96
+ virtual ~ShardedCacheBase() = default;
97
+
98
+ int GetNumShardBits() const;
99
+ uint32_t GetNumShards() const;
100
+
101
+ uint64_t NewId() override;
102
+
103
+ bool HasStrictCapacityLimit() const override;
104
+ size_t GetCapacity() const override;
105
+
106
+ using Cache::GetUsage;
107
+ size_t GetUsage(Handle* handle) const override;
108
+ std::string GetPrintableOptions() const override;
109
+
110
+ protected: // fns
111
+ virtual void AppendPrintableOptions(std::string& str) const = 0;
112
+ size_t GetPerShardCapacity() const;
113
+ size_t ComputePerShardCapacity(size_t capacity) const;
114
+
115
+ protected: // data
116
+ std::atomic<uint64_t> last_id_; // For NewId
117
+ const uint32_t shard_mask_;
118
+
119
+ // Dynamic configuration parameters, guarded by config_mutex_
120
+ bool strict_capacity_limit_;
121
+ size_t capacity_;
122
+ mutable port::Mutex config_mutex_;
123
+ };
124
+
125
+ // Generic cache interface that shards cache by hash of keys. 2^num_shard_bits
69
126
  // shards will be created, with capacity split evenly to each of the shards.
70
- // Keys are sharded by the highest num_shard_bits bits of hash value.
71
- class ShardedCache : public Cache {
127
+ // Keys are typically sharded by the lowest num_shard_bits bits of hash value
128
+ // so that the upper bits of the hash value can keep a stable ordering of
129
+ // table entries even as the table grows (using more upper hash bits).
130
+ // See CacheShardBase above for what is expected of the CacheShard parameter.
131
+ template <class CacheShard>
132
+ class ShardedCache : public ShardedCacheBase {
72
133
  public:
134
+ using HashVal = typename CacheShard::HashVal;
135
+ using HashCref = typename CacheShard::HashCref;
136
+ using HandleImpl = typename CacheShard::HandleImpl;
137
+
73
138
  ShardedCache(size_t capacity, int num_shard_bits, bool strict_capacity_limit,
74
- std::shared_ptr<MemoryAllocator> memory_allocator = nullptr);
75
- virtual ~ShardedCache() = default;
76
- virtual CacheShard* GetShard(uint32_t shard) = 0;
77
- virtual const CacheShard* GetShard(uint32_t shard) const = 0;
78
-
79
- virtual uint32_t GetHash(Handle* handle) const = 0;
80
-
81
- virtual void SetCapacity(size_t capacity) override;
82
- virtual void SetStrictCapacityLimit(bool strict_capacity_limit) override;
83
-
84
- virtual Status Insert(const Slice& key, void* value, size_t charge,
85
- DeleterFn deleter, Handle** handle,
86
- Priority priority) override;
87
- virtual Status Insert(const Slice& key, void* value,
88
- const CacheItemHelper* helper, size_t charge,
89
- Handle** handle = nullptr,
90
- Priority priority = Priority::LOW) override;
91
- virtual Handle* Lookup(const Slice& key, Statistics* stats) override;
92
- virtual Handle* Lookup(const Slice& key, const CacheItemHelper* helper,
93
- const CreateCallback& create_cb, Priority priority,
94
- bool wait, Statistics* stats = nullptr) override;
95
- virtual bool Release(Handle* handle, bool useful,
96
- bool erase_if_last_ref = false) override;
97
- virtual bool IsReady(Handle* handle) override;
98
- virtual void Wait(Handle* handle) override;
99
- virtual bool Ref(Handle* handle) override;
100
- virtual bool Release(Handle* handle, bool erase_if_last_ref = false) override;
101
- virtual void Erase(const Slice& key) override;
102
- virtual uint64_t NewId() override;
103
- virtual size_t GetCapacity() const override;
104
- virtual bool HasStrictCapacityLimit() const override;
105
- virtual size_t GetUsage() const override;
106
- virtual size_t GetUsage(Handle* handle) const override;
107
- virtual size_t GetPinnedUsage() const override;
108
- virtual size_t GetOccupancyCount() const override;
109
- virtual size_t GetTableAddressCount() const override;
110
- virtual void ApplyToAllEntries(
139
+ std::shared_ptr<MemoryAllocator> allocator)
140
+ : ShardedCacheBase(capacity, num_shard_bits, strict_capacity_limit,
141
+ allocator),
142
+ shards_(reinterpret_cast<CacheShard*>(port::cacheline_aligned_alloc(
143
+ sizeof(CacheShard) * GetNumShards()))),
144
+ destroy_shards_in_dtor_(false) {}
145
+
146
+ virtual ~ShardedCache() {
147
+ if (destroy_shards_in_dtor_) {
148
+ ForEachShard([](CacheShard* cs) { cs->~CacheShard(); });
149
+ }
150
+ port::cacheline_aligned_free(shards_);
151
+ }
152
+
153
+ CacheShard& GetShard(HashCref hash) {
154
+ return shards_[CacheShard::HashPieceForSharding(hash) & shard_mask_];
155
+ }
156
+
157
+ const CacheShard& GetShard(HashCref hash) const {
158
+ return shards_[CacheShard::HashPieceForSharding(hash) & shard_mask_];
159
+ }
160
+
161
+ void SetCapacity(size_t capacity) override {
162
+ MutexLock l(&config_mutex_);
163
+ capacity_ = capacity;
164
+ auto per_shard = ComputePerShardCapacity(capacity);
165
+ ForEachShard([=](CacheShard* cs) { cs->SetCapacity(per_shard); });
166
+ }
167
+
168
+ void SetStrictCapacityLimit(bool s_c_l) override {
169
+ MutexLock l(&config_mutex_);
170
+ strict_capacity_limit_ = s_c_l;
171
+ ForEachShard(
172
+ [s_c_l](CacheShard* cs) { cs->SetStrictCapacityLimit(s_c_l); });
173
+ }
174
+
175
+ Status Insert(const Slice& key, void* value, size_t charge, DeleterFn deleter,
176
+ Handle** handle, Priority priority) override {
177
+ HashVal hash = CacheShard::ComputeHash(key);
178
+ auto h_out = reinterpret_cast<HandleImpl**>(handle);
179
+ return GetShard(hash).Insert(key, hash, value, charge, deleter, h_out,
180
+ priority);
181
+ }
182
+ Status Insert(const Slice& key, void* value, const CacheItemHelper* helper,
183
+ size_t charge, Handle** handle = nullptr,
184
+ Priority priority = Priority::LOW) override {
185
+ if (!helper) {
186
+ return Status::InvalidArgument();
187
+ }
188
+ HashVal hash = CacheShard::ComputeHash(key);
189
+ auto h_out = reinterpret_cast<HandleImpl**>(handle);
190
+ return GetShard(hash).Insert(key, hash, value, helper, charge, h_out,
191
+ priority);
192
+ }
193
+
194
+ Handle* Lookup(const Slice& key, Statistics* /*stats*/) override {
195
+ HashVal hash = CacheShard::ComputeHash(key);
196
+ HandleImpl* result = GetShard(hash).Lookup(key, hash);
197
+ return reinterpret_cast<Handle*>(result);
198
+ }
199
+ Handle* Lookup(const Slice& key, const CacheItemHelper* helper,
200
+ const CreateCallback& create_cb, Priority priority, bool wait,
201
+ Statistics* stats = nullptr) override {
202
+ HashVal hash = CacheShard::ComputeHash(key);
203
+ HandleImpl* result = GetShard(hash).Lookup(key, hash, helper, create_cb,
204
+ priority, wait, stats);
205
+ return reinterpret_cast<Handle*>(result);
206
+ }
207
+
208
+ void Erase(const Slice& key) override {
209
+ HashVal hash = CacheShard::ComputeHash(key);
210
+ GetShard(hash).Erase(key, hash);
211
+ }
212
+
213
+ bool Release(Handle* handle, bool useful,
214
+ bool erase_if_last_ref = false) override {
215
+ auto h = reinterpret_cast<HandleImpl*>(handle);
216
+ return GetShard(h->GetHash()).Release(h, useful, erase_if_last_ref);
217
+ }
218
+ bool IsReady(Handle* handle) override {
219
+ auto h = reinterpret_cast<HandleImpl*>(handle);
220
+ return GetShard(h->GetHash()).IsReady(h);
221
+ }
222
+ void Wait(Handle* handle) override {
223
+ auto h = reinterpret_cast<HandleImpl*>(handle);
224
+ GetShard(h->GetHash()).Wait(h);
225
+ }
226
+ bool Ref(Handle* handle) override {
227
+ auto h = reinterpret_cast<HandleImpl*>(handle);
228
+ return GetShard(h->GetHash()).Ref(h);
229
+ }
230
+ bool Release(Handle* handle, bool erase_if_last_ref = false) override {
231
+ return Release(handle, true /*useful*/, erase_if_last_ref);
232
+ }
233
+ using ShardedCacheBase::GetUsage;
234
+ size_t GetUsage() const override {
235
+ return SumOverShards2(&CacheShard::GetUsage);
236
+ }
237
+ size_t GetPinnedUsage() const override {
238
+ return SumOverShards2(&CacheShard::GetPinnedUsage);
239
+ }
240
+ size_t GetOccupancyCount() const override {
241
+ return SumOverShards2(&CacheShard::GetPinnedUsage);
242
+ }
243
+ size_t GetTableAddressCount() const override {
244
+ return SumOverShards2(&CacheShard::GetTableAddressCount);
245
+ }
246
+ void ApplyToAllEntries(
111
247
  const std::function<void(const Slice& key, void* value, size_t charge,
112
248
  DeleterFn deleter)>& callback,
113
- const ApplyToAllEntriesOptions& opts) override;
114
- virtual void EraseUnRefEntries() override;
115
- virtual std::string GetPrintableOptions() const override;
249
+ const ApplyToAllEntriesOptions& opts) override {
250
+ uint32_t num_shards = GetNumShards();
251
+ // Iterate over part of each shard, rotating between shards, to
252
+ // minimize impact on latency of concurrent operations.
253
+ std::unique_ptr<size_t[]> states(new size_t[num_shards]{});
116
254
 
117
- int GetNumShardBits() const;
118
- uint32_t GetNumShards() const;
255
+ size_t aepl = opts.average_entries_per_lock;
256
+ aepl = std::min(aepl, size_t{1});
257
+
258
+ bool remaining_work;
259
+ do {
260
+ remaining_work = false;
261
+ for (uint32_t i = 0; i < num_shards; i++) {
262
+ if (states[i] != SIZE_MAX) {
263
+ shards_[i].ApplyToSomeEntries(callback, aepl, &states[i]);
264
+ remaining_work |= states[i] != SIZE_MAX;
265
+ }
266
+ }
267
+ } while (remaining_work);
268
+ }
269
+
270
+ virtual void EraseUnRefEntries() override {
271
+ ForEachShard([](CacheShard* cs) { cs->EraseUnRefEntries(); });
272
+ }
273
+
274
+ void DisownData() override {
275
+ // Leak data only if that won't generate an ASAN/valgrind warning.
276
+ if (!kMustFreeHeapAllocations) {
277
+ destroy_shards_in_dtor_ = false;
278
+ }
279
+ }
119
280
 
120
281
  protected:
121
- inline uint32_t Shard(uint32_t hash) { return hash & shard_mask_; }
282
+ inline void ForEachShard(const std::function<void(CacheShard*)>& fn) {
283
+ uint32_t num_shards = GetNumShards();
284
+ for (uint32_t i = 0; i < num_shards; i++) {
285
+ fn(shards_ + i);
286
+ }
287
+ }
288
+
289
+ inline size_t SumOverShards(
290
+ const std::function<size_t(CacheShard&)>& fn) const {
291
+ uint32_t num_shards = GetNumShards();
292
+ size_t result = 0;
293
+ for (uint32_t i = 0; i < num_shards; i++) {
294
+ result += fn(shards_[i]);
295
+ }
296
+ return result;
297
+ }
298
+
299
+ inline size_t SumOverShards2(size_t (CacheShard::*fn)() const) const {
300
+ return SumOverShards([fn](CacheShard& cs) { return (cs.*fn)(); });
301
+ }
302
+
303
+ // Must be called exactly once by derived class constructor
304
+ void InitShards(const std::function<void(CacheShard*)>& placement_new) {
305
+ ForEachShard(placement_new);
306
+ destroy_shards_in_dtor_ = true;
307
+ }
308
+
309
+ void AppendPrintableOptions(std::string& str) const override {
310
+ shards_[0].AppendPrintableOptions(str);
311
+ }
122
312
 
123
313
  private:
124
- const uint32_t shard_mask_;
125
- mutable port::Mutex capacity_mutex_;
126
- size_t capacity_;
127
- bool strict_capacity_limit_;
128
- std::atomic<uint64_t> last_id_;
314
+ CacheShard* const shards_;
315
+ bool destroy_shards_in_dtor_;
129
316
  };
130
317
 
131
318
  // 512KB is traditional minimum shard size.
@@ -45,6 +45,7 @@ void ArenaWrappedDBIter::Init(
45
45
  sv_number_ = version_number;
46
46
  read_options_ = read_options;
47
47
  allow_refresh_ = allow_refresh;
48
+ memtable_range_tombstone_iter_ = nullptr;
48
49
  }
49
50
 
50
51
  Status ArenaWrappedDBIter::Refresh() {
@@ -89,18 +90,25 @@ Status ArenaWrappedDBIter::Refresh() {
89
90
  // Refresh range-tombstones in MemTable
90
91
  if (!read_options_.ignore_range_deletions) {
91
92
  SuperVersion* sv = cfd_->GetThreadLocalSuperVersion(db_impl_);
93
+ TEST_SYNC_POINT_CALLBACK("ArenaWrappedDBIter::Refresh:SV", nullptr);
92
94
  auto t = sv->mem->NewRangeTombstoneIterator(
93
95
  read_options_, latest_seq, false /* immutable_memtable */);
94
96
  if (!t || t->empty()) {
97
+ // If memtable_range_tombstone_iter_ points to a non-empty tombstone
98
+ // iterator, then it means sv->mem is not the memtable that
99
+ // memtable_range_tombstone_iter_ points to, so SV must have changed
100
+ // after the sv_number_ != cur_sv_number check above. We will fall
101
+ // back to re-init the InternalIterator, and the tombstone iterator
102
+ // will be freed during db_iter destruction there.
95
103
  if (memtable_range_tombstone_iter_) {
96
- delete *memtable_range_tombstone_iter_;
97
- *memtable_range_tombstone_iter_ = nullptr;
104
+ assert(!*memtable_range_tombstone_iter_ ||
105
+ sv_number_ != cfd_->GetSuperVersionNumber());
98
106
  }
99
107
  delete t;
100
108
  } else { // current mutable memtable has range tombstones
101
109
  if (!memtable_range_tombstone_iter_) {
102
110
  delete t;
103
- cfd_->ReturnThreadLocalSuperVersion(sv);
111
+ db_impl_->ReturnAndCleanupSuperVersion(cfd_, sv);
104
112
  // The memtable under DBIter did not have range tombstone before
105
113
  // refresh.
106
114
  reinit_internal_iter();
@@ -112,7 +120,7 @@ Status ArenaWrappedDBIter::Refresh() {
112
120
  &cfd_->internal_comparator(), nullptr, nullptr);
113
121
  }
114
122
  }
115
- cfd_->ReturnThreadLocalSuperVersion(sv);
123
+ db_impl_->ReturnAndCleanupSuperVersion(cfd_, sv);
116
124
  }
117
125
  // Refresh latest sequence number
118
126
  db_iter_->set_sequence(latest_seq);
@@ -321,6 +321,7 @@ TEST(BlobCountingIteratorTest, CorruptBlobIndex) {
321
321
  } // namespace ROCKSDB_NAMESPACE
322
322
 
323
323
  int main(int argc, char** argv) {
324
+ ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
324
325
  ::testing::InitGoogleTest(&argc, argv);
325
326
  return RUN_ALL_TESTS();
326
327
  }
@@ -205,6 +205,7 @@ TEST_F(BlobFileAdditionTest, ForwardIncompatibleCustomField) {
205
205
  } // namespace ROCKSDB_NAMESPACE
206
206
 
207
207
  int main(int argc, char** argv) {
208
+ ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
208
209
  ::testing::InitGoogleTest(&argc, argv);
209
210
  return RUN_ALL_TESTS();
210
211
  }
@@ -674,6 +674,7 @@ TEST_P(BlobFileBuilderIOErrorTest, IOError) {
674
674
  } // namespace ROCKSDB_NAMESPACE
675
675
 
676
676
  int main(int argc, char** argv) {
677
+ ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
677
678
  ::testing::InitGoogleTest(&argc, argv);
678
679
  return RUN_ALL_TESTS();
679
680
  }
@@ -263,6 +263,7 @@ TEST_F(BlobFileCacheTest, GetBlobFileReader_CacheFull) {
263
263
  } // namespace ROCKSDB_NAMESPACE
264
264
 
265
265
  int main(int argc, char** argv) {
266
+ ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
266
267
  ::testing::InitGoogleTest(&argc, argv);
267
268
  return RUN_ALL_TESTS();
268
269
  }
@@ -168,6 +168,7 @@ TEST_F(BlobFileGarbageTest, ForwardIncompatibleCustomField) {
168
168
  } // namespace ROCKSDB_NAMESPACE
169
169
 
170
170
  int main(int argc, char** argv) {
171
+ ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
171
172
  ::testing::InitGoogleTest(&argc, argv);
172
173
  return RUN_ALL_TESTS();
173
174
  }
@@ -1018,6 +1018,7 @@ TEST_P(BlobFileReaderDecodingErrorTest, DecodingError) {
1018
1018
  } // namespace ROCKSDB_NAMESPACE
1019
1019
 
1020
1020
  int main(int argc, char** argv) {
1021
+ ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
1021
1022
  ::testing::InitGoogleTest(&argc, argv);
1022
1023
  return RUN_ALL_TESTS();
1023
1024
  }
@@ -191,6 +191,7 @@ TEST(BlobGarbageMeterTest, InlinedTTLBlobIndex) {
191
191
  } // namespace ROCKSDB_NAMESPACE
192
192
 
193
193
  int main(int argc, char** argv) {
194
+ ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
194
195
  ::testing::InitGoogleTest(&argc, argv);
195
196
  return RUN_ALL_TESTS();
196
197
  }
@@ -1304,12 +1304,20 @@ TEST_F(BlobSecondaryCacheTest, GetBlobsFromSecondaryCache) {
1304
1304
  blob_offsets[1]));
1305
1305
 
1306
1306
  // key1's dummy handle is in the primary cache and key1's item is still
1307
- // in the secondary cache. So, the primary cache's Lookup() can only
1308
- // get a dummy handle.
1307
+ // in the secondary cache. So, the primary cache's Lookup() without
1308
+ // secondary cache support cannot see it. (NOTE: The dummy handle used
1309
+ // to be a leaky abstraction but not anymore.)
1310
+ handle1 = blob_cache->Lookup(key1, statistics);
1311
+ ASSERT_EQ(handle1, nullptr);
1312
+
1313
+ // But after another access, it is promoted to primary cache
1314
+ ASSERT_TRUE(blob_source.TEST_BlobInCache(file_number, file_size,
1315
+ blob_offsets[1]));
1316
+
1317
+ // And Lookup() can find it (without secondary cache support)
1309
1318
  handle1 = blob_cache->Lookup(key1, statistics);
1310
1319
  ASSERT_NE(handle1, nullptr);
1311
- // handl1 is a dummy handle.
1312
- ASSERT_EQ(blob_cache->Value(handle1), nullptr);
1320
+ ASSERT_NE(blob_cache->Value(handle1), nullptr);
1313
1321
  blob_cache->Release(handle1);
1314
1322
  }
1315
1323
  }
@@ -1610,6 +1618,7 @@ TEST_F(BlobSourceCacheReservationTest, IncreaseCacheReservationOnFullCache) {
1610
1618
  } // namespace ROCKSDB_NAMESPACE
1611
1619
 
1612
1620
  int main(int argc, char** argv) {
1621
+ ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
1613
1622
  ::testing::InitGoogleTest(&argc, argv);
1614
1623
  return RUN_ALL_TESTS();
1615
1624
  }
@@ -90,7 +90,7 @@ Status BuildTable(
90
90
  iter->SeekToFirst();
91
91
  std::unique_ptr<CompactionRangeDelAggregator> range_del_agg(
92
92
  new CompactionRangeDelAggregator(&tboptions.internal_comparator,
93
- snapshots));
93
+ snapshots, full_history_ts_low));
94
94
  uint64_t num_unfragmented_tombstones = 0;
95
95
  uint64_t total_tombstone_payload_bytes = 0;
96
96
  for (auto& range_del_iter : range_del_iters) {
@@ -233,6 +233,21 @@ ColumnFamilyOptions SanitizeOptions(const ImmutableDBOptions& db_options,
233
233
  result.min_write_buffer_number_to_merge = 1;
234
234
  }
235
235
 
236
+ if (db_options.atomic_flush && result.min_write_buffer_number_to_merge > 1) {
237
+ ROCKS_LOG_WARN(
238
+ db_options.logger,
239
+ "Currently, if atomic_flush is true, then triggering flush for any "
240
+ "column family internally (non-manual flush) will trigger flushing "
241
+ "all column families even if the number of memtables is smaller "
242
+ "min_write_buffer_number_to_merge. Therefore, configuring "
243
+ "min_write_buffer_number_to_merge > 1 is not compatible and should "
244
+ "be satinized to 1. Not doing so will lead to data loss and "
245
+ "inconsistent state across multiple column families when WAL is "
246
+ "disabled, which is a common setting for atomic flush");
247
+
248
+ result.min_write_buffer_number_to_merge = 1;
249
+ }
250
+
236
251
  if (result.num_levels < 1) {
237
252
  result.num_levels = 1;
238
253
  }
@@ -276,7 +291,6 @@ ColumnFamilyOptions SanitizeOptions(const ImmutableDBOptions& db_options,
276
291
  }
277
292
 
278
293
  if (result.compaction_style == kCompactionStyleFIFO) {
279
- result.num_levels = 1;
280
294
  // since we delete level0 files in FIFO compaction when there are too many
281
295
  // of them, these options don't really mean anything
282
296
  result.level0_slowdown_writes_trigger = std::numeric_limits<int>::max();
@@ -490,6 +490,7 @@ TEST_F(CompactFilesTest, GetCompactionJobInfo) {
490
490
  } // namespace ROCKSDB_NAMESPACE
491
491
 
492
492
  int main(int argc, char** argv) {
493
+ ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
493
494
  ::testing::InitGoogleTest(&argc, argv);
494
495
  return RUN_ALL_TESTS();
495
496
  }
@@ -253,6 +253,7 @@ INSTANTIATE_TEST_CASE_P(
253
253
  } // namespace ROCKSDB_NAMESPACE
254
254
 
255
255
  int main(int argc, char** argv) {
256
+ ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
256
257
  ::testing::InitGoogleTest(&argc, argv);
257
258
  return RUN_ALL_TESTS();
258
259
  }