rocksdb-native 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/binding.c +92 -10
  2. package/index.js +9 -0
  3. package/lib/batch.js +11 -1
  4. package/lib/iterator.js +3 -1
  5. package/lib/snapshot.js +21 -0
  6. package/package.json +1 -1
  7. package/prebuilds/darwin-arm64/rocksdb-native.bare +0 -0
  8. package/prebuilds/darwin-arm64/rocksdb-native.node +0 -0
  9. package/prebuilds/darwin-x64/rocksdb-native.bare +0 -0
  10. package/prebuilds/darwin-x64/rocksdb-native.node +0 -0
  11. package/prebuilds/linux-arm64/rocksdb-native.bare +0 -0
  12. package/prebuilds/linux-arm64/rocksdb-native.node +0 -0
  13. package/prebuilds/linux-x64/rocksdb-native.bare +0 -0
  14. package/prebuilds/linux-x64/rocksdb-native.node +0 -0
  15. package/prebuilds/win32-x64/rocksdb-native.bare +0 -0
  16. package/prebuilds/win32-x64/rocksdb-native.node +0 -0
  17. package/vendor/librocksdb/include/rocksdb.h +38 -4
  18. package/vendor/librocksdb/src/rocksdb.cc +114 -14
  19. package/vendor/librocksdb/vendor/rocksdb/CMakeLists.txt +21 -4
  20. package/vendor/librocksdb/vendor/rocksdb/cache/secondary_cache_adapter.cc +6 -3
  21. package/vendor/librocksdb/vendor/rocksdb/db/arena_wrapped_db_iter.cc +4 -4
  22. package/vendor/librocksdb/vendor/rocksdb/db/arena_wrapped_db_iter.h +4 -2
  23. package/vendor/librocksdb/vendor/rocksdb/db/attribute_group_iterator_impl.cc +20 -0
  24. package/vendor/librocksdb/vendor/rocksdb/db/attribute_group_iterator_impl.h +83 -0
  25. package/vendor/librocksdb/vendor/rocksdb/db/builder.cc +9 -5
  26. package/vendor/librocksdb/vendor/rocksdb/db/builder.h +1 -1
  27. package/vendor/librocksdb/vendor/rocksdb/db/c.cc +231 -6
  28. package/vendor/librocksdb/vendor/rocksdb/db/c_test.c +202 -2
  29. package/vendor/librocksdb/vendor/rocksdb/db/coalescing_iterator.cc +47 -0
  30. package/vendor/librocksdb/vendor/rocksdb/db/coalescing_iterator.h +79 -0
  31. package/vendor/librocksdb/vendor/rocksdb/db/column_family.cc +28 -0
  32. package/vendor/librocksdb/vendor/rocksdb/db/column_family.h +17 -0
  33. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction.cc +8 -1
  34. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction.h +11 -9
  35. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_iterator.cc +50 -23
  36. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_iterator.h +13 -0
  37. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_job.cc +22 -25
  38. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_job.h +2 -0
  39. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_outputs.cc +8 -1
  40. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_outputs.h +1 -0
  41. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker.cc +40 -17
  42. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker.h +20 -14
  43. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker_level.cc +11 -6
  44. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker_universal.cc +77 -24
  45. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_service_job.cc +2 -0
  46. package/vendor/librocksdb/vendor/rocksdb/db/convenience.cc +3 -0
  47. package/vendor/librocksdb/vendor/rocksdb/db/db_filesnapshot.cc +125 -31
  48. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl.cc +457 -231
  49. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl.h +172 -73
  50. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_compaction_flush.cc +152 -133
  51. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_debug.cc +5 -0
  52. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_files.cc +58 -52
  53. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_follower.cc +348 -0
  54. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_follower.h +54 -0
  55. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_open.cc +136 -117
  56. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_secondary.cc +4 -3
  57. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_secondary.h +7 -6
  58. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_write.cc +134 -80
  59. package/vendor/librocksdb/vendor/rocksdb/db/db_iter.cc +11 -0
  60. package/vendor/librocksdb/vendor/rocksdb/db/db_test2.cc +1 -1
  61. package/vendor/librocksdb/vendor/rocksdb/db/db_test_util.cc +11 -1
  62. package/vendor/librocksdb/vendor/rocksdb/db/db_test_util.h +11 -7
  63. package/vendor/librocksdb/vendor/rocksdb/db/dbformat.cc +19 -4
  64. package/vendor/librocksdb/vendor/rocksdb/db/dbformat.h +3 -2
  65. package/vendor/librocksdb/vendor/rocksdb/db/error_handler.cc +34 -39
  66. package/vendor/librocksdb/vendor/rocksdb/db/error_handler.h +3 -4
  67. package/vendor/librocksdb/vendor/rocksdb/db/event_helpers.cc +6 -3
  68. package/vendor/librocksdb/vendor/rocksdb/db/experimental.cc +3 -2
  69. package/vendor/librocksdb/vendor/rocksdb/db/external_sst_file_ingestion_job.cc +76 -18
  70. package/vendor/librocksdb/vendor/rocksdb/db/external_sst_file_ingestion_job.h +11 -0
  71. package/vendor/librocksdb/vendor/rocksdb/db/flush_job.cc +37 -5
  72. package/vendor/librocksdb/vendor/rocksdb/db/flush_job.h +14 -0
  73. package/vendor/librocksdb/vendor/rocksdb/db/import_column_family_job.cc +49 -45
  74. package/vendor/librocksdb/vendor/rocksdb/db/internal_stats.cc +60 -1
  75. package/vendor/librocksdb/vendor/rocksdb/db/internal_stats.h +20 -1
  76. package/vendor/librocksdb/vendor/rocksdb/db/log_reader.cc +15 -6
  77. package/vendor/librocksdb/vendor/rocksdb/db/log_writer.cc +59 -10
  78. package/vendor/librocksdb/vendor/rocksdb/db/log_writer.h +8 -0
  79. package/vendor/librocksdb/vendor/rocksdb/db/memtable.cc +24 -40
  80. package/vendor/librocksdb/vendor/rocksdb/db/memtable.h +10 -10
  81. package/vendor/librocksdb/vendor/rocksdb/db/memtable_list.cc +9 -8
  82. package/vendor/librocksdb/vendor/rocksdb/db/multi_cf_iterator_impl.h +296 -0
  83. package/vendor/librocksdb/vendor/rocksdb/db/range_tombstone_fragmenter.h +8 -10
  84. package/vendor/librocksdb/vendor/rocksdb/db/repair.cc +4 -3
  85. package/vendor/librocksdb/vendor/rocksdb/db/seqno_to_time_mapping.cc +30 -0
  86. package/vendor/librocksdb/vendor/rocksdb/db/seqno_to_time_mapping.h +9 -0
  87. package/vendor/librocksdb/vendor/rocksdb/db/table_cache.cc +17 -2
  88. package/vendor/librocksdb/vendor/rocksdb/db/table_cache.h +9 -1
  89. package/vendor/librocksdb/vendor/rocksdb/db/table_properties_collector.h +9 -2
  90. package/vendor/librocksdb/vendor/rocksdb/db/transaction_log_impl.cc +3 -3
  91. package/vendor/librocksdb/vendor/rocksdb/db/transaction_log_impl.h +7 -7
  92. package/vendor/librocksdb/vendor/rocksdb/db/version_edit.cc +0 -1
  93. package/vendor/librocksdb/vendor/rocksdb/db/version_edit_handler.cc +39 -5
  94. package/vendor/librocksdb/vendor/rocksdb/db/version_edit_handler.h +24 -15
  95. package/vendor/librocksdb/vendor/rocksdb/db/version_set.cc +117 -64
  96. package/vendor/librocksdb/vendor/rocksdb/db/version_set.h +27 -10
  97. package/vendor/librocksdb/vendor/rocksdb/db/wal_manager.cc +37 -29
  98. package/vendor/librocksdb/vendor/rocksdb/db/wal_manager.h +6 -5
  99. package/vendor/librocksdb/vendor/rocksdb/db/wide/wide_columns.cc +2 -3
  100. package/vendor/librocksdb/vendor/rocksdb/db/wide/wide_columns_helper.cc +6 -0
  101. package/vendor/librocksdb/vendor/rocksdb/db/write_batch.cc +89 -31
  102. package/vendor/librocksdb/vendor/rocksdb/db/write_thread.cc +53 -5
  103. package/vendor/librocksdb/vendor/rocksdb/db/write_thread.h +36 -4
  104. package/vendor/librocksdb/vendor/rocksdb/env/composite_env_wrapper.h +21 -0
  105. package/vendor/librocksdb/vendor/rocksdb/env/env.cc +15 -0
  106. package/vendor/librocksdb/vendor/rocksdb/env/fs_on_demand.cc +331 -0
  107. package/vendor/librocksdb/vendor/rocksdb/env/fs_on_demand.h +139 -0
  108. package/vendor/librocksdb/vendor/rocksdb/env/io_posix.cc +8 -6
  109. package/vendor/librocksdb/vendor/rocksdb/env/io_posix.h +1 -1
  110. package/vendor/librocksdb/vendor/rocksdb/file/delete_scheduler.cc +130 -27
  111. package/vendor/librocksdb/vendor/rocksdb/file/delete_scheduler.h +61 -8
  112. package/vendor/librocksdb/vendor/rocksdb/file/file_util.cc +25 -4
  113. package/vendor/librocksdb/vendor/rocksdb/file/file_util.h +15 -0
  114. package/vendor/librocksdb/vendor/rocksdb/file/sequence_file_reader.cc +1 -0
  115. package/vendor/librocksdb/vendor/rocksdb/file/sequence_file_reader.h +9 -4
  116. package/vendor/librocksdb/vendor/rocksdb/file/sst_file_manager_impl.cc +18 -0
  117. package/vendor/librocksdb/vendor/rocksdb/file/sst_file_manager_impl.h +31 -4
  118. package/vendor/librocksdb/vendor/rocksdb/file/writable_file_writer.cc +40 -38
  119. package/vendor/librocksdb/vendor/rocksdb/file/writable_file_writer.h +48 -15
  120. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/advanced_options.h +12 -3
  121. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/attribute_groups.h +114 -0
  122. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/c.h +90 -0
  123. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/cache.h +5 -0
  124. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/comparator.h +27 -0
  125. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/db.h +71 -12
  126. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/env.h +9 -0
  127. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/experimental.h +5 -0
  128. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/file_system.h +14 -0
  129. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/iterator.h +9 -71
  130. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/iterator_base.h +90 -0
  131. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/listener.h +21 -0
  132. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/options.h +125 -12
  133. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/perf_context.h +1 -1
  134. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/sst_file_reader.h +11 -1
  135. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/table.h +6 -6
  136. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/table_properties.h +19 -0
  137. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/transaction_log.h +12 -6
  138. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/types.h +12 -0
  139. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/universal_compaction.h +31 -0
  140. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/user_write_callback.h +29 -0
  141. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/cache_dump_load.h +4 -0
  142. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/checkpoint.h +4 -2
  143. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/customizable_util.h +0 -1
  144. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/env_mirror.h +1 -1
  145. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/ldb_cmd.h +24 -7
  146. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/option_change_migration.h +4 -4
  147. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/stackable_db.h +24 -5
  148. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/table_properties_collectors.h +46 -0
  149. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/transaction.h +42 -17
  150. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/transaction_db.h +5 -0
  151. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/types_util.h +36 -0
  152. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/write_batch_with_index.h +71 -3
  153. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/version.h +2 -2
  154. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/wide_columns.h +87 -72
  155. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/write_batch_base.h +1 -1
  156. package/vendor/librocksdb/vendor/rocksdb/memory/memory_allocator.cc +1 -0
  157. package/vendor/librocksdb/vendor/rocksdb/options/cf_options.cc +13 -2
  158. package/vendor/librocksdb/vendor/rocksdb/options/cf_options.h +6 -2
  159. package/vendor/librocksdb/vendor/rocksdb/options/db_options.cc +27 -1
  160. package/vendor/librocksdb/vendor/rocksdb/options/db_options.h +10 -3
  161. package/vendor/librocksdb/vendor/rocksdb/options/options.cc +3 -0
  162. package/vendor/librocksdb/vendor/rocksdb/options/options_helper.cc +1 -0
  163. package/vendor/librocksdb/vendor/rocksdb/port/jemalloc_helper.h +2 -2
  164. package/vendor/librocksdb/vendor/rocksdb/port/stack_trace.cc +1 -0
  165. package/vendor/librocksdb/vendor/rocksdb/port/win/port_win.cc +3 -2
  166. package/vendor/librocksdb/vendor/rocksdb/table/block_based/binary_search_index_reader.cc +1 -2
  167. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_builder.cc +47 -31
  168. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_factory.cc +15 -0
  169. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_iterator.cc +37 -18
  170. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_iterator.h +10 -3
  171. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader.cc +102 -41
  172. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader.h +15 -7
  173. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader_impl.h +1 -3
  174. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +5 -6
  175. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_cache.h +31 -0
  176. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_prefetcher.cc +6 -0
  177. package/vendor/librocksdb/vendor/rocksdb/table/block_based/cachable_entry.h +10 -5
  178. package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_block.h +34 -28
  179. package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_block_reader_common.cc +17 -11
  180. package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_block_reader_common.h +5 -2
  181. package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_policy.cc +12 -3
  182. package/vendor/librocksdb/vendor/rocksdb/table/block_based/full_filter_block.cc +37 -30
  183. package/vendor/librocksdb/vendor/rocksdb/table/block_based/full_filter_block.h +11 -13
  184. package/vendor/librocksdb/vendor/rocksdb/table/block_based/hash_index_reader.cc +1 -2
  185. package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_builder.cc +62 -53
  186. package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_builder.h +60 -38
  187. package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_reader_common.cc +14 -9
  188. package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_reader_common.h +4 -1
  189. package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_filter_block.cc +135 -94
  190. package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_filter_block.h +52 -46
  191. package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_index_reader.cc +51 -13
  192. package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_index_reader.h +2 -0
  193. package/vendor/librocksdb/vendor/rocksdb/table/block_based/uncompression_dict_reader.cc +3 -11
  194. package/vendor/librocksdb/vendor/rocksdb/table/block_based/uncompression_dict_reader.h +2 -3
  195. package/vendor/librocksdb/vendor/rocksdb/table/block_fetcher.cc +8 -10
  196. package/vendor/librocksdb/vendor/rocksdb/table/block_fetcher.h +2 -1
  197. package/vendor/librocksdb/vendor/rocksdb/table/compaction_merging_iterator.cc +9 -10
  198. package/vendor/librocksdb/vendor/rocksdb/table/compaction_merging_iterator.h +3 -2
  199. package/vendor/librocksdb/vendor/rocksdb/table/format.cc +1 -2
  200. package/vendor/librocksdb/vendor/rocksdb/table/iterator.cc +4 -0
  201. package/vendor/librocksdb/vendor/rocksdb/table/merging_iterator.cc +18 -13
  202. package/vendor/librocksdb/vendor/rocksdb/table/merging_iterator.h +5 -3
  203. package/vendor/librocksdb/vendor/rocksdb/table/meta_blocks.cc +18 -4
  204. package/vendor/librocksdb/vendor/rocksdb/table/meta_blocks.h +4 -0
  205. package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_builder.cc +2 -2
  206. package/vendor/librocksdb/vendor/rocksdb/table/sst_file_dumper.cc +6 -6
  207. package/vendor/librocksdb/vendor/rocksdb/table/sst_file_reader.cc +24 -2
  208. package/vendor/librocksdb/vendor/rocksdb/table/sst_file_writer_collectors.h +3 -1
  209. package/vendor/librocksdb/vendor/rocksdb/table/table_builder.h +8 -7
  210. package/vendor/librocksdb/vendor/rocksdb/table/table_iterator.h +69 -0
  211. package/vendor/librocksdb/vendor/rocksdb/table/table_reader.h +9 -0
  212. package/vendor/librocksdb/vendor/rocksdb/test_util/testutil.cc +25 -0
  213. package/vendor/librocksdb/vendor/rocksdb/test_util/testutil.h +12 -0
  214. package/vendor/librocksdb/vendor/rocksdb/tools/db_bench_tool.cc +32 -0
  215. package/vendor/librocksdb/vendor/rocksdb/tools/ldb_cmd.cc +618 -124
  216. package/vendor/librocksdb/vendor/rocksdb/tools/ldb_cmd_impl.h +19 -1
  217. package/vendor/librocksdb/vendor/rocksdb/tools/ldb_tool.cc +9 -0
  218. package/vendor/librocksdb/vendor/rocksdb/util/aligned_storage.h +24 -0
  219. package/vendor/librocksdb/vendor/rocksdb/util/autovector.h +4 -0
  220. package/vendor/librocksdb/vendor/rocksdb/util/comparator.cc +12 -0
  221. package/vendor/librocksdb/vendor/rocksdb/util/filter_bench.cc +1 -1
  222. package/vendor/librocksdb/vendor/rocksdb/util/random.cc +2 -1
  223. package/vendor/librocksdb/vendor/rocksdb/util/stderr_logger.cc +3 -4
  224. package/vendor/librocksdb/vendor/rocksdb/util/stderr_logger.h +1 -1
  225. package/vendor/librocksdb/vendor/rocksdb/util/udt_util.cc +33 -0
  226. package/vendor/librocksdb/vendor/rocksdb/util/udt_util.h +7 -0
  227. package/vendor/librocksdb/vendor/rocksdb/util/write_batch_util.h +5 -0
  228. package/vendor/librocksdb/vendor/rocksdb/util/xxhash.h +36 -29
  229. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_db_impl.h +3 -0
  230. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_db_impl_filesnapshot.cc +20 -0
  231. package/vendor/librocksdb/vendor/rocksdb/utilities/cache_dump_load_impl.cc +29 -9
  232. package/vendor/librocksdb/vendor/rocksdb/utilities/cache_dump_load_impl.h +14 -3
  233. package/vendor/librocksdb/vendor/rocksdb/utilities/debug.cc +16 -4
  234. package/vendor/librocksdb/vendor/rocksdb/utilities/fault_injection_fs.cc +677 -248
  235. package/vendor/librocksdb/vendor/rocksdb/utilities/fault_injection_fs.h +325 -158
  236. package/vendor/librocksdb/vendor/rocksdb/utilities/option_change_migration/option_change_migration.cc +1 -8
  237. package/vendor/librocksdb/vendor/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector.cc +144 -0
  238. package/vendor/librocksdb/vendor/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector.h +45 -0
  239. package/vendor/librocksdb/vendor/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector.cc +12 -0
  240. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +1 -1
  241. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/growable_array.h +3 -3
  242. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction.cc +116 -20
  243. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction.h +33 -1
  244. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction_db.cc +78 -13
  245. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction_db.h +33 -1
  246. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_base.cc +106 -7
  247. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_base.h +68 -10
  248. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_test.h +7 -3
  249. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_util.cc +8 -5
  250. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_util.h +7 -4
  251. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_prepared_txn.cc +18 -12
  252. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_prepared_txn_db.cc +4 -4
  253. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_prepared_txn_db.h +17 -0
  254. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_unprepared_txn.cc +11 -9
  255. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_unprepared_txn_db.cc +2 -1
  256. package/vendor/librocksdb/vendor/rocksdb/utilities/types_util.cc +88 -0
  257. package/vendor/librocksdb/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +313 -14
  258. package/vendor/librocksdb/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.cc +7 -0
  259. package/vendor/librocksdb/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.h +1 -1
  260. package/vendor/librocksdb/vendor/rocksdb/db/multi_cf_iterator.cc +0 -102
  261. package/vendor/librocksdb/vendor/rocksdb/db/multi_cf_iterator.h +0 -159
