@nxtedition/rocksdb 8.2.7 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (359) hide show
  1. package/deps/rocksdb/rocksdb/CMakeLists.txt +7 -1
  2. package/deps/rocksdb/rocksdb/Makefile +22 -19
  3. package/deps/rocksdb/rocksdb/TARGETS +8 -0
  4. package/deps/rocksdb/rocksdb/cache/cache_bench_tool.cc +157 -61
  5. package/deps/rocksdb/rocksdb/cache/cache_test.cc +43 -92
  6. package/deps/rocksdb/rocksdb/cache/clock_cache.cc +632 -455
  7. package/deps/rocksdb/rocksdb/cache/clock_cache.h +244 -149
  8. package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache.cc +41 -13
  9. package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache.h +11 -1
  10. package/deps/rocksdb/rocksdb/cache/compressed_secondary_cache_test.cc +216 -17
  11. package/deps/rocksdb/rocksdb/cache/lru_cache.cc +7 -5
  12. package/deps/rocksdb/rocksdb/cache/lru_cache_test.cc +279 -199
  13. package/deps/rocksdb/rocksdb/cache/secondary_cache.cc +2 -1
  14. package/deps/rocksdb/rocksdb/cache/secondary_cache_adapter.cc +159 -8
  15. package/deps/rocksdb/rocksdb/cache/secondary_cache_adapter.h +28 -2
  16. package/deps/rocksdb/rocksdb/cache/sharded_cache.cc +1 -1
  17. package/deps/rocksdb/rocksdb/cache/sharded_cache.h +8 -0
  18. package/deps/rocksdb/rocksdb/crash_test.mk +14 -0
  19. package/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.cc +3 -1
  20. package/deps/rocksdb/rocksdb/db/blob/blob_file_builder.cc +1 -1
  21. package/deps/rocksdb/rocksdb/db/blob/blob_file_builder_test.cc +1 -1
  22. package/deps/rocksdb/rocksdb/db/blob/blob_file_cache.cc +2 -2
  23. package/deps/rocksdb/rocksdb/db/blob/blob_file_cache.h +1 -1
  24. package/deps/rocksdb/rocksdb/db/blob/blob_file_reader.cc +18 -21
  25. package/deps/rocksdb/rocksdb/db/blob/blob_file_reader.h +1 -2
  26. package/deps/rocksdb/rocksdb/db/blob/blob_file_reader_test.cc +1 -1
  27. package/deps/rocksdb/rocksdb/db/blob/blob_log_sequential_reader.cc +2 -3
  28. package/deps/rocksdb/rocksdb/db/blob/blob_source_test.cc +1 -1
  29. package/deps/rocksdb/rocksdb/db/builder.cc +32 -7
  30. package/deps/rocksdb/rocksdb/db/c.cc +169 -6
  31. package/deps/rocksdb/rocksdb/db/c_test.c +104 -6
  32. package/deps/rocksdb/rocksdb/db/column_family.cc +98 -47
  33. package/deps/rocksdb/rocksdb/db/column_family.h +25 -2
  34. package/deps/rocksdb/rocksdb/db/column_family_test.cc +213 -2
  35. package/deps/rocksdb/rocksdb/db/compact_files_test.cc +4 -1
  36. package/deps/rocksdb/rocksdb/db/compaction/compaction.cc +93 -23
  37. package/deps/rocksdb/rocksdb/db/compaction/compaction.h +33 -9
  38. package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.cc +7 -6
  39. package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.h +17 -6
  40. package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator_test.cc +2 -2
  41. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.cc +107 -43
  42. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.h +15 -4
  43. package/deps/rocksdb/rocksdb/db/compaction/compaction_job_stats_test.cc +2 -0
  44. package/deps/rocksdb/rocksdb/db/compaction/compaction_job_test.cc +4 -2
  45. package/deps/rocksdb/rocksdb/db/compaction/compaction_outputs.cc +25 -17
  46. package/deps/rocksdb/rocksdb/db/compaction/compaction_outputs.h +13 -4
  47. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker.cc +11 -11
  48. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_test.cc +29 -4
  49. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_universal.cc +24 -31
  50. package/deps/rocksdb/rocksdb/db/compaction/file_pri.h +3 -1
  51. package/deps/rocksdb/rocksdb/db/compaction/tiered_compaction_test.cc +19 -19
  52. package/deps/rocksdb/rocksdb/db/comparator_db_test.cc +2 -1
  53. package/deps/rocksdb/rocksdb/db/convenience.cc +20 -3
  54. package/deps/rocksdb/rocksdb/db/convenience_impl.h +15 -0
  55. package/deps/rocksdb/rocksdb/db/corruption_test.cc +17 -0
  56. package/deps/rocksdb/rocksdb/db/cuckoo_table_db_test.cc +1 -0
  57. package/deps/rocksdb/rocksdb/db/db_basic_test.cc +17 -3
  58. package/deps/rocksdb/rocksdb/db/db_block_cache_test.cc +5 -0
  59. package/deps/rocksdb/rocksdb/db/db_bloom_filter_test.cc +15 -15
  60. package/deps/rocksdb/rocksdb/db/db_compaction_test.cc +666 -44
  61. package/deps/rocksdb/rocksdb/db/db_filesnapshot.cc +2 -29
  62. package/deps/rocksdb/rocksdb/db/db_flush_test.cc +274 -1
  63. package/deps/rocksdb/rocksdb/db/db_impl/compacted_db_impl.cc +40 -19
  64. package/deps/rocksdb/rocksdb/db/db_impl/compacted_db_impl.h +6 -5
  65. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.cc +250 -116
  66. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +51 -23
  67. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_compaction_flush.cc +354 -96
  68. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_debug.cc +6 -3
  69. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_experimental.cc +2 -1
  70. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_files.cc +5 -0
  71. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +50 -21
  72. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_readonly.cc +26 -13
  73. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_readonly.h +13 -5
  74. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.cc +61 -21
  75. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.h +8 -87
  76. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_write.cc +7 -1
  77. package/deps/rocksdb/rocksdb/db/db_iter.cc +2 -2
  78. package/deps/rocksdb/rocksdb/db/db_iter.h +1 -0
  79. package/deps/rocksdb/rocksdb/db/db_merge_operand_test.cc +4 -11
  80. package/deps/rocksdb/rocksdb/db/db_merge_operator_test.cc +6 -6
  81. package/deps/rocksdb/rocksdb/db/db_options_test.cc +39 -29
  82. package/deps/rocksdb/rocksdb/db/db_properties_test.cc +26 -36
  83. package/deps/rocksdb/rocksdb/db/db_range_del_test.cc +106 -0
  84. package/deps/rocksdb/rocksdb/db/db_rate_limiter_test.cc +12 -3
  85. package/deps/rocksdb/rocksdb/db/db_statistics_test.cc +1 -1
  86. package/deps/rocksdb/rocksdb/db/db_table_properties_test.cc +1 -0
  87. package/deps/rocksdb/rocksdb/db/db_tailing_iter_test.cc +279 -166
  88. package/deps/rocksdb/rocksdb/db/db_test.cc +48 -21
  89. package/deps/rocksdb/rocksdb/db/db_test2.cc +81 -12
  90. package/deps/rocksdb/rocksdb/db/db_test_util.cc +14 -6
  91. package/deps/rocksdb/rocksdb/db/db_test_util.h +40 -0
  92. package/deps/rocksdb/rocksdb/db/db_universal_compaction_test.cc +13 -1
  93. package/deps/rocksdb/rocksdb/db/db_wal_test.cc +233 -0
  94. package/deps/rocksdb/rocksdb/db/db_with_timestamp_basic_test.cc +143 -0
  95. package/deps/rocksdb/rocksdb/db/db_write_buffer_manager_test.cc +6 -6
  96. package/deps/rocksdb/rocksdb/db/db_write_test.cc +2 -2
  97. package/deps/rocksdb/rocksdb/db/dbformat.cc +36 -0
  98. package/deps/rocksdb/rocksdb/db/dbformat.h +169 -20
  99. package/deps/rocksdb/rocksdb/db/dbformat_test.cc +129 -0
  100. package/deps/rocksdb/rocksdb/db/error_handler.cc +16 -0
  101. package/deps/rocksdb/rocksdb/db/error_handler.h +6 -3
  102. package/deps/rocksdb/rocksdb/db/error_handler_fs_test.cc +4 -4
  103. package/deps/rocksdb/rocksdb/db/event_helpers.cc +4 -0
  104. package/deps/rocksdb/rocksdb/db/experimental.cc +2 -1
  105. package/deps/rocksdb/rocksdb/db/external_sst_file_basic_test.cc +4 -4
  106. package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.cc +17 -8
  107. package/deps/rocksdb/rocksdb/db/external_sst_file_test.cc +86 -4
  108. package/deps/rocksdb/rocksdb/db/fault_injection_test.cc +1 -1
  109. package/deps/rocksdb/rocksdb/db/file_indexer.cc +2 -4
  110. package/deps/rocksdb/rocksdb/db/flush_job.cc +101 -11
  111. package/deps/rocksdb/rocksdb/db/flush_job.h +24 -1
  112. package/deps/rocksdb/rocksdb/db/flush_job_test.cc +88 -11
  113. package/deps/rocksdb/rocksdb/db/forward_iterator.cc +2 -3
  114. package/deps/rocksdb/rocksdb/db/import_column_family_job.cc +159 -91
  115. package/deps/rocksdb/rocksdb/db/import_column_family_job.h +19 -10
  116. package/deps/rocksdb/rocksdb/db/import_column_family_test.cc +143 -0
  117. package/deps/rocksdb/rocksdb/db/internal_stats.cc +13 -1
  118. package/deps/rocksdb/rocksdb/db/internal_stats.h +2 -0
  119. package/deps/rocksdb/rocksdb/db/listener_test.cc +2 -1
  120. package/deps/rocksdb/rocksdb/db/log_reader.h +3 -2
  121. package/deps/rocksdb/rocksdb/db/log_test.cc +17 -21
  122. package/deps/rocksdb/rocksdb/db/log_writer.cc +1 -1
  123. package/deps/rocksdb/rocksdb/db/log_writer.h +3 -2
  124. package/deps/rocksdb/rocksdb/db/manual_compaction_test.cc +4 -3
  125. package/deps/rocksdb/rocksdb/db/memtable.cc +52 -13
  126. package/deps/rocksdb/rocksdb/db/memtable.h +45 -1
  127. package/deps/rocksdb/rocksdb/db/memtable_list.cc +44 -10
  128. package/deps/rocksdb/rocksdb/db/memtable_list.h +32 -1
  129. package/deps/rocksdb/rocksdb/db/memtable_list_test.cc +90 -4
  130. package/deps/rocksdb/rocksdb/db/perf_context_test.cc +2 -2
  131. package/deps/rocksdb/rocksdb/db/plain_table_db_test.cc +1 -0
  132. package/deps/rocksdb/rocksdb/db/repair.cc +21 -4
  133. package/deps/rocksdb/rocksdb/db/repair_test.cc +143 -2
  134. package/deps/rocksdb/rocksdb/db/seqno_time_test.cc +5 -4
  135. package/deps/rocksdb/rocksdb/db/table_cache.cc +44 -35
  136. package/deps/rocksdb/rocksdb/db/table_cache.h +6 -6
  137. package/deps/rocksdb/rocksdb/db/table_cache_sync_and_async.h +2 -2
  138. package/deps/rocksdb/rocksdb/db/version_builder.cc +0 -1
  139. package/deps/rocksdb/rocksdb/db/version_builder_test.cc +236 -204
  140. package/deps/rocksdb/rocksdb/db/version_edit.cc +66 -4
  141. package/deps/rocksdb/rocksdb/db/version_edit.h +48 -6
  142. package/deps/rocksdb/rocksdb/db/version_edit_handler.cc +80 -8
  143. package/deps/rocksdb/rocksdb/db/version_edit_handler.h +12 -0
  144. package/deps/rocksdb/rocksdb/db/version_edit_test.cc +86 -17
  145. package/deps/rocksdb/rocksdb/db/version_set.cc +136 -41
  146. package/deps/rocksdb/rocksdb/db/version_set.h +28 -7
  147. package/deps/rocksdb/rocksdb/db/version_set_test.cc +25 -15
  148. package/deps/rocksdb/rocksdb/db/write_batch.cc +11 -0
  149. package/deps/rocksdb/rocksdb/db/write_batch_internal.h +3 -0
  150. package/deps/rocksdb/rocksdb/db/write_batch_test.cc +16 -0
  151. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.h +22 -3
  152. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_driver.cc +2 -0
  153. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_env_wrapper.h +42 -0
  154. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_gflags.cc +32 -3
  155. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_shared_state.h +7 -0
  156. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.cc +247 -120
  157. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.h +9 -4
  158. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_tool.cc +13 -6
  159. package/deps/rocksdb/rocksdb/db_stress_tool/expected_value.h +2 -0
  160. package/deps/rocksdb/rocksdb/db_stress_tool/multi_ops_txns_stress.cc +15 -27
  161. package/deps/rocksdb/rocksdb/db_stress_tool/no_batched_ops_stress.cc +264 -69
  162. package/deps/rocksdb/rocksdb/env/env.cc +1 -2
  163. package/deps/rocksdb/rocksdb/env/env_encryption.cc +11 -165
  164. package/deps/rocksdb/rocksdb/env/env_encryption_ctr.h +0 -17
  165. package/deps/rocksdb/rocksdb/env/env_posix.cc +6 -2
  166. package/deps/rocksdb/rocksdb/env/env_test.cc +86 -2
  167. package/deps/rocksdb/rocksdb/env/fs_posix.cc +6 -4
  168. package/deps/rocksdb/rocksdb/env/unique_id_gen.cc +78 -0
  169. package/deps/rocksdb/rocksdb/env/unique_id_gen.h +34 -0
  170. package/deps/rocksdb/rocksdb/file/delete_scheduler.cc +1 -0
  171. package/deps/rocksdb/rocksdb/file/delete_scheduler_test.cc +15 -4
  172. package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.cc +52 -43
  173. package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.h +34 -18
  174. package/deps/rocksdb/rocksdb/file/file_util.cc +10 -5
  175. package/deps/rocksdb/rocksdb/file/file_util.h +13 -1
  176. package/deps/rocksdb/rocksdb/file/prefetch_test.cc +724 -79
  177. package/deps/rocksdb/rocksdb/file/random_access_file_reader.cc +64 -33
  178. package/deps/rocksdb/rocksdb/file/random_access_file_reader.h +3 -16
  179. package/deps/rocksdb/rocksdb/file/random_access_file_reader_test.cc +23 -12
  180. package/deps/rocksdb/rocksdb/file/sequence_file_reader.h +3 -0
  181. package/deps/rocksdb/rocksdb/include/rocksdb/advanced_cache.h +2 -1
  182. package/deps/rocksdb/rocksdb/include/rocksdb/advanced_options.h +153 -88
  183. package/deps/rocksdb/rocksdb/include/rocksdb/c.h +70 -2
  184. package/deps/rocksdb/rocksdb/include/rocksdb/cache.h +50 -11
  185. package/deps/rocksdb/rocksdb/include/rocksdb/compaction_job_stats.h +3 -0
  186. package/deps/rocksdb/rocksdb/include/rocksdb/comparator.h +16 -2
  187. package/deps/rocksdb/rocksdb/include/rocksdb/convenience.h +1 -1
  188. package/deps/rocksdb/rocksdb/include/rocksdb/db.h +55 -8
  189. package/deps/rocksdb/rocksdb/include/rocksdb/env.h +32 -4
  190. package/deps/rocksdb/rocksdb/include/rocksdb/env_encryption.h +9 -109
  191. package/deps/rocksdb/rocksdb/include/rocksdb/file_system.h +90 -13
  192. package/deps/rocksdb/rocksdb/include/rocksdb/listener.h +3 -0
  193. package/deps/rocksdb/rocksdb/include/rocksdb/options.h +85 -17
  194. package/deps/rocksdb/rocksdb/include/rocksdb/secondary_cache.h +13 -1
  195. package/deps/rocksdb/rocksdb/include/rocksdb/sst_file_manager.h +2 -1
  196. package/deps/rocksdb/rocksdb/include/rocksdb/sst_file_writer.h +5 -1
  197. package/deps/rocksdb/rocksdb/include/rocksdb/statistics.h +21 -2
  198. package/deps/rocksdb/rocksdb/include/rocksdb/table.h +7 -1
  199. package/deps/rocksdb/rocksdb/include/rocksdb/table_properties.h +6 -0
  200. package/deps/rocksdb/rocksdb/include/rocksdb/thread_status.h +5 -0
  201. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/optimistic_transaction_db.h +33 -2
  202. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/stackable_db.h +14 -0
  203. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/transaction.h +33 -2
  204. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/write_batch_with_index.h +0 -3
  205. package/deps/rocksdb/rocksdb/include/rocksdb/version.h +2 -2
  206. package/deps/rocksdb/rocksdb/include/rocksdb/write_batch.h +3 -0
  207. package/deps/rocksdb/rocksdb/memory/arena_test.cc +18 -11
  208. package/deps/rocksdb/rocksdb/memory/jemalloc_nodump_allocator.cc +2 -1
  209. package/deps/rocksdb/rocksdb/microbench/db_basic_bench.cc +69 -34
  210. package/deps/rocksdb/rocksdb/monitoring/statistics.cc +16 -1
  211. package/deps/rocksdb/rocksdb/monitoring/thread_status_util_debug.cc +10 -0
  212. package/deps/rocksdb/rocksdb/options/cf_options.cc +19 -0
  213. package/deps/rocksdb/rocksdb/options/cf_options.h +10 -2
  214. package/deps/rocksdb/rocksdb/options/customizable_test.cc +2 -1
  215. package/deps/rocksdb/rocksdb/options/db_options.cc +7 -0
  216. package/deps/rocksdb/rocksdb/options/db_options.h +1 -0
  217. package/deps/rocksdb/rocksdb/options/options.cc +15 -1
  218. package/deps/rocksdb/rocksdb/options/options_helper.cc +6 -0
  219. package/deps/rocksdb/rocksdb/options/options_settable_test.cc +11 -3
  220. package/deps/rocksdb/rocksdb/options/options_test.cc +8 -0
  221. package/deps/rocksdb/rocksdb/port/mmap.h +20 -0
  222. package/deps/rocksdb/rocksdb/port/stack_trace.cc +27 -12
  223. package/deps/rocksdb/rocksdb/port/win/env_win.h +1 -1
  224. package/deps/rocksdb/rocksdb/src.mk +3 -0
  225. package/deps/rocksdb/rocksdb/table/block_based/binary_search_index_reader.cc +2 -1
  226. package/deps/rocksdb/rocksdb/table/block_based/block.cc +48 -22
  227. package/deps/rocksdb/rocksdb/table/block_based/block.h +60 -12
  228. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_builder.cc +115 -42
  229. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_factory.cc +6 -5
  230. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.cc +60 -2
  231. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.h +2 -0
  232. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.cc +62 -44
  233. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.h +36 -14
  234. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +38 -15
  235. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_test.cc +219 -51
  236. package/deps/rocksdb/rocksdb/table/block_based/block_builder.cc +41 -8
  237. package/deps/rocksdb/rocksdb/table/block_based/block_builder.h +25 -1
  238. package/deps/rocksdb/rocksdb/table/block_based/block_prefetcher.cc +50 -21
  239. package/deps/rocksdb/rocksdb/table/block_based/block_prefetcher.h +11 -4
  240. package/deps/rocksdb/rocksdb/table/block_based/block_test.cc +195 -55
  241. package/deps/rocksdb/rocksdb/table/block_based/hash_index_reader.cc +1 -1
  242. package/deps/rocksdb/rocksdb/table/block_based/index_builder.cc +31 -16
  243. package/deps/rocksdb/rocksdb/table/block_based/index_builder.h +97 -58
  244. package/deps/rocksdb/rocksdb/table/block_based/index_reader_common.cc +1 -1
  245. package/deps/rocksdb/rocksdb/table/block_based/index_reader_common.h +6 -0
  246. package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block.cc +27 -12
  247. package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block.h +3 -1
  248. package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block_test.cc +114 -70
  249. package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_iterator.cc +1 -2
  250. package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_reader.cc +9 -6
  251. package/deps/rocksdb/rocksdb/table/block_based/reader_common.cc +15 -3
  252. package/deps/rocksdb/rocksdb/table/block_based/reader_common.h +6 -3
  253. package/deps/rocksdb/rocksdb/table/block_fetcher.cc +11 -11
  254. package/deps/rocksdb/rocksdb/table/block_fetcher_test.cc +3 -0
  255. package/deps/rocksdb/rocksdb/table/compaction_merging_iterator.cc +1 -0
  256. package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_builder.cc +6 -2
  257. package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_builder_test.cc +1 -2
  258. package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_reader.cc +2 -3
  259. package/deps/rocksdb/rocksdb/table/format.cc +175 -33
  260. package/deps/rocksdb/rocksdb/table/format.h +63 -10
  261. package/deps/rocksdb/rocksdb/table/merging_iterator.cc +10 -2
  262. package/deps/rocksdb/rocksdb/table/meta_blocks.cc +12 -4
  263. package/deps/rocksdb/rocksdb/table/meta_blocks.h +1 -0
  264. package/deps/rocksdb/rocksdb/table/mock_table.cc +8 -3
  265. package/deps/rocksdb/rocksdb/table/plain/plain_table_builder.cc +10 -5
  266. package/deps/rocksdb/rocksdb/table/plain/plain_table_builder.h +10 -1
  267. package/deps/rocksdb/rocksdb/table/plain/plain_table_key_coding.cc +1 -2
  268. package/deps/rocksdb/rocksdb/table/plain/plain_table_reader.cc +3 -3
  269. package/deps/rocksdb/rocksdb/table/sst_file_dumper.cc +12 -3
  270. package/deps/rocksdb/rocksdb/table/sst_file_writer.cc +26 -1
  271. package/deps/rocksdb/rocksdb/table/table_builder.h +6 -2
  272. package/deps/rocksdb/rocksdb/table/table_properties.cc +6 -0
  273. package/deps/rocksdb/rocksdb/table/table_test.cc +52 -22
  274. package/deps/rocksdb/rocksdb/test_util/secondary_cache_test_util.h +19 -7
  275. package/deps/rocksdb/rocksdb/test_util/sync_point.h +3 -1
  276. package/deps/rocksdb/rocksdb/test_util/testutil.cc +29 -0
  277. package/deps/rocksdb/rocksdb/test_util/testutil.h +19 -0
  278. package/deps/rocksdb/rocksdb/tools/db_bench_tool.cc +65 -26
  279. package/deps/rocksdb/rocksdb/tools/ldb_cmd.cc +8 -5
  280. package/deps/rocksdb/rocksdb/tools/ldb_tool.cc +1 -0
  281. package/deps/rocksdb/rocksdb/tools/reduce_levels_test.cc +1 -0
  282. package/deps/rocksdb/rocksdb/tools/sst_dump_test.cc +0 -1
  283. package/deps/rocksdb/rocksdb/tools/sst_dump_tool.cc +4 -0
  284. package/deps/rocksdb/rocksdb/unreleased_history/README.txt +73 -0
  285. package/deps/rocksdb/rocksdb/unreleased_history/add.sh +27 -0
  286. package/deps/rocksdb/rocksdb/unreleased_history/behavior_changes/.gitkeep +0 -0
  287. package/deps/rocksdb/rocksdb/unreleased_history/bug_fixes/.gitkeep +0 -0
  288. package/deps/rocksdb/rocksdb/unreleased_history/new_features/.gitkeep +0 -0
  289. package/deps/rocksdb/rocksdb/unreleased_history/performance_improvements/.gitkeep +0 -0
  290. package/deps/rocksdb/rocksdb/unreleased_history/public_api_changes/.gitkeep +0 -0
  291. package/deps/rocksdb/rocksdb/unreleased_history/release.sh +104 -0
  292. package/deps/rocksdb/rocksdb/util/async_file_reader.cc +5 -0
  293. package/deps/rocksdb/rocksdb/util/bloom_impl.h +3 -3
  294. package/deps/rocksdb/rocksdb/util/cast_util.h +14 -0
  295. package/deps/rocksdb/rocksdb/util/compaction_job_stats_impl.cc +2 -0
  296. package/deps/rocksdb/rocksdb/util/comparator.cc +29 -7
  297. package/deps/rocksdb/rocksdb/util/compression.cc +4 -4
  298. package/deps/rocksdb/rocksdb/util/compression.h +110 -32
  299. package/deps/rocksdb/rocksdb/util/core_local.h +2 -1
  300. package/deps/rocksdb/rocksdb/util/dynamic_bloom.h +4 -4
  301. package/deps/rocksdb/rocksdb/util/filelock_test.cc +3 -0
  302. package/deps/rocksdb/rocksdb/util/hash.h +7 -3
  303. package/deps/rocksdb/rocksdb/util/hash_test.cc +44 -0
  304. package/deps/rocksdb/rocksdb/util/math.h +58 -6
  305. package/deps/rocksdb/rocksdb/util/math128.h +29 -7
  306. package/deps/rocksdb/rocksdb/util/mutexlock.h +35 -27
  307. package/deps/rocksdb/rocksdb/util/single_thread_executor.h +1 -0
  308. package/deps/rocksdb/rocksdb/util/stop_watch.h +1 -1
  309. package/deps/rocksdb/rocksdb/util/thread_operation.h +8 -1
  310. package/deps/rocksdb/rocksdb/util/udt_util.cc +343 -0
  311. package/deps/rocksdb/rocksdb/util/udt_util.h +173 -1
  312. package/deps/rocksdb/rocksdb/util/udt_util_test.cc +447 -0
  313. package/deps/rocksdb/rocksdb/util/write_batch_util.cc +25 -0
  314. package/deps/rocksdb/rocksdb/util/write_batch_util.h +80 -0
  315. package/deps/rocksdb/rocksdb/utilities/backup/backup_engine_test.cc +4 -4
  316. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db_impl.cc +69 -25
  317. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db_impl.h +7 -6
  318. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db_listener.h +1 -1
  319. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_dump_tool.cc +2 -3
  320. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_file.cc +6 -11
  321. package/deps/rocksdb/rocksdb/utilities/cache_dump_load_impl.h +1 -2
  322. package/deps/rocksdb/rocksdb/utilities/checkpoint/checkpoint_test.cc +4 -5
  323. package/deps/rocksdb/rocksdb/utilities/fault_injection_fs.cc +1 -1
  324. package/deps/rocksdb/rocksdb/utilities/fault_injection_secondary_cache.cc +2 -2
  325. package/deps/rocksdb/rocksdb/utilities/fault_injection_secondary_cache.h +2 -1
  326. package/deps/rocksdb/rocksdb/utilities/option_change_migration/option_change_migration_test.cc +3 -3
  327. package/deps/rocksdb/rocksdb/utilities/persistent_cache/block_cache_tier_file.cc +1 -2
  328. package/deps/rocksdb/rocksdb/utilities/trace/file_trace_reader_writer.cc +2 -3
  329. package/deps/rocksdb/rocksdb/utilities/transactions/lock/point/point_lock_manager_test.cc +2 -2
  330. package/deps/rocksdb/rocksdb/utilities/transactions/lock/point/point_lock_manager_test.h +1 -1
  331. package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction.cc +23 -8
  332. package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction_db_impl.cc +9 -6
  333. package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction_db_impl.h +37 -12
  334. package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction_test.cc +231 -33
  335. package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction.h +0 -1
  336. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_base.cc +76 -20
  337. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_base.h +18 -9
  338. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.cc +40 -23
  339. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.h +13 -12
  340. package/deps/rocksdb/rocksdb/utilities/transactions/write_committed_transaction_ts_test.cc +7 -0
  341. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_transaction_test.cc +1 -1
  342. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn.cc +41 -11
  343. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn.h +6 -3
  344. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn_db.cc +71 -24
  345. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn_db.h +19 -4
  346. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_transaction_test.cc +60 -107
  347. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn.cc +39 -11
  348. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn.h +6 -3
  349. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn_db.cc +14 -8
  350. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn_db.h +1 -1
  351. package/deps/rocksdb/rocksdb/utilities/ttl/db_ttl_impl.cc +10 -5
  352. package/deps/rocksdb/rocksdb/utilities/ttl/db_ttl_impl.h +1 -1
  353. package/deps/rocksdb/rocksdb/utilities/ttl/ttl_test.cc +1 -1
  354. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +2 -1
  355. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_test.cc +6 -6
  356. package/deps/rocksdb/rocksdb.gyp +2 -0
  357. package/package.json +1 -1
  358. package/prebuilds/darwin-arm64/node.napi.node +0 -0
  359. package/prebuilds/linux-x64/node.napi.node +0 -0
