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
@@ -155,21 +155,36 @@ Status DBImpl::Write(const WriteOptions& write_options, WriteBatch* my_batch) {
155
155
  }
156
156
  if (s.ok()) {
157
157
  s = WriteImpl(write_options, my_batch, /*callback=*/nullptr,
158
+ /*user_write_cb=*/nullptr,
158
159
  /*log_used=*/nullptr);
159
160
  }
160
161
  return s;
161
162
  }
162
163
 
164
+ Status DBImpl::WriteWithCallback(const WriteOptions& write_options,
165
+ WriteBatch* my_batch, WriteCallback* callback,
166
+ UserWriteCallback* user_write_cb) {
167
+ Status s;
168
+ if (write_options.protection_bytes_per_key > 0) {
169
+ s = WriteBatchInternal::UpdateProtectionInfo(
170
+ my_batch, write_options.protection_bytes_per_key);
171
+ }
172
+ if (s.ok()) {
173
+ s = WriteImpl(write_options, my_batch, callback, user_write_cb);
174
+ }
175
+ return s;
176
+ }
177
+
163
178
  Status DBImpl::WriteWithCallback(const WriteOptions& write_options,
164
179
  WriteBatch* my_batch,
165
- WriteCallback* callback) {
180
+ UserWriteCallback* user_write_cb) {
166
181
  Status s;
167
182
  if (write_options.protection_bytes_per_key > 0) {
168
183
  s = WriteBatchInternal::UpdateProtectionInfo(
169
184
  my_batch, write_options.protection_bytes_per_key);
170
185
  }
171
186
  if (s.ok()) {
172
- s = WriteImpl(write_options, my_batch, callback, nullptr);
187
+ s = WriteImpl(write_options, my_batch, /*callback=*/nullptr, user_write_cb);
173
188
  }
174
189
  return s;
175
190
  }
@@ -179,9 +194,9 @@ Status DBImpl::WriteWithCallback(const WriteOptions& write_options,
179
194
  // published sequence.
180
195
  Status DBImpl::WriteImpl(const WriteOptions& write_options,
181
196
  WriteBatch* my_batch, WriteCallback* callback,
182
- uint64_t* log_used, uint64_t log_ref,
183
- bool disable_memtable, uint64_t* seq_used,
184
- size_t batch_cnt,
197
+ UserWriteCallback* user_write_cb, uint64_t* log_used,
198
+ uint64_t log_ref, bool disable_memtable,
199
+ uint64_t* seq_used, size_t batch_cnt,
185
200
  PreReleaseCallback* pre_release_callback,
186
201
  PostMemTableCallback* post_memtable_callback) {
187
202
  assert(!seq_per_batch_ || batch_cnt != 0);
@@ -221,7 +236,11 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
221
236
  return Status::InvalidArgument(
222
237
  "`WriteOptions::protection_bytes_per_key` must be zero or eight");
223
238
  } else if (write_options.disableWAL &&
224
- immutable_db_options_.recycle_log_file_num > 0) {
239
+ immutable_db_options_.recycle_log_file_num > 0 &&
240
+ !(two_write_queues_ && disable_memtable)) {
241
+ // Corruption detection in recycled WALs relies on sequential sequence
242
+ // numbers, but WritePreparedTxnDB uses disableWAL internally for split
243
+ // writes
225
244
  return Status::InvalidArgument(
226
245
  "WriteOptions::disableWAL option is not supported if "
227
246
  "DBOptions::recycle_log_file_num > 0");
@@ -264,6 +283,10 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
264
283
  return Status::NotSupported(
265
284
  "seq_per_batch currently does not honor post_memtable_callback");
266
285
  }
286
+ if (my_batch->HasDeleteRange() && immutable_db_options_.row_cache) {
287
+ return Status::NotSupported(
288
+ "DeleteRange is not compatible with row cache.");
289
+ }
267
290
  // Otherwise IsLatestPersistentState optimization does not make sense
268
291
  assert(!WriteBatchInternal::IsLatestPersistentState(my_batch) ||
269
292
  disable_memtable);
@@ -280,10 +303,10 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
280
303
  seq_per_batch_ ? kDoAssignOrder : kDontAssignOrder;
281
304
  // Otherwise it is WAL-only Prepare batches in WriteCommitted policy and
282
305
  // they don't consume sequence.
283
- return WriteImplWALOnly(&nonmem_write_thread_, write_options, my_batch,
284
- callback, log_used, log_ref, seq_used, batch_cnt,
285
- pre_release_callback, assign_order,
286
- kDontPublishLastSeq, disable_memtable);
306
+ return WriteImplWALOnly(
307
+ &nonmem_write_thread_, write_options, my_batch, callback, user_write_cb,
308
+ log_used, log_ref, seq_used, batch_cnt, pre_release_callback,
309
+ assign_order, kDontPublishLastSeq, disable_memtable);
287
310
  }