@@ -17,6 +17,8 @@ using namespace rocksdb;
17
17
 
18
18
  static_assert(sizeof(Slice) == sizeof(rocksdb_slice_t));
19
19
 
20
+ namespace {
21
+
20
22
  static const rocksdb_options_t rocksdb__default_options = {
21
23
  .version = 0,
22
24
  .read_only = false,
@@ -33,12 +35,35 @@ static const rocksdb_options_t rocksdb__default_options = {
33
35
  .table_format_version = 6,
34
36
  };
35
37
 
38
+ static const rocksdb_read_options_t rocksdb__default_read_options = {
39
+ .version = 0,
40
+ .snapshot = nullptr,
41
+ };
42
+
43
+ static const rocksdb_write_options_t rocksdb__default_write_options = {
44
+ .version = 0,
45
+ };
46
+
36
47
  template <auto rocksdb_options_t::*P, typename T>
37
48
  static inline T
38
49
  rocksdb__option (const rocksdb_options_t *options, int min_version, T fallback = T(rocksdb__default_options.*P)) {
39
50
  return options->version >= min_version ? T(options->*P) : fallback;
40
51
  }
41
52
 
53
+ template <auto rocksdb_read_options_t::*P, typename T>
54
+ static inline T
55
+ rocksdb__option (const rocksdb_read_options_t *options, int min_version, T fallback = T(rocksdb__default_read_options.*P)) {
56
+ return options->version >= min_version ? T(options->*P) : fallback;
57
+ }
58
+
59
+ template <auto rocksdb_write_options_t::*P, typename T>
60
+ static inline T
61
+ rocksdb__option (const rocksdb_write_options_t *options, int min_version, T fallback = T(rocksdb__default_write_options.*P)) {
62
+ return options->version >= min_version ? T(options->*P) : fallback;
63
+ }
64
+
65
+ } // namespace
66
+
42
67
  extern "C" int
43
68
  rocksdb_init (uv_loop_t *loop, rocksdb_t *db) {
44
69
  db->loop = loop;
@@ -47,6 +72,8 @@ rocksdb_init (uv_loop_t *loop, rocksdb_t *db) {
47
72
  return 0;
48
73
  }
49
74
 
75
+ namespace {
76
+
50
77
  template <typename T>
51
78
  static inline void
52
79
  rocksdb__on_status (uv_work_t *handle, int status) {
@@ -59,6 +86,8 @@ rocksdb__on_status (uv_work_t *handle, int status) {
59
86
  if (error) free(error);
60
87
  }
61
88
 
89
+ } // namespace
90
+
62
91
  static void
63
92
  rocksdb__on_open (uv_work_t *handle) {
64
93
  auto req = reinterpret_cast<rocksdb_open_t *>(handle->data);
@@ -146,6 +175,8 @@ rocksdb_open (rocksdb_t *db, rocksdb_open_t *req, const char *path, const rocksd
146
175
  return uv_queue_work(db->loop, &req->worker, rocksdb__on_open, rocksdb__on_status<rocksdb_open_t>);
147
176
  }
148
177
 
178
+ namespace {
179
+
149
180
  static void
150
181
  rocksdb__on_close (uv_work_t *handle) {
151
182
  auto req = reinterpret_cast<rocksdb_close_t *>(handle->data);
@@ -165,6 +196,8 @@ rocksdb__on_close (uv_work_t *handle) {
165
196
  delete rocks;
166
197
  }
167
198
 
199
+ } // namespace
200
+
168
201
  extern "C" int
169
202
  rocksdb_close (rocksdb_t *db, rocksdb_close_t *req, rocksdb_close_cb cb) {
170
203
  req->db = db;
@@ -191,6 +224,8 @@ rocksdb_slice_empty (void) {
191
224
  return {.data = nullptr, .len = 0};
192
225
  }
193
226
 
227
+ namespace {
228
+
194
229
  static inline rocksdb_slice_t
195
230
  rocksdb__slice_copy (const Slice &slice) {
196
231
  auto len = slice.size();
@@ -323,8 +358,8 @@ rocksdb__iterator_valid (Iterator *iterator, T *req) {
323
358
 
324
359
  template <bool reverse = false>
325
360
  static inline Iterator *
326
- rocksdb__iterator_open (DB *db, const rocksdb_range_t &range) {
327
- auto iterator = db->NewIterator(ReadOptions());
361
+ rocksdb__iterator_open (DB *db, const ReadOptions &options, const rocksdb_range_t &range) {
362
+ auto iterator = db->NewIterator(options);
328
363
 
329
364
  rocksdb__iterator_seek<reverse>(iterator, range);
330
365
 
@@ -338,10 +373,18 @@ rocksdb__iterator_open (T *req) {
338
373
 
339
374
  const auto &range = req->range;
340
375
 
376
+ auto snapshot = rocksdb__option<&rocksdb_read_options_t::snapshot, rocksdb_snapshot_t *>(
377
+ &req->options, 0
378
+ );
379
+
380
+ ReadOptions options;
381
+
382
+ if (snapshot) options.snapshot = reinterpret_cast<const Snapshot *>(snapshot->handle);
383
+
341
384
  if (req->reverse) {
342
- return rocksdb__iterator_open<true>(db, range);
385
+ return rocksdb__iterator_open<true>(db, options, range);
343
386
  } else {
344
- return rocksdb__iterator_open<false>(db, range);
387
+ return rocksdb__iterator_open<false>(db, options, range);
345
388
  }
346
389
  }
347
390
 
@@ -366,6 +409,10 @@ rocksdb__iterator_refresh (Iterator *iterator, T *req) {
366
409
  rocksdb__iterator_seek(iterator, req);
367
410
  }
368
411
 
412
+ } // namespace
413
+
414
+ namespace {
415
+
369
416
  static void
370
417
  rocksdb__on_after_iterator (uv_work_t *handle, int status) {
371
418
  auto req = reinterpret_cast<rocksdb_iterator_t *>(handle->data);
@@ -394,9 +441,12 @@ rocksdb__on_iterator_open (uv_work_t *handle) {
394
441
  }
395
442
  }
396
443
 
444
+ } // namespace
445
+
397
446
  extern "C" int
398
- rocksdb_iterator_open (rocksdb_t *db, rocksdb_iterator_t *iterator, rocksdb_range_t range, bool reverse, rocksdb_iterator_cb cb) {
447
+ rocksdb_iterator_open (rocksdb_t *db, rocksdb_iterator_t *iterator, rocksdb_range_t range, bool reverse, const rocksdb_read_options_t *options, rocksdb_iterator_cb cb) {
399
448
  iterator->db = db;
449
+ iterator->options = options ? *options : rocksdb__default_read_options;
400
450
  iterator->range = range;
401
451
  iterator->reverse = reverse;
402
452
  iterator->cb = cb;
@@ -406,6 +456,8 @@ rocksdb_iterator_open (rocksdb_t *db, rocksdb_iterator_t *iterator, rocksdb_rang
406
456
  return uv_queue_work(iterator->db->loop, &iterator->worker, rocksdb__on_iterator_open, rocksdb__on_after_iterator);
407
457
  }
408
458
 
459
+ namespace {
460
+
409
461
  static void
410
462
  rocksdb__on_iterator_close (uv_work_t *handle) {
411
463
  auto req = reinterpret_cast<rocksdb_iterator_t *>(handle->data);
@@ -415,6 +467,8 @@ rocksdb__on_iterator_close (uv_work_t *handle) {
415
467
  delete iterator;
416
468
  }
417
469
 
470
+ } // namespace
471
+
418
472
  extern "C" int
419
473
  rocksdb_iterator_close (rocksdb_iterator_t *iterator, rocksdb_iterator_cb cb) {
420
474
  iterator->cb = cb;
@@ -422,6 +476,8 @@ rocksdb_iterator_close (rocksdb_iterator_t *iterator, rocksdb_iterator_cb cb) {
422
476
  return uv_queue_work(iterator->db->loop, &iterator->worker, rocksdb__on_iterator_close, rocksdb__on_after_iterator);
423
477
  }
424
478
 
479
+ namespace {
480
+
425
481
  static void
426
482
  rocksdb__on_iterator_refresh (uv_work_t *handle) {
427
483
  auto req = reinterpret_cast<rocksdb_iterator_t *>(handle->data);
@@ -439,8 +495,11 @@ rocksdb__on_iterator_refresh (uv_work_t *handle) {
439
495
  }
440
496
  }
441
497
 
498
+ } // namespace
499
+
442
500
  extern "C" int
443
- rocksdb_iterator_refresh (rocksdb_iterator_t *iterator, rocksdb_range_t range, bool reverse, rocksdb_iterator_cb cb) {
501
+ rocksdb_iterator_refresh (rocksdb_iterator_t *iterator, rocksdb_range_t range, bool reverse, const rocksdb_read_options_t *options, rocksdb_iterator_cb cb) {
502
+ iterator->options = options ? *options : rocksdb__default_read_options;
444
503
  iterator->range = range;
445
504
  iterator->reverse = reverse;
446
505
  iterator->cb = cb;
@@ -448,6 +507,8 @@ rocksdb_iterator_refresh (rocksdb_iterator_t *iterator, rocksdb_range_t range, b
448
507
  return uv_queue_work(iterator->db->loop, &iterator->worker, rocksdb__on_iterator_close, rocksdb__on_after_iterator);
449
508
  }
450
509
 
510
+ namespace {
511
+
451
512
  static void
452
513
  rocksdb__on_iterator_read (uv_work_t *handle) {
453
514
  auto req = reinterpret_cast<rocksdb_iterator_t *>(handle->data);
@@ -465,6 +526,8 @@ rocksdb__on_iterator_read (uv_work_t *handle) {
465
526
  }
466
527
  }
467
528
 
529
+ } // namespace
530
+
468
531
  extern "C" int
469
532
  rocksdb_iterator_read (rocksdb_iterator_t *iterator, rocksdb_slice_t *keys, rocksdb_slice_t *values, size_t capacity, rocksdb_iterator_cb cb) {
470
533
  iterator->cb = cb;
@@ -476,6 +539,8 @@ rocksdb_iterator_read (rocksdb_iterator_t *iterator, rocksdb_slice_t *keys, rock
476
539
  return uv_queue_work(iterator->db->loop, &iterator->worker, rocksdb__on_iterator_read, rocksdb__on_after_iterator);
477
540
  }
478
541
 
542
+ namespace {
543
+
479
544
  static void
480
545
  rocksdb__on_after_read (uv_work_t *handle, int status) {
481
546
  auto req = reinterpret_cast<rocksdb_read_batch_t *>(handle->data);
@@ -488,7 +553,7 @@ rocksdb__on_after_read (uv_work_t *handle, int status) {
488
553
  }
489
554
 
490
555
  static void
491
- rocksdb__on_batch_read (uv_work_t *handle) {
556
+ rocksdb__on_read (uv_work_t *handle) {
492
557
  auto req = reinterpret_cast<rocksdb_read_batch_t *>(handle->data);
493
558
 
494
559
  auto db = reinterpret_cast<DB *>(req->db->handle);
@@ -510,7 +575,15 @@ rocksdb__on_batch_read (uv_work_t *handle) {
510
575
 
511
576
  std::vector<Status> statuses(req->len);
512
577
 
513
- db->MultiGet(ReadOptions(), db->DefaultColumnFamily(), req->len, keys.data(), values.data(), statuses.data());
578
+ auto snapshot = rocksdb__option<&rocksdb_read_options_t::snapshot, rocksdb_snapshot_t *>(
579
+ &req->options, 0
580
+ );
581
+
582
+ ReadOptions options;
583
+
584
+ if (snapshot) options.snapshot = reinterpret_cast<const Snapshot *>(snapshot->handle);
585
+
586
+ db->MultiGet(options, db->DefaultColumnFamily(), req->len, keys.data(), values.data(), statuses.data());
514
587
 
515
588
  for (size_t i = 0, n = req->len; i < n; i++) {
516
589
  auto op = &req->reads[i];
@@ -539,9 +612,12 @@ rocksdb__on_batch_read (uv_work_t *handle) {
539
612
  }
540
613
  }
541
614
 
615
+ } // namespace
616
+
542
617
  extern "C" int
543
- rocksdb_read (rocksdb_t *db, rocksdb_read_batch_t *batch, rocksdb_read_t *reads, char **errors, size_t len, rocksdb_read_batch_cb cb) {
618
+ rocksdb_read (rocksdb_t *db, rocksdb_read_batch_t *batch, rocksdb_read_t *reads, char **errors, size_t len, const rocksdb_read_options_t *options, rocksdb_read_batch_cb cb) {
544
619
  batch->db = db;
620
+ batch->options = options ? *options : rocksdb__default_read_options;
545
621
  batch->reads = reads;
546
622
  batch->errors = errors;
547
623
  batch->len = len;
@@ -549,9 +625,11 @@ rocksdb_read (rocksdb_t *db, rocksdb_read_batch_t *batch, rocksdb_read_t *reads,
549
625
 
550
626
  batch->worker.data = static_cast<void *>(batch);
551
627
 
552
- return uv_queue_work(batch->db->loop, &batch->worker, rocksdb__on_batch_read, rocksdb__on_after_read);
628
+ return uv_queue_work(batch->db->loop, &batch->worker, rocksdb__on_read, rocksdb__on_after_read);
553
629
  }
554
630
 
631
+ namespace {
632
+
555
633
  static void
556
634
  rocksdb__on_after_write (uv_work_t *handle, int status) {
557
635
  auto req = reinterpret_cast<rocksdb_write_batch_t *>(handle->data);
@@ -564,7 +642,7 @@ rocksdb__on_after_write (uv_work_t *handle, int status) {
564
642
  }
565
643
 
566
644
  static void
567
- rocksdb__on_batch_write (uv_work_t *handle) {
645
+ rocksdb__on_write (uv_work_t *handle) {
568
646
  auto req = reinterpret_cast<rocksdb_write_batch_t *>(handle->data);
569
647
 
570
648
  auto db = reinterpret_cast<DB *>(req->db->handle);
@@ -590,7 +668,9 @@ rocksdb__on_batch_write (uv_work_t *handle) {
590
668
  }
591
669
  }
592
670
 
593
- auto status = db->Write(WriteOptions(), &batch);
671
+ WriteOptions options;
672
+
673
+ auto status = db->Write(options, &batch);
594
674
 
595
675
  if (status.ok()) {
596
676
  req->error = nullptr;
@@ -600,9 +680,12 @@ rocksdb__on_batch_write (uv_work_t *handle) {
600
680
  }
601
681
  }
602
682
 
683
+ } // namespace
684
+
603
685
  extern "C" int
604
- rocksdb_write (rocksdb_t *db, rocksdb_write_batch_t *batch, rocksdb_write_t *writes, size_t len, rocksdb_write_batch_cb cb) {
686
+ rocksdb_write (rocksdb_t *db, rocksdb_write_batch_t *batch, rocksdb_write_t *writes, size_t len, const rocksdb_write_options_t *options, rocksdb_write_batch_cb cb) {
605
687
  batch->db = db;
688
+ batch->options = options ? *options : rocksdb__default_write_options;
606
689
  batch->writes = writes;
607
690
  batch->error = nullptr;
608
691
  batch->len = len;
@@ -610,5 +693,22 @@ rocksdb_write (rocksdb_t *db, rocksdb_write_batch_t *batch, rocksdb_write_t *wri
610
693
 
611
694
  batch->worker.data = static_cast<void *>(batch);
612
695
 
613
- return uv_queue_work(batch->db->loop, &batch->worker, rocksdb__on_batch_write, rocksdb__on_after_write);
696
+ return uv_queue_work(batch->db->loop, &batch->worker, rocksdb__on_write, rocksdb__on_after_write);
697
+ }
698
+
699
+ extern "C" int
700
+ rocksdb_snapshot_create (rocksdb_t *db, rocksdb_snapshot_t *snapshot) {
701
+ auto handle = reinterpret_cast<DB *>(db->handle)->GetSnapshot();
702
+
703
+ if (handle == nullptr) return -1;
704
+
705
+ snapshot->db = db;
706
+ snapshot->handle = handle;
707
+
708
+ return 0;
709
+ }
710
+
711
+ extern "C" void
712
+ rocksdb_snapshot_destroy (rocksdb_snapshot_t *snapshot) {
713
+ reinterpret_cast<DB *>(snapshot->db->handle)->ReleaseSnapshot(reinterpret_cast<const Snapshot *>(snapshot->handle));
614
714
  }
@@ -267,8 +267,8 @@ endif(CMAKE_SYSTEM_PROCESSOR MATCHES "s390x")
267
267
  if(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
268
268
  CHECK_C_COMPILER_FLAG("-march=loongarch64" HAS_LOONGARCH64)
269
269
  if(HAS_LOONGARCH64)
270
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=loongarch64 -mtune=loongarch64")
271
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=loongarch64 -mtune=loongarch64")
270
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=loongarch64 -mtune=loongarch64")
271
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=loongarch64 -mtune=loongarch64")
272
272
  endif(HAS_LOONGARCH64)
273
273
  endif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
274
274
 
@@ -488,6 +488,8 @@ if(CMAKE_SYSTEM_NAME MATCHES "Cygwin")
488
488
  add_definitions(-fno-builtin-memcmp -DCYGWIN)
489
489
  elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
490
490
  add_definitions(-DOS_MACOSX)
491
+ elseif(CMAKE_SYSTEM_NAME MATCHES "iOS")
492
+ add_definitions(-DOS_MACOSX -DIOS_CROSS_COMPILE)
491
493
  elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
492
494
  add_definitions(-DOS_LINUX)
493
495
  elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
@@ -615,7 +617,7 @@ if(USE_FOLLY)
615
617
  FMT_INST_PATH)
616
618
  exec_program(ls ARGS -d ${FOLLY_INST_PATH}/../gflags* OUTPUT_VARIABLE
617
619
  GFLAGS_INST_PATH)
618
- set(Boost_DIR ${BOOST_INST_PATH}/lib/cmake/Boost-1.78.0)
620
+ set(Boost_DIR ${BOOST_INST_PATH}/lib/cmake/Boost-1.83.0)
619
621
  if(EXISTS ${FMT_INST_PATH}/lib64)
620
622
  set(fmt_DIR ${FMT_INST_PATH}/lib64/cmake/fmt)
621
623
  else()
@@ -653,6 +655,7 @@ set(SOURCES
653
655
  cache/sharded_cache.cc
654
656
  cache/tiered_secondary_cache.cc
655
657
  db/arena_wrapped_db_iter.cc
658
+ db/attribute_group_iterator_impl.cc
656
659
  db/blob/blob_contents.cc
657
660
  db/blob/blob_fetcher.cc
658
661
  db/blob/blob_file_addition.cc
@@ -669,6 +672,7 @@ set(SOURCES
669
672
  db/blob/prefetch_buffer_collection.cc
670
673
  db/builder.cc
671
674
  db/c.cc
675
+ db/coalescing_iterator.cc
672
676
  db/column_family.cc
673
677
  db/compaction/compaction.cc
674
678
  db/compaction/compaction_iterator.cc
@@ -689,6 +693,7 @@ set(SOURCES
689
693
  db/db_impl/db_impl_write.cc
690
694
  db/db_impl/db_impl_compaction_flush.cc
691
695
  db/db_impl/db_impl_files.cc
696
+ db/db_impl/db_impl_follower.cc
692
697
  db/db_impl/db_impl_open.cc
693
698
  db/db_impl/db_impl_debug.cc
694
699
  db/db_impl/db_impl_experimental.cc
@@ -715,7 +720,6 @@ set(SOURCES
715
720
  db/memtable_list.cc
716
721
  db/merge_helper.cc
717
722
  db/merge_operator.cc
718
- db/multi_cf_iterator.cc
719
723
  db/output_validator.cc
720
724
  db/periodic_task_scheduler.cc
721
725
  db/range_del_aggregator.cc
@@ -747,6 +751,7 @@ set(SOURCES
747
751
  env/env_encryption.cc
748
752
  env/file_system.cc
749
753
  env/file_system_tracer.cc
754
+ env/fs_on_demand.cc
750
755
  env/fs_remap.cc
751
756
  env/mock_env.cc
752
757
  env/unique_id_gen.cc
@@ -934,6 +939,7 @@ set(SOURCES
934
939
  utilities/persistent_cache/volatile_tier_impl.cc
935
940
  utilities/simulator_cache/cache_simulator.cc
936
941
  utilities/simulator_cache/sim_cache.cc
942
+ utilities/table_properties_collectors/compact_for_tiering_collector.cc
937
943
  utilities/table_properties_collectors/compact_on_deletion_collector.cc
938
944
  utilities/trace/file_trace_reader_writer.cc
939
945
  utilities/trace/replayer_impl.cc
@@ -954,6 +960,7 @@ set(SOURCES
954
960
  utilities/transactions/write_prepared_txn_db.cc
955
961
  utilities/transactions/write_unprepared_txn.cc
956
962
  utilities/transactions/write_unprepared_txn_db.cc
963
+ utilities/types_util.cc
957
964
  utilities/ttl/db_ttl_impl.cc
958
965
  utilities/wal_filter.cc
959
966
  utilities/write_batch_with_index/write_batch_with_index.cc
@@ -1045,6 +1052,7 @@ if(USE_FOLLY_LITE)
1045
1052
  list(APPEND SOURCES
1046
1053
  third-party/folly/folly/container/detail/F14Table.cpp
1047
1054
  third-party/folly/folly/detail/Futex.cpp
1055
+ third-party/folly/folly/lang/Exception.cpp
1048
1056
  third-party/folly/folly/lang/SafeAssert.cpp
1049
1057
  third-party/folly/folly/lang/ToAscii.cpp
1050
1058
  third-party/folly/folly/ScopeGuard.cpp
@@ -1052,6 +1060,12 @@ if(USE_FOLLY_LITE)
1052
1060
  third-party/folly/folly/synchronization/DistributedMutex.cpp
1053
1061
  third-party/folly/folly/synchronization/ParkingLot.cpp)
1054
1062
  include_directories(${PROJECT_SOURCE_DIR}/third-party/folly)
1063
+ exec_program(python3 ${PROJECT_SOURCE_DIR}/third-party/folly ARGS
1064
+ build/fbcode_builder/getdeps.py show-source-dir boost OUTPUT_VARIABLE
1065
+ BOOST_SOURCE_PATH)
1066
+ exec_program(ls ARGS -d ${BOOST_SOURCE_PATH}/boost* OUTPUT_VARIABLE
1067
+ BOOST_INCLUDE_DIR)
1068
+ include_directories(${BOOST_INCLUDE_DIR})
1055
1069
  add_definitions(-DUSE_FOLLY -DFOLLY_NO_CONFIG)
1056
1070
  list(APPEND THIRDPARTY_LIBS glog)
1057
1071
  endif()
@@ -1361,6 +1375,7 @@ if(WITH_TESTS)
1361
1375
  db/file_indexer_test.cc
1362
1376
  db/filename_test.cc
1363
1377
  db/flush_job_test.cc
1378
+ db/db_follower_test.cc
1364
1379
  db/import_column_family_test.cc
1365
1380
  db/listener_test.cc
1366
1381
  db/log_test.cc
@@ -1474,6 +1489,7 @@ if(WITH_TESTS)
1474
1489
  utilities/persistent_cache/persistent_cache_test.cc
1475
1490
  utilities/simulator_cache/cache_simulator_test.cc
1476
1491
  utilities/simulator_cache/sim_cache_test.cc
1492
+ utilities/table_properties_collectors/compact_for_tiering_collector_test.cc
1477
1493
  utilities/table_properties_collectors/compact_on_deletion_collector_test.cc
1478
1494
  utilities/transactions/optimistic_transaction_test.cc
1479
1495
  utilities/transactions/transaction_test.cc
@@ -1484,6 +1500,7 @@ if(WITH_TESTS)
1484
1500
  utilities/transactions/lock/range/range_locking_test.cc
1485
1501
  utilities/transactions/timestamped_snapshot_test.cc
1486
1502
  utilities/ttl/ttl_test.cc
1503
+ utilities/types_util_test.cc
1487
1504
  utilities/util_merge_operators_test.cc
1488
1505
  utilities/write_batch_with_index/write_batch_with_index_test.cc
1489
1506
  ${PLUGIN_TESTS}
@@ -134,12 +134,14 @@ bool CacheWithSecondaryAdapter::EvictionHandler(const Slice& key,
134
134
  auto obj = target_->Value(handle);
135
135
  // Ignore dummy entry
136
136
  if (obj != kDummyObj) {
137
- bool hit = false;
137
+ bool force = false;
138
138
  if (adm_policy_ == TieredAdmissionPolicy::kAdmPolicyAllowCacheHits) {
139
- hit = was_hit;
139
+ force = was_hit;
140
+ } else if (adm_policy_ == TieredAdmissionPolicy::kAdmPolicyAllowAll) {
141
+ force = true;
140
142
  }
141
143
  // Spill into secondary cache.
142
- secondary_cache_->Insert(key, obj, helper, hit).PermitUncheckedError();
144
+ secondary_cache_->Insert(key, obj, helper, force).PermitUncheckedError();
143
145
  }
144
146
  }
145
147
  // Never takes ownership of obj
@@ -661,6 +663,7 @@ std::shared_ptr<Cache> NewTieredCache(const TieredCacheOptions& _opts) {
661
663
  break;
662
664
  case TieredAdmissionPolicy::kAdmPolicyPlaceholder:
663
665
  case TieredAdmissionPolicy::kAdmPolicyAllowCacheHits:
666
+ case TieredAdmissionPolicy::kAdmPolicyAllowAll:
664
667
  if (opts.nvm_sec_cache) {
665
668
  valid_adm_policy = false;
666
669
  }
@@ -138,10 +138,10 @@ Status ArenaWrappedDBIter::Refresh(const Snapshot* snapshot) {
138
138
  reinit_internal_iter();
139
139
  break;
140
140
  } else {
141
- delete *memtable_range_tombstone_iter_;
142
- *memtable_range_tombstone_iter_ = new TruncatedRangeDelIterator(
143
- std::unique_ptr<FragmentedRangeTombstoneIterator>(t),
144
- &cfd->internal_comparator(), nullptr, nullptr);
141
+ *memtable_range_tombstone_iter_ =
142
+ std::make_unique<TruncatedRangeDelIterator>(
143
+ std::unique_ptr<FragmentedRangeTombstoneIterator>(t),
144
+ &cfd->internal_comparator(), nullptr, nullptr);
145
145
  }
146
146
  }
147
147
  db_impl->ReturnAndCleanupSuperVersion(cfd, sv);
@@ -55,7 +55,8 @@ class ArenaWrappedDBIter : public Iterator {
55
55
  db_iter_->SetIter(iter);
56
56
  }
57
57
 
58
- void SetMemtableRangetombstoneIter(TruncatedRangeDelIterator** iter) {
58
+ void SetMemtableRangetombstoneIter(
59
+ std::unique_ptr<TruncatedRangeDelIterator>* iter) {
59
60
  memtable_range_tombstone_iter_ = iter;
60
61
  }
61
62
 
@@ -110,7 +111,8 @@ class ArenaWrappedDBIter : public Iterator {
110
111
  bool allow_refresh_ = true;
111
112
  // If this is nullptr, it means the mutable memtable does not contain range
112
113
  // tombstone when added under this DBIter.
113
- TruncatedRangeDelIterator** memtable_range_tombstone_iter_ = nullptr;
114
+ std::unique_ptr<TruncatedRangeDelIterator>* memtable_range_tombstone_iter_ =
115
+ nullptr;
114
116
  };
115
117
 
116
118
  // Generate the arena wrapped iterator class.
@@ -0,0 +1,20 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ // This source code is licensed under both the GPLv2 (found in the
3
+ // COPYING file in the root directory) and Apache 2.0 License
4
+ // (found in the LICENSE.Apache file in the root directory).
5
+
6
+ #include "db/attribute_group_iterator_impl.h"
7
+
8
+ namespace ROCKSDB_NAMESPACE {
9
+
10
+ const AttributeGroups kNoAttributeGroups;
11
+ const IteratorAttributeGroups kNoIteratorAttributeGroups;
12
+
13
+ void AttributeGroupIteratorImpl::AddToAttributeGroups(
14
+ const autovector<MultiCfIteratorInfo>& items) {
15
+ for (const auto& item : items) {
16
+ attribute_groups_.emplace_back(item.cfh, &item.iterator->columns());
17
+ }
18
+ }
19
+
20
+ } // namespace ROCKSDB_NAMESPACE
@@ -0,0 +1,83 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ // This source code is licensed under both the GPLv2 (found in the
3
+ // COPYING file in the root directory) and Apache 2.0 License
4
+ // (found in the LICENSE.Apache file in the root directory).
5
+
6
+ #pragma once
7
+
8
+ #include "db/multi_cf_iterator_impl.h"
9
+ #include "rocksdb/attribute_groups.h"
10
+
11
+ namespace ROCKSDB_NAMESPACE {
12
+
13
+ class AttributeGroupIteratorImpl : public AttributeGroupIterator {
14
+ public:
15
+ AttributeGroupIteratorImpl(
16
+ const Comparator* comparator,
17
+ const std::vector<ColumnFamilyHandle*>& column_families,
18
+ const std::vector<Iterator*>& child_iterators)
19
+ : impl_(
20
+ comparator, column_families, child_iterators, [this]() { Reset(); },
21
+ [this](const autovector<MultiCfIteratorInfo>& items) {
22
+ AddToAttributeGroups(items);
23
+ }) {}
24
+ ~AttributeGroupIteratorImpl() override {}
25
+
26
+ // No copy allowed
27
+ AttributeGroupIteratorImpl(const AttributeGroupIteratorImpl&) = delete;
28
+ AttributeGroupIteratorImpl& operator=(const AttributeGroupIteratorImpl&) =
29
+ delete;
30
+
31
+ bool Valid() const override { return impl_.Valid(); }
32
+ void SeekToFirst() override { impl_.SeekToFirst(); }
33
+ void SeekToLast() override { impl_.SeekToLast(); }
34
+ void Seek(const Slice& target) override { impl_.Seek(target); }
35
+ void SeekForPrev(const Slice& target) override { impl_.SeekForPrev(target); }
36
+ void Next() override { impl_.Next(); }
37
+ void Prev() override { impl_.Prev(); }
38
+ Slice key() const override { return impl_.key(); }
39
+ Status status() const override { return impl_.status(); }
40
+
41
+ const IteratorAttributeGroups& attribute_groups() const override {
42
+ assert(Valid());
43
+ return attribute_groups_;
44
+ }
45
+
46
+ void Reset() { attribute_groups_.clear(); }
47
+
48
+ private:
49
+ MultiCfIteratorImpl impl_;
50
+ IteratorAttributeGroups attribute_groups_;
51
+ void AddToAttributeGroups(const autovector<MultiCfIteratorInfo>& items);
52
+ };
53
+
54
+ class EmptyAttributeGroupIterator : public AttributeGroupIterator {
55
+ public:
56
+ explicit EmptyAttributeGroupIterator(const Status& s) : status_(s) {}
57
+ bool Valid() const override { return false; }
58
+ void Seek(const Slice& /*target*/) override {}
59
+ void SeekForPrev(const Slice& /*target*/) override {}
60
+ void SeekToFirst() override {}
61
+ void SeekToLast() override {}
62
+ void Next() override { assert(false); }
63
+ void Prev() override { assert(false); }
64
+ Slice key() const override {
65
+ assert(false);
66
+ return Slice();
67
+ }
68
+ Status status() const override { return status_; }
69
+
70
+ const IteratorAttributeGroups& attribute_groups() const override {
71
+ return kNoIteratorAttributeGroups;
72
+ }
73
+
74
+ private:
75
+ Status status_;
76
+ };
77
+
78
+ inline std::unique_ptr<AttributeGroupIterator> NewAttributeGroupErrorIterator(
79
+ const Status& status) {
80
+ return std::make_unique<EmptyAttributeGroupIterator>(status);
81
+ }
82
+
83
+ } // namespace ROCKSDB_NAMESPACE
@@ -64,7 +64,7 @@ Status BuildTable(
64
64
  std::vector<std::unique_ptr<FragmentedRangeTombstoneIterator>>
65
65
  range_del_iters,
66
66
  FileMetaData* meta, std::vector<BlobFileAddition>* blob_file_additions,
67
- std::vector<SequenceNumber> snapshots,
67
+ std::vector<SequenceNumber> snapshots, SequenceNumber earliest_snapshot,
68
68
  SequenceNumber earliest_write_conflict_snapshot,
69
69
  SequenceNumber job_snapshot, SnapshotChecker* snapshot_checker,
70
70
  bool paranoid_file_checks, InternalStats* internal_stats,
@@ -195,7 +195,7 @@ Status BuildTable(
195
195
 
196
196
  const std::atomic<bool> kManualCompactionCanceledFalse{false};
197
197
  CompactionIterator c_iter(
198
- iter, ucmp, &merge, kMaxSequenceNumber, &snapshots,
198
+ iter, ucmp, &merge, kMaxSequenceNumber, &snapshots, earliest_snapshot,
199
199
  earliest_write_conflict_snapshot, job_snapshot, snapshot_checker, env,
200
200
  ShouldReportDetailedTime(env, ioptions.stats),
201
201
  true /* internal key corruption is not ok */, range_del_agg.get(),
@@ -210,6 +210,7 @@ Status BuildTable(
210
210
  const bool logical_strip_timestamp =
211
211
  ts_sz > 0 && !ioptions.persist_user_defined_timestamps;
212
212
 
213
+ SequenceNumber smallest_preferred_seqno = kMaxSequenceNumber;
213
214
  std::string key_after_flush_buf;
214
215
  std::string value_buf;
215
216
  c_iter.SeekToFirst();
@@ -242,6 +243,8 @@ Status BuildTable(
242
243
  if (preferred_seqno < ikey.sequence) {
243
244
  value_after_flush =
244
245
  PackValueAndSeqno(unpacked_value, preferred_seqno, &value_buf);
246
+ smallest_preferred_seqno =
247
+ std::min(smallest_preferred_seqno, preferred_seqno);
245
248
  } else {
246
249
  // Cannot get a useful preferred seqno, convert it to a kTypeValue.
247
250
  UpdateInternalKey(&key_after_flush_buf, ikey.sequence, kTypeValue);
@@ -326,9 +329,10 @@ Status BuildTable(
326
329
  } else {
327
330
  SeqnoToTimeMapping relevant_mapping;
328
331
  if (seqno_to_time_mapping) {
329
- relevant_mapping.CopyFromSeqnoRange(*seqno_to_time_mapping,
330
- meta->fd.smallest_seqno,
331
- meta->fd.largest_seqno);
332
+ relevant_mapping.CopyFromSeqnoRange(
333
+ *seqno_to_time_mapping,
334
+ std::min(meta->fd.smallest_seqno, smallest_preferred_seqno),
335
+ meta->fd.largest_seqno);
332
336
  relevant_mapping.SetCapacity(kMaxSeqnoTimePairsPerSST);
333
337
  relevant_mapping.Enforce(tboptions.file_creation_time);
334
338
  }
@@ -57,7 +57,7 @@ Status BuildTable(
57
57
  std::vector<std::unique_ptr<FragmentedRangeTombstoneIterator>>
58
58
  range_del_iters,
59
59
  FileMetaData* meta, std::vector<BlobFileAddition>* blob_file_additions,
60
- std::vector<SequenceNumber> snapshots,
60
+ std::vector<SequenceNumber> snapshots, SequenceNumber earliest_snapshot,
61
61
  SequenceNumber earliest_write_conflict_snapshot,
62
62
  SequenceNumber job_snapshot, SnapshotChecker* snapshot_checker,
63
63
  bool paranoid_file_checks, InternalStats* internal_stats,