@@ -30,14 +30,6 @@ std::shared_ptr<EncryptionProvider> EncryptionProvider::NewCTRProvider(
30
30
  return std::make_shared<CTREncryptionProvider>(cipher);
31
31
  }
32
32
 
33
- // Read up to "n" bytes from the file. "scratch[0..n-1]" may be
34
- // written by this routine. Sets "*result" to the data that was
35
- // read (including if fewer than "n" bytes were successfully read).
36
- // May set "*result" to point at data in "scratch[0..n-1]", so
37
- // "scratch[0..n-1]" must be live when "*result" is used.
38
- // If an error was encountered, returns a non-OK status.
39
- //
40
- // REQUIRES: External synchronization
41
33
  IOStatus EncryptedSequentialFile::Read(size_t n, const IOOptions& options,
42
34
  Slice* result, char* scratch,
43
35
  IODebugContext* dbg) {
@@ -52,19 +44,12 @@ IOStatus EncryptedSequentialFile::Read(size_t n, const IOOptions& options,
52
44
  stream_->Decrypt(offset_, (char*)result->data(), result->size()));
53
45
  }
54
46
  if (io_s.ok()) {
55
- offset_ += result->size(); // We've already ready data from disk, so update
47
+ offset_ += result->size(); // We've already read data from disk, so update
56
48
  // offset_ even if decryption fails.
57
49
  }
