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
@@ -3,10 +3,10 @@
3
3
  // COPYING file in the root directory) and Apache 2.0 License
4
4
  // (found in the LICENSE.Apache file in the root directory).
5
5
 
6
-
7
6
  #include "utilities/transactions/pessimistic_transaction_db.h"
8
7
 
9
8
  #include <cinttypes>
9
+ #include <memory>
10
10
  #include <sstream>
11
11
  #include <string>
12
12
  #include <unordered_set>
@@ -255,7 +255,8 @@ Status TransactionDB::Open(
255
255
  txn_db_options.write_policy == WRITE_COMMITTED ||
256
256
  txn_db_options.write_policy == WRITE_PREPARED;
257
257
  s = DBImpl::Open(db_options_2pc, dbname, column_families_copy, handles, &db,
258
- use_seq_per_batch, use_batch_per_txn);
258
+ use_seq_per_batch, use_batch_per_txn,
259
+ /*is_retry=*/false, /*can_retry=*/nullptr);
259
260
  if (s.ok()) {
260
261
  ROCKS_LOG_WARN(db->GetDBOptions().info_log,
261
262
  "Transaction write_policy is %" PRId32,
@@ -426,6 +427,27 @@ Status PessimisticTransactionDB::CreateColumnFamilies(
426
427
  return s;
427
428
  }
428
429
 
430
+ Status PessimisticTransactionDB::CreateColumnFamilyWithImport(
431
+ const ColumnFamilyOptions& options, const std::string& column_family_name,
432
+ const ImportColumnFamilyOptions& import_options,
433
+ const std::vector<const ExportImportFilesMetaData*>& metadatas,
434
+ ColumnFamilyHandle** handle) {
435
+ InstrumentedMutexLock l(&column_family_mutex_);
436
+ Status s = VerifyCFOptions(options);
437
+ if (!s.ok()) {
438
+ return s;
439
+ }
440
+
441
+ s = db_->CreateColumnFamilyWithImport(options, column_family_name,
442
+ import_options, metadatas, handle);
443
+ if (s.ok()) {
444
+ lock_manager_->AddColumnFamily(*handle);
445
+ UpdateCFComparatorMap(*handle);
446
+ }
447
+
448
+ return s;
449
+ }
450
+
429
451
  // Let LockManager know that it can deallocate the LockMap for this
430
452
  // column family.
431
453
  Status PessimisticTransactionDB::DropColumnFamily(
@@ -490,15 +512,15 @@ Transaction* PessimisticTransactionDB::BeginInternalTransaction(
490
512
  return txn;
491
513
  }
492
514
 
493
- // All user Put, Merge, Delete, and Write requests must be intercepted to make
494
- // sure that they lock all keys that they are writing to avoid causing conflicts
495
- // with any concurrent transactions. The easiest way to do this is to wrap all
496
- // write operations in a transaction.
515
+ // All user Put, PutEntity, Merge, Delete, and Write requests must be
516
+ // intercepted to make sure that they lock all keys that they are writing to
517
+ // avoid causing conflicts with any concurrent transactions. The easiest way to
518
+ // do this is to wrap all write operations in a transaction.
497
519
  //
498
- // Put(), Merge(), and Delete() only lock a single key per call. Write() will
499
- // sort its keys before locking them. This guarantees that TransactionDB write
500
- // methods cannot deadlock with each other (but still could deadlock with a
501
- // Transaction).
520
+ // Put(), PutEntity(), Merge(), and Delete() only lock a single key per call.
521
+ // Write() will sort its keys before locking them. This guarantees that
522
+ // TransactionDB write methods cannot deadlock with each other (but still could
523
+ // deadlock with a Transaction).
502
524
  Status PessimisticTransactionDB::Put(const WriteOptions& options,
503
525
  ColumnFamilyHandle* column_family,
504
526
  const Slice& key, const Slice& val) {
@@ -523,6 +545,42 @@ Status PessimisticTransactionDB::Put(const WriteOptions& options,
523
545
  return s;
524
546
  }
525
547
 
548
+ Status PessimisticTransactionDB::PutEntity(const WriteOptions& options,
549
+ ColumnFamilyHandle* column_family,
550
+ const Slice& key,
551
+ const WideColumns& columns) {
552
+ {
553
+ const Status s = FailIfCfEnablesTs(this, column_family);
554
+ if (!s.ok()) {
555
+ return s;
556
+ }
557
+ }
558
+
559
+ {
560
+ std::unique_ptr<Transaction> txn(BeginInternalTransaction(options));
561
+ txn->DisableIndexing();
562
+
563
+ // Since the client didn't create a transaction, they don't care about
564
+ // conflict checking for this write. So we just need to do
565
+ // PutEntityUntracked().
566
+ {
567
+ const Status s = txn->PutEntityUntracked(column_family, key, columns);
568
+ if (!s.ok()) {
569
+ return s;
570
+ }
571
+ }
572
+
573
+ {
574
+ const Status s = txn->Commit();
575
+ if (!s.ok()) {
576
+ return s;
577
+ }
578
+ }
579
+ }
580
+
581
+ return Status::OK();
582
+ }
583
+
526
584
  Status PessimisticTransactionDB::Delete(const WriteOptions& wopts,
527
585
  ColumnFamilyHandle* column_family,
528
586
  const Slice& key) {
@@ -665,6 +723,11 @@ void PessimisticTransactionDB::ReinitializeTransaction(
665
723
  Transaction* PessimisticTransactionDB::GetTransactionByName(
666
724
  const TransactionName& name) {
667
725
  std::lock_guard<std::mutex> lock(name_map_mutex_);
726
+ return GetTransactionByNameLocked(name);
727
+ }
728
+
729
+ Transaction* PessimisticTransactionDB::GetTransactionByNameLocked(
730
+ const TransactionName& name) {
668
731
  auto it = transactions_.find(name);
669
732
  if (it == transactions_.end()) {
670
733
  return nullptr;
@@ -697,13 +760,15 @@ void PessimisticTransactionDB::SetDeadlockInfoBufferSize(uint32_t target_size) {
697
760
  lock_manager_->Resize(target_size);
698
761
  }
699
762
 
700
- void PessimisticTransactionDB::RegisterTransaction(Transaction* txn) {
763
+ Status PessimisticTransactionDB::RegisterTransaction(Transaction* txn) {
701
764
  assert(txn);
702
765
  assert(txn->GetName().length() > 0);
703
- assert(GetTransactionByName(txn->GetName()) == nullptr);
704
766
  assert(txn->GetState() == Transaction::STARTED);
705
767
  std::lock_guard<std::mutex> lock(name_map_mutex_);
706
- transactions_[txn->GetName()] = txn;
768
+ if (!transactions_.insert({txn->GetName(), txn}).second) {
769
+ return Status::InvalidArgument("Duplicate txn name " + txn->GetName());
770
+ }
771
+ return Status::OK();
707
772
  }
708
773
 
709
774
  void PessimisticTransactionDB::UnregisterTransaction(Transaction* txn) {
@@ -50,6 +50,20 @@ class PessimisticTransactionDB : public TransactionDB {
50
50
  Status Put(const WriteOptions& options, ColumnFamilyHandle* column_family,
51
51
  const Slice& key, const Slice& val) override;
52
52
 
53
+ Status PutEntity(const WriteOptions& options,
54
+ ColumnFamilyHandle* column_family, const Slice& key,
55
+ const WideColumns& columns) override;
56
+ Status PutEntity(const WriteOptions& /* options */, const Slice& /* key */,
57
+ const AttributeGroups& attribute_groups) override {
58
+ if (attribute_groups.empty()) {
59
+ return Status::InvalidArgument(
60
+ "Cannot call this method without attribute groups");
61
+ }
62
+ return Status::NotSupported(
63
+ "PutEntity with AttributeGroups not supported by "
64
+ "PessimisticTransactionDB");
65
+ }
66
+
53
67
  using StackableDB::Delete;
54
68
  Status Delete(const WriteOptions& wopts, ColumnFamilyHandle* column_family,
55
69
  const Slice& key) override;
@@ -106,6 +120,23 @@ class PessimisticTransactionDB : public TransactionDB {
106
120
  const std::vector<ColumnFamilyDescriptor>& column_families,
107
121
  std::vector<ColumnFamilyHandle*>* handles) override;
108
122
 
123
+ using StackableDB::CreateColumnFamilyWithImport;
124
+ Status CreateColumnFamilyWithImport(
125
+ const ColumnFamilyOptions& options, const std::string& column_family_name,
126
+ const ImportColumnFamilyOptions& import_options,
127
+ const ExportImportFilesMetaData& metadata,
128
+ ColumnFamilyHandle** handle) override {
129
+ const std::vector<const ExportImportFilesMetaData*>& metadatas{&metadata};
130
+ return CreateColumnFamilyWithImport(options, column_family_name,
131
+ import_options, metadatas, handle);
132
+ }
133
+
134
+ Status CreateColumnFamilyWithImport(
135
+ const ColumnFamilyOptions& options, const std::string& column_family_name,
136
+ const ImportColumnFamilyOptions& import_options,
137
+ const std::vector<const ExportImportFilesMetaData*>& metadatas,
138
+ ColumnFamilyHandle** handle) override;
139
+
109
140
  using StackableDB::DropColumnFamily;
110
141
  Status DropColumnFamily(ColumnFamilyHandle* column_family) override;
111
142
 
@@ -142,7 +173,7 @@ class PessimisticTransactionDB : public TransactionDB {
142
173
 
143
174
  Transaction* GetTransactionByName(const TransactionName& name) override;
144
175
 
145
- void RegisterTransaction(Transaction* txn);
176
+ Status RegisterTransaction(Transaction* txn);
146
177
  void UnregisterTransaction(Transaction* txn);
147
178
 
148
179
  // not thread safe. current use case is during recovery (single thread)
@@ -208,6 +239,7 @@ class PessimisticTransactionDB : public TransactionDB {
208
239
  friend class WriteUnpreparedTransactionTest_MarkLogWithPrepSection_Test;
209
240
 
210
241
  Transaction* BeginInternalTransaction(const WriteOptions& options);
242
+ Transaction* GetTransactionByNameLocked(const TransactionName& name);
211
243
 
212
244
  std::shared_ptr<LockManager> lock_manager_;
213
245
 
@@ -3,7 +3,6 @@
3
3
  // COPYING file in the root directory) and Apache 2.0 License
4
4
  // (found in the LICENSE.Apache file in the root directory).
5
5
 
6
-
7
6
  #include "utilities/transactions/transaction_base.h"
8
7
 
9
8
  #include <cinttypes>
@@ -90,6 +89,7 @@ void TransactionBaseImpl::Clear() {
90
89
  commit_time_batch_.Clear();
91
90
  tracked_locks_->Clear();
92
91
  num_puts_ = 0;
92
+ num_put_entities_ = 0;
93
93
  num_deletes_ = 0;
94
94
  num_merges_ = 0;
95
95
 
@@ -177,7 +177,7 @@ void TransactionBaseImpl::SetSavePoint() {
177
177
  autovector<TransactionBaseImpl::SavePoint>>());
178
178
  }
179
179
  save_points_->emplace(snapshot_, snapshot_needed_, snapshot_notifier_,
180
- num_puts_, num_deletes_, num_merges_,
180
+ num_puts_, num_put_entities_, num_deletes_, num_merges_,
181
181
  lock_tracker_factory_);
182
182
  write_batch_.SetSavePoint();
183
183
  }
@@ -190,6 +190,7 @@ Status TransactionBaseImpl::RollbackToSavePoint() {
190
190
  snapshot_needed_ = save_point.snapshot_needed_;
191
191
  snapshot_notifier_ = save_point.snapshot_notifier_;
192
192
  num_puts_ = save_point.num_puts_;
193
+ num_put_entities_ = save_point.num_put_entities_;
193
194
  num_deletes_ = save_point.num_deletes_;
194
195
  num_merges_ = save_point.num_merges_;
195
196
 
@@ -288,6 +289,13 @@ Status TransactionBaseImpl::GetImpl(const ReadOptions& read_options,
288
289
  pinnable_val);
289
290
  }
290
291
 
292
+ Status TransactionBaseImpl::GetEntity(const ReadOptions& read_options,
293
+ ColumnFamilyHandle* column_family,
294
+ const Slice& key,
295
+ PinnableWideColumns* columns) {
296
+ return GetEntityImpl(read_options, column_family, key, columns);
297
+ }
298
+
291
299
  Status TransactionBaseImpl::GetForUpdate(const ReadOptions& read_options,
292
300
  ColumnFamilyHandle* column_family,
293
301
  const Slice& key, std::string* value,
@@ -343,6 +351,24 @@ Status TransactionBaseImpl::GetForUpdate(const ReadOptions& read_options,
343
351
  return s;
344
352
  }
345
353
 
354
+ Status TransactionBaseImpl::GetEntityForUpdate(
355
+ const ReadOptions& read_options, ColumnFamilyHandle* column_family,
356
+ const Slice& key, PinnableWideColumns* columns, bool exclusive,
357
+ bool do_validate) {
358
+ if (!do_validate && read_options.snapshot != nullptr) {
359
+ return Status::InvalidArgument(
360
+ "Snapshot must not be set if validation is disabled");
361
+ }
362
+
363
+ const Status s =
364
+ TryLock(column_family, key, true /* read_only */, exclusive, do_validate);
365
+ if (!s.ok()) {
366
+ return s;
367
+ }
368
+
369
+ return GetEntityImpl(read_options, column_family, key, columns);
370
+ }
371
+
346
372
  std::vector<Status> TransactionBaseImpl::MultiGet(
347
373
  const ReadOptions& _read_options,
348
374
  const std::vector<ColumnFamilyHandle*>& column_family,
@@ -400,6 +426,15 @@ void TransactionBaseImpl::MultiGet(const ReadOptions& _read_options,
400
426
  sorted_input);
401
427
  }
402
428
 
429
+ void TransactionBaseImpl::MultiGetEntity(const ReadOptions& read_options,
430
+ ColumnFamilyHandle* column_family,
431
+ size_t num_keys, const Slice* keys,
432
+ PinnableWideColumns* results,
433
+ Status* statuses, bool sorted_input) {
434
+ MultiGetEntityImpl(read_options, column_family, num_keys, keys, results,
435
+ statuses, sorted_input);
436
+ }
437
+
403
438
  std::vector<Status> TransactionBaseImpl::MultiGetForUpdate(
404
439
  const ReadOptions& read_options,
405
440
  const std::vector<ColumnFamilyHandle*>& column_family,
@@ -451,6 +486,32 @@ Iterator* TransactionBaseImpl::GetIterator(const ReadOptions& read_options,
451
486
  &read_options);
452
487
  }
453
488
 
489
+ Status TransactionBaseImpl::PutEntityImpl(ColumnFamilyHandle* column_family,
490
+ const Slice& key,
491
+ const WideColumns& columns,
492
+ bool do_validate,
493
+ bool assume_tracked) {
494
+ {
495
+ constexpr bool read_only = false;
496
+ constexpr bool exclusive = true;
497
+ const Status s = TryLock(column_family, key, read_only, exclusive,
498
+ do_validate, assume_tracked);
499
+ if (!s.ok()) {
500
+ return s;
501
+ }
502
+ }
503
+
504
+ {
505
+ const Status s = GetBatchForWrite()->PutEntity(column_family, key, columns);
506
+ if (!s.ok()) {
507
+ return s;
508
+ }
509
+ }
510
+
511
+ ++num_put_entities_;
512
+ return Status::OK();
513
+ }
514
+
454
515
  Status TransactionBaseImpl::Put(ColumnFamilyHandle* column_family,
455
516
  const Slice& key, const Slice& value,
456
517
  const bool assume_tracked) {
@@ -678,6 +739,10 @@ uint64_t TransactionBaseImpl::GetElapsedTime() const {
678
739
 
679
740
  uint64_t TransactionBaseImpl::GetNumPuts() const { return num_puts_; }
680
741
 
742
+ uint64_t TransactionBaseImpl::GetNumPutEntities() const {
743
+ return num_put_entities_;
744
+ }
745
+
681
746
  uint64_t TransactionBaseImpl::GetNumDeletes() const { return num_deletes_; }
682
747
 
683
748
  uint64_t TransactionBaseImpl::GetNumMerges() const { return num_merges_; }
@@ -705,7 +770,8 @@ void TransactionBaseImpl::TrackKey(uint32_t cfh_id, const std::string& key,
705
770
  }
706
771
  }
707
772
 
708
- // Gets the write batch that should be used for Put/Merge/Deletes.
773
+ // Gets the write batch that should be used for Put/PutEntity/Merge/Delete
774
+ // operations.
709
775
  //
710
776
  // Returns either a WriteBatch or WriteBatchWithIndex depending on whether
711
777
  // DisableIndexing() has been called.
@@ -766,19 +832,37 @@ Status TransactionBaseImpl::RebuildFromWriteBatch(WriteBatch* src_batch) {
766
832
  }
767
833
 
768
834
  Status PutCF(uint32_t cf, const Slice& key, const Slice& val) override {
769
- return txn_->Put(db_->GetColumnFamilyHandle(cf), key, val);
835
+ Slice user_key = GetUserKey(cf, key);
836
+ return txn_->Put(db_->GetColumnFamilyHandle(cf), user_key, val);
837
+ }
838
+
839
+ Status PutEntityCF(uint32_t cf, const Slice& key,
840
+ const Slice& entity) override {
841
+ Slice user_key = GetUserKey(cf, key);
842
+ Slice entity_copy = entity;
843
+ WideColumns columns;
844
+ const Status s =
845
+ WideColumnSerialization::Deserialize(entity_copy, columns);
846
+ if (!s.ok()) {
847
+ return s;
848
+ }
849
+
850
+ return txn_->PutEntity(db_->GetColumnFamilyHandle(cf), user_key, columns);
770
851
  }
771
852
 
772
853
  Status DeleteCF(uint32_t cf, const Slice& key) override {
773
- return txn_->Delete(db_->GetColumnFamilyHandle(cf), key);
854
+ Slice user_key = GetUserKey(cf, key);
855
+ return txn_->Delete(db_->GetColumnFamilyHandle(cf), user_key);
774
856
  }
775
857
 
776
858
  Status SingleDeleteCF(uint32_t cf, const Slice& key) override {
777
- return txn_->SingleDelete(db_->GetColumnFamilyHandle(cf), key);
859
+ Slice user_key = GetUserKey(cf, key);
860
+ return txn_->SingleDelete(db_->GetColumnFamilyHandle(cf), user_key);
778
861
  }
779
862
 
780
863
  Status MergeCF(uint32_t cf, const Slice& key, const Slice& val) override {
781
- return txn_->Merge(db_->GetColumnFamilyHandle(cf), key, val);
864
+ Slice user_key = GetUserKey(cf, key);
865
+ return txn_->Merge(db_->GetColumnFamilyHandle(cf), user_key, val);
782
866
  }
783
867
 
784
868
  // this is used for reconstructing prepared transactions upon
@@ -801,6 +885,21 @@ Status TransactionBaseImpl::RebuildFromWriteBatch(WriteBatch* src_batch) {
801
885
  Status MarkRollback(const Slice&) override {
802
886
  return Status::InvalidArgument();
803
887
  }
888
+ size_t GetTimestampSize(uint32_t cf_id) {
889
+ auto cfd = db_->versions_->GetColumnFamilySet()->GetColumnFamily(cf_id);
890
+ const Comparator* ucmp = cfd->user_comparator();
891
+ assert(ucmp);
892
+ return ucmp->timestamp_size();
893
+ }
894
+
895
+ Slice GetUserKey(uint32_t cf_id, const Slice& key) {
896
+ size_t ts_sz = GetTimestampSize(cf_id);
897
+ if (ts_sz == 0) {
898
+ return key;
899
+ }
900
+ assert(key.size() >= ts_sz);
901
+ return Slice(key.data(), key.size() - ts_sz);
902
+ }
804
903
  };
805
904
 
806
905
  IndexedWriteBatchBuilder copycat(this, dbimpl_);
@@ -5,7 +5,6 @@
5
5
 
6
6
  #pragma once
7
7
 
8
-
9
8
  #include <stack>
10
9
  #include <string>
11
10
  #include <vector>
@@ -37,10 +36,11 @@ class TransactionBaseImpl : public Transaction {
37
36
 
38
37
  void Reinitialize(DB* db, const WriteOptions& write_options);
39
38
 
40
- // Called before executing Put, Merge, Delete, and GetForUpdate. If TryLock
41
- // returns non-OK, the Put/Merge/Delete/GetForUpdate will be failed.
42
- // do_validate will be false if called from PutUntracked, DeleteUntracked,
43
- // MergeUntracked, or GetForUpdate(do_validate=false)
39
+ // Called before executing Put, PutEntity, Merge, Delete, and GetForUpdate. If
40
+ // TryLock returns non-OK, the Put/PutEntity/Merge/Delete/GetForUpdate will be
41
+ // failed. do_validate will be false if called from PutUntracked,
42
+ // PutEntityUntracked, DeleteUntracked, MergeUntracked, or
43
+ // GetForUpdate(do_validate=false)
44
44
  virtual Status TryLock(ColumnFamilyHandle* column_family, const Slice& key,
45
45
  bool read_only, bool exclusive,
46
46
  const bool do_validate = true,
@@ -66,6 +66,10 @@ class TransactionBaseImpl : public Transaction {
66
66
  return Get(options, db_->DefaultColumnFamily(), key, value);
67
67
  }
68
68
 
69
+ Status GetEntity(const ReadOptions& options,
70
+ ColumnFamilyHandle* column_family, const Slice& key,
71
+ PinnableWideColumns* columns) override;
72
+
69
73
  using Transaction::GetForUpdate;
70
74
  Status GetForUpdate(const ReadOptions& options,
71
75
  ColumnFamilyHandle* column_family, const Slice& key,
@@ -91,6 +95,11 @@ class TransactionBaseImpl : public Transaction {
91
95
  exclusive, do_validate);
92
96
  }
93
97
 
98
+ Status GetEntityForUpdate(const ReadOptions& read_options,
99
+ ColumnFamilyHandle* column_family, const Slice& key,
100
+ PinnableWideColumns* columns, bool exclusive = true,
101
+ bool do_validate = true) override;
102
+
94
103
  using Transaction::MultiGet;
95
104
  std::vector<Status> MultiGet(
96
105
  const ReadOptions& _read_options,
@@ -112,6 +121,11 @@ class TransactionBaseImpl : public Transaction {
112
121
  const Slice* keys, PinnableSlice* values, Status* statuses,
113
122
  const bool sorted_input = false) override;
114
123
 
124
+ void MultiGetEntity(const ReadOptions& options,
125
+ ColumnFamilyHandle* column_family, size_t num_keys,
126
+ const Slice* keys, PinnableWideColumns* results,
127
+ Status* statuses, bool sorted_input = false) override;
128
+
115
129
  using Transaction::MultiGetForUpdate;
116
130
  std::vector<Status> MultiGetForUpdate(
117
131
  const ReadOptions& options,
@@ -145,6 +159,15 @@ class TransactionBaseImpl : public Transaction {
145
159
  return Put(nullptr, key, value);
146
160
  }
147
161
 
162
+ Status PutEntity(ColumnFamilyHandle* column_family, const Slice& key,
163
+ const WideColumns& columns,
164
+ bool assume_tracked = false) override {
165
+ const bool do_validate = !assume_tracked;
166
+
167
+ return PutEntityImpl(column_family, key, columns, do_validate,
168
+ assume_tracked);
169
+ }
170
+
148
171
  Status Merge(ColumnFamilyHandle* column_family, const Slice& key,
149
172
  const Slice& value, const bool assume_tracked = false) override;
150
173
  Status Merge(const Slice& key, const Slice& value) override {
@@ -181,6 +204,15 @@ class TransactionBaseImpl : public Transaction {
181
204
  return PutUntracked(nullptr, key, value);
182
205
  }
183
206
 
207
+ Status PutEntityUntracked(ColumnFamilyHandle* column_family, const Slice& key,
208
+ const WideColumns& columns) override {
209
+ constexpr bool do_validate = false;
210
+ constexpr bool assume_tracked = false;
211
+
212
+ return PutEntityImpl(column_family, key, columns, do_validate,
213
+ assume_tracked);
214
+ }
215
+
184
216
  Status MergeUntracked(ColumnFamilyHandle* column_family, const Slice& key,
185
217
  const Slice& value) override;
186
218
  Status MergeUntracked(const Slice& key, const Slice& value) override {
@@ -240,6 +272,8 @@ class TransactionBaseImpl : public Transaction {
240
272
 
241
273
  uint64_t GetNumPuts() const override;
242
274
 
275
+ uint64_t GetNumPutEntities() const override;
276
+
243
277
  uint64_t GetNumDeletes() const override;
244
278
 
245
279
  uint64_t GetNumMerges() const override;
@@ -276,6 +310,26 @@ class TransactionBaseImpl : public Transaction {
276
310
  Status GetImpl(const ReadOptions& options, ColumnFamilyHandle* column_family,
277
311
  const Slice& key, PinnableSlice* value) override;
278
312
 
313
+ Status GetEntityImpl(const ReadOptions& options,
314
+ ColumnFamilyHandle* column_family, const Slice& key,
315
+ PinnableWideColumns* columns) {
316
+ return write_batch_.GetEntityFromBatchAndDB(db_, options, column_family,
317
+ key, columns);
318
+ }
319
+
320
+ void MultiGetEntityImpl(const ReadOptions& options,
321
+ ColumnFamilyHandle* column_family, size_t num_keys,
322
+ const Slice* keys, PinnableWideColumns* results,
323
+ Status* statuses, bool sorted_input) {
324
+ write_batch_.MultiGetEntityFromBatchAndDB(db_, options, column_family,
325
+ num_keys, keys, results, statuses,
326
+ sorted_input);
327
+ }
328
+
329
+ Status PutEntityImpl(ColumnFamilyHandle* column_family, const Slice& key,
330
+ const WideColumns& columns, bool do_validate,
331
+ bool assume_tracked);
332
+
279
333
  // Add a key to the list of tracked keys.
280
334
  //
281
335
  // seqno is the earliest seqno this key was involved with this transaction.
@@ -320,6 +374,7 @@ class TransactionBaseImpl : public Transaction {
320
374
 
321
375
  // Count of various operations pending in this transaction
322
376
  uint64_t num_puts_ = 0;
377
+ uint64_t num_put_entities_ = 0;
323
378
  uint64_t num_deletes_ = 0;
324
379
  uint64_t num_merges_ = 0;
325
380
 
@@ -328,6 +383,7 @@ class TransactionBaseImpl : public Transaction {
328
383
  bool snapshot_needed_ = false;
329
384
  std::shared_ptr<TransactionNotifier> snapshot_notifier_;
330
385
  uint64_t num_puts_ = 0;
386
+ uint64_t num_put_entities_ = 0;
331
387
  uint64_t num_deletes_ = 0;
332
388
  uint64_t num_merges_ = 0;
333
389
 
@@ -336,12 +392,14 @@ class TransactionBaseImpl : public Transaction {
336
392
 
337
393
  SavePoint(std::shared_ptr<const Snapshot> snapshot, bool snapshot_needed,
338
394
  std::shared_ptr<TransactionNotifier> snapshot_notifier,
339
- uint64_t num_puts, uint64_t num_deletes, uint64_t num_merges,
395
+ uint64_t num_puts, uint64_t num_put_entities,
396
+ uint64_t num_deletes, uint64_t num_merges,
340
397
  const LockTrackerFactory& lock_tracker_factory)
341
398
  : snapshot_(snapshot),
342
399
  snapshot_needed_(snapshot_needed),
343
400
  snapshot_notifier_(snapshot_notifier),
344
401
  num_puts_(num_puts),
402
+ num_put_entities_(num_put_entities),
345
403
  num_deletes_(num_deletes),
346
404
  num_merges_(num_merges),
347
405
  new_locks_(lock_tracker_factory.Create()) {}
@@ -373,10 +431,10 @@ class TransactionBaseImpl : public Transaction {
373
431
  // prepare phase is not skipped.
374
432
  WriteBatch commit_time_batch_;
375
433
 
376
- // If true, future Put/Merge/Deletes will be indexed in the
377
- // WriteBatchWithIndex.
378
- // If false, future Put/Merge/Deletes will be inserted directly into the
379
- // underlying WriteBatch and not indexed in the WriteBatchWithIndex.
434
+ // If true, future Put/PutEntity/Merge/Delete operations will be indexed in
435
+ // the WriteBatchWithIndex. If false, future Put/PutEntity/Merge/Delete
436
+ // operations will be inserted directly into the underlying WriteBatch and not
437
+ // indexed in the WriteBatchWithIndex.
380
438
  bool indexing_enabled_;
381
439
 
382
440
  // SetSnapshotOnNextOperation() has been called and the snapshot has not yet
@@ -63,6 +63,8 @@ class TransactionTestBase : public ::testing::Test {
63
63
  options.unordered_write = write_ordering == kUnorderedWrite;
64
64
  options.level0_file_num_compaction_trigger = 2;
65
65
  options.merge_operator = MergeOperators::CreateFromStringId("stringappend");
66
+ // Recycling log file is generally more challenging for correctness
67
+ options.recycle_log_file_num = 2;
66
68
  special_env.skip_fsync_ = true;
67
69
  fault_fs.reset(new FaultInjectionTestFS(FileSystem::Default()));
68
70
  env.reset(new CompositeEnvWrapper(&special_env, fault_fs));
@@ -170,7 +172,8 @@ class TransactionTestBase : public ::testing::Test {
170
172
  txn_db_options.write_policy == WRITE_COMMITTED ||
171
173
  txn_db_options.write_policy == WRITE_PREPARED;
172
174
  Status s = DBImpl::Open(options_copy, dbname, cfs, handles, &root_db,
173
- use_seq_per_batch, use_batch_per_txn);
175
+ use_seq_per_batch, use_batch_per_txn,
176
+ /*is_retry=*/false, /*can_retry=*/nullptr);
174
177
  auto stackable_db = std::make_unique<StackableDB>(root_db);
175
178
  if (s.ok()) {
176
179
  assert(root_db != nullptr);
@@ -200,7 +203,8 @@ class TransactionTestBase : public ::testing::Test {
200
203
  txn_db_options.write_policy == WRITE_COMMITTED ||
201
204
  txn_db_options.write_policy == WRITE_PREPARED;
202
205
  Status s = DBImpl::Open(options_copy, dbname, column_families, &handles,
203
- &root_db, use_seq_per_batch, use_batch_per_txn);
206
+ &root_db, use_seq_per_batch, use_batch_per_txn,
207
+ /*is_retry=*/false, /*can_retry=*/nullptr);
204
208
  if (!s.ok()) {
205
209
  delete root_db;
206
210
  return s;
@@ -459,7 +463,7 @@ class TransactionTestBase : public ::testing::Test {
459
463
  }
460
464
  db_impl = static_cast_with_check<DBImpl>(db->GetRootDB());
461
465
  // Check that WAL is empty
462
- VectorLogPtr log_files;
466
+ VectorWalPtr log_files;
463
467
  ASSERT_OK(db_impl->GetSortedWalFiles(log_files));
464
468
  ASSERT_EQ(0, log_files.size());
465
469
 
@@ -21,7 +21,8 @@ namespace ROCKSDB_NAMESPACE {
21
21
  Status TransactionUtil::CheckKeyForConflicts(
22
22
  DBImpl* db_impl, ColumnFamilyHandle* column_family, const std::string& key,
23
23
  SequenceNumber snap_seq, const std::string* const read_ts, bool cache_only,
24
- ReadCallback* snap_checker, SequenceNumber min_uncommitted) {
24
+ ReadCallback* snap_checker, SequenceNumber min_uncommitted,
25
+ bool enable_udt_validation) {
25
26
  Status result;
26
27
 
27
28
  auto cfh = static_cast_with_check<ColumnFamilyHandleImpl>(column_family);
@@ -37,8 +38,9 @@ Status TransactionUtil::CheckKeyForConflicts(
37
38
  SequenceNumber earliest_seq =
38
39
  db_impl->GetEarliestMemTableSequenceNumber(sv, true);
39
40
 
40
- result = CheckKey(db_impl, sv, earliest_seq, snap_seq, key, read_ts,
41
- cache_only, snap_checker, min_uncommitted);
41
+ result =
42
+ CheckKey(db_impl, sv, earliest_seq, snap_seq, key, read_ts, cache_only,
43
+ snap_checker, min_uncommitted, enable_udt_validation);
42
44
 
43
45
  db_impl->ReturnAndCleanupSuperVersion(cfd, sv);
44
46
  }
@@ -52,7 +54,8 @@ Status TransactionUtil::CheckKey(DBImpl* db_impl, SuperVersion* sv,
52
54
  const std::string& key,
53
55
  const std::string* const read_ts,
54
56
  bool cache_only, ReadCallback* snap_checker,
55
- SequenceNumber min_uncommitted) {
57
+ SequenceNumber min_uncommitted,
58
+ bool enable_udt_validation) {
56
59
  // When `min_uncommitted` is provided, keys are not always committed
57
60
  // in sequence number order, and `snap_checker` is used to check whether
58
61
  // specific sequence number is in the database is visible to the transaction.
@@ -130,7 +133,7 @@ Status TransactionUtil::CheckKey(DBImpl* db_impl, SuperVersion* sv,
130
133
  ? snap_seq < seq
131
134
  : !snap_checker->IsVisible(seq);
132
135
  // Perform conflict checking based on timestamp if applicable.
133
- if (!write_conflict && read_ts != nullptr) {
136
+ if (enable_udt_validation && !write_conflict && read_ts != nullptr) {
134
137
  ColumnFamilyData* cfd = sv->cfd;
135
138
  assert(cfd);
136
139
  const Comparator* const ucmp = cfd->user_comparator();