288
311
 
289
312
  if (immutable_db_options_.unordered_write) {
@@ -295,9 +318,9 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
295
318
  // Use a write thread to i) optimize for WAL write, ii) publish last
296
319
  // sequence in in increasing order, iii) call pre_release_callback serially
297
320
  Status status = WriteImplWALOnly(
298
- &write_thread_, write_options, my_batch, callback, log_used, log_ref,
299
- &seq, sub_batch_cnt, pre_release_callback, kDoAssignOrder,
300
- kDoPublishLastSeq, disable_memtable);
321
+ &write_thread_, write_options, my_batch, callback, user_write_cb,
322
+ log_used, log_ref, &seq, sub_batch_cnt, pre_release_callback,
323
+ kDoAssignOrder, kDoPublishLastSeq, disable_memtable);
301
324
  TEST_SYNC_POINT("DBImpl::WriteImpl:UnorderedWriteAfterWriteWAL");
302
325
  if (!status.ok()) {
303
326
  return status;
@@ -314,17 +337,20 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
314
337
  }
315
338
 
316
339
  if (immutable_db_options_.enable_pipelined_write) {
317
- return PipelinedWriteImpl(write_options, my_batch, callback, log_used,
318
- log_ref, disable_memtable, seq_used);
340
+ return PipelinedWriteImpl(write_options, my_batch, callback, user_write_cb,
341
+ log_used, log_ref, disable_memtable, seq_used);
319
342
  }
320
343
 
321
344
  PERF_TIMER_GUARD(write_pre_and_post_process_time);
322
- WriteThread::Writer w(write_options, my_batch, callback, log_ref,
323
- disable_memtable, batch_cnt, pre_release_callback,
324
- post_memtable_callback);
345
+ WriteThread::Writer w(write_options, my_batch, callback, user_write_cb,
346
+ log_ref, disable_memtable, batch_cnt,
347
+ pre_release_callback, post_memtable_callback);
325
348
  StopWatch write_sw(immutable_db_options_.clock, stats_, DB_WRITE);
326
349
 
327
350
  write_thread_.JoinBatchGroup(&w);