58
50
  return io_s;
59
51
  }
60
52
 
61
- // Skip "n" bytes from the file. This is guaranteed to be no
62
- // slower that reading the same data, but may be faster.
63
- //
64
- // If end of file is reached, skipping will stop at the end of the
65
- // file, and Skip will return OK.
66
- //
67
- // REQUIRES: External synchronization
68
53
  IOStatus EncryptedSequentialFile::Skip(uint64_t n) {
69
54
  auto status = file_->Skip(n);
70
55
  if (!status.ok()) {
@@ -74,28 +59,19 @@ IOStatus EncryptedSequentialFile::Skip(uint64_t n) {
74
59
  return status;
75
60
  }
76
61
 
77
- // Indicates the upper layers if the current SequentialFile implementation
78
- // uses direct IO.
79
62
  bool EncryptedSequentialFile::use_direct_io() const {
80
63
  return file_->use_direct_io();
81
64
  }
82
65
 
83
- // Use the returned alignment value to allocate
84
- // aligned buffer for Direct I/O
85
66
  size_t EncryptedSequentialFile::GetRequiredBufferAlignment() const {
86
67
  return file_->GetRequiredBufferAlignment();
87
68
  }
88
69
 
89
- // Remove any kind of caching of data from the offset to offset+length
90
- // of this file. If the length is 0, then it refers to the end of file.
91
- // If the system is not caching the file contents, then this is a noop.
92
70
  IOStatus EncryptedSequentialFile::InvalidateCache(size_t offset,
93
71
  size_t length) {
94
72
  return file_->InvalidateCache(offset + prefixLength_, length);
95
73
  }
96
74
 
97
- // Positioned Read for direct I/O
98
- // If Direct I/O enabled, offset, n, and scratch should be properly aligned
99
75
  IOStatus EncryptedSequentialFile::PositionedRead(uint64_t offset, size_t n,
100
76
  const IOOptions& options,
101
77
  Slice* result, char* scratch,
@@ -115,16 +91,6 @@ IOStatus EncryptedSequentialFile::PositionedRead(uint64_t offset, size_t n,
115
91
  return io_s;
116
92
  }
117
93
 
118
- // Read up to "n" bytes from the file starting at "offset".
119
- // "scratch[0..n-1]" may be written by this routine. Sets "*result"
120
- // to the data that was read (including if fewer than "n" bytes were
121
- // successfully read). May set "*result" to point at data in
122
- // "scratch[0..n-1]", so "scratch[0..n-1]" must be live when
123
- // "*result" is used. If an error was encountered, returns a non-OK
124
- // status.
125
- //
126
- // Safe for concurrent use by multiple threads.
127
- // If Direct I/O enabled, offset, n, and scratch should be aligned properly.
128
94
  IOStatus EncryptedRandomAccessFile::Read(uint64_t offset, size_t n,
129
95
  const IOOptions& options,
130
96
  Slice* result, char* scratch,
@@ -143,29 +109,12 @@ IOStatus EncryptedRandomAccessFile::Read(uint64_t offset, size_t n,
143
109
  return io_s;
144
110
  }
145
111
 
146
- // Readahead the file starting from offset by n bytes for caching.
147
112
  IOStatus EncryptedRandomAccessFile::Prefetch(uint64_t offset, size_t n,
148
113
  const IOOptions& options,
149
114
  IODebugContext* dbg) {
150
- // return Status::OK();
151
115
  return file_->Prefetch(offset + prefixLength_, n, options, dbg);
152
116
  }
153
117
 
154
- // Tries to get an unique ID for this file that will be the same each time
155
- // the file is opened (and will stay the same while the file is open).
156
- // Furthermore, it tries to make this ID at most "max_size" bytes. If such an
157
- // ID can be created this function returns the length of the ID and places it
158
- // in "id"; otherwise, this function returns 0, in which case "id"
159
- // may not have been modified.
160
- //
161
- // This function guarantees, for IDs from a given environment, two unique ids
162
- // cannot be made equal to each other by adding arbitrary bytes to one of
163
- // them. That is, no unique ID is the prefix of another.
164
- //
165
- // This function guarantees that the returned ID will not be interpretable as
166
- // a single varint.
167
- //
168
- // Note: these IDs are only valid for the duration of the process.
169
118
  size_t EncryptedRandomAccessFile::GetUniqueId(char* id, size_t max_size) const {
170
119
  return file_->GetUniqueId(id, max_size);
171
120
  };
@@ -174,29 +123,19 @@ void EncryptedRandomAccessFile::Hint(AccessPattern pattern) {
174
123
  file_->Hint(pattern);
175
124
  }
176
125
 
177
- // Indicates the upper layers if the current RandomAccessFile implementation
178
- // uses direct IO.
179
126
  bool EncryptedRandomAccessFile::use_direct_io() const {
180
127
  return file_->use_direct_io();
181
128
  }
182
129
 
183
- // Use the returned alignment value to allocate
184
- // aligned buffer for Direct I/O
185
130
  size_t EncryptedRandomAccessFile::GetRequiredBufferAlignment() const {
186
131
  return file_->GetRequiredBufferAlignment();
187
132
  }
188
133
 
189
- // Remove any kind of caching of data from the offset to offset+length
190
- // of this file. If the length is 0, then it refers to the end of file.
191
- // If the system is not caching the file contents, then this is a noop.
192
134
  IOStatus EncryptedRandomAccessFile::InvalidateCache(size_t offset,
193
135
  size_t length) {
194
136
  return file_->InvalidateCache(offset + prefixLength_, length);
195
137
  }
196
138
 
197
- // A file abstraction for sequential writing. The implementation
198
- // must provide buffering since callers may append small fragments
199
- // at a time to the file.
200
139
  IOStatus EncryptedWritableFile::Append(const Slice& data,
201
140
  const IOOptions& options,
202
141
  IODebugContext* dbg) {
@@ -252,67 +191,39 @@ IOStatus EncryptedWritableFile::PositionedAppend(const Slice& data,
252
191
  return file_->PositionedAppend(dataToAppend, offset, options, dbg);
253
192
  }
254
193
 
255
- // Indicates the upper layers if the current WritableFile implementation
256
- // uses direct IO.
257
194
  bool EncryptedWritableFile::use_direct_io() const {
258
195
  return file_->use_direct_io();
259
196
  }
260
197
 
261
- // true if Sync() and Fsync() are safe to call concurrently with Append()
262
- // and Flush().
263
198
  bool EncryptedWritableFile::IsSyncThreadSafe() const {
264
199
  return file_->IsSyncThreadSafe();
265
200
  }
266
201
 
267
- // Use the returned alignment value to allocate
268
- // aligned buffer for Direct I/O
269
202
  size_t EncryptedWritableFile::GetRequiredBufferAlignment() const {
270
203
  return file_->GetRequiredBufferAlignment();
271
204
  }
272
205
 
273
- /*
274
- * Get the size of valid data in the file.
275
- */
276
206
  uint64_t EncryptedWritableFile::GetFileSize(const IOOptions& options,
277
207
  IODebugContext* dbg) {
278
208
  return file_->GetFileSize(options, dbg) - prefixLength_;
279
209
  }
280
210
 
281
- // Truncate is necessary to trim the file to the correct size
282
- // before closing. It is not always possible to keep track of the file
283
- // size due to whole pages writes. The behavior is undefined if called
284
- // with other writes to follow.
285
211
  IOStatus EncryptedWritableFile::Truncate(uint64_t size,
286
212
  const IOOptions& options,
287
213
  IODebugContext* dbg) {
288
214
  return file_->Truncate(size + prefixLength_, options, dbg);
289
215
  }
290
216
 
291
- // Remove any kind of caching of data from the offset to offset+length
292
- // of this file. If the length is 0, then it refers to the end of file.
293
- // If the system is not caching the file contents, then this is a noop.
294
- // This call has no effect on dirty pages in the cache.
295
217
  IOStatus EncryptedWritableFile::InvalidateCache(size_t offset, size_t length) {
296
218
  return file_->InvalidateCache(offset + prefixLength_, length);
297
219
  }
298
220
 
299
- // Sync a file range with disk.
300
- // offset is the starting byte of the file range to be synchronized.
301
- // nbytes specifies the length of the range to be synchronized.
302
- // This asks the OS to initiate flushing the cached data to disk,
303
- // without waiting for completion.
304
- // Default implementation does nothing.
305
221
  IOStatus EncryptedWritableFile::RangeSync(uint64_t offset, uint64_t nbytes,
306
222
  const IOOptions& options,
307
223
  IODebugContext* dbg) {
308
224
  return file_->RangeSync(offset + prefixLength_, nbytes, options, dbg);
309
225
  }
310
226
 
311
- // PrepareWrite performs any necessary preparation for a write
312
- // before the write actually occurs. This allows for pre-allocation
313
- // of space on devices where it can result in less file
314
- // fragmentation and/or less waste from over-zealous filesystem
315
- // pre-allocation.
316
227
  void EncryptedWritableFile::PrepareWrite(size_t offset, size_t len,
317
228
  const IOOptions& options,
318
229
  IODebugContext* dbg) {
@@ -330,7 +241,6 @@ void EncryptedWritableFile::GetPreallocationStatus(
330
241
  file_->GetPreallocationStatus(block_size, last_allocated_block);
331
242
  }
332
243
 
333
- // Pre-allocates space for a file.
334
244
  IOStatus EncryptedWritableFile::Allocate(uint64_t offset, uint64_t len,
335
245
  const IOOptions& options,
336
246
  IODebugContext* dbg) {
@@ -352,22 +262,14 @@ IOStatus EncryptedWritableFile::Close(const IOOptions& options,
352
262
  return file_->Close(options, dbg);
353
263
  }
354
264
 
355
- // A file abstraction for random reading and writing.
356
-
357
- // Indicates if the class makes use of direct I/O
358
- // If false you must pass aligned buffer to Write()
359
265
  bool EncryptedRandomRWFile::use_direct_io() const {
360
266
  return file_->use_direct_io();
361
267
  }
362
268
 
363
- // Use the returned alignment value to allocate
364
- // aligned buffer for Direct I/O
365
269
  size_t EncryptedRandomRWFile::GetRequiredBufferAlignment() const {
366
270
  return file_->GetRequiredBufferAlignment();
367
271
  }
368
272
 
369
- // Write bytes in `data` at offset `offset`, Returns Status::OK() on success.
370
- // Pass aligned buffer when use_direct_io() returns true.
371
273
  IOStatus EncryptedRandomRWFile::Write(uint64_t offset, const Slice& data,
372
274
  const IOOptions& options,
373
275
  IODebugContext* dbg) {
@@ -394,9 +296,6 @@ IOStatus EncryptedRandomRWFile::Write(uint64_t offset, const Slice& data,
394
296
  return file_->Write(offset, dataToWrite, options, dbg);
395
297
  }
396
298
 
397
- // Read up to `n` bytes starting from offset `offset` and store them in
398
- // result, provided `scratch` size should be at least `n`.
399
- // Returns Status::OK() on success.
400
299
  IOStatus EncryptedRandomRWFile::Read(uint64_t offset, size_t n,
401
300
  const IOOptions& options, Slice* result,
402
301
  char* scratch, IODebugContext* dbg) const {
@@ -678,7 +577,6 @@ class EncryptedFileSystemImpl : public EncryptedFileSystem {
678
577
  return provider_->AddCipher(descriptor, cipher, len, for_write);
679
578
  }
680
579
 
681
- // NewSequentialFile opens a file for sequential reading.
682
580
  IOStatus NewSequentialFile(const std::string& fname,
683
581
  const FileOptions& options,
684
582
  std::unique_ptr<FSSequentialFile>* result,
@@ -716,7 +614,6 @@ class EncryptedFileSystemImpl : public EncryptedFileSystem {
716
614
  return status;
717
615
  }
718
616
 
719
- // NewRandomAccessFile opens a file for random read access.
720
617
  IOStatus NewRandomAccessFile(const std::string& fname,
721
618
  const FileOptions& options,
722
619
  std::unique_ptr<FSRandomAccessFile>* result,
@@ -747,7 +644,6 @@ class EncryptedFileSystemImpl : public EncryptedFileSystem {
747
644
  return status;
748
645
  }
749
646
 
750
- // NewWritableFile opens a file for sequential writing.
751
647
  IOStatus NewWritableFile(const std::string& fname, const FileOptions& options,
752
648
  std::unique_ptr<FSWritableFile>* result,
753
649
  IODebugContext* dbg) override {
@@ -765,13 +661,6 @@ class EncryptedFileSystemImpl : public EncryptedFileSystem {
765
661
  return CreateWritableEncryptedFile(fname, underlying, options, result, dbg);
766
662
  }
767
663
 
768
- // Create an object that writes to a new file with the specified
769
- // name. Deletes any existing file with the same name and creates a
770
- // new file. On success, stores a pointer to the new file in
771
- // *result and returns OK. On failure stores nullptr in *result and
772
- // returns non-OK.
773
- //
774
- // The returned file will only be accessed by one thread at a time.
775
664
  IOStatus ReopenWritableFile(const std::string& fname,
776
665
  const FileOptions& options,
777
666
  std::unique_ptr<FSWritableFile>* result,
@@ -790,7 +679,6 @@ class EncryptedFileSystemImpl : public EncryptedFileSystem {
790
679
  return CreateWritableEncryptedFile(fname, underlying, options, result, dbg);
791
680
  }
792
681
 
793
- // Reuse an existing file by renaming it and opening it as writable.
794
682
  IOStatus ReuseWritableFile(const std::string& fname,
795
683
  const std::string& old_fname,
796
684
  const FileOptions& options,
@@ -810,11 +698,6 @@ class EncryptedFileSystemImpl : public EncryptedFileSystem {
810
698
  return CreateWritableEncryptedFile(fname, underlying, options, result, dbg);
811
699
  }
812
700
 
813
- // Open `fname` for random read and write, if file doesn't exist the file
814
- // will be created. On success, stores a pointer to the new file in
815
- // *result and returns OK. On failure returns non-OK.
816
- //
817
- // The returned file will only be accessed by one thread at a time.
818
701
  IOStatus NewRandomRWFile(const std::string& fname, const FileOptions& options,
819
702
  std::unique_ptr<FSRandomRWFile>* result,
820
703
  IODebugContext* dbg) override {
@@ -854,20 +737,6 @@ class EncryptedFileSystemImpl : public EncryptedFileSystem {
854
737
  return status;
855
738
  }
856
739
 
857
- // Store in *result the attributes of the children of the specified
858
- // directory.
859
- // In case the implementation lists the directory prior to iterating the
860
- // files
861
- // and files are concurrently deleted, the deleted files will be omitted
862
- // from
863
- // result.
864
- // The name attributes are relative to "dir".
865
- // Original contents of *results are dropped.
866
- // Returns OK if "dir" exists and "*result" contains its children.
867
- // NotFound if "dir" does not exist, the calling process does not
868
- // have
869
- // permission to access "dir", or if "dir" is invalid.
870
- // IOError if an IO Error was encountered
871
740
  IOStatus GetChildrenFileAttributes(const std::string& dir,
872
741
  const IOOptions& options,
873
742
  std::vector<FileAttributes>* result,
@@ -894,7 +763,6 @@ class EncryptedFileSystemImpl : public EncryptedFileSystem {
894
763
  return IOStatus::OK();
895
764
  }
896
765
 
897
- // Store the size of fname in *file_size.
898
766
  IOStatus GetFileSize(const std::string& fname, const IOOptions& options,
899
767
  uint64_t* file_size, IODebugContext* dbg) override {
900
768
  auto status =
@@ -940,16 +808,13 @@ std::shared_ptr<FileSystem> NewEncryptedFS(
940
808
  return nullptr;
941
809
  }
942
810
  }
943
- // Returns an Env that encrypts data when stored on disk and decrypts data when
944
- // read from disk.
811
+
945
812
  Env* NewEncryptedEnv(Env* base_env,
946
813
  const std::shared_ptr<EncryptionProvider>& provider) {
947
814
  return new CompositeEnvWrapper(
948
815
  base_env, NewEncryptedFS(base_env->GetFileSystem(), provider));
949
816
  }
950
817
 
951
- // Encrypt one or more (partial) blocks of data at the file offset.
952
- // Length of data is given in dataSize.
953
818
  Status BlockAccessCipherStream::Encrypt(uint64_t fileOffset, char* data,
954
819
  size_t dataSize) {
955
820
  // Calculate block index
@@ -968,7 +833,7 @@ Status BlockAccessCipherStream::Encrypt(uint64_t fileOffset, char* data,
968
833
  if (n != blockSize) {
969
834
  // We're not encrypting a full block.
970
835
  // Copy data to blockBuffer
971
- if (!blockBuffer.get()) {
836
+ if (!blockBuffer) {
972
837
  // Allocate buffer
973
838
  blockBuffer = std::unique_ptr<char[]>(new char[blockSize]);
974
839
  }
@@ -994,8 +859,6 @@ Status BlockAccessCipherStream::Encrypt(uint64_t fileOffset, char* data,
994
859
  }
995
860
  }
996
861
 
997
- // Decrypt one or more (partial) blocks of data at the file offset.
998
- // Length of data is given in dataSize.
999
862
  Status BlockAccessCipherStream::Decrypt(uint64_t fileOffset, char* data,
1000
863
  size_t dataSize) {
1001
864
  // Calculate block index
@@ -1014,7 +877,7 @@ Status BlockAccessCipherStream::Decrypt(uint64_t fileOffset, char* data,
1014
877
  if (n != blockSize) {
1015
878
  // We're not decrypting a full block.
1016
879
  // Copy data to blockBuffer
1017
- if (!blockBuffer.get()) {
880
+ if (!blockBuffer) {
1018
881
  // Allocate buffer
1019
882
  blockBuffer = std::unique_ptr<char[]>(new char[blockSize]);
1020
883
  }
@@ -1055,6 +918,7 @@ static std::unordered_map<std::string, OptionTypeInfo>
1055
918
  {0 /* No offset, whole struct*/, OptionType::kInt,
1056
919
  OptionVerificationType::kNormal, OptionTypeFlags::kNone}},
1057
920
  };
921
+
1058
922
  // Implements a BlockCipher using ROT13.
1059
923
  //
1060
924
  // Note: This is a sample implementation of BlockCipher,
@@ -1071,22 +935,17 @@ class ROT13BlockCipher : public BlockCipher {
1071
935
 
1072
936
  static const char* kClassName() { return "ROT13"; }
1073
937
  const char* Name() const override { return kClassName(); }
1074
- // BlockSize returns the size of each block supported by this cipher stream.
1075
- size_t BlockSize() override { return blockSize_; }
1076
938
 
1077
- // Encrypt a block of data.
1078
- // Length of data is equal to BlockSize().
939
+ size_t BlockSize() override { return blockSize_; }
1079
940
  Status Encrypt(char* data) override {
1080
941
  for (size_t i = 0; i < blockSize_; ++i) {
1081
942
  data[i] += 13;
1082
943
  }
1083
944
  return Status::OK();
1084
945
  }
1085
-
1086
- // Decrypt a block of data.
1087
- // Length of data is equal to BlockSize().
1088
946
  Status Decrypt(char* data) override { return Encrypt(data); }
1089
947
  };
948
+
1090
949
  static const std::unordered_map<std::string, OptionTypeInfo>
1091
950
  ctr_encryption_provider_type_info = {
1092
951
  {"cipher",
@@ -1096,14 +955,11 @@ static const std::unordered_map<std::string, OptionTypeInfo>
1096
955
  };
1097
956
  } // anonymous namespace
1098
957
 
1099
- // Allocate scratch space which is passed to EncryptBlock/DecryptBlock.
1100
958
  void CTRCipherStream::AllocateScratch(std::string& scratch) {
1101
959
  auto blockSize = cipher_->BlockSize();
1102
960
  scratch.reserve(blockSize);
1103
961
  }
1104
962
 
1105
- // Encrypt a block of data at the given block index.
1106
- // Length of data is equal to BlockSize();
1107
963
  Status CTRCipherStream::EncryptBlock(uint64_t blockIndex, char* data,
1108
964
  char* scratch) {
1109
965
  // Create nonce + counter
@@ -1111,7 +967,7 @@ Status CTRCipherStream::EncryptBlock(uint64_t blockIndex, char* data,
1111
967
  memmove(scratch, iv_.data(), blockSize);
1112
968
  EncodeFixed64(scratch, blockIndex + initialCounter_);
1113
969
 
1114
- // Encrypt nonce+counter
970
+ // Encrypt nonce + counter
1115
971
  auto status = cipher_->Encrypt(scratch);
1116
972
  if (!status.ok()) {
1117
973
  return status;
@@ -1124,8 +980,6 @@ Status CTRCipherStream::EncryptBlock(uint64_t blockIndex, char* data,
1124
980
  return Status::OK();
1125
981
  }
1126
982
 
1127
- // Decrypt a block of data at the given block index.
1128
- // Length of data is equal to BlockSize();
1129
983
  Status CTRCipherStream::DecryptBlock(uint64_t blockIndex, char* data,
1130
984
  char* scratch) {
1131
985
  // For CTR decryption & encryption are the same
@@ -1147,10 +1001,6 @@ bool CTREncryptionProvider::IsInstanceOf(const std::string& name) const {
1147
1001
  }
1148
1002
  }
1149
1003
 
1150
- // GetPrefixLength returns the length of the prefix that is added to every file
1151
- // and used for storing encryption options.
1152
- // For optimal performance, the prefix length should be a multiple of
1153
- // the page size.
1154
1004
  size_t CTREncryptionProvider::GetPrefixLength() const {
1155
1005
  return defaultPrefixLength;
1156
1006
  }
@@ -1179,8 +1029,6 @@ static void decodeCTRParameters(const char* prefix, size_t blockSize,
1179
1029
  iv = Slice(prefix + blockSize, blockSize);
1180
1030
  }
1181
1031
 
1182
- // CreateNewPrefix initialized an allocated block of prefix memory
1183
- // for a new file.
1184
1032
  Status CTREncryptionProvider::CreateNewPrefix(const std::string& /*fname*/,
1185
1033
  char* prefix,
1186
1034
  size_t prefixLength) const {
@@ -1212,10 +1060,8 @@ Status CTREncryptionProvider::CreateNewPrefix(const std::string& /*fname*/,
1212
1060
  status = cipherStream.Encrypt(0, prefix + (2 * blockSize),
1213
1061
  prefixLength - (2 * blockSize));
1214
1062
  }
1215
- if (!status.ok()) {
1216
- return status;
1217
- }
1218
- return Status::OK();
1063
+
1064
+ return status;
1219
1065
  }
1220
1066
 
1221
1067
  // PopulateSecretPrefixPart initializes the data into a new prefix block
@@ -1267,7 +1113,7 @@ Status CTREncryptionProvider::CreateCipherStream(
1267
1113
  }
1268
1114
 
1269
1115
  // CreateCipherStreamFromPrefix creates a block access cipher stream for a file
1270
- // given given name and options. The given prefix is already decrypted.
1116
+ // given name and options. The given prefix is already decrypted.
1271
1117
  Status CTREncryptionProvider::CreateCipherStreamFromPrefix(
1272
1118
  const std::string& /*fname*/, const EnvOptions& /*options*/,
1273
1119
  uint64_t initialCounter, const Slice& iv, const Slice& /*prefix*/,
@@ -27,19 +27,13 @@ class CTRCipherStream final : public BlockAccessCipherStream {
27
27
  : cipher_(c), iv_(iv, c->BlockSize()), initialCounter_(initialCounter){};
28
28
  virtual ~CTRCipherStream(){};
29
29
 
30
- // BlockSize returns the size of each block supported by this cipher stream.
31
30
  size_t BlockSize() override { return cipher_->BlockSize(); }
32
31
 
33
32
  protected:
34
- // Allocate scratch space which is passed to EncryptBlock/DecryptBlock.
35
33
  void AllocateScratch(std::string&) override;
36
34
 
37
- // Encrypt a block of data at the given block index.
38
- // Length of data is equal to BlockSize();
39
35
  Status EncryptBlock(uint64_t blockIndex, char* data, char* scratch) override;
40
36
 
41
- // Decrypt a block of data at the given block index.
42
- // Length of data is equal to BlockSize();
43
37
  Status DecryptBlock(uint64_t blockIndex, char* data, char* scratch) override;
44
38
  };
45
39
 
@@ -66,20 +60,9 @@ class CTREncryptionProvider : public EncryptionProvider {
66
60
  static const char* kClassName() { return "CTR"; }
67
61
  const char* Name() const override { return kClassName(); }
68
62
  bool IsInstanceOf(const std::string& name) const override;
69
- // GetPrefixLength returns the length of the prefix that is added to every
70
- // file
71
- // and used for storing encryption options.
72
- // For optimal performance when using direct IO, the prefix length should be a
73
- // multiple of the page size.
74
63
  size_t GetPrefixLength() const override;
75
-
76
- // CreateNewPrefix initialized an allocated block of prefix memory
77
- // for a new file.
78
64
  Status CreateNewPrefix(const std::string& fname, char* prefix,
79
65
  size_t prefixLength) const override;
80
-
81
- // CreateCipherStream creates a block access cipher stream for a file given
82
- // given name and options.
83
66
  Status CreateCipherStream(
84
67
  const std::string& fname, const EnvOptions& options, Slice& prefix,
85
68
  std::unique_ptr<BlockAccessCipherStream>* result) override;
@@ -330,12 +330,16 @@ class PosixEnv : public CompositeEnv {
330
330
  }
331
331
 
332
332
  Status GetHostName(char* name, uint64_t len) override {
333
- int ret = gethostname(name, static_cast<size_t>(len));
333
+ const size_t max_len = static_cast<size_t>(len);
334
+ int ret = gethostname(name, max_len);
334
335
  if (ret < 0) {
335
336
  if (errno == EFAULT || errno == EINVAL) {
336
337
  return Status::InvalidArgument(errnoStr(errno).c_str());
338
+ } else if (errno == ENAMETOOLONG) {
339
+ return IOError("GetHostName", std::string(name, strnlen(name, max_len)),
340
+ errno);
337
341
  } else {
338
- return IOError("GetHostName", name, errno);
342
+ return IOError("GetHostName", "", errno);
339
343
  }
340
344
  }
341
345
  return Status::OK();
@@ -3054,7 +3054,7 @@ TEST_F(EnvTest, PortGenerateRfcUuid) {
3054
3054
  VerifyRfcUuids(t.ids);
3055
3055
  }
3056
3056
 
3057
- // Test the atomic, linear generation of GenerateRawUuid
3057
+ // Test the atomic, linear generation of GenerateRawUniqueId
3058
3058
  TEST_F(EnvTest, GenerateRawUniqueId) {
3059
3059
  struct MyStressTest
3060
3060
  : public NoDuplicateMiniStressTest<uint64_pair_t, HashUint64Pair> {
@@ -3148,6 +3148,90 @@ TEST_F(EnvTest, SemiStructuredUniqueIdGenTestSmaller) {
3148
3148
  }
3149
3149
  }
3150
3150
 
3151
+ TEST_F(EnvTest, UnpredictableUniqueIdGenTest1) {
3152
+ // Must be thread safe and usable as a static.
3153
+ static UnpredictableUniqueIdGen gen;
3154
+
3155
+ struct MyStressTest
3156
+ : public NoDuplicateMiniStressTest<uint64_pair_t, HashUint64Pair> {
3157
+ uint64_pair_t Generate() override {
3158
+ uint64_pair_t p;
3159
+ gen.GenerateNext(&p.first, &p.second);
3160
+ return p;
3161
+ }
3162
+ };
3163
+
3164
+ MyStressTest t;
3165
+ t.Run();
3166
+ }
3167
+
3168
+ TEST_F(EnvTest, UnpredictableUniqueIdGenTest2) {
3169
+ // Even if we completely strip the seeding and entropy of the structure
3170
+ // down to a bare minimum, we still get quality pseudorandom results.
3171
+ static UnpredictableUniqueIdGen gen{
3172
+ UnpredictableUniqueIdGen::TEST_ZeroInitialized{}};
3173
+
3174
+ struct MyStressTest
3175
+ : public NoDuplicateMiniStressTest<uint64_pair_t, HashUint64Pair> {
3176
+ uint64_pair_t Generate() override {
3177
+ uint64_pair_t p;
3178
+ // No extra entropy is required to get quality pseudorandom results
3179
+ gen.GenerateNextWithEntropy(&p.first, &p.second, /*no extra entropy*/ 0);
3180
+ return p;
3181
+ }
3182
+ };
3183
+
3184
+ MyStressTest t;
3185
+ t.Run();
3186
+ }
3187
+
3188
+ TEST_F(EnvTest, UnpredictableUniqueIdGenTest3) {
3189
+ struct MyStressTest
3190
+ : public NoDuplicateMiniStressTest<uint64_pair_t, HashUint64Pair> {
3191
+ uint64_pair_t Generate() override {
3192
+ uint64_pair_t p;
3193
+ thread_local UnpredictableUniqueIdGen gen{
3194
+ UnpredictableUniqueIdGen::TEST_ZeroInitialized{}};
3195
+ // Even without the counter (reset it to thread id), we get quality
3196
+ // single-threaded results (because part of each result is fed back
3197
+ // into pool).
3198
+ gen.TEST_counter().store(Env::Default()->GetThreadID());
3199
+ gen.GenerateNext(&p.first, &p.second);
3200
+ return p;
3201
+ }
3202
+ };
3203
+
3204
+ MyStressTest t;
3205
+ t.Run();
3206
+ }
3207
+
3208
+ TEST_F(EnvTest, UnpredictableUniqueIdGenTest4) {
3209
+ struct MyStressTest
3210
+ : public NoDuplicateMiniStressTest<uint64_pair_t, HashUint64Pair> {
3211
+ uint64_pair_t Generate() override {
3212
+ uint64_pair_t p;
3213
+ // Even if we reset the state to thread ID each time, RDTSC instruction
3214
+ // suffices for quality single-threaded results.
3215
+ UnpredictableUniqueIdGen gen{
3216
+ UnpredictableUniqueIdGen::TEST_ZeroInitialized{}};
3217
+ gen.TEST_counter().store(Env::Default()->GetThreadID());
3218
+ gen.GenerateNext(&p.first, &p.second);
3219
+ return p;
3220
+ }
3221
+ };
3222
+
3223
+ MyStressTest t;
3224
+ #ifdef __SSE4_2__ // Our rough check for RDTSC
3225
+ t.Run();
3226
+ #else
3227
+ ROCKSDB_GTEST_BYPASS("Requires IA32 with RDTSC");
3228
+ // because nanosecond time might not be high enough fidelity to have
3229
+ // incremented after a few hundred instructions, especially in cases where
3230
+ // we really only have microsecond fidelity. Also, wall clock might not be
3231
+ // monotonic.
3232
+ #endif
3233
+ }
3234
+
3151
3235
  TEST_F(EnvTest, FailureToCreateLockFile) {
3152
3236
  auto env = Env::Default();
3153
3237
  auto fs = env->GetFileSystem();
@@ -3454,7 +3538,7 @@ IOStatus ReadAsyncRandomAccessFile::ReadAsync(
3454
3538
  }
3455
3539
  };
3456
3540
 
3457
- fs_.workers.emplace_back(submit_request, req);
3541
+ fs_.workers.emplace_back(submit_request, std::move(req));
3458
3542
  return IOStatus::OK();
3459
3543
  }
3460
3544
 
@@ -1183,11 +1183,13 @@ class PosixFileSystem : public FileSystem {
1183
1183
  #endif
1184
1184
  }
1185
1185
 
1186
- bool use_async_io() override {
1186
+ void SupportedOps(int64_t& supported_ops) override {
1187
+ supported_ops = 0;
1187
1188
  #if defined(ROCKSDB_IOURING_PRESENT)
1188
- return IsIOUringEnabled();
1189
- #else
1190
- return false;
1189
+ if (IsIOUringEnabled()) {
1190
+ // Underlying FS supports async_io
1191
+ supported_ops |= (1 << FSSupportedOps::kAsyncIO);
1192
+ }
1191
1193
  #endif
1192
1194
  }
1193
1195