351
+ if (w.state == WriteThread::STATE_PARALLEL_MEMTABLE_CALLER) {
352
+ write_thread_.SetMemWritersEachStride(&w);
353
+ }
328
354
  if (w.state == WriteThread::STATE_PARALLEL_MEMTABLE_WRITER) {
329
355
  // we are a non-leader in a parallel group
330
356
 
@@ -530,6 +556,35 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
530
556
  const SequenceNumber current_sequence = last_sequence + 1;
531
557
  last_sequence += seq_inc;
532
558
 
559
+ if (log_context.need_log_sync) {
560
+ VersionEdit synced_wals;
561
+ log_write_mutex_.Lock();
562
+ if (status.ok()) {
563
+ MarkLogsSynced(logfile_number_, log_context.need_log_dir_sync,
564
+ &synced_wals);
565
+ } else {
566
+ MarkLogsNotSynced(logfile_number_);
567
+ }
568
+ log_write_mutex_.Unlock();
569
+ if (status.ok() && synced_wals.IsWalAddition()) {
570
+ InstrumentedMutexLock l(&mutex_);
571
+ // TODO: plumb Env::IOActivity, Env::IOPriority
572
+ const ReadOptions read_options;
573
+ status = ApplyWALToManifest(read_options, write_options, &synced_wals);
574
+ }
575
+
576
+ // Requesting sync with two_write_queues_ is expected to be very rare. We
577
+ // hence provide a simple implementation that is not necessarily
578
+ // efficient.
579
+ if (status.ok() && two_write_queues_) {
580
+ if (manual_wal_flush_) {
581
+ status = FlushWAL(true);
582
+ } else {
583
+ status = SyncWAL();
584
+ }
585
+ }
586
+ }
587
+
533
588
  // PreReleaseCallback is called after WAL write and before memtable write
534
589
  if (status.ok()) {
535
590
  SequenceNumber next_sequence = current_sequence;
@@ -613,34 +668,6 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
613
668
  assert(pre_release_cb_status.ok());
614
669
  }
615
670
 
616
- if (log_context.need_log_sync) {
617
- VersionEdit synced_wals;
618
- log_write_mutex_.Lock();
619
- if (status.ok()) {
620
- MarkLogsSynced(logfile_number_, log_context.need_log_dir_sync,
621
- &synced_wals);
622
- } else {
623
- MarkLogsNotSynced(logfile_number_);
624
- }
625
- log_write_mutex_.Unlock();
626
- if (status.ok() && synced_wals.IsWalAddition()) {
627
- InstrumentedMutexLock l(&mutex_);
628
- // TODO: plumb Env::IOActivity, Env::IOPriority
629
- const ReadOptions read_options;
630
- status = ApplyWALToManifest(read_options, write_options, &synced_wals);
631
- }
632
-
633
- // Requesting sync with two_write_queues_ is expected to be very rare. We
634
- // hence provide a simple implementation that is not necessarily efficient.
635
- if (two_write_queues_) {
636
- if (manual_wal_flush_) {
637
- status = FlushWAL(true);
638
- } else {
639
- status = SyncWAL();
640
- }
641
- }
642
- }
643
-
644
671
  bool should_exit_batch_group = true;
645
672
  if (in_parallel_group) {
646
673
  // CompleteParallelWorker returns true if this thread should
@@ -675,6 +702,7 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
675
702
 
676
703
  Status DBImpl::PipelinedWriteImpl(const WriteOptions& write_options,
677
704
  WriteBatch* my_batch, WriteCallback* callback,
705
+ UserWriteCallback* user_write_cb,
678
706
  uint64_t* log_used, uint64_t log_ref,
679
707
  bool disable_memtable, uint64_t* seq_used) {
680
708
  PERF_TIMER_GUARD(write_pre_and_post_process_time);
@@ -682,8 +710,8 @@ Status DBImpl::PipelinedWriteImpl(const WriteOptions& write_options,
682
710
 
683
711
  WriteContext write_context;
684
712
 
685
- WriteThread::Writer w(write_options, my_batch, callback, log_ref,
686
- disable_memtable, /*_batch_cnt=*/0,
713
+ WriteThread::Writer w(write_options, my_batch, callback, user_write_cb,
714
+ log_ref, disable_memtable, /*_batch_cnt=*/0,
687
715
  /*_pre_release_callback=*/nullptr);
688
716
  write_thread_.JoinBatchGroup(&w);
689
717
  TEST_SYNC_POINT("DBImplWrite::PipelinedWriteImpl:AfterJoinBatchGroup");
@@ -822,7 +850,9 @@ Status DBImpl::PipelinedWriteImpl(const WriteOptions& write_options,
822
850
  // so we need to set its status to pass ASSERT_STATUS_CHECKED
823
851
  memtable_write_group.status.PermitUncheckedError();
824
852
  }
825
-
853
+ if (w.state == WriteThread::STATE_PARALLEL_MEMTABLE_CALLER) {
854
+ write_thread_.SetMemWritersEachStride(&w);
855
+ }
826
856
  if (w.state == WriteThread::STATE_PARALLEL_MEMTABLE_WRITER) {
827
857
  PERF_TIMER_STOP(write_pre_and_post_process_time);
828
858
  PERF_TIMER_FOR_WAIT_GUARD(write_memtable_time);
@@ -862,7 +892,8 @@ Status DBImpl::UnorderedWriteMemtable(const WriteOptions& write_options,
862
892
  PERF_TIMER_GUARD(write_pre_and_post_process_time);
863
893
  StopWatch write_sw(immutable_db_options_.clock, stats_, DB_WRITE);
864
894
 
865
- WriteThread::Writer w(write_options, my_batch, callback, log_ref,
895
+ WriteThread::Writer w(write_options, my_batch, callback,
896
+ /*user_write_cb=*/nullptr, log_ref,
866
897
  false /*disable_memtable*/);
867
898
 
868
899
  if (w.CheckCallback(this) && w.ShouldWriteToMemtable()) {
@@ -912,13 +943,15 @@ Status DBImpl::UnorderedWriteMemtable(const WriteOptions& write_options,
912
943
  // applicable in a two-queue setting.
913
944
  Status DBImpl::WriteImplWALOnly(
914
945
  WriteThread* write_thread, const WriteOptions& write_options,
915
- WriteBatch* my_batch, WriteCallback* callback, uint64_t* log_used,
946
+ WriteBatch* my_batch, WriteCallback* callback,
947
+ UserWriteCallback* user_write_cb, uint64_t* log_used,
916
948
  const uint64_t log_ref, uint64_t* seq_used, const size_t sub_batch_cnt,
917
949
  PreReleaseCallback* pre_release_callback, const AssignOrder assign_order,
918
950
  const PublishLastSeq publish_last_seq, const bool disable_memtable) {
919
951
  PERF_TIMER_GUARD(write_pre_and_post_process_time);
920
- WriteThread::Writer w(write_options, my_batch, callback, log_ref,
921
- disable_memtable, sub_batch_cnt, pre_release_callback);
952
+ WriteThread::Writer w(write_options, my_batch, callback, user_write_cb,
953
+ log_ref, disable_memtable, sub_batch_cnt,
954
+ pre_release_callback);
922
955
  StopWatch write_sw(immutable_db_options_.clock, stats_, DB_WRITE);
923
956
 
924
957
  write_thread->JoinBatchGroup(&w);
@@ -936,21 +969,17 @@ Status DBImpl::WriteImplWALOnly(
936
969
  assert(w.state == WriteThread::STATE_GROUP_LEADER);
937
970
 
938
971
  if (publish_last_seq == kDoPublishLastSeq) {
939
- Status status;
940
-
941
972
  // Currently we only use kDoPublishLastSeq in unordered_write
942
973
  assert(immutable_db_options_.unordered_write);
943
- WriteContext write_context;
944
- if (error_handler_.IsDBStopped()) {
945
- status = error_handler_.GetBGError();
946
- }
974
+
947
975
  // TODO(myabandeh): Make preliminary checks thread-safe so we could do them
948
976
  // without paying the cost of obtaining the mutex.
949
- if (status.ok()) {
950
- LogContext log_context;
951
- status = PreprocessWrite(write_options, &log_context, &write_context);
952
- WriteStatusCheckOnLocked(status);
953
- }
977
+ LogContext log_context;
978
+ WriteContext write_context;
979
+ Status status =
980
+ PreprocessWrite(write_options, &log_context, &write_context);
981
+ WriteStatusCheckOnLocked(status);
982
+
954
983
  if (!status.ok()) {
955
984
  WriteThread::WriteGroup write_group;
956
985
  write_thread->EnterAsBatchGroupLeader(&w, &write_group);
@@ -1172,8 +1201,7 @@ void DBImpl::MemTableInsertStatusCheck(const Status& status) {
1172
1201
  mutex_.Lock();
1173
1202
  assert(!error_handler_.IsBGWorkStopped());
1174
1203
  // Maybe change the return status to void?
1175
- error_handler_.SetBGError(status, BackgroundErrorReason::kMemTable)
1176
- .PermitUncheckedError();
1204
+ error_handler_.SetBGError(status, BackgroundErrorReason::kMemTable);
1177
1205
  mutex_.Unlock();
1178
1206
  }
1179
1207
  }
@@ -1379,6 +1407,7 @@ IOStatus DBImpl::WriteToWAL(const WriteBatch& merged_batch,
1379
1407
  total_log_size_ += log_entry.size();
1380
1408
  log_file_number_size.AddSize(*log_size);
1381
1409
  log_empty_ = false;
1410
+
1382
1411
  return io_s;
1383
1412
  }
1384
1413
 
@@ -1451,9 +1480,14 @@ IOStatus DBImpl::WriteToWAL(const WriteThread::WriteGroup& write_group,
1451
1480
  if (!io_s.ok()) {
1452
1481
  break;
1453
1482
  }
1454
- io_s = log.writer->file()->Sync(opts, immutable_db_options_.use_fsync);
1455
- if (!io_s.ok()) {
1456
- break;
1483
+ // If last sync failed on a later WAL, this could be a fully synced
1484
+ // and closed WAL that just needs to be recorded as synced in the
1485
+ // manifest.
1486
+ if (auto* f = log.writer->file()) {
1487
+ io_s = f->Sync(opts, immutable_db_options_.use_fsync);
1488
+ if (!io_s.ok()) {
1489
+ break;
1490
+ }
1457
1491
  }
1458
1492
  }
1459
1493
  }
@@ -1485,6 +1519,11 @@ IOStatus DBImpl::WriteToWAL(const WriteThread::WriteGroup& write_group,
1485
1519
  RecordTick(stats_, WAL_FILE_BYTES, log_size);
1486
1520
  stats->AddDBStats(InternalStats::kIntStatsWriteWithWal, write_with_wal);
1487
1521
  RecordTick(stats_, WRITE_WITH_WAL, write_with_wal);
1522
+ for (auto* writer : write_group) {
1523
+ if (!writer->CallbackFailed()) {
1524
+ writer->CheckPostWalWriteCallback();
1525
+ }
1526
+ }
1488
1527
  }
1489
1528
  return io_s;
1490
1529
  }
@@ -1549,6 +1588,11 @@ IOStatus DBImpl::ConcurrentWriteToWAL(
1549
1588
  stats->AddDBStats(InternalStats::kIntStatsWriteWithWal, write_with_wal,
1550
1589
  concurrent);
1551
1590
  RecordTick(stats_, WRITE_WITH_WAL, write_with_wal);
1591
+ for (auto* writer : write_group) {
1592
+ if (!writer->CallbackFailed()) {
1593
+ writer->CheckPostWalWriteCallback();
1594
+ }
1595
+ }
1552
1596
  }
1553
1597
  return io_s;
1554
1598
  }
@@ -1608,7 +1652,8 @@ Status DBImpl::WriteRecoverableState() {
1608
1652
 
1609
1653
  void DBImpl::SelectColumnFamiliesForAtomicFlush(
1610
1654
  autovector<ColumnFamilyData*>* selected_cfds,
1611
- const autovector<ColumnFamilyData*>& provided_candidate_cfds) {
1655
+ const autovector<ColumnFamilyData*>& provided_candidate_cfds,
1656
+ FlushReason flush_reason) {
1612
1657
  mutex_.AssertHeld();
1613
1658
  assert(selected_cfds);
1614
1659
 
@@ -1631,7 +1676,8 @@ void DBImpl::SelectColumnFamiliesForAtomicFlush(
1631
1676
  continue;
1632
1677
  }
1633
1678
  if (cfd->imm()->NumNotFlushed() != 0 || !cfd->mem()->IsEmpty() ||
1634
- !cached_recoverable_state_empty_.load()) {
1679
+ !cached_recoverable_state_empty_.load() ||
1680
+ IsRecoveryFlush(flush_reason)) {
1635
1681
  selected_cfds->push_back(cfd);
1636
1682
  }
1637
1683
  }
@@ -2152,6 +2198,8 @@ void DBImpl::NotifyOnMemTableSealed(ColumnFamilyData* /*cfd*/,
2152
2198
  // two_write_queues_ is true (This is to simplify the reasoning.)
2153
2199
  Status DBImpl::SwitchMemtable(ColumnFamilyData* cfd, WriteContext* context) {
2154
2200
  mutex_.AssertHeld();
2201
+ assert(lock_wal_count_ == 0);
2202
+
2155
2203
  // TODO: plumb Env::IOActivity, Env::IOPriority
2156
2204
  const ReadOptions read_options;
2157
2205
  const WriteOptions write_options;
@@ -2195,6 +2243,11 @@ Status DBImpl::SwitchMemtable(ColumnFamilyData* cfd, WriteContext* context) {
2195
2243
  memtable_info.earliest_seqno = cfd->mem()->GetEarliestSequenceNumber();
2196
2244
  memtable_info.num_entries = cfd->mem()->num_entries();
2197
2245
  memtable_info.num_deletes = cfd->mem()->num_deletes();
2246
+ if (!cfd->ioptions()->persist_user_defined_timestamps &&
2247
+ cfd->user_comparator()->timestamp_size() > 0) {
2248
+ const Slice& newest_udt = cfd->mem()->GetNewestUDT();
2249
+ memtable_info.newest_udt.assign(newest_udt.data(), newest_udt.size());
2250
+ }
2198
2251
  // Log this later after lock release. It may be outdated, e.g., if background
2199
2252
  // flush happens before logging, but that should be ok.
2200
2253
  int num_imm_unflushed = cfd->imm()->NumNotFlushed();
@@ -2214,14 +2267,15 @@ Status DBImpl::SwitchMemtable(ColumnFamilyData* cfd, WriteContext* context) {
2214
2267
  SequenceNumber seq = versions_->LastSequence();
2215
2268
  new_mem = cfd->ConstructNewMemtable(mutable_cf_options, seq);
2216
2269
  context->superversion_context.NewSuperVersion();
2270
+
2271
+ ROCKS_LOG_INFO(immutable_db_options_.info_log,
2272
+ "[%s] New memtable created with log file: #%" PRIu64
2273
+ ". Immutable memtables: %d.\n",
2274
+ cfd->GetName().c_str(), new_log_number, num_imm_unflushed);
2275
+ // There should be no concurrent write as the thread is at the front of
2276
+ // writer queue
2277
+ cfd->mem()->ConstructFragmentedRangeTombstones();
2217
2278
  }
2218
- ROCKS_LOG_INFO(immutable_db_options_.info_log,
2219
- "[%s] New memtable created with log file: #%" PRIu64
2220
- ". Immutable memtables: %d.\n",
2221
- cfd->GetName().c_str(), new_log_number, num_imm_unflushed);
2222
- // There should be no concurrent write as the thread is at the front of
2223
- // writer queue
2224
- cfd->mem()->ConstructFragmentedRangeTombstones();
2225
2279
 
2226
2280
  mutex_.Lock();
2227
2281
  if (recycle_log_number != 0) {
@@ -2313,8 +2367,8 @@ Status DBImpl::SwitchMemtable(ColumnFamilyData* cfd, WriteContext* context) {
2313
2367
  read_options, write_options, &wal_deletion, &mutex_,
2314
2368
  directories_.GetDbDir());
2315
2369
  if (!s.ok() && versions_->io_status().IsIOError()) {
2316
- s = error_handler_.SetBGError(versions_->io_status(),
2317
- BackgroundErrorReason::kManifestWrite);
2370
+ error_handler_.SetBGError(versions_->io_status(),
2371
+ BackgroundErrorReason::kManifestWrite);
2318
2372
  }
2319
2373
  if (!s.ok()) {
2320
2374
  return s;
@@ -109,6 +109,16 @@ Status DBIter::GetProperty(std::string prop_name, std::string* prop) {
109
109
  *prop = "Iterator is not valid.";
110
110
  }
111
111
  return Status::OK();
112
+ } else if (prop_name == "rocksdb.iterator.is-value-pinned") {
113
+ if (valid_) {
114
+ *prop = (pin_thru_lifetime_ && iter_.Valid() &&
115
+ iter_.value().data() == value_.data())
116
+ ? "1"
117
+ : "0";
118
+ } else {
119
+ *prop = "Iterator is not valid.";
120
+ }
121
+ return Status::OK();
112
122
  } else if (prop_name == "rocksdb.iterator.internal-key") {
113
123
  *prop = saved_key_.GetUserKey().ToString();
114
124
  return Status::OK();
@@ -231,6 +241,7 @@ bool DBIter::SetValueAndColumnsFromEntity(Slice slice) {
231
241
  if (!s.ok()) {
232
242
  status_ = s;
233
243
  valid_ = false;
244
+ wide_columns_.clear();
234
245
  return false;
235
246
  }
236
247
 
@@ -4154,7 +4154,7 @@ TEST_F(DBTest2, LiveFilesOmitObsoleteFiles) {
4154
4154
  TEST_SYNC_POINT("DBTest2::LiveFilesOmitObsoleteFiles:FlushTriggered");
4155
4155
 
4156
4156
  ASSERT_OK(db_->DisableFileDeletions());
4157
- VectorLogPtr log_files;
4157
+ VectorWalPtr log_files;
4158
4158
  ASSERT_OK(db_->GetSortedWalFiles(log_files));
4159
4159
  TEST_SYNC_POINT("DBTest2::LiveFilesOmitObsoleteFiles:LiveFilesCaptured");
4160
4160
  for (const auto& log_file : log_files) {
@@ -154,6 +154,9 @@ bool DBTestBase::ShouldSkipOptions(int option_config, int skip_mask) {
154
154
  if ((skip_mask & kSkipMmapReads) && option_config == kWalDirAndMmapReads) {
155
155
  return true;
156
156
  }
157
+ if ((skip_mask & kSkipRowCache) && option_config == kRowCache) {
158
+ return true;
159
+ }
157
160
  return false;
158
161
  }
159
162
 
@@ -562,6 +565,11 @@ Options DBTestBase::GetOptions(
562
565
  options.unordered_write = false;
563
566
  break;
564
567
  }
568
+ case kBlockBasedTableWithBinarySearchWithFirstKeyIndex: {
569
+ table_options.index_type =
570
+ BlockBasedTableOptions::kBinarySearchWithFirstKey;
571
+ break;
572
+ }
565
573
 
566
574
  default:
567
575
  break;
@@ -766,7 +774,9 @@ Status DBTestBase::TimedPut(const Slice& k, const Slice& v,
766
774
 
767
775
  Status DBTestBase::TimedPut(int cf, const Slice& k, const Slice& v,
768
776
  uint64_t write_unix_time, WriteOptions wo) {
769
- WriteBatch wb;
777
+ WriteBatch wb(/*reserved_bytes=*/0, /*max_bytes=*/0,
778
+ wo.protection_bytes_per_key,
779
+ /*default_cf_ts_sz=*/0);
770
780
  ColumnFamilyHandle* cfh;
771
781
  if (cf != 0) {
772
782
  cfh = handles_[cf];
@@ -276,16 +276,16 @@ class SpecialEnv : public EnvWrapper {
276
276
  SpecialEnv* env_;
277
277
  std::unique_ptr<WritableFile> base_;
278
278
  };
279
- class WalFile : public WritableFile {
279
+ class SpecialWalFile : public WritableFile {
280
280
  public:
281
- WalFile(SpecialEnv* env, std::unique_ptr<WritableFile>&& b)
281
+ SpecialWalFile(SpecialEnv* env, std::unique_ptr<WritableFile>&& b)
282
282
  : env_(env), base_(std::move(b)) {
283
283
  env_->num_open_wal_file_.fetch_add(1);
284
284
  }
285
- virtual ~WalFile() { env_->num_open_wal_file_.fetch_add(-1); }
285
+ virtual ~SpecialWalFile() { env_->num_open_wal_file_.fetch_add(-1); }
286
286
  Status Append(const Slice& data) override {
287
287
  #if !(defined NDEBUG) || !defined(OS_WIN)
288
- TEST_SYNC_POINT("SpecialEnv::WalFile::Append:1");
288
+ TEST_SYNC_POINT("SpecialEnv::SpecialWalFile::Append:1");
289
289
  #endif
290
290
  Status s;
291
291
  if (env_->log_write_error_.load(std::memory_order_acquire)) {
@@ -299,7 +299,7 @@ class SpecialEnv : public EnvWrapper {
299
299
  s = base_->Append(data);
300
300
  }
301
301
  #if !(defined NDEBUG) || !defined(OS_WIN)
302
- TEST_SYNC_POINT("SpecialEnv::WalFile::Append:2");
302
+ TEST_SYNC_POINT("SpecialEnv::SpecialWalFile::Append:2");
303
303
  #endif
304
304
  return s;
305
305
  }
@@ -419,7 +419,7 @@ class SpecialEnv : public EnvWrapper {
419
419
  } else if (strstr(f.c_str(), "MANIFEST") != nullptr) {
420
420
  r->reset(new ManifestFile(this, std::move(*r)));
421
421
  } else if (strstr(f.c_str(), "log") != nullptr) {
422
- r->reset(new WalFile(this, std::move(*r)));
422
+ r->reset(new SpecialWalFile(this, std::move(*r)));
423
423
  } else {
424
424
  r->reset(new OtherFile(this, std::move(*r)));
425
425
  }
@@ -1041,6 +1041,7 @@ class DBTestBase : public testing::Test {
1041
1041
  kPartitionedFilterWithNewTableReaderForCompactions,
1042
1042
  kUniversalSubcompactions,
1043
1043
  kUnorderedWrite,
1044
+ kBlockBasedTableWithBinarySearchWithFirstKeyIndex,
1044
1045
  // This must be the last line
1045
1046
  kEnd,
1046
1047
  };
@@ -1071,6 +1072,7 @@ class DBTestBase : public testing::Test {
1071
1072
  kSkipNoSeekToLast = 32,
1072
1073
  kSkipFIFOCompaction = 128,
1073
1074
  kSkipMmapReads = 256,
1075
+ kSkipRowCache = 512,
1074
1076
  };
1075
1077
 
1076
1078
  const int kRangeDelSkipConfigs =
@@ -1078,7 +1080,9 @@ class DBTestBase : public testing::Test {
1078
1080
  kSkipPlainTable |
1079
1081
  // MmapReads disables the iterator pinning that RangeDelAggregator
1080
1082
  // requires.
1081
- kSkipMmapReads;
1083
+ kSkipMmapReads |
1084
+ // Not compatible yet.
1085
+ kSkipRowCache;
1082
1086
 
1083
1087
  // `env_do_fsync` decides whether the special Env would do real
1084
1088
  // fsync for files and directories. Skipping fsync can speed up
@@ -47,6 +47,8 @@ EntryType GetEntryType(ValueType value_type) {
47
47
  return kEntryBlobIndex;
48
48
  case kTypeWideColumnEntity:
49
49
  return kEntryWideColumnEntity;
50
+ case kTypeValuePreferredSeqno:
51
+ return kEntryTimedPut;
50
52
  default:
51
53
  return kEntryOther;
52
54
  }
@@ -155,10 +157,23 @@ void ReplaceInternalKeyWithMinTimestamp(std::string* result, const Slice& key,
155
157
  result->append(key.data() + key_sz - kNumInternalBytes, kNumInternalBytes);
156
158
  }
157
159
 
158
- std::string ParsedInternalKey::DebugString(bool log_err_key, bool hex) const {
160
+ std::string ParsedInternalKey::DebugString(bool log_err_key, bool hex,
161
+ const Comparator* ucmp) const {
159
162
  std::string result = "'";
163
+ size_t ts_sz_for_debug = ucmp == nullptr ? 0 : ucmp->timestamp_size();
160
164
  if (log_err_key) {
161
- result += user_key.ToString(hex);
165
+ if (ts_sz_for_debug == 0) {
166
+ result += user_key.ToString(hex);
167
+ } else {
168
+ assert(user_key.size() >= ts_sz_for_debug);
169
+ Slice user_key_without_ts = user_key;
170
+ user_key_without_ts.remove_suffix(ts_sz_for_debug);
171
+ result += user_key_without_ts.ToString(hex);
172
+ Slice ts = Slice(user_key.data() + user_key.size() - ts_sz_for_debug,
173
+ ts_sz_for_debug);
174
+ result += "|timestamp:";
175
+ result += ucmp->TimestampToString(ts);
176
+ }
162
177
  } else {
163
178
  result += "<redacted>";
164
179
  }
@@ -171,11 +186,11 @@ std::string ParsedInternalKey::DebugString(bool log_err_key, bool hex) const {
171
186
  return result;
172
187
  }
173
188
 
174
- std::string InternalKey::DebugString(bool hex) const {
189
+ std::string InternalKey::DebugString(bool hex, const Comparator* ucmp) const {
175
190
  std::string result;
176
191
  ParsedInternalKey parsed;
177
192
  if (ParseInternalKey(rep_, &parsed, false /* log_err_key */).ok()) {
178
- result = parsed.DebugString(true /* log_err_key */, hex); // TODO
193
+ result = parsed.DebugString(true /* log_err_key */, hex, ucmp); // TODO
179
194
  } else {
180
195
  result = "(bad)";
181
196
  result.append(EscapeString(rep_));
@@ -148,7 +148,8 @@ struct ParsedInternalKey {
148
148
  // u contains timestamp if user timestamp feature is enabled.
149
149
  ParsedInternalKey(const Slice& u, const SequenceNumber& seq, ValueType t)
150
150
  : user_key(u), sequence(seq), type(t) {}
151
- std::string DebugString(bool log_err_key, bool hex) const;
151
+ std::string DebugString(bool log_err_key, bool hex,
152
+ const Comparator* ucmp = nullptr) const;
152
153
 
153
154
  void clear() {
154
155
  user_key.clear();
@@ -503,7 +504,7 @@ class InternalKey {
503
504
  AppendInternalKeyFooter(&rep_, s, t);
504
505
  }
505
506
 
506
- std::string DebugString(bool hex) const;
507
+ std::string DebugString(bool hex, const Comparator* ucmp = nullptr) const;
507
508
  };
508
509
 
509
510
  inline int InternalKeyComparator::Compare(const InternalKey& a,