rocksdb-native 2.6.2 → 2.6.4

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 (956) hide show
  1. package/CMakeLists.txt +29 -17
  2. package/binding.js +1 -1
  3. package/package.json +7 -4
  4. package/prebuilds/darwin-arm64/rocksdb-native.bare +0 -0
  5. package/prebuilds/darwin-arm64/rocksdb-native.node +0 -0
  6. package/prebuilds/darwin-x64/rocksdb-native.bare +0 -0
  7. package/prebuilds/darwin-x64/rocksdb-native.node +0 -0
  8. package/prebuilds/ios-arm64/rocksdb-native.bare +0 -0
  9. package/prebuilds/ios-arm64-simulator/rocksdb-native.bare +0 -0
  10. package/prebuilds/ios-x64-simulator/rocksdb-native.bare +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-arm64/rocksdb-native.bare +0 -0
  16. package/prebuilds/win32-arm64/rocksdb-native.node +0 -0
  17. package/prebuilds/win32-x64/rocksdb-native.bare +0 -0
  18. package/prebuilds/win32-x64/rocksdb-native.node +0 -0
  19. package/vendor/librocksdb/CMakeLists.txt +0 -94
  20. package/vendor/librocksdb/LICENSE +0 -201
  21. package/vendor/librocksdb/NOTICE +0 -13
  22. package/vendor/librocksdb/README.md +0 -11
  23. package/vendor/librocksdb/include/rocksdb.h +0 -294
  24. package/vendor/librocksdb/src/rocksdb.cc +0 -714
  25. package/vendor/librocksdb/vendor/rocksdb/CMakeLists.txt +0 -1642
  26. package/vendor/librocksdb/vendor/rocksdb/cache/cache.cc +0 -193
  27. package/vendor/librocksdb/vendor/rocksdb/cache/cache_bench.cc +0 -20
  28. package/vendor/librocksdb/vendor/rocksdb/cache/cache_bench_tool.cc +0 -1177
  29. package/vendor/librocksdb/vendor/rocksdb/cache/cache_entry_roles.cc +0 -104
  30. package/vendor/librocksdb/vendor/rocksdb/cache/cache_entry_roles.h +0 -20
  31. package/vendor/librocksdb/vendor/rocksdb/cache/cache_entry_stats.h +0 -182
  32. package/vendor/librocksdb/vendor/rocksdb/cache/cache_helpers.cc +0 -41
  33. package/vendor/librocksdb/vendor/rocksdb/cache/cache_helpers.h +0 -139
  34. package/vendor/librocksdb/vendor/rocksdb/cache/cache_key.cc +0 -364
  35. package/vendor/librocksdb/vendor/rocksdb/cache/cache_key.h +0 -143
  36. package/vendor/librocksdb/vendor/rocksdb/cache/cache_reservation_manager.cc +0 -184
  37. package/vendor/librocksdb/vendor/rocksdb/cache/cache_reservation_manager.h +0 -318
  38. package/vendor/librocksdb/vendor/rocksdb/cache/charged_cache.cc +0 -111
  39. package/vendor/librocksdb/vendor/rocksdb/cache/charged_cache.h +0 -61
  40. package/vendor/librocksdb/vendor/rocksdb/cache/clock_cache.cc +0 -3657
  41. package/vendor/librocksdb/vendor/rocksdb/cache/clock_cache.h +0 -1165
  42. package/vendor/librocksdb/vendor/rocksdb/cache/compressed_secondary_cache.cc +0 -414
  43. package/vendor/librocksdb/vendor/rocksdb/cache/compressed_secondary_cache.h +0 -151
  44. package/vendor/librocksdb/vendor/rocksdb/cache/lru_cache.cc +0 -726
  45. package/vendor/librocksdb/vendor/rocksdb/cache/lru_cache.h +0 -467
  46. package/vendor/librocksdb/vendor/rocksdb/cache/secondary_cache.cc +0 -12
  47. package/vendor/librocksdb/vendor/rocksdb/cache/secondary_cache_adapter.cc +0 -743
  48. package/vendor/librocksdb/vendor/rocksdb/cache/secondary_cache_adapter.h +0 -103
  49. package/vendor/librocksdb/vendor/rocksdb/cache/sharded_cache.cc +0 -147
  50. package/vendor/librocksdb/vendor/rocksdb/cache/sharded_cache.h +0 -322
  51. package/vendor/librocksdb/vendor/rocksdb/cache/tiered_secondary_cache.cc +0 -125
  52. package/vendor/librocksdb/vendor/rocksdb/cache/tiered_secondary_cache.h +0 -158
  53. package/vendor/librocksdb/vendor/rocksdb/cache/typed_cache.h +0 -380
  54. package/vendor/librocksdb/vendor/rocksdb/cmake/RocksDBConfig.cmake.in +0 -54
  55. package/vendor/librocksdb/vendor/rocksdb/db/arena_wrapped_db_iter.cc +0 -182
  56. package/vendor/librocksdb/vendor/rocksdb/db/arena_wrapped_db_iter.h +0 -128
  57. package/vendor/librocksdb/vendor/rocksdb/db/attribute_group_iterator_impl.cc +0 -20
  58. package/vendor/librocksdb/vendor/rocksdb/db/attribute_group_iterator_impl.h +0 -83
  59. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_constants.h +0 -16
  60. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_contents.cc +0 -42
  61. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_contents.h +0 -60
  62. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_counting_iterator.h +0 -150
  63. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_fetcher.cc +0 -34
  64. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_fetcher.h +0 -37
  65. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_file_addition.cc +0 -156
  66. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_file_addition.h +0 -67
  67. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_file_builder.cc +0 -429
  68. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_file_builder.h +0 -113
  69. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_file_cache.cc +0 -101
  70. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_file_cache.h +0 -56
  71. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_file_completion_callback.h +0 -84
  72. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_file_garbage.cc +0 -134
  73. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_file_garbage.h +0 -57
  74. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_file_meta.cc +0 -62
  75. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_file_meta.h +0 -170
  76. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_file_reader.cc +0 -622
  77. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_file_reader.h +0 -111
  78. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_garbage_meter.cc +0 -100
  79. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_garbage_meter.h +0 -102
  80. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_index.h +0 -187
  81. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_log_format.cc +0 -143
  82. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_log_format.h +0 -164
  83. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_log_sequential_reader.cc +0 -133
  84. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_log_sequential_reader.h +0 -83
  85. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_log_writer.cc +0 -207
  86. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_log_writer.h +0 -87
  87. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_read_request.h +0 -58
  88. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_source.cc +0 -459
  89. package/vendor/librocksdb/vendor/rocksdb/db/blob/blob_source.h +0 -161
  90. package/vendor/librocksdb/vendor/rocksdb/db/blob/prefetch_buffer_collection.cc +0 -23
  91. package/vendor/librocksdb/vendor/rocksdb/db/blob/prefetch_buffer_collection.h +0 -38
  92. package/vendor/librocksdb/vendor/rocksdb/db/builder.cc +0 -517
  93. package/vendor/librocksdb/vendor/rocksdb/db/builder.h +0 -76
  94. package/vendor/librocksdb/vendor/rocksdb/db/c.cc +0 -7133
  95. package/vendor/librocksdb/vendor/rocksdb/db/c_test.c +0 -4052
  96. package/vendor/librocksdb/vendor/rocksdb/db/coalescing_iterator.cc +0 -47
  97. package/vendor/librocksdb/vendor/rocksdb/db/coalescing_iterator.h +0 -79
  98. package/vendor/librocksdb/vendor/rocksdb/db/column_family.cc +0 -1859
  99. package/vendor/librocksdb/vendor/rocksdb/db/column_family.h +0 -918
  100. package/vendor/librocksdb/vendor/rocksdb/db/compaction/clipping_iterator.h +0 -281
  101. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction.cc +0 -995
  102. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction.h +0 -602
  103. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_iteration_stats.h +0 -56
  104. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_iterator.cc +0 -1523
  105. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_iterator.h +0 -557
  106. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_job.cc +0 -2155
  107. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_job.h +0 -520
  108. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_outputs.cc +0 -802
  109. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_outputs.h +0 -411
  110. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker.cc +0 -1245
  111. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker.h +0 -322
  112. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker_fifo.cc +0 -478
  113. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker_fifo.h +0 -61
  114. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker_level.cc +0 -977
  115. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker_level.h +0 -32
  116. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker_universal.cc +0 -1578
  117. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_picker_universal.h +0 -29
  118. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_service_job.cc +0 -835
  119. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_state.cc +0 -46
  120. package/vendor/librocksdb/vendor/rocksdb/db/compaction/compaction_state.h +0 -42
  121. package/vendor/librocksdb/vendor/rocksdb/db/compaction/file_pri.h +0 -94
  122. package/vendor/librocksdb/vendor/rocksdb/db/compaction/sst_partitioner.cc +0 -83
  123. package/vendor/librocksdb/vendor/rocksdb/db/compaction/subcompaction_state.cc +0 -106
  124. package/vendor/librocksdb/vendor/rocksdb/db/compaction/subcompaction_state.h +0 -220
  125. package/vendor/librocksdb/vendor/rocksdb/db/convenience.cc +0 -101
  126. package/vendor/librocksdb/vendor/rocksdb/db/convenience_impl.h +0 -15
  127. package/vendor/librocksdb/vendor/rocksdb/db/db_filesnapshot.cc +0 -506
  128. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/compacted_db_impl.cc +0 -275
  129. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/compacted_db_impl.h +0 -147
  130. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl.cc +0 -6767
  131. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl.h +0 -3056
  132. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_compaction_flush.cc +0 -4390
  133. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_debug.cc +0 -327
  134. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_experimental.cc +0 -164
  135. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_files.cc +0 -1032
  136. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_follower.cc +0 -348
  137. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_follower.h +0 -54
  138. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_open.cc +0 -2325
  139. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_readonly.cc +0 -376
  140. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_readonly.h +0 -179
  141. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_secondary.cc +0 -1025
  142. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_secondary.h +0 -322
  143. package/vendor/librocksdb/vendor/rocksdb/db/db_impl/db_impl_write.cc +0 -2624
  144. package/vendor/librocksdb/vendor/rocksdb/db/db_info_dumper.cc +0 -165
  145. package/vendor/librocksdb/vendor/rocksdb/db/db_info_dumper.h +0 -15
  146. package/vendor/librocksdb/vendor/rocksdb/db/db_iter.cc +0 -1774
  147. package/vendor/librocksdb/vendor/rocksdb/db/db_iter.h +0 -444
  148. package/vendor/librocksdb/vendor/rocksdb/db/db_test2.cc +0 -7839
  149. package/vendor/librocksdb/vendor/rocksdb/db/db_test_util.cc +0 -1800
  150. package/vendor/librocksdb/vendor/rocksdb/db/db_test_util.h +0 -1427
  151. package/vendor/librocksdb/vendor/rocksdb/db/db_with_timestamp_test_util.cc +0 -96
  152. package/vendor/librocksdb/vendor/rocksdb/db/db_with_timestamp_test_util.h +0 -126
  153. package/vendor/librocksdb/vendor/rocksdb/db/dbformat.cc +0 -282
  154. package/vendor/librocksdb/vendor/rocksdb/db/dbformat.h +0 -1101
  155. package/vendor/librocksdb/vendor/rocksdb/db/error_handler.cc +0 -806
  156. package/vendor/librocksdb/vendor/rocksdb/db/error_handler.h +0 -149
  157. package/vendor/librocksdb/vendor/rocksdb/db/event_helpers.cc +0 -332
  158. package/vendor/librocksdb/vendor/rocksdb/db/event_helpers.h +0 -78
  159. package/vendor/librocksdb/vendor/rocksdb/db/experimental.cc +0 -1212
  160. package/vendor/librocksdb/vendor/rocksdb/db/external_sst_file_ingestion_job.cc +0 -1249
  161. package/vendor/librocksdb/vendor/rocksdb/db/external_sst_file_ingestion_job.h +0 -268
  162. package/vendor/librocksdb/vendor/rocksdb/db/file_indexer.cc +0 -216
  163. package/vendor/librocksdb/vendor/rocksdb/db/file_indexer.h +0 -140
  164. package/vendor/librocksdb/vendor/rocksdb/db/flush_job.cc +0 -1217
  165. package/vendor/librocksdb/vendor/rocksdb/db/flush_job.h +0 -240
  166. package/vendor/librocksdb/vendor/rocksdb/db/flush_scheduler.cc +0 -86
  167. package/vendor/librocksdb/vendor/rocksdb/db/flush_scheduler.h +0 -55
  168. package/vendor/librocksdb/vendor/rocksdb/db/forward_iterator.cc +0 -1082
  169. package/vendor/librocksdb/vendor/rocksdb/db/forward_iterator.h +0 -166
  170. package/vendor/librocksdb/vendor/rocksdb/db/forward_iterator_bench.cc +0 -378
  171. package/vendor/librocksdb/vendor/rocksdb/db/history_trimming_iterator.h +0 -95
  172. package/vendor/librocksdb/vendor/rocksdb/db/import_column_family_job.cc +0 -463
  173. package/vendor/librocksdb/vendor/rocksdb/db/import_column_family_job.h +0 -91
  174. package/vendor/librocksdb/vendor/rocksdb/db/internal_stats.cc +0 -2198
  175. package/vendor/librocksdb/vendor/rocksdb/db/internal_stats.h +0 -896
  176. package/vendor/librocksdb/vendor/rocksdb/db/job_context.h +0 -254
  177. package/vendor/librocksdb/vendor/rocksdb/db/kv_checksum.h +0 -484
  178. package/vendor/librocksdb/vendor/rocksdb/db/log_format.h +0 -55
  179. package/vendor/librocksdb/vendor/rocksdb/db/log_reader.cc +0 -958
  180. package/vendor/librocksdb/vendor/rocksdb/db/log_reader.h +0 -245
  181. package/vendor/librocksdb/vendor/rocksdb/db/log_writer.cc +0 -355
  182. package/vendor/librocksdb/vendor/rocksdb/db/log_writer.h +0 -151
  183. package/vendor/librocksdb/vendor/rocksdb/db/logs_with_prep_tracker.cc +0 -67
  184. package/vendor/librocksdb/vendor/rocksdb/db/logs_with_prep_tracker.h +0 -62
  185. package/vendor/librocksdb/vendor/rocksdb/db/lookup_key.h +0 -68
  186. package/vendor/librocksdb/vendor/rocksdb/db/malloc_stats.cc +0 -52
  187. package/vendor/librocksdb/vendor/rocksdb/db/malloc_stats.h +0 -22
  188. package/vendor/librocksdb/vendor/rocksdb/db/memtable.cc +0 -1684
  189. package/vendor/librocksdb/vendor/rocksdb/db/memtable.h +0 -712
  190. package/vendor/librocksdb/vendor/rocksdb/db/memtable_list.cc +0 -1028
  191. package/vendor/librocksdb/vendor/rocksdb/db/memtable_list.h +0 -514
  192. package/vendor/librocksdb/vendor/rocksdb/db/merge_context.h +0 -150
  193. package/vendor/librocksdb/vendor/rocksdb/db/merge_helper.cc +0 -699
  194. package/vendor/librocksdb/vendor/rocksdb/db/merge_helper.h +0 -318
  195. package/vendor/librocksdb/vendor/rocksdb/db/merge_operator.cc +0 -167
  196. package/vendor/librocksdb/vendor/rocksdb/db/multi_cf_iterator_impl.h +0 -296
  197. package/vendor/librocksdb/vendor/rocksdb/db/output_validator.cc +0 -29
  198. package/vendor/librocksdb/vendor/rocksdb/db/output_validator.h +0 -45
  199. package/vendor/librocksdb/vendor/rocksdb/db/periodic_task_scheduler.cc +0 -110
  200. package/vendor/librocksdb/vendor/rocksdb/db/periodic_task_scheduler.h +0 -108
  201. package/vendor/librocksdb/vendor/rocksdb/db/pinned_iterators_manager.h +0 -92
  202. package/vendor/librocksdb/vendor/rocksdb/db/post_memtable_callback.h +0 -25
  203. package/vendor/librocksdb/vendor/rocksdb/db/pre_release_callback.h +0 -37
  204. package/vendor/librocksdb/vendor/rocksdb/db/range_del_aggregator.cc +0 -553
  205. package/vendor/librocksdb/vendor/rocksdb/db/range_del_aggregator.h +0 -481
  206. package/vendor/librocksdb/vendor/rocksdb/db/range_del_aggregator_bench.cc +0 -280
  207. package/vendor/librocksdb/vendor/rocksdb/db/range_tombstone_fragmenter.cc +0 -515
  208. package/vendor/librocksdb/vendor/rocksdb/db/range_tombstone_fragmenter.h +0 -361
  209. package/vendor/librocksdb/vendor/rocksdb/db/read_callback.h +0 -54
  210. package/vendor/librocksdb/vendor/rocksdb/db/repair.cc +0 -864
  211. package/vendor/librocksdb/vendor/rocksdb/db/seqno_to_time_mapping.cc +0 -573
  212. package/vendor/librocksdb/vendor/rocksdb/db/seqno_to_time_mapping.h +0 -307
  213. package/vendor/librocksdb/vendor/rocksdb/db/snapshot_checker.h +0 -58
  214. package/vendor/librocksdb/vendor/rocksdb/db/snapshot_impl.cc +0 -25
  215. package/vendor/librocksdb/vendor/rocksdb/db/snapshot_impl.h +0 -239
  216. package/vendor/librocksdb/vendor/rocksdb/db/table_cache.cc +0 -745
  217. package/vendor/librocksdb/vendor/rocksdb/db/table_cache.h +0 -298
  218. package/vendor/librocksdb/vendor/rocksdb/db/table_cache_sync_and_async.h +0 -135
  219. package/vendor/librocksdb/vendor/rocksdb/db/table_properties_collector.cc +0 -74
  220. package/vendor/librocksdb/vendor/rocksdb/db/table_properties_collector.h +0 -185
  221. package/vendor/librocksdb/vendor/rocksdb/db/transaction_log_impl.cc +0 -296
  222. package/vendor/librocksdb/vendor/rocksdb/db/transaction_log_impl.h +0 -128
  223. package/vendor/librocksdb/vendor/rocksdb/db/trim_history_scheduler.cc +0 -54
  224. package/vendor/librocksdb/vendor/rocksdb/db/trim_history_scheduler.h +0 -46
  225. package/vendor/librocksdb/vendor/rocksdb/db/version_builder.cc +0 -1431
  226. package/vendor/librocksdb/vendor/rocksdb/db/version_builder.h +0 -93
  227. package/vendor/librocksdb/vendor/rocksdb/db/version_edit.cc +0 -1119
  228. package/vendor/librocksdb/vendor/rocksdb/db/version_edit.h +0 -769
  229. package/vendor/librocksdb/vendor/rocksdb/db/version_edit_handler.cc +0 -1264
  230. package/vendor/librocksdb/vendor/rocksdb/db/version_edit_handler.h +0 -390
  231. package/vendor/librocksdb/vendor/rocksdb/db/version_set.cc +0 -7562
  232. package/vendor/librocksdb/vendor/rocksdb/db/version_set.h +0 -1799
  233. package/vendor/librocksdb/vendor/rocksdb/db/version_set_sync_and_async.h +0 -169
  234. package/vendor/librocksdb/vendor/rocksdb/db/version_util.h +0 -77
  235. package/vendor/librocksdb/vendor/rocksdb/db/wal_edit.cc +0 -211
  236. package/vendor/librocksdb/vendor/rocksdb/db/wal_edit.h +0 -177
  237. package/vendor/librocksdb/vendor/rocksdb/db/wal_manager.cc +0 -539
  238. package/vendor/librocksdb/vendor/rocksdb/db/wal_manager.h +0 -138
  239. package/vendor/librocksdb/vendor/rocksdb/db/wide/wide_column_serialization.cc +0 -166
  240. package/vendor/librocksdb/vendor/rocksdb/db/wide/wide_column_serialization.h +0 -57
  241. package/vendor/librocksdb/vendor/rocksdb/db/wide/wide_columns.cc +0 -22
  242. package/vendor/librocksdb/vendor/rocksdb/db/wide/wide_columns_helper.cc +0 -52
  243. package/vendor/librocksdb/vendor/rocksdb/db/wide/wide_columns_helper.h +0 -40
  244. package/vendor/librocksdb/vendor/rocksdb/db/write_batch.cc +0 -3394
  245. package/vendor/librocksdb/vendor/rocksdb/db/write_batch_base.cc +0 -94
  246. package/vendor/librocksdb/vendor/rocksdb/db/write_batch_internal.h +0 -408
  247. package/vendor/librocksdb/vendor/rocksdb/db/write_callback.h +0 -27
  248. package/vendor/librocksdb/vendor/rocksdb/db/write_controller.cc +0 -121
  249. package/vendor/librocksdb/vendor/rocksdb/db/write_controller.h +0 -148
  250. package/vendor/librocksdb/vendor/rocksdb/db/write_stall_stats.cc +0 -179
  251. package/vendor/librocksdb/vendor/rocksdb/db/write_stall_stats.h +0 -47
  252. package/vendor/librocksdb/vendor/rocksdb/db/write_thread.cc +0 -931
  253. package/vendor/librocksdb/vendor/rocksdb/db/write_thread.h +0 -498
  254. package/vendor/librocksdb/vendor/rocksdb/env/composite_env.cc +0 -534
  255. package/vendor/librocksdb/vendor/rocksdb/env/composite_env_wrapper.h +0 -399
  256. package/vendor/librocksdb/vendor/rocksdb/env/emulated_clock.h +0 -114
  257. package/vendor/librocksdb/vendor/rocksdb/env/env.cc +0 -1253
  258. package/vendor/librocksdb/vendor/rocksdb/env/env_chroot.cc +0 -149
  259. package/vendor/librocksdb/vendor/rocksdb/env/env_chroot.h +0 -55
  260. package/vendor/librocksdb/vendor/rocksdb/env/env_encryption.cc +0 -1192
  261. package/vendor/librocksdb/vendor/rocksdb/env/env_encryption_ctr.h +0 -97
  262. package/vendor/librocksdb/vendor/rocksdb/env/env_posix.cc +0 -530
  263. package/vendor/librocksdb/vendor/rocksdb/env/file_system.cc +0 -278
  264. package/vendor/librocksdb/vendor/rocksdb/env/file_system_tracer.cc +0 -564
  265. package/vendor/librocksdb/vendor/rocksdb/env/file_system_tracer.h +0 -461
  266. package/vendor/librocksdb/vendor/rocksdb/env/fs_on_demand.cc +0 -331
  267. package/vendor/librocksdb/vendor/rocksdb/env/fs_on_demand.h +0 -139
  268. package/vendor/librocksdb/vendor/rocksdb/env/fs_posix.cc +0 -1285
  269. package/vendor/librocksdb/vendor/rocksdb/env/fs_readonly.h +0 -105
  270. package/vendor/librocksdb/vendor/rocksdb/env/fs_remap.cc +0 -341
  271. package/vendor/librocksdb/vendor/rocksdb/env/fs_remap.h +0 -137
  272. package/vendor/librocksdb/vendor/rocksdb/env/io_posix.cc +0 -1738
  273. package/vendor/librocksdb/vendor/rocksdb/env/io_posix.h +0 -517
  274. package/vendor/librocksdb/vendor/rocksdb/env/mock_env.cc +0 -1058
  275. package/vendor/librocksdb/vendor/rocksdb/env/mock_env.h +0 -144
  276. package/vendor/librocksdb/vendor/rocksdb/env/unique_id_gen.cc +0 -243
  277. package/vendor/librocksdb/vendor/rocksdb/env/unique_id_gen.h +0 -119
  278. package/vendor/librocksdb/vendor/rocksdb/file/delete_scheduler.cc +0 -513
  279. package/vendor/librocksdb/vendor/rocksdb/file/delete_scheduler.h +0 -200
  280. package/vendor/librocksdb/vendor/rocksdb/file/file_prefetch_buffer.cc +0 -992
  281. package/vendor/librocksdb/vendor/rocksdb/file/file_prefetch_buffer.h +0 -629
  282. package/vendor/librocksdb/vendor/rocksdb/file/file_util.cc +0 -308
  283. package/vendor/librocksdb/vendor/rocksdb/file/file_util.h +0 -123
  284. package/vendor/librocksdb/vendor/rocksdb/file/filename.cc +0 -538
  285. package/vendor/librocksdb/vendor/rocksdb/file/filename.h +0 -186
  286. package/vendor/librocksdb/vendor/rocksdb/file/line_file_reader.cc +0 -73
  287. package/vendor/librocksdb/vendor/rocksdb/file/line_file_reader.h +0 -60
  288. package/vendor/librocksdb/vendor/rocksdb/file/random_access_file_reader.cc +0 -639
  289. package/vendor/librocksdb/vendor/rocksdb/file/random_access_file_reader.h +0 -197
  290. package/vendor/librocksdb/vendor/rocksdb/file/read_write_util.cc +0 -33
  291. package/vendor/librocksdb/vendor/rocksdb/file/read_write_util.h +0 -31
  292. package/vendor/librocksdb/vendor/rocksdb/file/readahead_file_info.h +0 -33
  293. package/vendor/librocksdb/vendor/rocksdb/file/readahead_raf.cc +0 -169
  294. package/vendor/librocksdb/vendor/rocksdb/file/readahead_raf.h +0 -29
  295. package/vendor/librocksdb/vendor/rocksdb/file/sequence_file_reader.cc +0 -324
  296. package/vendor/librocksdb/vendor/rocksdb/file/sequence_file_reader.h +0 -127
  297. package/vendor/librocksdb/vendor/rocksdb/file/sst_file_manager_impl.cc +0 -525
  298. package/vendor/librocksdb/vendor/rocksdb/file/sst_file_manager_impl.h +0 -220
  299. package/vendor/librocksdb/vendor/rocksdb/file/writable_file_writer.cc +0 -1007
  300. package/vendor/librocksdb/vendor/rocksdb/file/writable_file_writer.h +0 -370
  301. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/advanced_cache.h +0 -665
  302. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/advanced_options.h +0 -1101
  303. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/attribute_groups.h +0 -114
  304. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/block_cache_trace_writer.h +0 -149
  305. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/c.h +0 -3122
  306. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/cache.h +0 -579
  307. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/cache_bench_tool.h +0 -14
  308. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/cleanable.h +0 -128
  309. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/compaction_filter.h +0 -374
  310. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/compaction_job_stats.h +0 -112
  311. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/comparator.h +0 -231
  312. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/compression_type.h +0 -186
  313. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/concurrent_task_limiter.h +0 -51
  314. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/configurable.h +0 -390
  315. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/convenience.h +0 -466
  316. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/customizable.h +0 -229
  317. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/data_structure.h +0 -186
  318. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/db.h +0 -2174
  319. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/db_bench_tool.h +0 -11
  320. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/db_dump_tool.h +0 -43
  321. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/db_stress_tool.h +0 -11
  322. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/env.h +0 -1920
  323. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/env_encryption.h +0 -363
  324. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/experimental.h +0 -492
  325. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/file_checksum.h +0 -146
  326. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/file_system.h +0 -1961
  327. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/filter_policy.h +0 -211
  328. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/flush_block_policy.h +0 -75
  329. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/functor_wrapper.h +0 -56
  330. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/io_status.h +0 -244
  331. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/iostats_context.h +0 -98
  332. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/iterator.h +0 -104
  333. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/iterator_base.h +0 -90
  334. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/ldb_tool.h +0 -42
  335. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/listener.h +0 -869
  336. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/memory_allocator.h +0 -87
  337. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/memtablerep.h +0 -421
  338. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/merge_operator.h +0 -337
  339. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/metadata.h +0 -258
  340. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/options.h +0 -2339
  341. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/perf_context.h +0 -319
  342. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/perf_level.h +0 -39
  343. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/persistent_cache.h +0 -74
  344. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/port_defs.h +0 -26
  345. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/rate_limiter.h +0 -172
  346. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/rocksdb_namespace.h +0 -16
  347. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/secondary_cache.h +0 -220
  348. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/slice.h +0 -264
  349. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/slice_transform.h +0 -135
  350. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/snapshot.h +0 -53
  351. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/sst_dump_tool.h +0 -17
  352. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/sst_file_manager.h +0 -139
  353. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/sst_file_reader.h +0 -61
  354. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/sst_file_writer.h +0 -203
  355. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/sst_partitioner.h +0 -142
  356. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/statistics.h +0 -794
  357. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/stats_history.h +0 -70
  358. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/status.h +0 -609
  359. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/system_clock.h +0 -129
  360. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/table.h +0 -938
  361. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/table_properties.h +0 -380
  362. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/table_reader_caller.h +0 -41
  363. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/thread_status.h +0 -197
  364. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/threadpool.h +0 -67
  365. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/trace_reader_writer.h +0 -52
  366. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/trace_record.h +0 -248
  367. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/trace_record_result.h +0 -187
  368. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/transaction_log.h +0 -128
  369. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/types.h +0 -113
  370. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/unique_id.h +0 -55
  371. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/universal_compaction.h +0 -127
  372. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/user_write_callback.h +0 -29
  373. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/agg_merge.h +0 -138
  374. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/backup_engine.h +0 -689
  375. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/cache_dump_load.h +0 -144
  376. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/checkpoint.h +0 -65
  377. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/convenience.h +0 -10
  378. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/customizable_util.h +0 -321
  379. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/db_ttl.h +0 -70
  380. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/debug.h +0 -46
  381. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/env_mirror.h +0 -179
  382. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/info_log_finder.h +0 -19
  383. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/ldb_cmd.h +0 -338
  384. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/ldb_cmd_execute_result.h +0 -75
  385. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/leveldb_options.h +0 -145
  386. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/lua/rocks_lua_custom_library.h +0 -43
  387. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/lua/rocks_lua_util.h +0 -55
  388. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/memory_util.h +0 -48
  389. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/object_registry.h +0 -583
  390. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/optimistic_transaction_db.h +0 -129
  391. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/option_change_migration.h +0 -24
  392. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/options_type.h +0 -1222
  393. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/options_util.h +0 -105
  394. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/replayer.h +0 -85
  395. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/sim_cache.h +0 -92
  396. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/stackable_db.h +0 -593
  397. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/table_properties_collectors.h +0 -133
  398. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/transaction.h +0 -765
  399. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/transaction_db.h +0 -510
  400. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/transaction_db_mutex.h +0 -89
  401. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/types_util.h +0 -36
  402. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/utilities/write_batch_with_index.h +0 -402
  403. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/version.h +0 -43
  404. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/wal_filter.h +0 -111
  405. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/wide_columns.h +0 -303
  406. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/write_batch.h +0 -518
  407. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/write_batch_base.h +0 -165
  408. package/vendor/librocksdb/vendor/rocksdb/include/rocksdb/write_buffer_manager.h +0 -183
  409. package/vendor/librocksdb/vendor/rocksdb/logging/auto_roll_logger.cc +0 -366
  410. package/vendor/librocksdb/vendor/rocksdb/logging/auto_roll_logger.h +0 -165
  411. package/vendor/librocksdb/vendor/rocksdb/logging/env_logger.h +0 -195
  412. package/vendor/librocksdb/vendor/rocksdb/logging/event_logger.cc +0 -68
  413. package/vendor/librocksdb/vendor/rocksdb/logging/event_logger.h +0 -202
  414. package/vendor/librocksdb/vendor/rocksdb/logging/log_buffer.cc +0 -91
  415. package/vendor/librocksdb/vendor/rocksdb/logging/log_buffer.h +0 -57
  416. package/vendor/librocksdb/vendor/rocksdb/logging/logging.h +0 -62
  417. package/vendor/librocksdb/vendor/rocksdb/memory/allocator.h +0 -58
  418. package/vendor/librocksdb/vendor/rocksdb/memory/arena.cc +0 -170
  419. package/vendor/librocksdb/vendor/rocksdb/memory/arena.h +0 -146
  420. package/vendor/librocksdb/vendor/rocksdb/memory/concurrent_arena.cc +0 -45
  421. package/vendor/librocksdb/vendor/rocksdb/memory/concurrent_arena.h +0 -215
  422. package/vendor/librocksdb/vendor/rocksdb/memory/jemalloc_nodump_allocator.cc +0 -304
  423. package/vendor/librocksdb/vendor/rocksdb/memory/jemalloc_nodump_allocator.h +0 -99
  424. package/vendor/librocksdb/vendor/rocksdb/memory/memkind_kmem_allocator.cc +0 -44
  425. package/vendor/librocksdb/vendor/rocksdb/memory/memkind_kmem_allocator.h +0 -43
  426. package/vendor/librocksdb/vendor/rocksdb/memory/memory_allocator.cc +0 -81
  427. package/vendor/librocksdb/vendor/rocksdb/memory/memory_allocator_impl.h +0 -47
  428. package/vendor/librocksdb/vendor/rocksdb/memory/memory_usage.h +0 -38
  429. package/vendor/librocksdb/vendor/rocksdb/memtable/alloc_tracker.cc +0 -63
  430. package/vendor/librocksdb/vendor/rocksdb/memtable/hash_linklist_rep.cc +0 -925
  431. package/vendor/librocksdb/vendor/rocksdb/memtable/hash_skiplist_rep.cc +0 -392
  432. package/vendor/librocksdb/vendor/rocksdb/memtable/inlineskiplist.h +0 -1051
  433. package/vendor/librocksdb/vendor/rocksdb/memtable/memtablerep_bench.cc +0 -687
  434. package/vendor/librocksdb/vendor/rocksdb/memtable/skiplist.h +0 -498
  435. package/vendor/librocksdb/vendor/rocksdb/memtable/skiplistrep.cc +0 -368
  436. package/vendor/librocksdb/vendor/rocksdb/memtable/stl_wrappers.h +0 -33
  437. package/vendor/librocksdb/vendor/rocksdb/memtable/vectorrep.cc +0 -307
  438. package/vendor/librocksdb/vendor/rocksdb/memtable/write_buffer_manager.cc +0 -185
  439. package/vendor/librocksdb/vendor/rocksdb/monitoring/file_read_sample.h +0 -23
  440. package/vendor/librocksdb/vendor/rocksdb/monitoring/histogram.cc +0 -280
  441. package/vendor/librocksdb/vendor/rocksdb/monitoring/histogram.h +0 -143
  442. package/vendor/librocksdb/vendor/rocksdb/monitoring/histogram_windowing.cc +0 -198
  443. package/vendor/librocksdb/vendor/rocksdb/monitoring/histogram_windowing.h +0 -84
  444. package/vendor/librocksdb/vendor/rocksdb/monitoring/in_memory_stats_history.cc +0 -50
  445. package/vendor/librocksdb/vendor/rocksdb/monitoring/in_memory_stats_history.h +0 -74
  446. package/vendor/librocksdb/vendor/rocksdb/monitoring/instrumented_mutex.cc +0 -90
  447. package/vendor/librocksdb/vendor/rocksdb/monitoring/instrumented_mutex.h +0 -126
  448. package/vendor/librocksdb/vendor/rocksdb/monitoring/iostats_context.cc +0 -78
  449. package/vendor/librocksdb/vendor/rocksdb/monitoring/iostats_context_imp.h +0 -62
  450. package/vendor/librocksdb/vendor/rocksdb/monitoring/perf_context.cc +0 -317
  451. package/vendor/librocksdb/vendor/rocksdb/monitoring/perf_context_imp.h +0 -103
  452. package/vendor/librocksdb/vendor/rocksdb/monitoring/perf_level.cc +0 -23
  453. package/vendor/librocksdb/vendor/rocksdb/monitoring/perf_level_imp.h +0 -14
  454. package/vendor/librocksdb/vendor/rocksdb/monitoring/perf_step_timer.h +0 -77
  455. package/vendor/librocksdb/vendor/rocksdb/monitoring/persistent_stats_history.cc +0 -173
  456. package/vendor/librocksdb/vendor/rocksdb/monitoring/persistent_stats_history.h +0 -83
  457. package/vendor/librocksdb/vendor/rocksdb/monitoring/statistics.cc +0 -561
  458. package/vendor/librocksdb/vendor/rocksdb/monitoring/statistics_impl.h +0 -143
  459. package/vendor/librocksdb/vendor/rocksdb/monitoring/thread_status_impl.cc +0 -163
  460. package/vendor/librocksdb/vendor/rocksdb/monitoring/thread_status_updater.cc +0 -328
  461. package/vendor/librocksdb/vendor/rocksdb/monitoring/thread_status_updater.h +0 -226
  462. package/vendor/librocksdb/vendor/rocksdb/monitoring/thread_status_updater_debug.cc +0 -43
  463. package/vendor/librocksdb/vendor/rocksdb/monitoring/thread_status_util.cc +0 -214
  464. package/vendor/librocksdb/vendor/rocksdb/monitoring/thread_status_util.h +0 -139
  465. package/vendor/librocksdb/vendor/rocksdb/monitoring/thread_status_util_debug.cc +0 -60
  466. package/vendor/librocksdb/vendor/rocksdb/options/cf_options.cc +0 -1218
  467. package/vendor/librocksdb/vendor/rocksdb/options/cf_options.h +0 -352
  468. package/vendor/librocksdb/vendor/rocksdb/options/configurable.cc +0 -720
  469. package/vendor/librocksdb/vendor/rocksdb/options/configurable_helper.h +0 -185
  470. package/vendor/librocksdb/vendor/rocksdb/options/configurable_test.h +0 -116
  471. package/vendor/librocksdb/vendor/rocksdb/options/customizable.cc +0 -133
  472. package/vendor/librocksdb/vendor/rocksdb/options/db_options.cc +0 -1113
  473. package/vendor/librocksdb/vendor/rocksdb/options/db_options.h +0 -160
  474. package/vendor/librocksdb/vendor/rocksdb/options/offpeak_time_info.cc +0 -59
  475. package/vendor/librocksdb/vendor/rocksdb/options/offpeak_time_info.h +0 -37
  476. package/vendor/librocksdb/vendor/rocksdb/options/options.cc +0 -717
  477. package/vendor/librocksdb/vendor/rocksdb/options/options_helper.cc +0 -1438
  478. package/vendor/librocksdb/vendor/rocksdb/options/options_helper.h +0 -115
  479. package/vendor/librocksdb/vendor/rocksdb/options/options_parser.cc +0 -745
  480. package/vendor/librocksdb/vendor/rocksdb/options/options_parser.h +0 -151
  481. package/vendor/librocksdb/vendor/rocksdb/port/jemalloc_helper.h +0 -107
  482. package/vendor/librocksdb/vendor/rocksdb/port/lang.h +0 -97
  483. package/vendor/librocksdb/vendor/rocksdb/port/likely.h +0 -18
  484. package/vendor/librocksdb/vendor/rocksdb/port/malloc.h +0 -17
  485. package/vendor/librocksdb/vendor/rocksdb/port/mmap.cc +0 -98
  486. package/vendor/librocksdb/vendor/rocksdb/port/mmap.h +0 -90
  487. package/vendor/librocksdb/vendor/rocksdb/port/port.h +0 -21
  488. package/vendor/librocksdb/vendor/rocksdb/port/port_dirent.h +0 -44
  489. package/vendor/librocksdb/vendor/rocksdb/port/port_example.h +0 -101
  490. package/vendor/librocksdb/vendor/rocksdb/port/port_posix.cc +0 -300
  491. package/vendor/librocksdb/vendor/rocksdb/port/port_posix.h +0 -246
  492. package/vendor/librocksdb/vendor/rocksdb/port/stack_trace.cc +0 -418
  493. package/vendor/librocksdb/vendor/rocksdb/port/stack_trace.h +0 -31
  494. package/vendor/librocksdb/vendor/rocksdb/port/sys_time.h +0 -63
  495. package/vendor/librocksdb/vendor/rocksdb/port/util_logger.h +0 -18
  496. package/vendor/librocksdb/vendor/rocksdb/port/win/env_default.cc +0 -45
  497. package/vendor/librocksdb/vendor/rocksdb/port/win/env_win.cc +0 -1436
  498. package/vendor/librocksdb/vendor/rocksdb/port/win/env_win.h +0 -305
  499. package/vendor/librocksdb/vendor/rocksdb/port/win/io_win.cc +0 -1101
  500. package/vendor/librocksdb/vendor/rocksdb/port/win/io_win.h +0 -504
  501. package/vendor/librocksdb/vendor/rocksdb/port/win/port_win.cc +0 -305
  502. package/vendor/librocksdb/vendor/rocksdb/port/win/port_win.h +0 -382
  503. package/vendor/librocksdb/vendor/rocksdb/port/win/win_jemalloc.cc +0 -80
  504. package/vendor/librocksdb/vendor/rocksdb/port/win/win_logger.cc +0 -192
  505. package/vendor/librocksdb/vendor/rocksdb/port/win/win_logger.h +0 -64
  506. package/vendor/librocksdb/vendor/rocksdb/port/win/win_thread.cc +0 -170
  507. package/vendor/librocksdb/vendor/rocksdb/port/win/win_thread.h +0 -117
  508. package/vendor/librocksdb/vendor/rocksdb/port/win/xpress_win.cc +0 -210
  509. package/vendor/librocksdb/vendor/rocksdb/port/win/xpress_win.h +0 -26
  510. package/vendor/librocksdb/vendor/rocksdb/port/xpress.h +0 -17
  511. package/vendor/librocksdb/vendor/rocksdb/rocksdb.pc.in +0 -10
  512. package/vendor/librocksdb/vendor/rocksdb/table/adaptive/adaptive_table_factory.cc +0 -119
  513. package/vendor/librocksdb/vendor/rocksdb/table/adaptive/adaptive_table_factory.h +0 -56
  514. package/vendor/librocksdb/vendor/rocksdb/table/block_based/binary_search_index_reader.cc +0 -73
  515. package/vendor/librocksdb/vendor/rocksdb/table/block_based/binary_search_index_reader.h +0 -48
  516. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block.cc +0 -1341
  517. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block.h +0 -969
  518. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_builder.cc +0 -2148
  519. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_builder.h +0 -208
  520. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_factory.cc +0 -980
  521. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_factory.h +0 -102
  522. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_iterator.cc +0 -893
  523. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_iterator.h +0 -445
  524. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader.cc +0 -3296
  525. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader.h +0 -785
  526. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader_impl.h +0 -205
  527. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +0 -819
  528. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_builder.cc +0 -266
  529. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_builder.h +0 -128
  530. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_cache.cc +0 -108
  531. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_cache.h +0 -190
  532. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_prefetcher.cc +0 -158
  533. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_prefetcher.h +0 -74
  534. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_prefix_index.cc +0 -226
  535. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_prefix_index.h +0 -70
  536. package/vendor/librocksdb/vendor/rocksdb/table/block_based/block_type.h +0 -34
  537. package/vendor/librocksdb/vendor/rocksdb/table/block_based/cachable_entry.h +0 -249
  538. package/vendor/librocksdb/vendor/rocksdb/table/block_based/data_block_footer.cc +0 -59
  539. package/vendor/librocksdb/vendor/rocksdb/table/block_based/data_block_footer.h +0 -25
  540. package/vendor/librocksdb/vendor/rocksdb/table/block_based/data_block_hash_index.cc +0 -94
  541. package/vendor/librocksdb/vendor/rocksdb/table/block_based/data_block_hash_index.h +0 -137
  542. package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_block.h +0 -189
  543. package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_block_reader_common.cc +0 -169
  544. package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_block_reader_common.h +0 -79
  545. package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_policy.cc +0 -1989
  546. package/vendor/librocksdb/vendor/rocksdb/table/block_based/filter_policy_internal.h +0 -341
  547. package/vendor/librocksdb/vendor/rocksdb/table/block_based/flush_block_policy.cc +0 -132
  548. package/vendor/librocksdb/vendor/rocksdb/table/block_based/flush_block_policy_impl.h +0 -40
  549. package/vendor/librocksdb/vendor/rocksdb/table/block_based/full_filter_block.cc +0 -297
  550. package/vendor/librocksdb/vendor/rocksdb/table/block_based/full_filter_block.h +0 -142
  551. package/vendor/librocksdb/vendor/rocksdb/table/block_based/hash_index_reader.cc +0 -146
  552. package/vendor/librocksdb/vendor/rocksdb/table/block_based/hash_index_reader.h +0 -49
  553. package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_builder.cc +0 -305
  554. package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_builder.h +0 -534
  555. package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_reader_common.cc +0 -62
  556. package/vendor/librocksdb/vendor/rocksdb/table/block_based/index_reader_common.h +0 -94
  557. package/vendor/librocksdb/vendor/rocksdb/table/block_based/mock_block_based_table.h +0 -62
  558. package/vendor/librocksdb/vendor/rocksdb/table/block_based/parsed_full_filter_block.cc +0 -23
  559. package/vendor/librocksdb/vendor/rocksdb/table/block_based/parsed_full_filter_block.h +0 -47
  560. package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_filter_block.cc +0 -610
  561. package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_filter_block.h +0 -188
  562. package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_index_iterator.cc +0 -164
  563. package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_index_iterator.h +0 -160
  564. package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_index_reader.cc +0 -264
  565. package/vendor/librocksdb/vendor/rocksdb/table/block_based/partitioned_index_reader.h +0 -58
  566. package/vendor/librocksdb/vendor/rocksdb/table/block_based/reader_common.cc +0 -64
  567. package/vendor/librocksdb/vendor/rocksdb/table/block_based/reader_common.h +0 -36
  568. package/vendor/librocksdb/vendor/rocksdb/table/block_based/uncompression_dict_reader.cc +0 -118
  569. package/vendor/librocksdb/vendor/rocksdb/table/block_based/uncompression_dict_reader.h +0 -60
  570. package/vendor/librocksdb/vendor/rocksdb/table/block_fetcher.cc +0 -458
  571. package/vendor/librocksdb/vendor/rocksdb/table/block_fetcher.h +0 -168
  572. package/vendor/librocksdb/vendor/rocksdb/table/compaction_merging_iterator.cc +0 -370
  573. package/vendor/librocksdb/vendor/rocksdb/table/compaction_merging_iterator.h +0 -45
  574. package/vendor/librocksdb/vendor/rocksdb/table/cuckoo/cuckoo_table_builder.cc +0 -555
  575. package/vendor/librocksdb/vendor/rocksdb/table/cuckoo/cuckoo_table_builder.h +0 -136
  576. package/vendor/librocksdb/vendor/rocksdb/table/cuckoo/cuckoo_table_factory.cc +0 -100
  577. package/vendor/librocksdb/vendor/rocksdb/table/cuckoo/cuckoo_table_factory.h +0 -80
  578. package/vendor/librocksdb/vendor/rocksdb/table/cuckoo/cuckoo_table_reader.cc +0 -416
  579. package/vendor/librocksdb/vendor/rocksdb/table/cuckoo/cuckoo_table_reader.h +0 -100
  580. package/vendor/librocksdb/vendor/rocksdb/table/format.cc +0 -708
  581. package/vendor/librocksdb/vendor/rocksdb/table/format.h +0 -439
  582. package/vendor/librocksdb/vendor/rocksdb/table/get_context.cc +0 -622
  583. package/vendor/librocksdb/vendor/rocksdb/table/get_context.h +0 -259
  584. package/vendor/librocksdb/vendor/rocksdb/table/internal_iterator.h +0 -242
  585. package/vendor/librocksdb/vendor/rocksdb/table/iter_heap.h +0 -44
  586. package/vendor/librocksdb/vendor/rocksdb/table/iterator.cc +0 -134
  587. package/vendor/librocksdb/vendor/rocksdb/table/iterator_wrapper.h +0 -225
  588. package/vendor/librocksdb/vendor/rocksdb/table/merging_iterator.cc +0 -1755
  589. package/vendor/librocksdb/vendor/rocksdb/table/merging_iterator.h +0 -100
  590. package/vendor/librocksdb/vendor/rocksdb/table/meta_blocks.cc +0 -590
  591. package/vendor/librocksdb/vendor/rocksdb/table/meta_blocks.h +0 -181
  592. package/vendor/librocksdb/vendor/rocksdb/table/mock_table.cc +0 -355
  593. package/vendor/librocksdb/vendor/rocksdb/table/mock_table.h +0 -92
  594. package/vendor/librocksdb/vendor/rocksdb/table/multiget_context.h +0 -405
  595. package/vendor/librocksdb/vendor/rocksdb/table/persistent_cache_helper.cc +0 -110
  596. package/vendor/librocksdb/vendor/rocksdb/table/persistent_cache_helper.h +0 -46
  597. package/vendor/librocksdb/vendor/rocksdb/table/persistent_cache_options.h +0 -34
  598. package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_bloom.cc +0 -78
  599. package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_bloom.h +0 -132
  600. package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_builder.cc +0 -348
  601. package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_builder.h +0 -151
  602. package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_factory.cc +0 -295
  603. package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_factory.h +0 -180
  604. package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_index.cc +0 -211
  605. package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_index.h +0 -246
  606. package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_key_coding.cc +0 -508
  607. package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_key_coding.h +0 -199
  608. package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_reader.cc +0 -778
  609. package/vendor/librocksdb/vendor/rocksdb/table/plain/plain_table_reader.h +0 -243
  610. package/vendor/librocksdb/vendor/rocksdb/table/sst_file_dumper.cc +0 -601
  611. package/vendor/librocksdb/vendor/rocksdb/table/sst_file_dumper.h +0 -104
  612. package/vendor/librocksdb/vendor/rocksdb/table/sst_file_reader.cc +0 -166
  613. package/vendor/librocksdb/vendor/rocksdb/table/sst_file_writer.cc +0 -536
  614. package/vendor/librocksdb/vendor/rocksdb/table/sst_file_writer_collectors.h +0 -97
  615. package/vendor/librocksdb/vendor/rocksdb/table/table_builder.h +0 -239
  616. package/vendor/librocksdb/vendor/rocksdb/table/table_factory.cc +0 -52
  617. package/vendor/librocksdb/vendor/rocksdb/table/table_iterator.h +0 -69
  618. package/vendor/librocksdb/vendor/rocksdb/table/table_properties.cc +0 -357
  619. package/vendor/librocksdb/vendor/rocksdb/table/table_properties_internal.h +0 -14
  620. package/vendor/librocksdb/vendor/rocksdb/table/table_reader.h +0 -202
  621. package/vendor/librocksdb/vendor/rocksdb/table/table_reader_bench.cc +0 -341
  622. package/vendor/librocksdb/vendor/rocksdb/table/two_level_iterator.cc +0 -222
  623. package/vendor/librocksdb/vendor/rocksdb/table/two_level_iterator.h +0 -43
  624. package/vendor/librocksdb/vendor/rocksdb/table/unique_id.cc +0 -223
  625. package/vendor/librocksdb/vendor/rocksdb/table/unique_id_impl.h +0 -93
  626. package/vendor/librocksdb/vendor/rocksdb/test_util/mock_time_env.cc +0 -38
  627. package/vendor/librocksdb/vendor/rocksdb/test_util/mock_time_env.h +0 -109
  628. package/vendor/librocksdb/vendor/rocksdb/test_util/secondary_cache_test_util.cc +0 -93
  629. package/vendor/librocksdb/vendor/rocksdb/test_util/secondary_cache_test_util.h +0 -131
  630. package/vendor/librocksdb/vendor/rocksdb/test_util/sync_point.cc +0 -82
  631. package/vendor/librocksdb/vendor/rocksdb/test_util/sync_point.h +0 -182
  632. package/vendor/librocksdb/vendor/rocksdb/test_util/sync_point_impl.cc +0 -152
  633. package/vendor/librocksdb/vendor/rocksdb/test_util/sync_point_impl.h +0 -96
  634. package/vendor/librocksdb/vendor/rocksdb/test_util/testharness.cc +0 -105
  635. package/vendor/librocksdb/vendor/rocksdb/test_util/testharness.h +0 -124
  636. package/vendor/librocksdb/vendor/rocksdb/test_util/testutil.cc +0 -776
  637. package/vendor/librocksdb/vendor/rocksdb/test_util/testutil.h +0 -908
  638. package/vendor/librocksdb/vendor/rocksdb/test_util/transaction_test_util.cc +0 -400
  639. package/vendor/librocksdb/vendor/rocksdb/test_util/transaction_test_util.h +0 -147
  640. package/vendor/librocksdb/vendor/rocksdb/tools/CMakeLists.txt +0 -30
  641. package/vendor/librocksdb/vendor/rocksdb/tools/blob_dump.cc +0 -103
  642. package/vendor/librocksdb/vendor/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer.cc +0 -2331
  643. package/vendor/librocksdb/vendor/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer.h +0 -398
  644. package/vendor/librocksdb/vendor/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer_tool.cc +0 -17
  645. package/vendor/librocksdb/vendor/rocksdb/tools/db_bench.cc +0 -21
  646. package/vendor/librocksdb/vendor/rocksdb/tools/db_bench_tool.cc +0 -8743
  647. package/vendor/librocksdb/vendor/rocksdb/tools/db_repl_stress.cc +0 -132
  648. package/vendor/librocksdb/vendor/rocksdb/tools/dump/db_dump_tool.cc +0 -264
  649. package/vendor/librocksdb/vendor/rocksdb/tools/dump/rocksdb_dump.cc +0 -60
  650. package/vendor/librocksdb/vendor/rocksdb/tools/dump/rocksdb_undump.cc +0 -59
  651. package/vendor/librocksdb/vendor/rocksdb/tools/io_tracer_parser.cc +0 -17
  652. package/vendor/librocksdb/vendor/rocksdb/tools/io_tracer_parser_tool.cc +0 -142
  653. package/vendor/librocksdb/vendor/rocksdb/tools/io_tracer_parser_tool.h +0 -38
  654. package/vendor/librocksdb/vendor/rocksdb/tools/ldb.cc +0 -13
  655. package/vendor/librocksdb/vendor/rocksdb/tools/ldb_cmd.cc +0 -5044
  656. package/vendor/librocksdb/vendor/rocksdb/tools/ldb_cmd_impl.h +0 -814
  657. package/vendor/librocksdb/vendor/rocksdb/tools/ldb_tool.cc +0 -192
  658. package/vendor/librocksdb/vendor/rocksdb/tools/simulated_hybrid_file_system.cc +0 -244
  659. package/vendor/librocksdb/vendor/rocksdb/tools/simulated_hybrid_file_system.h +0 -124
  660. package/vendor/librocksdb/vendor/rocksdb/tools/sst_dump.cc +0 -12
  661. package/vendor/librocksdb/vendor/rocksdb/tools/sst_dump_tool.cc +0 -588
  662. package/vendor/librocksdb/vendor/rocksdb/tools/trace_analyzer.cc +0 -17
  663. package/vendor/librocksdb/vendor/rocksdb/tools/trace_analyzer_tool.cc +0 -1935
  664. package/vendor/librocksdb/vendor/rocksdb/tools/trace_analyzer_tool.h +0 -329
  665. package/vendor/librocksdb/vendor/rocksdb/tools/write_stress.cc +0 -305
  666. package/vendor/librocksdb/vendor/rocksdb/trace_replay/block_cache_tracer.cc +0 -509
  667. package/vendor/librocksdb/vendor/rocksdb/trace_replay/block_cache_tracer.h +0 -239
  668. package/vendor/librocksdb/vendor/rocksdb/trace_replay/io_tracer.cc +0 -303
  669. package/vendor/librocksdb/vendor/rocksdb/trace_replay/io_tracer.h +0 -185
  670. package/vendor/librocksdb/vendor/rocksdb/trace_replay/trace_record.cc +0 -206
  671. package/vendor/librocksdb/vendor/rocksdb/trace_replay/trace_record_handler.cc +0 -190
  672. package/vendor/librocksdb/vendor/rocksdb/trace_replay/trace_record_handler.h +0 -46
  673. package/vendor/librocksdb/vendor/rocksdb/trace_replay/trace_record_result.cc +0 -146
  674. package/vendor/librocksdb/vendor/rocksdb/trace_replay/trace_replay.cc +0 -632
  675. package/vendor/librocksdb/vendor/rocksdb/trace_replay/trace_replay.h +0 -184
  676. package/vendor/librocksdb/vendor/rocksdb/util/aligned_buffer.h +0 -235
  677. package/vendor/librocksdb/vendor/rocksdb/util/aligned_storage.h +0 -24
  678. package/vendor/librocksdb/vendor/rocksdb/util/async_file_reader.cc +0 -84
  679. package/vendor/librocksdb/vendor/rocksdb/util/async_file_reader.h +0 -144
  680. package/vendor/librocksdb/vendor/rocksdb/util/atomic.h +0 -111
  681. package/vendor/librocksdb/vendor/rocksdb/util/autovector.h +0 -397
  682. package/vendor/librocksdb/vendor/rocksdb/util/bloom_impl.h +0 -489
  683. package/vendor/librocksdb/vendor/rocksdb/util/build_version.cc.in +0 -79
  684. package/vendor/librocksdb/vendor/rocksdb/util/cast_util.h +0 -88
  685. package/vendor/librocksdb/vendor/rocksdb/util/channel.h +0 -69
  686. package/vendor/librocksdb/vendor/rocksdb/util/cleanable.cc +0 -181
  687. package/vendor/librocksdb/vendor/rocksdb/util/coding.cc +0 -90
  688. package/vendor/librocksdb/vendor/rocksdb/util/coding.h +0 -385
  689. package/vendor/librocksdb/vendor/rocksdb/util/coding_lean.h +0 -101
  690. package/vendor/librocksdb/vendor/rocksdb/util/compaction_job_stats_impl.cc +0 -94
  691. package/vendor/librocksdb/vendor/rocksdb/util/comparator.cc +0 -443
  692. package/vendor/librocksdb/vendor/rocksdb/util/compression.cc +0 -122
  693. package/vendor/librocksdb/vendor/rocksdb/util/compression.h +0 -1879
  694. package/vendor/librocksdb/vendor/rocksdb/util/compression_context_cache.cc +0 -106
  695. package/vendor/librocksdb/vendor/rocksdb/util/compression_context_cache.h +0 -47
  696. package/vendor/librocksdb/vendor/rocksdb/util/concurrent_task_limiter_impl.cc +0 -64
  697. package/vendor/librocksdb/vendor/rocksdb/util/concurrent_task_limiter_impl.h +0 -67
  698. package/vendor/librocksdb/vendor/rocksdb/util/core_local.h +0 -85
  699. package/vendor/librocksdb/vendor/rocksdb/util/coro_utils.h +0 -112
  700. package/vendor/librocksdb/vendor/rocksdb/util/crc32c.cc +0 -1295
  701. package/vendor/librocksdb/vendor/rocksdb/util/crc32c.h +0 -56
  702. package/vendor/librocksdb/vendor/rocksdb/util/crc32c_arm64.cc +0 -213
  703. package/vendor/librocksdb/vendor/rocksdb/util/crc32c_arm64.h +0 -51
  704. package/vendor/librocksdb/vendor/rocksdb/util/crc32c_ppc.c +0 -94
  705. package/vendor/librocksdb/vendor/rocksdb/util/crc32c_ppc.h +0 -21
  706. package/vendor/librocksdb/vendor/rocksdb/util/crc32c_ppc_asm.S +0 -756
  707. package/vendor/librocksdb/vendor/rocksdb/util/crc32c_ppc_constants.h +0 -900
  708. package/vendor/librocksdb/vendor/rocksdb/util/data_structure.cc +0 -16
  709. package/vendor/librocksdb/vendor/rocksdb/util/defer.h +0 -82
  710. package/vendor/librocksdb/vendor/rocksdb/util/distributed_mutex.h +0 -50
  711. package/vendor/librocksdb/vendor/rocksdb/util/duplicate_detector.h +0 -69
  712. package/vendor/librocksdb/vendor/rocksdb/util/dynamic_bloom.cc +0 -70
  713. package/vendor/librocksdb/vendor/rocksdb/util/dynamic_bloom.h +0 -214
  714. package/vendor/librocksdb/vendor/rocksdb/util/fastrange.h +0 -114
  715. package/vendor/librocksdb/vendor/rocksdb/util/file_checksum_helper.cc +0 -170
  716. package/vendor/librocksdb/vendor/rocksdb/util/file_checksum_helper.h +0 -101
  717. package/vendor/librocksdb/vendor/rocksdb/util/filter_bench.cc +0 -840
  718. package/vendor/librocksdb/vendor/rocksdb/util/gflags_compat.h +0 -29
  719. package/vendor/librocksdb/vendor/rocksdb/util/hash.cc +0 -201
  720. package/vendor/librocksdb/vendor/rocksdb/util/hash.h +0 -141
  721. package/vendor/librocksdb/vendor/rocksdb/util/hash128.h +0 -26
  722. package/vendor/librocksdb/vendor/rocksdb/util/hash_containers.h +0 -51
  723. package/vendor/librocksdb/vendor/rocksdb/util/hash_map.h +0 -67
  724. package/vendor/librocksdb/vendor/rocksdb/util/heap.h +0 -174
  725. package/vendor/librocksdb/vendor/rocksdb/util/kv_map.h +0 -33
  726. package/vendor/librocksdb/vendor/rocksdb/util/log_write_bench.cc +0 -88
  727. package/vendor/librocksdb/vendor/rocksdb/util/math.h +0 -351
  728. package/vendor/librocksdb/vendor/rocksdb/util/math128.h +0 -338
  729. package/vendor/librocksdb/vendor/rocksdb/util/murmurhash.cc +0 -196
  730. package/vendor/librocksdb/vendor/rocksdb/util/murmurhash.h +0 -43
  731. package/vendor/librocksdb/vendor/rocksdb/util/mutexlock.h +0 -189
  732. package/vendor/librocksdb/vendor/rocksdb/util/overload.h +0 -23
  733. package/vendor/librocksdb/vendor/rocksdb/util/ppc-opcode.h +0 -27
  734. package/vendor/librocksdb/vendor/rocksdb/util/random.cc +0 -63
  735. package/vendor/librocksdb/vendor/rocksdb/util/random.h +0 -190
  736. package/vendor/librocksdb/vendor/rocksdb/util/rate_limiter.cc +0 -391
  737. package/vendor/librocksdb/vendor/rocksdb/util/rate_limiter_impl.h +0 -156
  738. package/vendor/librocksdb/vendor/rocksdb/util/repeatable_thread.h +0 -149
  739. package/vendor/librocksdb/vendor/rocksdb/util/ribbon_alg.h +0 -1225
  740. package/vendor/librocksdb/vendor/rocksdb/util/ribbon_config.cc +0 -498
  741. package/vendor/librocksdb/vendor/rocksdb/util/ribbon_config.h +0 -182
  742. package/vendor/librocksdb/vendor/rocksdb/util/ribbon_impl.h +0 -1137
  743. package/vendor/librocksdb/vendor/rocksdb/util/set_comparator.h +0 -24
  744. package/vendor/librocksdb/vendor/rocksdb/util/single_thread_executor.h +0 -57
  745. package/vendor/librocksdb/vendor/rocksdb/util/slice.cc +0 -366
  746. package/vendor/librocksdb/vendor/rocksdb/util/status.cc +0 -163
  747. package/vendor/librocksdb/vendor/rocksdb/util/stderr_logger.cc +0 -62
  748. package/vendor/librocksdb/vendor/rocksdb/util/stderr_logger.h +0 -41
  749. package/vendor/librocksdb/vendor/rocksdb/util/stop_watch.h +0 -136
  750. package/vendor/librocksdb/vendor/rocksdb/util/string_util.cc +0 -554
  751. package/vendor/librocksdb/vendor/rocksdb/util/string_util.h +0 -185
  752. package/vendor/librocksdb/vendor/rocksdb/util/thread_guard.h +0 -41
  753. package/vendor/librocksdb/vendor/rocksdb/util/thread_local.cc +0 -521
  754. package/vendor/librocksdb/vendor/rocksdb/util/thread_local.h +0 -100
  755. package/vendor/librocksdb/vendor/rocksdb/util/thread_operation.h +0 -122
  756. package/vendor/librocksdb/vendor/rocksdb/util/threadpool_imp.cc +0 -550
  757. package/vendor/librocksdb/vendor/rocksdb/util/threadpool_imp.h +0 -120
  758. package/vendor/librocksdb/vendor/rocksdb/util/timer.h +0 -340
  759. package/vendor/librocksdb/vendor/rocksdb/util/timer_queue.h +0 -231
  760. package/vendor/librocksdb/vendor/rocksdb/util/udt_util.cc +0 -418
  761. package/vendor/librocksdb/vendor/rocksdb/util/udt_util.h +0 -275
  762. package/vendor/librocksdb/vendor/rocksdb/util/user_comparator_wrapper.h +0 -64
  763. package/vendor/librocksdb/vendor/rocksdb/util/vector_iterator.h +0 -114
  764. package/vendor/librocksdb/vendor/rocksdb/util/work_queue.h +0 -150
  765. package/vendor/librocksdb/vendor/rocksdb/util/write_batch_util.cc +0 -25
  766. package/vendor/librocksdb/vendor/rocksdb/util/write_batch_util.h +0 -90
  767. package/vendor/librocksdb/vendor/rocksdb/util/xxhash.cc +0 -48
  768. package/vendor/librocksdb/vendor/rocksdb/util/xxhash.h +0 -6364
  769. package/vendor/librocksdb/vendor/rocksdb/util/xxph3.h +0 -1760
  770. package/vendor/librocksdb/vendor/rocksdb/utilities/agg_merge/agg_merge.cc +0 -237
  771. package/vendor/librocksdb/vendor/rocksdb/utilities/agg_merge/agg_merge_impl.h +0 -49
  772. package/vendor/librocksdb/vendor/rocksdb/utilities/agg_merge/test_agg_merge.cc +0 -103
  773. package/vendor/librocksdb/vendor/rocksdb/utilities/agg_merge/test_agg_merge.h +0 -47
  774. package/vendor/librocksdb/vendor/rocksdb/utilities/backup/backup_engine.cc +0 -3357
  775. package/vendor/librocksdb/vendor/rocksdb/utilities/backup/backup_engine_impl.h +0 -34
  776. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_compaction_filter.cc +0 -490
  777. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_compaction_filter.h +0 -202
  778. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_db.cc +0 -109
  779. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_db.h +0 -231
  780. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_db_gc_stats.h +0 -54
  781. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_db_impl.cc +0 -2269
  782. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_db_impl.h +0 -514
  783. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_db_impl_filesnapshot.cc +0 -127
  784. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_db_iterator.h +0 -148
  785. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_db_listener.h +0 -71
  786. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_dump_tool.cc +0 -276
  787. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_dump_tool.h +0 -56
  788. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_file.cc +0 -311
  789. package/vendor/librocksdb/vendor/rocksdb/utilities/blob_db/blob_file.h +0 -245
  790. package/vendor/librocksdb/vendor/rocksdb/utilities/cache_dump_load.cc +0 -67
  791. package/vendor/librocksdb/vendor/rocksdb/utilities/cache_dump_load_impl.cc +0 -389
  792. package/vendor/librocksdb/vendor/rocksdb/utilities/cache_dump_load_impl.h +0 -368
  793. package/vendor/librocksdb/vendor/rocksdb/utilities/cassandra/cassandra_compaction_filter.cc +0 -104
  794. package/vendor/librocksdb/vendor/rocksdb/utilities/cassandra/cassandra_compaction_filter.h +0 -57
  795. package/vendor/librocksdb/vendor/rocksdb/utilities/cassandra/cassandra_options.h +0 -41
  796. package/vendor/librocksdb/vendor/rocksdb/utilities/cassandra/format.cc +0 -365
  797. package/vendor/librocksdb/vendor/rocksdb/utilities/cassandra/format.h +0 -183
  798. package/vendor/librocksdb/vendor/rocksdb/utilities/cassandra/merge_operator.cc +0 -76
  799. package/vendor/librocksdb/vendor/rocksdb/utilities/cassandra/merge_operator.h +0 -43
  800. package/vendor/librocksdb/vendor/rocksdb/utilities/cassandra/serialize.h +0 -81
  801. package/vendor/librocksdb/vendor/rocksdb/utilities/cassandra/test_utils.cc +0 -67
  802. package/vendor/librocksdb/vendor/rocksdb/utilities/cassandra/test_utils.h +0 -42
  803. package/vendor/librocksdb/vendor/rocksdb/utilities/checkpoint/checkpoint_impl.cc +0 -472
  804. package/vendor/librocksdb/vendor/rocksdb/utilities/checkpoint/checkpoint_impl.h +0 -64
  805. package/vendor/librocksdb/vendor/rocksdb/utilities/compaction_filters/layered_compaction_filter_base.h +0 -41
  806. package/vendor/librocksdb/vendor/rocksdb/utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc +0 -24
  807. package/vendor/librocksdb/vendor/rocksdb/utilities/compaction_filters/remove_emptyvalue_compactionfilter.h +0 -26
  808. package/vendor/librocksdb/vendor/rocksdb/utilities/compaction_filters.cc +0 -52
  809. package/vendor/librocksdb/vendor/rocksdb/utilities/convenience/info_log_finder.cc +0 -26
  810. package/vendor/librocksdb/vendor/rocksdb/utilities/counted_fs.cc +0 -379
  811. package/vendor/librocksdb/vendor/rocksdb/utilities/counted_fs.h +0 -158
  812. package/vendor/librocksdb/vendor/rocksdb/utilities/debug.cc +0 -134
  813. package/vendor/librocksdb/vendor/rocksdb/utilities/env_mirror.cc +0 -280
  814. package/vendor/librocksdb/vendor/rocksdb/utilities/env_timed.cc +0 -181
  815. package/vendor/librocksdb/vendor/rocksdb/utilities/env_timed.h +0 -95
  816. package/vendor/librocksdb/vendor/rocksdb/utilities/fault_injection_env.cc +0 -555
  817. package/vendor/librocksdb/vendor/rocksdb/utilities/fault_injection_env.h +0 -252
  818. package/vendor/librocksdb/vendor/rocksdb/utilities/fault_injection_fs.cc +0 -1507
  819. package/vendor/librocksdb/vendor/rocksdb/utilities/fault_injection_fs.h +0 -760
  820. package/vendor/librocksdb/vendor/rocksdb/utilities/fault_injection_secondary_cache.cc +0 -138
  821. package/vendor/librocksdb/vendor/rocksdb/utilities/fault_injection_secondary_cache.h +0 -115
  822. package/vendor/librocksdb/vendor/rocksdb/utilities/leveldb_options/leveldb_options.cc +0 -57
  823. package/vendor/librocksdb/vendor/rocksdb/utilities/memory/memory_util.cc +0 -50
  824. package/vendor/librocksdb/vendor/rocksdb/utilities/memory_allocators.h +0 -103
  825. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators/bytesxor.cc +0 -57
  826. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators/bytesxor.h +0 -39
  827. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators/max.cc +0 -64
  828. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators/max_operator.h +0 -35
  829. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators/put.cc +0 -74
  830. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators/put_operator.h +0 -56
  831. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators/sortlist.cc +0 -97
  832. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators/sortlist.h +0 -42
  833. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators/string_append/stringappend.cc +0 -76
  834. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators/string_append/stringappend.h +0 -32
  835. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators/string_append/stringappend2.cc +0 -129
  836. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators/string_append/stringappend2.h +0 -51
  837. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators/uint64add.cc +0 -56
  838. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators/uint64add.h +0 -35
  839. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators.cc +0 -115
  840. package/vendor/librocksdb/vendor/rocksdb/utilities/merge_operators.h +0 -36
  841. package/vendor/librocksdb/vendor/rocksdb/utilities/object_registry.cc +0 -381
  842. package/vendor/librocksdb/vendor/rocksdb/utilities/option_change_migration/option_change_migration.cc +0 -169
  843. package/vendor/librocksdb/vendor/rocksdb/utilities/options/options_util.cc +0 -117
  844. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/block_cache_tier.cc +0 -420
  845. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/block_cache_tier.h +0 -154
  846. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/block_cache_tier_file.cc +0 -607
  847. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/block_cache_tier_file.h +0 -291
  848. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/block_cache_tier_file_buffer.h +0 -127
  849. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/block_cache_tier_metadata.cc +0 -84
  850. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/block_cache_tier_metadata.h +0 -122
  851. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/hash_table.h +0 -237
  852. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/hash_table_bench.cc +0 -310
  853. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/hash_table_evictable.h +0 -166
  854. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/lrulist.h +0 -172
  855. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/persistent_cache_bench.cc +0 -355
  856. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/persistent_cache_test.h +0 -284
  857. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/persistent_cache_tier.cc +0 -165
  858. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/persistent_cache_tier.h +0 -340
  859. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/persistent_cache_util.h +0 -67
  860. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/volatile_tier_impl.cc +0 -138
  861. package/vendor/librocksdb/vendor/rocksdb/utilities/persistent_cache/volatile_tier_impl.h +0 -139
  862. package/vendor/librocksdb/vendor/rocksdb/utilities/simulator_cache/cache_simulator.cc +0 -287
  863. package/vendor/librocksdb/vendor/rocksdb/utilities/simulator_cache/cache_simulator.h +0 -231
  864. package/vendor/librocksdb/vendor/rocksdb/utilities/simulator_cache/sim_cache.cc +0 -375
  865. package/vendor/librocksdb/vendor/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector.cc +0 -144
  866. package/vendor/librocksdb/vendor/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector.h +0 -45
  867. package/vendor/librocksdb/vendor/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector.cc +0 -233
  868. package/vendor/librocksdb/vendor/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector.h +0 -65
  869. package/vendor/librocksdb/vendor/rocksdb/utilities/trace/file_trace_reader_writer.cc +0 -132
  870. package/vendor/librocksdb/vendor/rocksdb/utilities/trace/file_trace_reader_writer.h +0 -48
  871. package/vendor/librocksdb/vendor/rocksdb/utilities/trace/replayer_impl.cc +0 -313
  872. package/vendor/librocksdb/vendor/rocksdb/utilities/trace/replayer_impl.h +0 -84
  873. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/lock_manager.cc +0 -27
  874. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/lock_manager.h +0 -80
  875. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/lock_tracker.h +0 -207
  876. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/point/point_lock_manager.cc +0 -718
  877. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/point/point_lock_manager.h +0 -222
  878. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/point/point_lock_manager_test.h +0 -324
  879. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/point/point_lock_tracker.cc +0 -255
  880. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/point/point_lock_tracker.h +0 -97
  881. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_lock_manager.h +0 -34
  882. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/db.h +0 -81
  883. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/ft/comparator.h +0 -138
  884. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/ft/ft-status.h +0 -102
  885. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/concurrent_tree.cc +0 -137
  886. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/concurrent_tree.h +0 -174
  887. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/keyrange.cc +0 -220
  888. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/keyrange.h +0 -141
  889. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.cc +0 -525
  890. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.h +0 -255
  891. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/locktree.cc +0 -1021
  892. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/locktree.h +0 -580
  893. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/manager.cc +0 -525
  894. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/range_buffer.cc +0 -263
  895. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/range_buffer.h +0 -178
  896. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/treenode.cc +0 -518
  897. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/treenode.h +0 -302
  898. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/txnid_set.cc +0 -118
  899. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/txnid_set.h +0 -92
  900. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/wfg.cc +0 -211
  901. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/wfg.h +0 -124
  902. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/memory.h +0 -215
  903. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_assert_subst.h +0 -43
  904. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_atomic.h +0 -130
  905. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_external_pthread.h +0 -87
  906. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_instrumentation.h +0 -286
  907. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_portability.h +0 -87
  908. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_pthread.h +0 -520
  909. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_race_tools.h +0 -179
  910. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +0 -197
  911. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/txn_subst.h +0 -31
  912. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/standalone_port.cc +0 -139
  913. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/dbt.cc +0 -165
  914. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/dbt.h +0 -98
  915. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/growable_array.h +0 -144
  916. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/memarena.cc +0 -199
  917. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/memarena.h +0 -141
  918. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/omt.h +0 -794
  919. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/omt_impl.h +0 -1295
  920. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/partitioned_counter.h +0 -165
  921. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/status.h +0 -76
  922. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/range_tree_lock_manager.cc +0 -501
  923. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/range_tree_lock_manager.h +0 -135
  924. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/range_tree_lock_tracker.cc +0 -156
  925. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/lock/range/range_tree/range_tree_lock_tracker.h +0 -146
  926. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/optimistic_transaction.cc +0 -208
  927. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/optimistic_transaction.h +0 -99
  928. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/optimistic_transaction_db_impl.cc +0 -111
  929. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/optimistic_transaction_db_impl.h +0 -110
  930. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction.cc +0 -1278
  931. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction.h +0 -345
  932. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction_db.cc +0 -845
  933. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/pessimistic_transaction_db.h +0 -345
  934. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/snapshot_checker.cc +0 -37
  935. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_base.cc +0 -912
  936. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_base.h +0 -455
  937. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_db_mutex_impl.cc +0 -133
  938. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_db_mutex_impl.h +0 -24
  939. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_test.h +0 -589
  940. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_util.cc +0 -207
  941. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/transaction_util.h +0 -86
  942. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_prepared_txn.cc +0 -548
  943. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_prepared_txn.h +0 -118
  944. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_prepared_txn_db.cc +0 -1100
  945. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_prepared_txn_db.h +0 -1149
  946. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_unprepared_txn.cc +0 -1089
  947. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_unprepared_txn.h +0 -333
  948. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_unprepared_txn_db.cc +0 -486
  949. package/vendor/librocksdb/vendor/rocksdb/utilities/transactions/write_unprepared_txn_db.h +0 -105
  950. package/vendor/librocksdb/vendor/rocksdb/utilities/ttl/db_ttl_impl.cc +0 -638
  951. package/vendor/librocksdb/vendor/rocksdb/utilities/ttl/db_ttl_impl.h +0 -239
  952. package/vendor/librocksdb/vendor/rocksdb/utilities/types_util.cc +0 -88
  953. package/vendor/librocksdb/vendor/rocksdb/utilities/wal_filter.cc +0 -22
  954. package/vendor/librocksdb/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +0 -1134
  955. package/vendor/librocksdb/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.cc +0 -934
  956. package/vendor/librocksdb/vendor/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.h +0 -468
@@ -1,4390 +0,0 @@
1
- // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2
- // This source code is licensed under both the GPLv2 (found in the
3
- // COPYING file in the root directory) and Apache 2.0 License
4
- // (found in the LICENSE.Apache file in the root directory).
5
- //
6
- // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
7
- // Use of this source code is governed by a BSD-style license that can be
8
- // found in the LICENSE file. See the AUTHORS file for names of contributors.
9
- #include <cinttypes>
10
- #include <deque>
11
-
12
- #include "db/builder.h"
13
- #include "db/db_impl/db_impl.h"
14
- #include "db/error_handler.h"
15
- #include "db/event_helpers.h"
16
- #include "file/sst_file_manager_impl.h"
17
- #include "logging/logging.h"
18
- #include "monitoring/iostats_context_imp.h"
19
- #include "monitoring/perf_context_imp.h"
20
- #include "monitoring/thread_status_updater.h"
21
- #include "monitoring/thread_status_util.h"
22
- #include "rocksdb/file_system.h"
23
- #include "rocksdb/io_status.h"
24
- #include "rocksdb/options.h"
25
- #include "rocksdb/table.h"
26
- #include "test_util/sync_point.h"
27
- #include "util/cast_util.h"
28
- #include "util/coding.h"
29
- #include "util/concurrent_task_limiter_impl.h"
30
- #include "util/udt_util.h"
31
-
32
- namespace ROCKSDB_NAMESPACE {
33
-
34
- bool DBImpl::EnoughRoomForCompaction(
35
- ColumnFamilyData* cfd, const std::vector<CompactionInputFiles>& inputs,
36
- bool* sfm_reserved_compact_space, LogBuffer* log_buffer) {
37
- // Check if we have enough room to do the compaction
38
- bool enough_room = true;
39
- auto sfm = static_cast<SstFileManagerImpl*>(
40
- immutable_db_options_.sst_file_manager.get());
41
- if (sfm) {
42
- // Pass the current bg_error_ to SFM so it can decide what checks to
43
- // perform. If this DB instance hasn't seen any error yet, the SFM can be
44
- // optimistic and not do disk space checks
45
- Status bg_error = error_handler_.GetBGError();
46
- enough_room = sfm->EnoughRoomForCompaction(cfd, inputs, bg_error);
47
- bg_error.PermitUncheckedError(); // bg_error is just a copy of the Status
48
- // from the error_handler_
49
- if (enough_room) {
50
- *sfm_reserved_compact_space = true;
51
- }
52
- }
53
- if (!enough_room) {
54
- // Just in case tests want to change the value of enough_room
55
- TEST_SYNC_POINT_CALLBACK(
56
- "DBImpl::BackgroundCompaction():CancelledCompaction", &enough_room);
57
- ROCKS_LOG_BUFFER(log_buffer,
58
- "Cancelled compaction because not enough room");
59
- RecordTick(stats_, COMPACTION_CANCELLED, 1);
60
- }
61
- return enough_room;
62
- }
63
-
64
- bool DBImpl::RequestCompactionToken(ColumnFamilyData* cfd, bool force,
65
- std::unique_ptr<TaskLimiterToken>* token,
66
- LogBuffer* log_buffer) {
67
- assert(*token == nullptr);
68
- auto limiter = static_cast<ConcurrentTaskLimiterImpl*>(
69
- cfd->ioptions()->compaction_thread_limiter.get());
70
- if (limiter == nullptr) {
71
- return true;
72
- }
73
- *token = limiter->GetToken(force);
74
- if (*token != nullptr) {
75
- ROCKS_LOG_BUFFER(log_buffer,
76
- "Thread limiter [%s] increase [%s] compaction task, "
77
- "force: %s, tasks after: %d",
78
- limiter->GetName().c_str(), cfd->GetName().c_str(),
79
- force ? "true" : "false", limiter->GetOutstandingTask());
80
- return true;
81
- }
82
- return false;
83
- }
84
-
85
- bool DBImpl::ShouldRescheduleFlushRequestToRetainUDT(
86
- const FlushRequest& flush_req) {
87
- mutex_.AssertHeld();
88
- assert(flush_req.cfd_to_max_mem_id_to_persist.size() == 1);
89
- ColumnFamilyData* cfd = flush_req.cfd_to_max_mem_id_to_persist.begin()->first;
90
- if (cfd->GetAndClearFlushSkipReschedule()) {
91
- return false;
92
- }
93
- uint64_t max_memtable_id =
94
- flush_req.cfd_to_max_mem_id_to_persist.begin()->second;
95
- if (cfd->IsDropped() ||
96
- !cfd->ShouldPostponeFlushToRetainUDT(max_memtable_id)) {
97
- return false;
98
- }
99
- // Check if holding on the flush will cause entering write stall mode.
100
- // Write stall entered because of the accumulation of write buffers can be
101
- // alleviated if we continue with the flush instead of postponing it.
102
- const auto& mutable_cf_options = *cfd->GetLatestMutableCFOptions();
103
-
104
- // Use the same criteria as WaitUntilFlushWouldNotStallWrites does w.r.t
105
- // defining what a write stall is about to happen means. If this uses a
106
- // stricter criteria, for example, a write stall is about to happen if the
107
- // last memtable is 10% full, there is a possibility that manual flush could
108
- // be waiting in `WaitUntilFlushWouldNotStallWrites` with the incorrect
109
- // expectation that others will clear up the excessive memtables and
110
- // eventually let it proceed. The others in this case won't start clearing
111
- // until the last memtable is 10% full. To avoid that scenario, the criteria
112
- // this uses should be the same or less strict than
113
- // `WaitUntilFlushWouldNotStallWrites` does.
114
- WriteStallCondition write_stall =
115
- ColumnFamilyData::GetWriteStallConditionAndCause(
116
- cfd->GetUnflushedMemTableCountForWriteStallCheck(),
117
- /*num_l0_files=*/0,
118
- /*num_compaction_needed_bytes=*/0, mutable_cf_options,
119
- *cfd->ioptions())
120
- .first;
121
- if (write_stall != WriteStallCondition::kNormal) {
122
- return false;
123
- }
124
- return true;
125
- }
126
-
127
- IOStatus DBImpl::SyncClosedWals(const WriteOptions& write_options,
128
- JobContext* job_context,
129
- VersionEdit* synced_wals,
130
- bool error_recovery_in_prog) {
131
- TEST_SYNC_POINT("DBImpl::SyncClosedWals:Start");
132
-
133
- IOStatus io_s = SyncWalImpl(/*include_current_wal*/ false, write_options,
134
- job_context, synced_wals, error_recovery_in_prog);
135
- if (!io_s.ok()) {
136
- TEST_SYNC_POINT("DBImpl::SyncClosedWals:Failed");
137
- } else {
138
- TEST_SYNC_POINT("DBImpl::SyncClosedWals:end");
139
- }
140
- return io_s;
141
- }
142
-
143
- Status DBImpl::FlushMemTableToOutputFile(
144
- ColumnFamilyData* cfd, const MutableCFOptions& mutable_cf_options,
145
- bool* made_progress, JobContext* job_context, FlushReason flush_reason,
146
- SuperVersionContext* superversion_context,
147
- std::vector<SequenceNumber>& snapshot_seqs,
148
- SequenceNumber earliest_write_conflict_snapshot,
149
- SnapshotChecker* snapshot_checker, LogBuffer* log_buffer,
150
- Env::Priority thread_pri) {
151
- mutex_.AssertHeld();
152
- assert(cfd);
153
- assert(cfd->imm());
154
- assert(cfd->imm()->NumNotFlushed() != 0);
155
- assert(cfd->imm()->IsFlushPending());
156
- assert(versions_);
157
- assert(versions_->GetColumnFamilySet());
158
- const ReadOptions read_options(Env::IOActivity::kFlush);
159
- const WriteOptions write_options(Env::IOActivity::kFlush);
160
- // If there are more than one column families, we need to make sure that
161
- // all the log files except the most recent one are synced. Otherwise if
162
- // the host crashes after flushing and before WAL is persistent, the
163
- // flushed SST may contain data from write batches whose updates to
164
- // other (unflushed) column families are missing.
165
- //
166
- // When 2PC is enabled, non-recent WAL(s) may be needed for crash-recovery,
167
- // even when there is only one CF in the DB, for prepared transactions that
168
- // had not been committed yet. Make sure we sync them to keep the persisted
169
- // WAL state at least as new as the persisted SST state.
170
- const bool needs_to_sync_closed_wals =
171
- logfile_number_ > 0 &&
172
- (versions_->GetColumnFamilySet()->NumberOfColumnFamilies() > 1 ||
173
- allow_2pc());
174
-
175
- // If needs_to_sync_closed_wals is true, we need to record the current
176
- // maximum memtable ID of this column family so that a later PickMemtables()
177
- // call will not pick memtables whose IDs are higher. This is due to the fact
178
- // that SyncClosedWals() may release the db mutex, and memtable switch can
179
- // happen for this column family in the meantime. The newly created memtables
180
- // have their data backed by unsynced WALs, thus they cannot be included in
181
- // this flush job.
182
- // Another reason why we must record the current maximum memtable ID of this
183
- // column family: SyncClosedWals() may release db mutex, thus it's possible
184
- // for application to continue to insert into memtables increasing db's
185
- // sequence number. The application may take a snapshot, but this snapshot is
186
- // not included in `snapshot_seqs` which will be passed to flush job because
187
- // `snapshot_seqs` has already been computed before this function starts.
188
- // Recording the max memtable ID ensures that the flush job does not flush
189
- // a memtable without knowing such snapshot(s).
190
- uint64_t max_memtable_id =
191
- needs_to_sync_closed_wals
192
- ? cfd->imm()->GetLatestMemTableID(false /* for_atomic_flush */)
193
- : std::numeric_limits<uint64_t>::max();
194
-
195
- // If needs_to_sync_closed_wals is false, then the flush job will pick ALL
196
- // existing memtables of the column family when PickMemTable() is called
197
- // later. Although we won't call SyncClosedWals() in this case, we may still
198
- // call the callbacks of the listeners, i.e. NotifyOnFlushBegin() which also
199
- // releases and re-acquires the db mutex. In the meantime, the application
200
- // can still insert into the memtables and increase the db's sequence number.
201
- // The application can take a snapshot, hoping that the latest visible state
202
- // to this snapshot is preserved. This is hard to guarantee since db mutex
203
- // not held. This newly-created snapshot is not included in `snapshot_seqs`
204
- // and the flush job is unaware of its presence. Consequently, the flush job
205
- // may drop certain keys when generating the L0, causing incorrect data to be
206
- // returned for snapshot read using this snapshot.
207
- // To address this, we make sure NotifyOnFlushBegin() executes after memtable
208
- // picking so that no new snapshot can be taken between the two functions.
209
-
210
- FlushJob flush_job(
211
- dbname_, cfd, immutable_db_options_, mutable_cf_options, max_memtable_id,
212
- file_options_for_compaction_, versions_.get(), &mutex_, &shutting_down_,
213
- snapshot_seqs, earliest_write_conflict_snapshot, snapshot_checker,
214
- job_context, flush_reason, log_buffer, directories_.GetDbDir(),
215
- GetDataDir(cfd, 0U),
216
- GetCompressionFlush(*cfd->ioptions(), mutable_cf_options), stats_,
217
- &event_logger_, mutable_cf_options.report_bg_io_stats,
218
- true /* sync_output_directory */, true /* write_manifest */, thread_pri,
219
- io_tracer_, cfd->GetSuperVersion()->ShareSeqnoToTimeMapping(), db_id_,
220
- db_session_id_, cfd->GetFullHistoryTsLow(), &blob_callback_);
221
- FileMetaData file_meta;
222
-
223
- Status s;
224
- bool need_cancel = false;
225
- IOStatus log_io_s = IOStatus::OK();
226
- if (needs_to_sync_closed_wals) {
227
- // SyncClosedWals() may unlock and re-lock the log_write_mutex multiple
228
- // times.
229
- VersionEdit synced_wals;
230
- bool error_recovery_in_prog = error_handler_.IsRecoveryInProgress();
231
- mutex_.Unlock();
232
- log_io_s = SyncClosedWals(write_options, job_context, &synced_wals,
233
- error_recovery_in_prog);
234
- mutex_.Lock();
235
- if (log_io_s.ok() && synced_wals.IsWalAddition()) {
236
- log_io_s = status_to_io_status(
237
- ApplyWALToManifest(read_options, write_options, &synced_wals));
238
- TEST_SYNC_POINT_CALLBACK("DBImpl::FlushMemTableToOutputFile:CommitWal:1",
239
- nullptr);
240
- }
241
-
242
- if (!log_io_s.ok() && !log_io_s.IsShutdownInProgress() &&
243
- !log_io_s.IsColumnFamilyDropped()) {
244
- error_handler_.SetBGError(log_io_s, BackgroundErrorReason::kFlush);
245
- }
246
- } else {
247
- TEST_SYNC_POINT("DBImpl::SyncClosedWals:Skip");
248
- }
249
- s = log_io_s;
250
-
251
- // If the log sync failed, we do not need to pick memtable. Otherwise,
252
- // num_flush_not_started_ needs to be rollback.
253
- TEST_SYNC_POINT("DBImpl::FlushMemTableToOutputFile:BeforePickMemtables");
254
- // Exit a flush due to bg error should not set bg error again.
255
- bool skip_set_bg_error = false;
256
- if (s.ok() && !error_handler_.GetBGError().ok() &&
257
- error_handler_.IsBGWorkStopped() &&
258
- flush_reason != FlushReason::kErrorRecovery &&
259
- flush_reason != FlushReason::kErrorRecoveryRetryFlush) {
260
- // Error recovery in progress, should not pick memtable which excludes
261
- // them from being picked up by recovery flush.
262
- // This ensures that when bg error is set, no new flush can pick
263
- // memtables.
264
- skip_set_bg_error = true;
265
- s = error_handler_.GetBGError();
266
- assert(!s.ok());
267
- ROCKS_LOG_BUFFER(log_buffer,
268
- "[JOB %d] Skip flush due to background error %s",
269
- job_context->job_id, s.ToString().c_str());
270
- }
271
-
272
- if (s.ok()) {
273
- flush_job.PickMemTable();
274
- need_cancel = true;
275
- }
276
- TEST_SYNC_POINT_CALLBACK(
277
- "DBImpl::FlushMemTableToOutputFile:AfterPickMemtables", &flush_job);
278
-
279
- // may temporarily unlock and lock the mutex.
280
- NotifyOnFlushBegin(cfd, &file_meta, mutable_cf_options, job_context->job_id,
281
- flush_reason);
282
-
283
- bool switched_to_mempurge = false;
284
- // Within flush_job.Run, rocksdb may call event listener to notify
285
- // file creation and deletion.
286
- //
287
- // Note that flush_job.Run will unlock and lock the db_mutex,
288
- // and EventListener callback will be called when the db_mutex
289
- // is unlocked by the current thread.
290
- if (s.ok()) {
291
- s = flush_job.Run(&logs_with_prep_tracker_, &file_meta,
292
- &switched_to_mempurge, &skip_set_bg_error,
293
- &error_handler_);
294
- need_cancel = false;
295
- }
296
-
297
- if (!s.ok() && need_cancel) {
298
- flush_job.Cancel();
299
- }
300
-
301
- if (s.ok()) {
302
- InstallSuperVersionAndScheduleWork(cfd, superversion_context,
303
- mutable_cf_options);
304
- if (made_progress) {
305
- *made_progress = true;
306
- }
307
-
308
- const std::string& column_family_name = cfd->GetName();
309
-
310
- Version* const current = cfd->current();
311
- assert(current);
312
-
313
- const VersionStorageInfo* const storage_info = current->storage_info();
314
- assert(storage_info);
315
-
316
- VersionStorageInfo::LevelSummaryStorage tmp;
317
- ROCKS_LOG_BUFFER(log_buffer, "[%s] Level summary: %s\n",
318
- column_family_name.c_str(),
319
- storage_info->LevelSummary(&tmp));
320
-
321
- const auto& blob_files = storage_info->GetBlobFiles();
322
- if (!blob_files.empty()) {
323
- assert(blob_files.front());
324
- assert(blob_files.back());
325
-
326
- ROCKS_LOG_BUFFER(
327
- log_buffer,
328
- "[%s] Blob file summary: head=%" PRIu64 ", tail=%" PRIu64 "\n",
329
- column_family_name.c_str(), blob_files.front()->GetBlobFileNumber(),
330
- blob_files.back()->GetBlobFileNumber());
331
- }
332
- }
333
-
334
- if (!s.ok() && !s.IsShutdownInProgress() && !s.IsColumnFamilyDropped() &&
335
- !skip_set_bg_error) {
336
- if (log_io_s.ok()) {
337
- // Error while writing to MANIFEST.
338
- // In fact, versions_->io_status() can also be the result of renaming
339
- // CURRENT file. With current code, it's just difficult to tell. So just
340
- // be pessimistic and try write to a new MANIFEST.
341
- // TODO: distinguish between MANIFEST write and CURRENT renaming
342
- if (!versions_->io_status().ok()) {
343
- // If WAL sync is successful (either WAL size is 0 or there is no IO
344
- // error), all the Manifest write will be map to soft error.
345
- // TODO: kManifestWriteNoWAL and kFlushNoWAL are misleading. Refactor is
346
- // needed.
347
- error_handler_.SetBGError(s,
348
- BackgroundErrorReason::kManifestWriteNoWAL);
349
- } else {
350
- // If WAL sync is successful (either WAL size is 0 or there is no IO
351
- // error), all the other SST file write errors will be set as
352
- // kFlushNoWAL.
353
- error_handler_.SetBGError(s, BackgroundErrorReason::kFlushNoWAL);
354
- }
355
- } else {
356
- assert(s == log_io_s);
357
- Status new_bg_error = s;
358
- error_handler_.SetBGError(new_bg_error, BackgroundErrorReason::kFlush);
359
- }
360
- }
361
- // If flush ran smoothly and no mempurge happened
362
- // install new SST file path.
363
- if (s.ok() && (!switched_to_mempurge)) {
364
- // may temporarily unlock and lock the mutex.
365
- NotifyOnFlushCompleted(cfd, mutable_cf_options,
366
- flush_job.GetCommittedFlushJobsInfo());
367
- auto sfm = static_cast<SstFileManagerImpl*>(
368
- immutable_db_options_.sst_file_manager.get());
369
- if (sfm) {
370
- // Notify sst_file_manager that a new file was added
371
- std::string file_path = MakeTableFileName(
372
- cfd->ioptions()->cf_paths[0].path, file_meta.fd.GetNumber());
373
- // TODO (PR7798). We should only add the file to the FileManager if it
374
- // exists. Otherwise, some tests may fail. Ignore the error in the
375
- // interim.
376
- sfm->OnAddFile(file_path).PermitUncheckedError();
377
- if (sfm->IsMaxAllowedSpaceReached()) {
378
- Status new_bg_error =
379
- Status::SpaceLimit("Max allowed space was reached");
380
- TEST_SYNC_POINT_CALLBACK(
381
- "DBImpl::FlushMemTableToOutputFile:MaxAllowedSpaceReached",
382
- &new_bg_error);
383
- error_handler_.SetBGError(new_bg_error, BackgroundErrorReason::kFlush);
384
- }
385
- }
386
- }
387
- TEST_SYNC_POINT("DBImpl::FlushMemTableToOutputFile:Finish");
388
- return s;
389
- }
390
-
391
- Status DBImpl::FlushMemTablesToOutputFiles(
392
- const autovector<BGFlushArg>& bg_flush_args, bool* made_progress,
393
- JobContext* job_context, LogBuffer* log_buffer, Env::Priority thread_pri) {
394
- if (immutable_db_options_.atomic_flush) {
395
- return AtomicFlushMemTablesToOutputFiles(
396
- bg_flush_args, made_progress, job_context, log_buffer, thread_pri);
397
- }
398
- assert(bg_flush_args.size() == 1);
399
- std::vector<SequenceNumber> snapshot_seqs;
400
- SequenceNumber earliest_write_conflict_snapshot;
401
- SnapshotChecker* snapshot_checker;
402
- GetSnapshotContext(job_context, &snapshot_seqs,
403
- &earliest_write_conflict_snapshot, &snapshot_checker);
404
- const auto& bg_flush_arg = bg_flush_args[0];
405
- ColumnFamilyData* cfd = bg_flush_arg.cfd_;
406
- // intentional infrequent copy for each flush
407
- MutableCFOptions mutable_cf_options_copy = *cfd->GetLatestMutableCFOptions();
408
- SuperVersionContext* superversion_context =
409
- bg_flush_arg.superversion_context_;
410
- FlushReason flush_reason = bg_flush_arg.flush_reason_;
411
- Status s = FlushMemTableToOutputFile(
412
- cfd, mutable_cf_options_copy, made_progress, job_context, flush_reason,
413
- superversion_context, snapshot_seqs, earliest_write_conflict_snapshot,
414
- snapshot_checker, log_buffer, thread_pri);
415
- return s;
416
- }
417
-
418
- /*
419
- * Atomically flushes multiple column families.
420
- *
421
- * For each column family, all memtables with ID smaller than or equal to the
422
- * ID specified in bg_flush_args will be flushed. Only after all column
423
- * families finish flush will this function commit to MANIFEST. If any of the
424
- * column families are not flushed successfully, this function does not have
425
- * any side-effect on the state of the database.
426
- */
427
- Status DBImpl::AtomicFlushMemTablesToOutputFiles(
428
- const autovector<BGFlushArg>& bg_flush_args, bool* made_progress,
429
- JobContext* job_context, LogBuffer* log_buffer, Env::Priority thread_pri) {
430
- mutex_.AssertHeld();
431
- const ReadOptions read_options(Env::IOActivity::kFlush);
432
- const WriteOptions write_options(Env::IOActivity::kFlush);
433
-
434
- autovector<ColumnFamilyData*> cfds;
435
- for (const auto& arg : bg_flush_args) {
436
- cfds.emplace_back(arg.cfd_);
437
- }
438
-
439
- #ifndef NDEBUG
440
- for (const auto cfd : cfds) {
441
- assert(cfd->imm()->NumNotFlushed() != 0);
442
- assert(cfd->imm()->IsFlushPending());
443
- }
444
- for (const auto& bg_flush_arg : bg_flush_args) {
445
- assert(bg_flush_arg.flush_reason_ == bg_flush_args[0].flush_reason_);
446
- }
447
- #endif /* !NDEBUG */
448
-
449
- std::vector<SequenceNumber> snapshot_seqs;
450
- SequenceNumber earliest_write_conflict_snapshot;
451
- SnapshotChecker* snapshot_checker;
452
- GetSnapshotContext(job_context, &snapshot_seqs,
453
- &earliest_write_conflict_snapshot, &snapshot_checker);
454
-
455
- autovector<FSDirectory*> distinct_output_dirs;
456
- autovector<std::string> distinct_output_dir_paths;
457
- std::vector<std::unique_ptr<FlushJob>> jobs;
458
- std::vector<MutableCFOptions> all_mutable_cf_options;
459
- int num_cfs = static_cast<int>(cfds.size());
460
- all_mutable_cf_options.reserve(num_cfs);
461
- for (int i = 0; i < num_cfs; ++i) {
462
- auto cfd = cfds[i];
463
- FSDirectory* data_dir = GetDataDir(cfd, 0U);
464
- const std::string& curr_path = cfd->ioptions()->cf_paths[0].path;
465
-
466
- // Add to distinct output directories if eligible. Use linear search. Since
467
- // the number of elements in the vector is not large, performance should be
468
- // tolerable.
469
- bool found = false;
470
- for (const auto& path : distinct_output_dir_paths) {
471
- if (path == curr_path) {
472
- found = true;
473
- break;
474
- }
475
- }
476
- if (!found) {
477
- distinct_output_dir_paths.emplace_back(curr_path);
478
- distinct_output_dirs.emplace_back(data_dir);
479
- }
480
-
481
- all_mutable_cf_options.emplace_back(*cfd->GetLatestMutableCFOptions());
482
- const MutableCFOptions& mutable_cf_options = all_mutable_cf_options.back();
483
- uint64_t max_memtable_id = bg_flush_args[i].max_memtable_id_;
484
- FlushReason flush_reason = bg_flush_args[i].flush_reason_;
485
- jobs.emplace_back(new FlushJob(
486
- dbname_, cfd, immutable_db_options_, mutable_cf_options,
487
- max_memtable_id, file_options_for_compaction_, versions_.get(), &mutex_,
488
- &shutting_down_, snapshot_seqs, earliest_write_conflict_snapshot,
489
- snapshot_checker, job_context, flush_reason, log_buffer,
490
- directories_.GetDbDir(), data_dir,
491
- GetCompressionFlush(*cfd->ioptions(), mutable_cf_options), stats_,
492
- &event_logger_, mutable_cf_options.report_bg_io_stats,
493
- false /* sync_output_directory */, false /* write_manifest */,
494
- thread_pri, io_tracer_,
495
- cfd->GetSuperVersion()->ShareSeqnoToTimeMapping(), db_id_,
496
- db_session_id_, cfd->GetFullHistoryTsLow(), &blob_callback_));
497
- }
498
-
499
- std::vector<FileMetaData> file_meta(num_cfs);
500
- // Use of deque<bool> because vector<bool>
501
- // is specific and doesn't allow &v[i].
502
- std::deque<bool> switched_to_mempurge(num_cfs, false);
503
- Status s;
504
- IOStatus log_io_s = IOStatus::OK();
505
- assert(num_cfs == static_cast<int>(jobs.size()));
506
-
507
- for (int i = 0; i != num_cfs; ++i) {
508
- const MutableCFOptions& mutable_cf_options = all_mutable_cf_options.at(i);
509
- // may temporarily unlock and lock the mutex.
510
- FlushReason flush_reason = bg_flush_args[i].flush_reason_;
511
- NotifyOnFlushBegin(cfds[i], &file_meta[i], mutable_cf_options,
512
- job_context->job_id, flush_reason);
513
- }
514
-
515
- if (logfile_number_ > 0) {
516
- // TODO (yanqin) investigate whether we should sync the closed logs for
517
- // single column family case.
518
- VersionEdit synced_wals;
519
- bool error_recovery_in_prog = error_handler_.IsRecoveryInProgress();
520
- mutex_.Unlock();
521
- log_io_s = SyncClosedWals(write_options, job_context, &synced_wals,
522
- error_recovery_in_prog);
523
- mutex_.Lock();
524
- if (log_io_s.ok() && synced_wals.IsWalAddition()) {
525
- log_io_s = status_to_io_status(
526
- ApplyWALToManifest(read_options, write_options, &synced_wals));
527
- }
528
-
529
- if (!log_io_s.ok() && !log_io_s.IsShutdownInProgress() &&
530
- !log_io_s.IsColumnFamilyDropped()) {
531
- if (total_log_size_ > 0) {
532
- error_handler_.SetBGError(log_io_s, BackgroundErrorReason::kFlush);
533
- } else {
534
- // If the WAL is empty, we use different error reason
535
- error_handler_.SetBGError(log_io_s, BackgroundErrorReason::kFlushNoWAL);
536
- }
537
- }
538
- }
539
- s = log_io_s;
540
-
541
- // exec_status stores the execution status of flush_jobs as
542
- // <bool /* executed */, Status /* status code */>
543
- autovector<std::pair<bool, Status>> exec_status;
544
- std::vector<bool> pick_status;
545
- for (int i = 0; i != num_cfs; ++i) {
546
- // Initially all jobs are not executed, with status OK.
547
- exec_status.emplace_back(false, Status::OK());
548
- pick_status.push_back(false);
549
- }
550
-
551
- bool flush_for_recovery =
552
- bg_flush_args[0].flush_reason_ == FlushReason::kErrorRecovery ||
553
- bg_flush_args[0].flush_reason_ == FlushReason::kErrorRecoveryRetryFlush;
554
- bool skip_set_bg_error = false;
555
-
556
- if (s.ok() && !error_handler_.GetBGError().ok() &&
557
- error_handler_.IsBGWorkStopped() && !flush_for_recovery) {
558
- s = error_handler_.GetBGError();
559
- skip_set_bg_error = true;
560
- assert(!s.ok());
561
- ROCKS_LOG_BUFFER(log_buffer,
562
- "[JOB %d] Skip flush due to background error %s",
563
- job_context->job_id, s.ToString().c_str());
564
- }
565
-
566
- if (s.ok()) {
567
- for (int i = 0; i != num_cfs; ++i) {
568
- jobs[i]->PickMemTable();
569
- pick_status[i] = true;
570
- }
571
- }
572
-
573
- if (s.ok()) {
574
- assert(switched_to_mempurge.size() ==
575
- static_cast<long unsigned int>(num_cfs));
576
- // TODO (yanqin): parallelize jobs with threads.
577
- for (int i = 1; i != num_cfs; ++i) {
578
- exec_status[i].second =
579
- jobs[i]->Run(&logs_with_prep_tracker_, &file_meta[i],
580
- &(switched_to_mempurge.at(i)));
581
- exec_status[i].first = true;
582
- }
583
- if (num_cfs > 1) {
584
- TEST_SYNC_POINT(
585
- "DBImpl::AtomicFlushMemTablesToOutputFiles:SomeFlushJobsComplete:1");
586
- TEST_SYNC_POINT(
587
- "DBImpl::AtomicFlushMemTablesToOutputFiles:SomeFlushJobsComplete:2");
588
- }
589
- assert(exec_status.size() > 0);
590
- assert(!file_meta.empty());
591
- exec_status[0].second = jobs[0]->Run(
592
- &logs_with_prep_tracker_, file_meta.data() /* &file_meta[0] */,
593
- switched_to_mempurge.empty() ? nullptr : &(switched_to_mempurge.at(0)));
594
- exec_status[0].first = true;
595
-
596
- Status error_status;
597
- for (const auto& e : exec_status) {
598
- if (!e.second.ok()) {
599
- s = e.second;
600
- if (!e.second.IsShutdownInProgress() &&
601
- !e.second.IsColumnFamilyDropped()) {
602
- // If a flush job did not return OK, and the CF is not dropped, and
603
- // the DB is not shutting down, then we have to return this result to
604
- // caller later.
605
- error_status = e.second;
606
- }
607
- }
608
- }
609
-
610
- s = error_status.ok() ? s : error_status;
611
- }
612
-
613
- if (s.IsColumnFamilyDropped()) {
614
- s = Status::OK();
615
- }
616
-
617
- if (s.ok() || s.IsShutdownInProgress()) {
618
- // Sync on all distinct output directories.
619
- for (auto dir : distinct_output_dirs) {
620
- if (dir != nullptr) {
621
- IOOptions io_options;
622
- Status error_status =
623
- WritableFileWriter::PrepareIOOptions(write_options, io_options);
624
- if (error_status.ok()) {
625
- error_status = dir->FsyncWithDirOptions(
626
- io_options, nullptr,
627
- DirFsyncOptions(DirFsyncOptions::FsyncReason::kNewFileSynced));
628
- }
629
- if (!error_status.ok()) {
630
- s = error_status;
631
- break;
632
- }
633
- }
634
- }
635
- } else if (!skip_set_bg_error) {
636
- // When `skip_set_bg_error` is true, no memtable is picked so
637
- // there is no need to call Cancel() or RollbackMemtableFlush().
638
- //
639
- // Need to undo atomic flush if something went wrong, i.e. s is not OK and
640
- // it is not because of CF drop.
641
- // Have to cancel the flush jobs that have NOT executed because we need to
642
- // unref the versions.
643
- for (int i = 0; i != num_cfs; ++i) {
644
- if (pick_status[i] && !exec_status[i].first) {
645
- jobs[i]->Cancel();
646
- }
647
- }
648
- for (int i = 0; i != num_cfs; ++i) {
649
- if (exec_status[i].second.ok() && exec_status[i].first) {
650
- auto& mems = jobs[i]->GetMemTables();
651
- cfds[i]->imm()->RollbackMemtableFlush(
652
- mems, /*rollback_succeeding_memtables=*/false);
653
- }
654
- }
655
- }
656
-
657
- if (s.ok()) {
658
- const auto wait_to_install_func =
659
- [&]() -> std::pair<Status, bool /*continue to wait*/> {
660
- if (!versions_->io_status().ok()) {
661
- // Something went wrong elsewhere, we cannot count on waiting for our
662
- // turn to write/sync to MANIFEST or CURRENT. Just return.
663
- return std::make_pair(versions_->io_status(), false);
664
- } else if (shutting_down_.load(std::memory_order_acquire)) {
665
- return std::make_pair(Status::ShutdownInProgress(), false);
666
- }
667
- bool ready = true;
668
- for (size_t i = 0; i != cfds.size(); ++i) {
669
- const auto& mems = jobs[i]->GetMemTables();
670
- if (cfds[i]->IsDropped()) {
671
- // If the column family is dropped, then do not wait.
672
- continue;
673
- } else if (!mems.empty() &&
674
- cfds[i]->imm()->GetEarliestMemTableID() < mems[0]->GetID()) {
675
- // If a flush job needs to install the flush result for mems and
676
- // mems[0] is not the earliest memtable, it means another thread must
677
- // be installing flush results for the same column family, then the
678
- // current thread needs to wait.
679
- ready = false;
680
- break;
681
- } else if (mems.empty() && cfds[i]->imm()->GetEarliestMemTableID() <=
682
- bg_flush_args[i].max_memtable_id_) {
683
- // If a flush job does not need to install flush results, then it has
684
- // to wait until all memtables up to max_memtable_id_ (inclusive) are
685
- // installed.
686
- ready = false;
687
- break;
688
- }
689
- }
690
- return std::make_pair(Status::OK(), !ready);
691
- };
692
-
693
- bool resuming_from_bg_err =
694
- error_handler_.IsDBStopped() || flush_for_recovery;
695
- while ((!resuming_from_bg_err || error_handler_.GetRecoveryError().ok())) {
696
- std::pair<Status, bool> res = wait_to_install_func();
697
-
698
- TEST_SYNC_POINT_CALLBACK(
699
- "DBImpl::AtomicFlushMemTablesToOutputFiles:WaitToCommit", &res);
700
-
701
- if (!res.first.ok()) {
702
- s = res.first;
703
- break;
704
- } else if (!res.second) {
705
- // we are the oldest immutable memtable
706
- break;
707
- }
708
- // We are not the oldest immutable memtable
709
- TEST_SYNC_POINT_CALLBACK(
710
- "DBImpl::AtomicFlushMemTablesToOutputFiles:WaitCV", &res);
711
- //
712
- // If bg work is stopped, recovery thread first calls
713
- // WaitForBackgroundWork() before proceeding to flush for recovery. This
714
- // flush can block WaitForBackgroundWork() while waiting for recovery
715
- // flush to install result. To avoid this deadlock, we should abort here
716
- // if there is background error.
717
- if (!flush_for_recovery && error_handler_.IsBGWorkStopped() &&
718
- !error_handler_.GetBGError().ok()) {
719
- s = error_handler_.GetBGError();
720
- assert(!s.ok());
721
- break;
722
- }
723
- atomic_flush_install_cv_.Wait();
724
-
725
- resuming_from_bg_err = error_handler_.IsDBStopped() || flush_for_recovery;
726
- }
727
-
728
- if (!resuming_from_bg_err) {
729
- // If not resuming from bg err, then we determine future action based on
730
- // whether we hit background error.
731
- if (s.ok()) {
732
- s = error_handler_.GetBGError();
733
- }
734
- } else if (s.ok()) {
735
- // If resuming from bg err, we still rely on wait_to_install_func()'s
736
- // result to determine future action. If wait_to_install_func() returns
737
- // non-ok already, then we should not proceed to flush result
738
- // installation.
739
- s = error_handler_.GetRecoveryError();
740
- }
741
- // Since we are not installing these memtables, need to rollback
742
- // to allow future flush job to pick up these memtables.
743
- if (!s.ok()) {
744
- for (int i = 0; i != num_cfs; ++i) {
745
- assert(exec_status[i].first);
746
- assert(exec_status[i].second.ok());
747
- auto& mems = jobs[i]->GetMemTables();
748
- cfds[i]->imm()->RollbackMemtableFlush(
749
- mems, /*rollback_succeeding_memtables=*/false);
750
- }
751
- }
752
- }
753
-
754
- if (s.ok()) {
755
- autovector<ColumnFamilyData*> tmp_cfds;
756
- autovector<const autovector<MemTable*>*> mems_list;
757
- autovector<const MutableCFOptions*> mutable_cf_options_list;
758
- autovector<FileMetaData*> tmp_file_meta;
759
- autovector<std::list<std::unique_ptr<FlushJobInfo>>*>
760
- committed_flush_jobs_info;
761
- for (int i = 0; i != num_cfs; ++i) {
762
- const auto& mems = jobs[i]->GetMemTables();
763
- if (!cfds[i]->IsDropped() && !mems.empty()) {
764
- tmp_cfds.emplace_back(cfds[i]);
765
- mems_list.emplace_back(&mems);
766
- mutable_cf_options_list.emplace_back(&all_mutable_cf_options[i]);
767
- tmp_file_meta.emplace_back(&file_meta[i]);
768
- committed_flush_jobs_info.emplace_back(
769
- jobs[i]->GetCommittedFlushJobsInfo());
770
- }
771
- }
772
-
773
- s = InstallMemtableAtomicFlushResults(
774
- nullptr /* imm_lists */, tmp_cfds, mutable_cf_options_list, mems_list,
775
- versions_.get(), &logs_with_prep_tracker_, &mutex_, tmp_file_meta,
776
- committed_flush_jobs_info, &job_context->memtables_to_free,
777
- directories_.GetDbDir(), log_buffer);
778
- }
779
-
780
- if (s.ok()) {
781
- assert(num_cfs ==
782
- static_cast<int>(job_context->superversion_contexts.size()));
783
- for (int i = 0; i != num_cfs; ++i) {
784
- assert(cfds[i]);
785
-
786
- if (cfds[i]->IsDropped()) {
787
- continue;
788
- }
789
- InstallSuperVersionAndScheduleWork(cfds[i],
790
- &job_context->superversion_contexts[i],
791
- all_mutable_cf_options[i]);
792
-
793
- const std::string& column_family_name = cfds[i]->GetName();
794
-
795
- Version* const current = cfds[i]->current();
796
- assert(current);
797
-
798
- const VersionStorageInfo* const storage_info = current->storage_info();
799
- assert(storage_info);
800
-
801
- VersionStorageInfo::LevelSummaryStorage tmp;
802
- ROCKS_LOG_BUFFER(log_buffer, "[%s] Level summary: %s\n",
803
- column_family_name.c_str(),
804
- storage_info->LevelSummary(&tmp));
805
-
806
- const auto& blob_files = storage_info->GetBlobFiles();
807
- if (!blob_files.empty()) {
808
- assert(blob_files.front());
809
- assert(blob_files.back());
810
-
811
- ROCKS_LOG_BUFFER(
812
- log_buffer,
813
- "[%s] Blob file summary: head=%" PRIu64 ", tail=%" PRIu64 "\n",
814
- column_family_name.c_str(), blob_files.front()->GetBlobFileNumber(),
815
- blob_files.back()->GetBlobFileNumber());
816
- }
817
- }
818
- if (made_progress) {
819
- *made_progress = true;
820
- }
821
- auto sfm = static_cast<SstFileManagerImpl*>(
822
- immutable_db_options_.sst_file_manager.get());
823
- assert(all_mutable_cf_options.size() == static_cast<size_t>(num_cfs));
824
- for (int i = 0; s.ok() && i != num_cfs; ++i) {
825
- // If mempurge happened instead of Flush,
826
- // no NotifyOnFlushCompleted call (no SST file created).
827
- if (switched_to_mempurge[i]) {
828
- continue;
829
- }
830
- if (cfds[i]->IsDropped()) {
831
- continue;
832
- }
833
- NotifyOnFlushCompleted(cfds[i], all_mutable_cf_options[i],
834
- jobs[i]->GetCommittedFlushJobsInfo());
835
- if (sfm) {
836
- std::string file_path = MakeTableFileName(
837
- cfds[i]->ioptions()->cf_paths[0].path, file_meta[i].fd.GetNumber());
838
- // TODO (PR7798). We should only add the file to the FileManager if it
839
- // exists. Otherwise, some tests may fail. Ignore the error in the
840
- // interim.
841
- sfm->OnAddFile(file_path).PermitUncheckedError();
842
- if (sfm->IsMaxAllowedSpaceReached() &&
843
- error_handler_.GetBGError().ok()) {
844
- Status new_bg_error =
845
- Status::SpaceLimit("Max allowed space was reached");
846
- error_handler_.SetBGError(new_bg_error,
847
- BackgroundErrorReason::kFlush);
848
- }
849
- }
850
- }
851
- }
852
-
853
- // Need to undo atomic flush if something went wrong, i.e. s is not OK and
854
- // it is not because of CF drop.
855
- if (!s.ok() && !s.IsColumnFamilyDropped() && !skip_set_bg_error) {
856
- if (log_io_s.ok()) {
857
- // Error while writing to MANIFEST.
858
- // In fact, versions_->io_status() can also be the result of renaming
859
- // CURRENT file. With current code, it's just difficult to tell. So just
860
- // be pessimistic and try write to a new MANIFEST.
861
- // TODO: distinguish between MANIFEST write and CURRENT renaming
862
- if (!versions_->io_status().ok()) {
863
- // If WAL sync is successful (either WAL size is 0 or there is no IO
864
- // error), all the Manifest write will be map to soft error.
865
- // TODO: kManifestWriteNoWAL and kFlushNoWAL are misleading. Refactor
866
- // is needed.
867
- error_handler_.SetBGError(s,
868
- BackgroundErrorReason::kManifestWriteNoWAL);
869
- } else {
870
- // If WAL sync is successful (either WAL size is 0 or there is no IO
871
- // error), all the other SST file write errors will be set as
872
- // kFlushNoWAL.
873
- error_handler_.SetBGError(s, BackgroundErrorReason::kFlushNoWAL);
874
- }
875
- } else {
876
- assert(s == log_io_s);
877
- Status new_bg_error = s;
878
- error_handler_.SetBGError(new_bg_error, BackgroundErrorReason::kFlush);
879
- }
880
- }
881
-
882
- return s;
883
- }
884
-
885
- void DBImpl::NotifyOnFlushBegin(ColumnFamilyData* cfd, FileMetaData* file_meta,
886
- const MutableCFOptions& mutable_cf_options,
887
- int job_id, FlushReason flush_reason) {
888
- if (immutable_db_options_.listeners.size() == 0U) {
889
- return;
890
- }
891
- mutex_.AssertHeld();
892
- if (shutting_down_.load(std::memory_order_acquire)) {
893
- return;
894
- }
895
- bool triggered_writes_slowdown =
896
- (cfd->current()->storage_info()->NumLevelFiles(0) >=
897
- mutable_cf_options.level0_slowdown_writes_trigger);
898
- bool triggered_writes_stop =
899
- (cfd->current()->storage_info()->NumLevelFiles(0) >=
900
- mutable_cf_options.level0_stop_writes_trigger);
901
- // release lock while notifying events
902
- mutex_.Unlock();
903
- {
904
- FlushJobInfo info{};
905
- info.cf_id = cfd->GetID();
906
- info.cf_name = cfd->GetName();
907
- // TODO(yhchiang): make db_paths dynamic in case flush does not
908
- // go to L0 in the future.
909
- const uint64_t file_number = file_meta->fd.GetNumber();
910
- info.file_path =
911
- MakeTableFileName(cfd->ioptions()->cf_paths[0].path, file_number);
912
- info.file_number = file_number;
913
- info.thread_id = env_->GetThreadID();
914
- info.job_id = job_id;
915
- info.triggered_writes_slowdown = triggered_writes_slowdown;
916
- info.triggered_writes_stop = triggered_writes_stop;
917
- info.smallest_seqno = file_meta->fd.smallest_seqno;
918
- info.largest_seqno = file_meta->fd.largest_seqno;
919
- info.flush_reason = flush_reason;
920
- for (const auto& listener : immutable_db_options_.listeners) {
921
- listener->OnFlushBegin(this, info);
922
- }
923
- }
924
- mutex_.Lock();
925
- // no need to signal bg_cv_ as it will be signaled at the end of the
926
- // flush process.
927
- }
928
-
929
- void DBImpl::NotifyOnFlushCompleted(
930
- ColumnFamilyData* cfd, const MutableCFOptions& mutable_cf_options,
931
- std::list<std::unique_ptr<FlushJobInfo>>* flush_jobs_info) {
932
- assert(flush_jobs_info != nullptr);
933
- if (immutable_db_options_.listeners.size() == 0U) {
934
- return;
935
- }
936
- mutex_.AssertHeld();
937
- if (shutting_down_.load(std::memory_order_acquire)) {
938
- return;
939
- }
940
- bool triggered_writes_slowdown =
941
- (cfd->current()->storage_info()->NumLevelFiles(0) >=
942
- mutable_cf_options.level0_slowdown_writes_trigger);
943
- bool triggered_writes_stop =
944
- (cfd->current()->storage_info()->NumLevelFiles(0) >=
945
- mutable_cf_options.level0_stop_writes_trigger);
946
- // release lock while notifying events
947
- mutex_.Unlock();
948
- {
949
- for (auto& info : *flush_jobs_info) {
950
- info->triggered_writes_slowdown = triggered_writes_slowdown;
951
- info->triggered_writes_stop = triggered_writes_stop;
952
- for (const auto& listener : immutable_db_options_.listeners) {
953
- listener->OnFlushCompleted(this, *info);
954
- }
955
- TEST_SYNC_POINT(
956
- "DBImpl::NotifyOnFlushCompleted::PostAllOnFlushCompleted");
957
- }
958
- flush_jobs_info->clear();
959
- }
960
- mutex_.Lock();
961
- // no need to signal bg_cv_ as it will be signaled at the end of the
962
- // flush process.
963
- }
964
-
965
- Status DBImpl::CompactRange(const CompactRangeOptions& options,
966
- ColumnFamilyHandle* column_family,
967
- const Slice* begin_without_ts,
968
- const Slice* end_without_ts) {
969
- if (manual_compaction_paused_.load(std::memory_order_acquire) > 0) {
970
- return Status::Incomplete(Status::SubCode::kManualCompactionPaused);
971
- }
972
-
973
- if (options.canceled && options.canceled->load(std::memory_order_acquire)) {
974
- return Status::Incomplete(Status::SubCode::kManualCompactionPaused);
975
- }
976
-
977
- const Comparator* const ucmp = column_family->GetComparator();
978
- assert(ucmp);
979
- size_t ts_sz = ucmp->timestamp_size();
980
- if (ts_sz == 0) {
981
- return CompactRangeInternal(options, column_family, begin_without_ts,
982
- end_without_ts, "" /*trim_ts*/);
983
- }
984
-
985
- std::string begin_str, end_str;
986
- auto [begin, end] =
987
- MaybeAddTimestampsToRange(begin_without_ts, end_without_ts, ts_sz,
988
- &begin_str, &end_str, false /*exclusive_end*/);
989
-
990
- return CompactRangeInternal(
991
- options, column_family, begin.has_value() ? &begin.value() : nullptr,
992
- end.has_value() ? &end.value() : nullptr, "" /*trim_ts*/);
993
- }
994
-
995
- Status DBImpl::IncreaseFullHistoryTsLow(ColumnFamilyHandle* column_family,
996
- std::string ts_low) {
997
- ColumnFamilyData* cfd = nullptr;
998
- if (column_family == nullptr) {
999
- cfd = default_cf_handle_->cfd();
1000
- } else {
1001
- auto cfh = static_cast_with_check<ColumnFamilyHandleImpl>(column_family);
1002
- assert(cfh != nullptr);
1003
- cfd = cfh->cfd();
1004
- }
1005
- assert(cfd != nullptr && cfd->user_comparator() != nullptr);
1006
- if (cfd->user_comparator()->timestamp_size() == 0) {
1007
- return Status::InvalidArgument(
1008
- "Timestamp is not enabled in this column family");
1009
- }
1010
- if (cfd->user_comparator()->timestamp_size() != ts_low.size()) {
1011
- return Status::InvalidArgument("ts_low size mismatch");
1012
- }
1013
- return IncreaseFullHistoryTsLowImpl(cfd, ts_low);
1014
- }
1015
-
1016
- Status DBImpl::IncreaseFullHistoryTsLowImpl(ColumnFamilyData* cfd,
1017
- std::string ts_low) {
1018
- VersionEdit edit;
1019
- edit.SetColumnFamily(cfd->GetID());
1020
- edit.SetFullHistoryTsLow(ts_low);
1021
-
1022
- // TODO: plumb Env::IOActivity, Env::IOPriority
1023
- const ReadOptions read_options;
1024
- const WriteOptions write_options;
1025
-
1026
- TEST_SYNC_POINT_CALLBACK("DBImpl::IncreaseFullHistoryTsLowImpl:BeforeEdit",
1027
- &edit);
1028
-
1029
- InstrumentedMutexLock l(&mutex_);
1030
- std::string current_ts_low = cfd->GetFullHistoryTsLow();
1031
- const Comparator* ucmp = cfd->user_comparator();
1032
- assert(ucmp->timestamp_size() == ts_low.size() && !ts_low.empty());
1033
- if (!current_ts_low.empty() &&
1034
- ucmp->CompareTimestamp(ts_low, current_ts_low) < 0) {
1035
- std::stringstream oss;
1036
- oss << "Current full_history_ts_low: "
1037
- << ucmp->TimestampToString(current_ts_low)
1038
- << " is higher than provided ts: " << ucmp->TimestampToString(ts_low)
1039
- << std::endl;
1040
- return Status::InvalidArgument(oss.str());
1041
- }
1042
-
1043
- Status s = versions_->LogAndApply(cfd, *cfd->GetLatestMutableCFOptions(),
1044
- read_options, write_options, &edit, &mutex_,
1045
- directories_.GetDbDir());
1046
- if (!s.ok()) {
1047
- return s;
1048
- }
1049
- current_ts_low = cfd->GetFullHistoryTsLow();
1050
- if (!current_ts_low.empty() &&
1051
- ucmp->CompareTimestamp(current_ts_low, ts_low) > 0) {
1052
- std::stringstream oss;
1053
- oss << "full_history_ts_low: " << Slice(current_ts_low).ToString(true)
1054
- << " is set to be higher than the requested "
1055
- "timestamp: "
1056
- << Slice(ts_low).ToString(true) << std::endl;
1057
- return Status::TryAgain(oss.str());
1058
- }
1059
- return Status::OK();
1060
- }
1061
-
1062
- Status DBImpl::CompactRangeInternal(const CompactRangeOptions& options,
1063
- ColumnFamilyHandle* column_family,
1064
- const Slice* begin, const Slice* end,
1065
- const std::string& trim_ts) {
1066
- auto cfh = static_cast_with_check<ColumnFamilyHandleImpl>(column_family);
1067
- auto cfd = cfh->cfd();
1068
-
1069
- if (options.target_path_id >= cfd->ioptions()->cf_paths.size()) {
1070
- return Status::InvalidArgument("Invalid target path ID");
1071
- }
1072
- if (options.change_level &&
1073
- cfd->ioptions()->compaction_style == kCompactionStyleFIFO) {
1074
- return Status::NotSupported(
1075
- "FIFO compaction does not support change_level.");
1076
- }
1077
-
1078
- bool flush_needed = true;
1079
-
1080
- // Update full_history_ts_low if it's set
1081
- if (options.full_history_ts_low != nullptr &&
1082
- !options.full_history_ts_low->empty()) {
1083
- std::string ts_low = options.full_history_ts_low->ToString();
1084
- if (begin != nullptr || end != nullptr) {
1085
- return Status::InvalidArgument(
1086
- "Cannot specify compaction range with full_history_ts_low");
1087
- }
1088
- Status s = IncreaseFullHistoryTsLowImpl(cfd, ts_low);
1089
- if (!s.ok()) {
1090
- LogFlush(immutable_db_options_.info_log);
1091
- return s;
1092
- }
1093
- }
1094
-
1095
- Status s;
1096
- if (begin != nullptr && end != nullptr) {
1097
- // TODO(ajkr): We could also optimize away the flush in certain cases where
1098
- // one/both sides of the interval are unbounded. But it requires more
1099
- // changes to RangesOverlapWithMemtables.
1100
- UserKeyRange range(*begin, *end);
1101
- SuperVersion* super_version = cfd->GetReferencedSuperVersion(this);
1102
- s = cfd->RangesOverlapWithMemtables(
1103
- {range}, super_version, immutable_db_options_.allow_data_in_errors,
1104
- &flush_needed);
1105
- CleanupSuperVersion(super_version);
1106
- }
1107
-
1108
- if (s.ok() && flush_needed) {
1109
- FlushOptions fo;
1110
- fo.allow_write_stall = options.allow_write_stall;
1111
- if (immutable_db_options_.atomic_flush) {
1112
- s = AtomicFlushMemTables(fo, FlushReason::kManualCompaction);
1113
- } else {
1114
- s = FlushMemTable(cfd, fo, FlushReason::kManualCompaction);
1115
- }
1116
- if (!s.ok()) {
1117
- LogFlush(immutable_db_options_.info_log);
1118
- return s;
1119
- }
1120
- }
1121
-
1122
- constexpr int kInvalidLevel = -1;
1123
- int final_output_level = kInvalidLevel;
1124
- bool exclusive = options.exclusive_manual_compaction;
1125
- if (cfd->ioptions()->compaction_style == kCompactionStyleUniversal &&
1126
- cfd->NumberLevels() > 1) {
1127
- // Always compact all files together.
1128
- final_output_level = cfd->NumberLevels() - 1;
1129
- // if bottom most level is reserved
1130
- if (immutable_db_options_.allow_ingest_behind) {
1131
- final_output_level--;
1132
- }
1133
- s = RunManualCompaction(cfd, ColumnFamilyData::kCompactAllLevels,
1134
- final_output_level, options, begin, end, exclusive,
1135
- false /* disable_trivial_move */,
1136
- std::numeric_limits<uint64_t>::max(), trim_ts);
1137
- } else if (cfd->ioptions()->compaction_style == kCompactionStyleFIFO) {
1138
- // FIFOCompactionPicker::CompactRange() will ignore the input key range
1139
- // [begin, end] and just try to pick compaction based on the configured
1140
- // option `compaction_options_fifo`. So we skip checking if [begin, end]
1141
- // overlaps with the DB here.
1142
- final_output_level = 0;
1143
- s = RunManualCompaction(cfd, /*input_level=*/0, final_output_level, options,
1144
- begin, end, exclusive,
1145
- false /* disable_trivial_move */,
1146
- std::numeric_limits<uint64_t>::max(), trim_ts);
1147
- } else {
1148
- int first_overlapped_level = kInvalidLevel;
1149
- {
1150
- SuperVersion* super_version = cfd->GetReferencedSuperVersion(this);
1151
- Version* current_version = super_version->current;
1152
-
1153
- // Might need to query the partitioner
1154
- SstPartitionerFactory* partitioner_factory =
1155
- current_version->cfd()->ioptions()->sst_partitioner_factory.get();
1156
- std::unique_ptr<SstPartitioner> partitioner;
1157
- if (partitioner_factory && begin != nullptr && end != nullptr) {
1158
- SstPartitioner::Context context;
1159
- context.is_full_compaction = false;
1160
- context.is_manual_compaction = true;
1161
- context.output_level = /*unknown*/ -1;
1162
- // Small lies about compaction range
1163
- context.smallest_user_key = *begin;
1164
- context.largest_user_key = *end;
1165
- partitioner = partitioner_factory->CreatePartitioner(context);
1166
- }
1167
-
1168
- ReadOptions ro;
1169
- ro.total_order_seek = true;
1170
- ro.io_activity = Env::IOActivity::kCompaction;
1171
- bool overlap;
1172
- for (int level = 0;
1173
- level < current_version->storage_info()->num_non_empty_levels();
1174
- level++) {
1175
- overlap = true;
1176
-
1177
- // Whether to look at specific keys within files for overlap with
1178
- // compaction range, other than largest and smallest keys of the file
1179
- // known in Version metadata.
1180
- bool check_overlap_within_file = false;
1181
- if (begin != nullptr && end != nullptr) {
1182
- // Typically checking overlap within files in this case
1183
- check_overlap_within_file = true;
1184
- // WART: Not known why we don't check within file in one-sided bound
1185
- // cases
1186
- if (partitioner) {
1187
- // Especially if the partitioner is new, the manual compaction
1188
- // might be used to enforce the partitioning. Checking overlap
1189
- // within files might miss cases where compaction is needed to
1190
- // partition the files, as in this example:
1191
- // * File has two keys "001" and "111"
1192
- // * Compaction range is ["011", "101")
1193
- // * Partition boundary at "100"
1194
- // In cases like this, file-level overlap with the compaction
1195
- // range is sufficient to force any partitioning that is needed
1196
- // within the compaction range.
1197
- //
1198
- // But if there's no partitioning boundary within the compaction
1199
- // range, we can be sure there's no need to fix partitioning
1200
- // within that range, thus safe to check overlap within file.
1201
- //
1202
- // Use a hypothetical trivial move query to check for partition
1203
- // boundary in range. (NOTE: in defiance of all conventions,
1204
- // `begin` and `end` here are both INCLUSIVE bounds, which makes
1205
- // this analogy to CanDoTrivialMove() accurate even when `end` is
1206
- // the first key in a partition.)
1207
- if (!partitioner->CanDoTrivialMove(*begin, *end)) {
1208
- check_overlap_within_file = false;
1209
- }
1210
- }
1211
- }
1212
- if (check_overlap_within_file) {
1213
- Status status = current_version->OverlapWithLevelIterator(
1214
- ro, file_options_, *begin, *end, level, &overlap);
1215
- if (!status.ok()) {
1216
- check_overlap_within_file = false;
1217
- }
1218
- }
1219
- if (!check_overlap_within_file) {
1220
- overlap = current_version->storage_info()->OverlapInLevel(level,
1221
- begin, end);
1222
- }
1223
- if (overlap) {
1224
- first_overlapped_level = level;
1225
- break;
1226
- }
1227
- }
1228
- CleanupSuperVersion(super_version);
1229
- }
1230
- if (s.ok() && first_overlapped_level != kInvalidLevel) {
1231
- if (cfd->ioptions()->compaction_style == kCompactionStyleUniversal) {
1232
- assert(first_overlapped_level == 0);
1233
- s = RunManualCompaction(
1234
- cfd, first_overlapped_level, first_overlapped_level, options, begin,
1235
- end, exclusive, true /* disallow_trivial_move */,
1236
- std::numeric_limits<uint64_t>::max() /* max_file_num_to_ignore */,
1237
- trim_ts);
1238
- final_output_level = first_overlapped_level;
1239
- } else {
1240
- assert(cfd->ioptions()->compaction_style == kCompactionStyleLevel);
1241
- uint64_t next_file_number = versions_->current_next_file_number();
1242
- // Start compaction from `first_overlapped_level`, one level down at a
1243
- // time, until output level >= max_overlapped_level.
1244
- // When max_overlapped_level == 0, we will still compact from L0 -> L1
1245
- // (or LBase), and followed by a bottommost level intra-level compaction
1246
- // at L1 (or LBase), if applicable.
1247
- int level = first_overlapped_level;
1248
- final_output_level = level;
1249
- int output_level = 0, base_level = 0;
1250
- for (;;) {
1251
- // Always allow L0 -> L1 compaction
1252
- if (level > 0) {
1253
- if (cfd->ioptions()->level_compaction_dynamic_level_bytes) {
1254
- assert(final_output_level < cfd->ioptions()->num_levels);
1255
- if (final_output_level + 1 == cfd->ioptions()->num_levels) {
1256
- break;
1257
- }
1258
- } else {
1259
- // TODO(cbi): there is still a race condition here where
1260
- // if a background compaction compacts some file beyond
1261
- // current()->storage_info()->num_non_empty_levels() right after
1262
- // the check here.This should happen very infrequently and should
1263
- // not happen once a user populates the last level of the LSM.
1264
- InstrumentedMutexLock l(&mutex_);
1265
- // num_non_empty_levels may be lower after a compaction, so
1266
- // we check for >= here.
1267
- if (final_output_level + 1 >=
1268
- cfd->current()->storage_info()->num_non_empty_levels()) {
1269
- break;
1270
- }
1271
- }
1272
- }
1273
- output_level = level + 1;
1274
- if (cfd->ioptions()->level_compaction_dynamic_level_bytes &&
1275
- level == 0) {
1276
- output_level = ColumnFamilyData::kCompactToBaseLevel;
1277
- }
1278
- // Use max value for `max_file_num_to_ignore` to always compact
1279
- // files down.
1280
- s = RunManualCompaction(
1281
- cfd, level, output_level, options, begin, end, exclusive,
1282
- !trim_ts.empty() /* disallow_trivial_move */,
1283
- std::numeric_limits<uint64_t>::max() /* max_file_num_to_ignore */,
1284
- trim_ts,
1285
- output_level == ColumnFamilyData::kCompactToBaseLevel
1286
- ? &base_level
1287
- : nullptr);
1288
- if (!s.ok()) {
1289
- break;
1290
- }
1291
- if (output_level == ColumnFamilyData::kCompactToBaseLevel) {
1292
- assert(base_level > 0);
1293
- level = base_level;
1294
- } else {
1295
- ++level;
1296
- }
1297
- final_output_level = level;
1298
- TEST_SYNC_POINT("DBImpl::RunManualCompaction()::1");
1299
- TEST_SYNC_POINT("DBImpl::RunManualCompaction()::2");
1300
- }
1301
- if (s.ok()) {
1302
- assert(final_output_level > 0);
1303
- // bottommost level intra-level compaction
1304
- if ((options.bottommost_level_compaction ==
1305
- BottommostLevelCompaction::kIfHaveCompactionFilter &&
1306
- (cfd->ioptions()->compaction_filter != nullptr ||
1307
- cfd->ioptions()->compaction_filter_factory != nullptr)) ||
1308
- options.bottommost_level_compaction ==
1309
- BottommostLevelCompaction::kForceOptimized ||
1310
- options.bottommost_level_compaction ==
1311
- BottommostLevelCompaction::kForce) {
1312
- // Use `next_file_number` as `max_file_num_to_ignore` to avoid
1313
- // rewriting newly compacted files when it is kForceOptimized
1314
- // or kIfHaveCompactionFilter with compaction filter set.
1315
- s = RunManualCompaction(
1316
- cfd, final_output_level, final_output_level, options, begin,
1317
- end, exclusive, true /* disallow_trivial_move */,
1318
- next_file_number /* max_file_num_to_ignore */, trim_ts);
1319
- }
1320
- }
1321
- }
1322
- }
1323
- }
1324
- if (!s.ok() || final_output_level == kInvalidLevel) {
1325
- LogFlush(immutable_db_options_.info_log);
1326
- return s;
1327
- }
1328
-
1329
- if (options.change_level) {
1330
- TEST_SYNC_POINT("DBImpl::CompactRange:BeforeRefit:1");
1331
- TEST_SYNC_POINT("DBImpl::CompactRange:BeforeRefit:2");
1332
-
1333
- ROCKS_LOG_INFO(immutable_db_options_.info_log,
1334
- "[RefitLevel] waiting for background threads to stop");
1335
- // TODO(hx235): remove `Enable/DisableManualCompaction` and
1336
- // `Continue/PauseBackgroundWork` once we ensure registering RefitLevel()'s
1337
- // range is sufficient (if not, what else is needed) for avoiding range
1338
- // conflicts with other activities (e.g, compaction, flush) that are
1339
- // currently avoided by `Enable/DisableManualCompaction` and
1340
- // `Continue/PauseBackgroundWork`.
1341
- DisableManualCompaction();
1342
- s = PauseBackgroundWork();
1343
- if (s.ok()) {
1344
- TEST_SYNC_POINT("DBImpl::CompactRange:PreRefitLevel");
1345
- s = ReFitLevel(cfd, final_output_level, options.target_level);
1346
- TEST_SYNC_POINT("DBImpl::CompactRange:PostRefitLevel");
1347
- // ContinueBackgroundWork always return Status::OK().
1348
- Status temp_s = ContinueBackgroundWork();
1349
- assert(temp_s.ok());
1350
- }
1351
- EnableManualCompaction();
1352
- TEST_SYNC_POINT(
1353
- "DBImpl::CompactRange:PostRefitLevel:ManualCompactionEnabled");
1354
- }
1355
- LogFlush(immutable_db_options_.info_log);
1356
-
1357
- {
1358
- InstrumentedMutexLock l(&mutex_);
1359
- // an automatic compaction that has been scheduled might have been
1360
- // preempted by the manual compactions. Need to schedule it back.
1361
- MaybeScheduleFlushOrCompaction();
1362
- }
1363
-
1364
- return s;
1365
- }
1366
-
1367
- Status DBImpl::CompactFiles(const CompactionOptions& compact_options,
1368
- ColumnFamilyHandle* column_family,
1369
- const std::vector<std::string>& input_file_names,
1370
- const int output_level, const int output_path_id,
1371
- std::vector<std::string>* const output_file_names,
1372
- CompactionJobInfo* compaction_job_info) {
1373
- if (column_family == nullptr) {
1374
- return Status::InvalidArgument("ColumnFamilyHandle must be non-null.");
1375
- }
1376
-
1377
- auto cfd =
1378
- static_cast_with_check<ColumnFamilyHandleImpl>(column_family)->cfd();
1379
- assert(cfd);
1380
-
1381
- Status s;
1382
- JobContext job_context(next_job_id_.fetch_add(1), true);
1383
- LogBuffer log_buffer(InfoLogLevel::INFO_LEVEL,
1384
- immutable_db_options_.info_log.get());
1385
-
1386
- if (compact_options.compression !=
1387
- CompressionType::kDisableCompressionOption) {
1388
- ROCKS_LOG_WARN(immutable_db_options_.info_log,
1389
- "[%s] [JOB %d] Found use of deprecated option "
1390
- "`CompactionOptions::compression`",
1391
- cfd->GetName().c_str(), job_context.job_id);
1392
- }
1393
-
1394
- // Perform CompactFiles
1395
- TEST_SYNC_POINT("TestCompactFiles::IngestExternalFile2");
1396
- TEST_SYNC_POINT_CALLBACK("TestCompactFiles:PausingManualCompaction:3",
1397
- static_cast<void*>(const_cast<std::atomic<int>*>(
1398
- &manual_compaction_paused_)));
1399
- {
1400
- InstrumentedMutexLock l(&mutex_);
1401
- auto* current = cfd->current();
1402
- current->Ref();
1403
-
1404
- s = CompactFilesImpl(compact_options, cfd, current, input_file_names,
1405
- output_file_names, output_level, output_path_id,
1406
- &job_context, &log_buffer, compaction_job_info);
1407
-
1408
- current->Unref();
1409
- }
1410
-
1411
- // Find and delete obsolete files
1412
- {
1413
- InstrumentedMutexLock l(&mutex_);
1414
- // If !s.ok(), this means that Compaction failed. In that case, we want
1415
- // to delete all obsolete files we might have created and we force
1416
- // FindObsoleteFiles(). This is because job_context does not
1417
- // catch all created files if compaction failed.
1418
- FindObsoleteFiles(&job_context, !s.ok());
1419
- } // release the mutex
1420
-
1421
- // delete unnecessary files if any, this is done outside the mutex
1422
- if (job_context.HaveSomethingToClean() ||
1423
- job_context.HaveSomethingToDelete() || !log_buffer.IsEmpty()) {
1424
- // Have to flush the info logs before bg_compaction_scheduled_--
1425
- // because if bg_flush_scheduled_ becomes 0 and the lock is
1426
- // released, the deconstructor of DB can kick in and destroy all the
1427
- // states of DB so info_log might not be available after that point.
1428
- // It also applies to access other states that DB owns.
1429
- log_buffer.FlushBufferToLog();
1430
- if (job_context.HaveSomethingToDelete()) {
1431
- // no mutex is locked here. No need to Unlock() and Lock() here.
1432
- PurgeObsoleteFiles(job_context);
1433
- }
1434
- job_context.Clean();
1435
- }
1436
-
1437
- return s;
1438
- }
1439
-
1440
- Status DBImpl::CompactFilesImpl(
1441
- const CompactionOptions& compact_options, ColumnFamilyData* cfd,
1442
- Version* version, const std::vector<std::string>& input_file_names,
1443
- std::vector<std::string>* const output_file_names, const int output_level,
1444
- int output_path_id, JobContext* job_context, LogBuffer* log_buffer,
1445
- CompactionJobInfo* compaction_job_info) {
1446
- mutex_.AssertHeld();
1447
-
1448
- if (shutting_down_.load(std::memory_order_acquire)) {
1449
- return Status::ShutdownInProgress();
1450
- }
1451
- if (manual_compaction_paused_.load(std::memory_order_acquire) > 0) {
1452
- return Status::Incomplete(Status::SubCode::kManualCompactionPaused);
1453
- }
1454
-
1455
- std::unordered_set<uint64_t> input_set;
1456
- for (const auto& file_name : input_file_names) {
1457
- input_set.insert(TableFileNameToNumber(file_name));
1458
- }
1459
-
1460
- ColumnFamilyMetaData cf_meta;
1461
- // TODO(yhchiang): can directly use version here if none of the
1462
- // following functions call is pluggable to external developers.
1463
- version->GetColumnFamilyMetaData(&cf_meta);
1464
-
1465
- if (output_path_id < 0) {
1466
- if (cfd->ioptions()->cf_paths.size() == 1U) {
1467
- output_path_id = 0;
1468
- } else {
1469
- return Status::NotSupported(
1470
- "Automatic output path selection is not "
1471
- "yet supported in CompactFiles()");
1472
- }
1473
- }
1474
-
1475
- if (cfd->ioptions()->allow_ingest_behind &&
1476
- output_level >= cfd->ioptions()->num_levels - 1) {
1477
- return Status::InvalidArgument(
1478
- "Exceed the maximum output level defined by "
1479
- "the current compaction algorithm with ingest_behind --- " +
1480
- std::to_string(cfd->ioptions()->num_levels - 1));
1481
- }
1482
-
1483
- std::vector<CompactionInputFiles> input_files;
1484
- Status s = cfd->compaction_picker()->SanitizeAndConvertCompactionInputFiles(
1485
- &input_set, cf_meta, output_level, version->storage_info(), &input_files);
1486
- TEST_SYNC_POINT(
1487
- "DBImpl::CompactFilesImpl::PostSanitizeAndConvertCompactionInputFiles");
1488
- if (!s.ok()) {
1489
- return s;
1490
- }
1491
-
1492
- for (const auto& inputs : input_files) {
1493
- if (cfd->compaction_picker()->AreFilesInCompaction(inputs.files)) {
1494
- return Status::Aborted(
1495
- "Some of the necessary compaction input "
1496
- "files are already being compacted");
1497
- }
1498
- }
1499
- bool sfm_reserved_compact_space = false;
1500
- // First check if we have enough room to do the compaction
1501
- bool enough_room = EnoughRoomForCompaction(
1502
- cfd, input_files, &sfm_reserved_compact_space, log_buffer);
1503
-
1504
- if (!enough_room) {
1505
- // m's vars will get set properly at the end of this function,
1506
- // as long as status == CompactionTooLarge
1507
- return Status::CompactionTooLarge();
1508
- }
1509
-
1510
- // At this point, CompactFiles will be run.
1511
- bg_compaction_scheduled_++;
1512
-
1513
- std::unique_ptr<Compaction> c;
1514
- assert(cfd->compaction_picker());
1515
- c.reset(cfd->compaction_picker()->CompactFiles(
1516
- compact_options, input_files, output_level, version->storage_info(),
1517
- *cfd->GetLatestMutableCFOptions(), mutable_db_options_, output_path_id));
1518
- // we already sanitized the set of input files and checked for conflicts
1519
- // without releasing the lock, so we're guaranteed a compaction can be formed.
1520
- assert(c != nullptr);
1521
-
1522
- c->FinalizeInputInfo(version);
1523
-
1524
- // deletion compaction currently not allowed in CompactFiles.
1525
- assert(!c->deletion_compaction());
1526
-
1527
- std::vector<SequenceNumber> snapshot_seqs;
1528
- SequenceNumber earliest_write_conflict_snapshot;
1529
- SnapshotChecker* snapshot_checker;
1530
- GetSnapshotContext(job_context, &snapshot_seqs,
1531
- &earliest_write_conflict_snapshot, &snapshot_checker);
1532
-
1533
- std::unique_ptr<std::list<uint64_t>::iterator> pending_outputs_inserted_elem(
1534
- new std::list<uint64_t>::iterator(
1535
- CaptureCurrentFileNumberInPendingOutputs()));
1536
-
1537
- assert(is_snapshot_supported_ || snapshots_.empty());
1538
- CompactionJobStats compaction_job_stats;
1539
- CompactionJob compaction_job(
1540
- job_context->job_id, c.get(), immutable_db_options_, mutable_db_options_,
1541
- file_options_for_compaction_, versions_.get(), &shutting_down_,
1542
- log_buffer, directories_.GetDbDir(),
1543
- GetDataDir(c->column_family_data(), c->output_path_id()),
1544
- GetDataDir(c->column_family_data(), 0), stats_, &mutex_, &error_handler_,
1545
- snapshot_seqs, earliest_write_conflict_snapshot, snapshot_checker,
1546
- job_context, table_cache_, &event_logger_,
1547
- c->mutable_cf_options()->paranoid_file_checks,
1548
- c->mutable_cf_options()->report_bg_io_stats, dbname_,
1549
- &compaction_job_stats, Env::Priority::USER, io_tracer_,
1550
- kManualCompactionCanceledFalse_, db_id_, db_session_id_,
1551
- c->column_family_data()->GetFullHistoryTsLow(), c->trim_ts(),
1552
- &blob_callback_, &bg_compaction_scheduled_,
1553
- &bg_bottom_compaction_scheduled_);
1554
-
1555
- // Creating a compaction influences the compaction score because the score
1556
- // takes running compactions into account (by skipping files that are already
1557
- // being compacted). Since we just changed compaction score, we recalculate it
1558
- // here.
1559
- version->storage_info()->ComputeCompactionScore(*cfd->ioptions(),
1560
- *c->mutable_cf_options());
1561
-
1562
- compaction_job.Prepare();
1563
-
1564
- mutex_.Unlock();
1565
- TEST_SYNC_POINT("CompactFilesImpl:0");
1566
- TEST_SYNC_POINT("CompactFilesImpl:1");
1567
- // Ignore the status here, as it will be checked in the Install down below...
1568
- compaction_job.Run().PermitUncheckedError();
1569
- TEST_SYNC_POINT("CompactFilesImpl:2");
1570
- TEST_SYNC_POINT("CompactFilesImpl:3");
1571
- mutex_.Lock();
1572
-
1573
- bool compaction_released = false;
1574
- Status status =
1575
- compaction_job.Install(*c->mutable_cf_options(), &compaction_released);
1576
- if (!compaction_released) {
1577
- c->ReleaseCompactionFiles(s);
1578
- }
1579
- if (status.ok()) {
1580
- assert(compaction_job.io_status().ok());
1581
- InstallSuperVersionAndScheduleWork(
1582
- c->column_family_data(), job_context->superversion_contexts.data(),
1583
- *c->mutable_cf_options());
1584
- }
1585
- // status above captures any error during compaction_job.Install, so its ok
1586
- // not check compaction_job.io_status() explicitly if we're not calling
1587
- // SetBGError
1588
- compaction_job.io_status().PermitUncheckedError();
1589
- // Need to make sure SstFileManager does its bookkeeping
1590
- auto sfm = static_cast<SstFileManagerImpl*>(
1591
- immutable_db_options_.sst_file_manager.get());
1592
- if (sfm && sfm_reserved_compact_space) {
1593
- sfm->OnCompactionCompletion(c.get());
1594
- }
1595
-
1596
- ReleaseFileNumberFromPendingOutputs(pending_outputs_inserted_elem);
1597
-
1598
- mutex_.Unlock();
1599
- if (compaction_job_info != nullptr) {
1600
- BuildCompactionJobInfo(cfd, c.get(), s, compaction_job_stats,
1601
- job_context->job_id, compaction_job_info);
1602
- }
1603
- mutex_.Lock();
1604
-
1605
- if (status.ok()) {
1606
- // Done
1607
- } else if (status.IsColumnFamilyDropped() || status.IsShutdownInProgress()) {
1608
- // Ignore compaction errors found during shutting down
1609
- } else if (status.IsManualCompactionPaused()) {
1610
- // Don't report stopping manual compaction as error
1611
- ROCKS_LOG_INFO(immutable_db_options_.info_log,
1612
- "[%s] [JOB %d] Stopping manual compaction",
1613
- c->column_family_data()->GetName().c_str(),
1614
- job_context->job_id);
1615
- } else {
1616
- ROCKS_LOG_WARN(immutable_db_options_.info_log,
1617
- "[%s] [JOB %d] Compaction error: %s",
1618
- c->column_family_data()->GetName().c_str(),
1619
- job_context->job_id, status.ToString().c_str());
1620
- IOStatus io_s = compaction_job.io_status();
1621
- if (!io_s.ok()) {
1622
- error_handler_.SetBGError(io_s, BackgroundErrorReason::kCompaction);
1623
- } else {
1624
- error_handler_.SetBGError(status, BackgroundErrorReason::kCompaction);
1625
- }
1626
- }
1627
-
1628
- if (output_file_names != nullptr) {
1629
- for (const auto& newf : c->edit()->GetNewFiles()) {
1630
- output_file_names->push_back(TableFileName(
1631
- c->immutable_options()->cf_paths, newf.second.fd.GetNumber(),
1632
- newf.second.fd.GetPathId()));
1633
- }
1634
-
1635
- for (const auto& blob_file : c->edit()->GetBlobFileAdditions()) {
1636
- output_file_names->push_back(
1637
- BlobFileName(c->immutable_options()->cf_paths.front().path,
1638
- blob_file.GetBlobFileNumber()));
1639
- }
1640
- }
1641
-
1642
- c.reset();
1643
-
1644
- bg_compaction_scheduled_--;
1645
- if (bg_compaction_scheduled_ == 0) {
1646
- bg_cv_.SignalAll();
1647
- }
1648
- MaybeScheduleFlushOrCompaction();
1649
- TEST_SYNC_POINT("CompactFilesImpl:End");
1650
-
1651
- return status;
1652
- }
1653
-
1654
- Status DBImpl::PauseBackgroundWork() {
1655
- InstrumentedMutexLock guard_lock(&mutex_);
1656
- bg_compaction_paused_++;
1657
- while (bg_bottom_compaction_scheduled_ > 0 || bg_compaction_scheduled_ > 0 ||
1658
- bg_flush_scheduled_ > 0) {
1659
- bg_cv_.Wait();
1660
- }
1661
- bg_work_paused_++;
1662
- return Status::OK();
1663
- }
1664
-
1665
- Status DBImpl::ContinueBackgroundWork() {
1666
- InstrumentedMutexLock guard_lock(&mutex_);
1667
- if (bg_work_paused_ == 0) {
1668
- return Status::InvalidArgument("Background work already unpaused");
1669
- }
1670
- assert(bg_work_paused_ > 0);
1671
- assert(bg_compaction_paused_ > 0);
1672
- bg_compaction_paused_--;
1673
- bg_work_paused_--;
1674
- // It's sufficient to check just bg_work_paused_ here since
1675
- // bg_work_paused_ is always no greater than bg_compaction_paused_
1676
- if (bg_work_paused_ == 0) {
1677
- MaybeScheduleFlushOrCompaction();
1678
- }
1679
- return Status::OK();
1680
- }
1681
-
1682
- void DBImpl::NotifyOnCompactionBegin(ColumnFamilyData* cfd, Compaction* c,
1683
- const Status& st,
1684
- const CompactionJobStats& job_stats,
1685
- int job_id) {
1686
- if (immutable_db_options_.listeners.empty()) {
1687
- return;
1688
- }
1689
- mutex_.AssertHeld();
1690
- if (shutting_down_.load(std::memory_order_acquire)) {
1691
- return;
1692
- }
1693
- if (c->is_manual_compaction() &&
1694
- manual_compaction_paused_.load(std::memory_order_acquire) > 0) {
1695
- return;
1696
- }
1697
-
1698
- c->SetNotifyOnCompactionCompleted();
1699
- // release lock while notifying events
1700
- mutex_.Unlock();
1701
- TEST_SYNC_POINT("DBImpl::NotifyOnCompactionBegin::UnlockMutex");
1702
- {
1703
- CompactionJobInfo info{};
1704
- BuildCompactionJobInfo(cfd, c, st, job_stats, job_id, &info);
1705
- for (const auto& listener : immutable_db_options_.listeners) {
1706
- listener->OnCompactionBegin(this, info);
1707
- }
1708
- info.status.PermitUncheckedError();
1709
- }
1710
- mutex_.Lock();
1711
- }
1712
-
1713
- void DBImpl::NotifyOnCompactionCompleted(
1714
- ColumnFamilyData* cfd, Compaction* c, const Status& st,
1715
- const CompactionJobStats& compaction_job_stats, const int job_id) {
1716
- if (immutable_db_options_.listeners.size() == 0U) {
1717
- return;
1718
- }
1719
- mutex_.AssertHeld();
1720
- if (shutting_down_.load(std::memory_order_acquire)) {
1721
- return;
1722
- }
1723
-
1724
- if (c->ShouldNotifyOnCompactionCompleted() == false) {
1725
- return;
1726
- }
1727
-
1728
- // release lock while notifying events
1729
- mutex_.Unlock();
1730
- TEST_SYNC_POINT("DBImpl::NotifyOnCompactionCompleted::UnlockMutex");
1731
- {
1732
- CompactionJobInfo info{};
1733
- BuildCompactionJobInfo(cfd, c, st, compaction_job_stats, job_id, &info);
1734
- for (const auto& listener : immutable_db_options_.listeners) {
1735
- listener->OnCompactionCompleted(this, info);
1736
- }
1737
- }
1738
- mutex_.Lock();
1739
- // no need to signal bg_cv_ as it will be signaled at the end of the
1740
- // flush process.
1741
- }
1742
-
1743
- // REQUIREMENT: block all background work by calling PauseBackgroundWork()
1744
- // before calling this function
1745
- // TODO (hx235): Replace Status::NotSupported() with Status::Aborted() for
1746
- // better semantics like CompactFiles()
1747
- Status DBImpl::ReFitLevel(ColumnFamilyData* cfd, int level, int target_level) {
1748
- assert(level < cfd->NumberLevels());
1749
- if (target_level >= cfd->NumberLevels()) {
1750
- return Status::InvalidArgument("Target level exceeds number of levels");
1751
- }
1752
-
1753
- const ReadOptions read_options(Env::IOActivity::kCompaction);
1754
- const WriteOptions write_options(Env::IOActivity::kCompaction);
1755
-
1756
- SuperVersionContext sv_context(/* create_superversion */ true);
1757
-
1758
- InstrumentedMutexLock guard_lock(&mutex_);
1759
-
1760
- auto* vstorage = cfd->current()->storage_info();
1761
- if (vstorage->LevelFiles(level).empty()) {
1762
- return Status::OK();
1763
- }
1764
- // only allow one thread refitting
1765
- if (refitting_level_) {
1766
- ROCKS_LOG_INFO(immutable_db_options_.info_log,
1767
- "[ReFitLevel] another thread is refitting");
1768
- return Status::NotSupported("another thread is refitting");
1769
- }
1770
- refitting_level_ = true;
1771
-
1772
- const MutableCFOptions mutable_cf_options = *cfd->GetLatestMutableCFOptions();
1773
- // move to a smaller level
1774
- int to_level = target_level;
1775
- if (target_level < 0) {
1776
- to_level = FindMinimumEmptyLevelFitting(cfd, mutable_cf_options, level);
1777
- }
1778
-
1779
- if (to_level != level) {
1780
- std::vector<CompactionInputFiles> input(1);
1781
- input[0].level = level;
1782
- // TODO (hx235): Only refit the output files in the current manual
1783
- // compaction instead of all the files in the output level
1784
- for (auto& f : vstorage->LevelFiles(level)) {
1785
- input[0].files.push_back(f);
1786
- }
1787
- InternalKey refit_level_smallest;
1788
- InternalKey refit_level_largest;
1789
- cfd->compaction_picker()->GetRange(input[0], &refit_level_smallest,
1790
- &refit_level_largest);
1791
- if (to_level > level) {
1792
- if (level == 0) {
1793
- refitting_level_ = false;
1794
- return Status::NotSupported(
1795
- "Cannot change from level 0 to other levels.");
1796
- }
1797
- // Check levels are empty for a trivial move
1798
- for (int l = level + 1; l <= to_level; l++) {
1799
- if (vstorage->NumLevelFiles(l) > 0) {
1800
- refitting_level_ = false;
1801
- return Status::NotSupported(
1802
- "Levels between source and target are not empty for a move.");
1803
- }
1804
- if (cfd->RangeOverlapWithCompaction(refit_level_smallest.user_key(),
1805
- refit_level_largest.user_key(),
1806
- l)) {
1807
- refitting_level_ = false;
1808
- return Status::NotSupported(
1809
- "Levels between source and target "
1810
- "will have some ongoing compaction's output.");
1811
- }
1812
- }
1813
- } else {
1814
- // to_level < level
1815
- if (to_level == 0 && input[0].files.size() > 1) {
1816
- refitting_level_ = false;
1817
- return Status::Aborted(
1818
- "Moving more than 1 file from non-L0 to L0 is not allowed as it "
1819
- "does not bring any benefit to read nor write throughput.");
1820
- }
1821
- // Check levels are empty for a trivial move
1822
- for (int l = to_level; l < level; l++) {
1823
- if (vstorage->NumLevelFiles(l) > 0) {
1824
- refitting_level_ = false;
1825
- return Status::NotSupported(
1826
- "Levels between source and target are not empty for a move.");
1827
- }
1828
- if (cfd->RangeOverlapWithCompaction(refit_level_smallest.user_key(),
1829
- refit_level_largest.user_key(),
1830
- l)) {
1831
- refitting_level_ = false;
1832
- return Status::NotSupported(
1833
- "Levels between source and target "
1834
- "will have some ongoing compaction's output.");
1835
- }
1836
- }
1837
- }
1838
- ROCKS_LOG_DEBUG(immutable_db_options_.info_log,
1839
- "[%s] Before refitting:\n%s", cfd->GetName().c_str(),
1840
- cfd->current()->DebugString().data());
1841
-
1842
- std::unique_ptr<Compaction> c(new Compaction(
1843
- vstorage, *cfd->ioptions(), mutable_cf_options, mutable_db_options_,
1844
- {input}, to_level,
1845
- MaxFileSizeForLevel(
1846
- mutable_cf_options, to_level,
1847
- cfd->ioptions()
1848
- ->compaction_style) /* output file size limit, not applicable */
1849
- ,
1850
- LLONG_MAX /* max compaction bytes, not applicable */,
1851
- 0 /* output path ID, not applicable */, mutable_cf_options.compression,
1852
- mutable_cf_options.compression_opts,
1853
- mutable_cf_options.default_write_temperature,
1854
- 0 /* max_subcompactions, not applicable */,
1855
- {} /* grandparents, not applicable */, false /* is manual */,
1856
- "" /* trim_ts */, -1 /* score, not applicable */,
1857
- false /* is deletion compaction, not applicable */,
1858
- false /* l0_files_might_overlap, not applicable */,
1859
- CompactionReason::kRefitLevel));
1860
- cfd->compaction_picker()->RegisterCompaction(c.get());
1861
- TEST_SYNC_POINT("DBImpl::ReFitLevel:PostRegisterCompaction");
1862
- VersionEdit edit;
1863
- edit.SetColumnFamily(cfd->GetID());
1864
-
1865
- for (const auto& f : vstorage->LevelFiles(level)) {
1866
- edit.DeleteFile(level, f->fd.GetNumber());
1867
- edit.AddFile(
1868
- to_level, f->fd.GetNumber(), f->fd.GetPathId(), f->fd.GetFileSize(),
1869
- f->smallest, f->largest, f->fd.smallest_seqno, f->fd.largest_seqno,
1870
- f->marked_for_compaction, f->temperature, f->oldest_blob_file_number,
1871
- f->oldest_ancester_time, f->file_creation_time, f->epoch_number,
1872
- f->file_checksum, f->file_checksum_func_name, f->unique_id,
1873
- f->compensated_range_deletion_size, f->tail_size,
1874
- f->user_defined_timestamps_persisted);
1875
- }
1876
- ROCKS_LOG_DEBUG(immutable_db_options_.info_log,
1877
- "[%s] Apply version edit:\n%s", cfd->GetName().c_str(),
1878
- edit.DebugString().data());
1879
-
1880
- Status status = versions_->LogAndApply(cfd, mutable_cf_options,
1881
- read_options, write_options, &edit,
1882
- &mutex_, directories_.GetDbDir());
1883
-
1884
- cfd->compaction_picker()->UnregisterCompaction(c.get());
1885
- c.reset();
1886
-
1887
- InstallSuperVersionAndScheduleWork(cfd, &sv_context, mutable_cf_options);
1888
-
1889
- ROCKS_LOG_DEBUG(immutable_db_options_.info_log, "[%s] LogAndApply: %s\n",
1890
- cfd->GetName().c_str(), status.ToString().data());
1891
-
1892
- if (status.ok()) {
1893
- ROCKS_LOG_DEBUG(immutable_db_options_.info_log,
1894
- "[%s] After refitting:\n%s", cfd->GetName().c_str(),
1895
- cfd->current()->DebugString().data());
1896
- }
1897
- sv_context.Clean();
1898
- refitting_level_ = false;
1899
-
1900
- return status;
1901
- }
1902
-
1903
- refitting_level_ = false;
1904
- return Status::OK();
1905
- }
1906
-
1907
- int DBImpl::NumberLevels(ColumnFamilyHandle* column_family) {
1908
- auto cfh = static_cast_with_check<ColumnFamilyHandleImpl>(column_family);
1909
- return cfh->cfd()->NumberLevels();
1910
- }
1911
-
1912
- int DBImpl::MaxMemCompactionLevel(ColumnFamilyHandle* /*column_family*/) {
1913
- return 0;
1914
- }
1915
-
1916
- int DBImpl::Level0StopWriteTrigger(ColumnFamilyHandle* column_family) {
1917
- auto cfh = static_cast_with_check<ColumnFamilyHandleImpl>(column_family);
1918
- InstrumentedMutexLock l(&mutex_);
1919
- return cfh->cfd()
1920
- ->GetSuperVersion()
1921
- ->mutable_cf_options.level0_stop_writes_trigger;
1922
- }
1923
-
1924
- Status DBImpl::FlushAllColumnFamilies(const FlushOptions& flush_options,
1925
- FlushReason flush_reason) {
1926
- mutex_.AssertHeld();
1927
- Status status;
1928
- if (immutable_db_options_.atomic_flush) {
1929
- mutex_.Unlock();
1930
- status = AtomicFlushMemTables(flush_options, flush_reason);
1931
- if (status.IsColumnFamilyDropped()) {
1932
- status = Status::OK();
1933
- }
1934
- mutex_.Lock();
1935
- } else {
1936
- for (auto cfd : versions_->GetRefedColumnFamilySet()) {
1937
- if (cfd->IsDropped()) {
1938
- continue;
1939
- }
1940
- mutex_.Unlock();
1941
- status = FlushMemTable(cfd, flush_options, flush_reason);
1942
- TEST_SYNC_POINT("DBImpl::FlushAllColumnFamilies:1");
1943
- TEST_SYNC_POINT("DBImpl::FlushAllColumnFamilies:2");
1944
- mutex_.Lock();
1945
- if (!status.ok() && !status.IsColumnFamilyDropped()) {
1946
- break;
1947
- } else if (status.IsColumnFamilyDropped()) {
1948
- status = Status::OK();
1949
- }
1950
- }
1951
- }
1952
- return status;
1953
- }
1954
-
1955
- Status DBImpl::Flush(const FlushOptions& flush_options,
1956
- ColumnFamilyHandle* column_family) {
1957
- auto cfh = static_cast_with_check<ColumnFamilyHandleImpl>(column_family);
1958
- ROCKS_LOG_INFO(immutable_db_options_.info_log, "[%s] Manual flush start.",
1959
- cfh->GetName().c_str());
1960
- Status s;
1961
- if (immutable_db_options_.atomic_flush) {
1962
- s = AtomicFlushMemTables(flush_options, FlushReason::kManualFlush,
1963
- {cfh->cfd()});
1964
- } else {
1965
- s = FlushMemTable(cfh->cfd(), flush_options, FlushReason::kManualFlush);
1966
- }
1967
-
1968
- ROCKS_LOG_INFO(immutable_db_options_.info_log,
1969
- "[%s] Manual flush finished, status: %s\n",
1970
- cfh->GetName().c_str(), s.ToString().c_str());
1971
- return s;
1972
- }
1973
-
1974
- Status DBImpl::Flush(const FlushOptions& flush_options,
1975
- const std::vector<ColumnFamilyHandle*>& column_families) {
1976
- Status s;
1977
- if (!immutable_db_options_.atomic_flush) {
1978
- for (auto cfh : column_families) {
1979
- s = Flush(flush_options, cfh);
1980
- if (!s.ok()) {
1981
- break;
1982
- }
1983
- }
1984
- } else {
1985
- ROCKS_LOG_INFO(immutable_db_options_.info_log,
1986
- "Manual atomic flush start.\n"
1987
- "=====Column families:=====");
1988
- for (auto cfh : column_families) {
1989
- auto cfhi = static_cast<ColumnFamilyHandleImpl*>(cfh);
1990
- ROCKS_LOG_INFO(immutable_db_options_.info_log, "%s",
1991
- cfhi->GetName().c_str());
1992
- }
1993
- ROCKS_LOG_INFO(immutable_db_options_.info_log,
1994
- "=====End of column families list=====");
1995
- autovector<ColumnFamilyData*> cfds;
1996
- std::for_each(column_families.begin(), column_families.end(),
1997
- [&cfds](ColumnFamilyHandle* elem) {
1998
- auto cfh = static_cast<ColumnFamilyHandleImpl*>(elem);
1999
- cfds.emplace_back(cfh->cfd());
2000
- });
2001
- s = AtomicFlushMemTables(flush_options, FlushReason::kManualFlush, cfds);
2002
- ROCKS_LOG_INFO(immutable_db_options_.info_log,
2003
- "Manual atomic flush finished, status: %s\n"
2004
- "=====Column families:=====",
2005
- s.ToString().c_str());
2006
- for (auto cfh : column_families) {
2007
- auto cfhi = static_cast<ColumnFamilyHandleImpl*>(cfh);
2008
- ROCKS_LOG_INFO(immutable_db_options_.info_log, "%s",
2009
- cfhi->GetName().c_str());
2010
- }
2011
- ROCKS_LOG_INFO(immutable_db_options_.info_log,
2012
- "=====End of column families list=====");
2013
- }
2014
- return s;
2015
- }
2016
-
2017
- Status DBImpl::RunManualCompaction(
2018
- ColumnFamilyData* cfd, int input_level, int output_level,
2019
- const CompactRangeOptions& compact_range_options, const Slice* begin,
2020
- const Slice* end, bool exclusive, bool disallow_trivial_move,
2021
- uint64_t max_file_num_to_ignore, const std::string& trim_ts,
2022
- int* final_output_level) {
2023
- assert(input_level == ColumnFamilyData::kCompactAllLevels ||
2024
- input_level >= 0);
2025
-
2026
- InternalKey begin_storage, end_storage;
2027
- CompactionArg* ca = nullptr;
2028
-
2029
- bool scheduled = false;
2030
- bool unscheduled = false;
2031
- Env::Priority thread_pool_priority = Env::Priority::TOTAL;
2032
- bool manual_conflict = false;
2033
-
2034
- ManualCompactionState manual(
2035
- cfd, input_level, output_level, compact_range_options.target_path_id,
2036
- exclusive, disallow_trivial_move, compact_range_options.canceled);
2037
- // For universal compaction, we enforce every manual compaction to compact
2038
- // all files.
2039
- if (begin == nullptr ||
2040
- cfd->ioptions()->compaction_style == kCompactionStyleUniversal ||
2041
- cfd->ioptions()->compaction_style == kCompactionStyleFIFO) {
2042
- manual.begin = nullptr;
2043
- } else {
2044
- begin_storage.SetMinPossibleForUserKey(*begin);
2045
- manual.begin = &begin_storage;
2046
- }
2047
- if (end == nullptr ||
2048
- cfd->ioptions()->compaction_style == kCompactionStyleUniversal ||
2049
- cfd->ioptions()->compaction_style == kCompactionStyleFIFO) {
2050
- manual.end = nullptr;
2051
- } else {
2052
- end_storage.SetMaxPossibleForUserKey(*end);
2053
- manual.end = &end_storage;
2054
- }
2055
-
2056
- TEST_SYNC_POINT("DBImpl::RunManualCompaction:0");
2057
- TEST_SYNC_POINT("DBImpl::RunManualCompaction:1");
2058
- InstrumentedMutexLock l(&mutex_);
2059
-
2060
- if (manual_compaction_paused_ > 0) {
2061
- // Does not make sense to `AddManualCompaction()` in this scenario since
2062
- // `DisableManualCompaction()` just waited for the manual compaction queue
2063
- // to drain. So return immediately.
2064
- TEST_SYNC_POINT("DBImpl::RunManualCompaction:PausedAtStart");
2065
- manual.status =
2066
- Status::Incomplete(Status::SubCode::kManualCompactionPaused);
2067
- manual.done = true;
2068
- return manual.status;
2069
- }
2070
-
2071
- // When a manual compaction arrives, temporarily disable scheduling of
2072
- // non-manual compactions and wait until the number of scheduled compaction
2073
- // jobs drops to zero. This used to be needed to ensure that this manual
2074
- // compaction can compact any range of keys/files. Now it is optional
2075
- // (see `CompactRangeOptions::exclusive_manual_compaction`). The use case for
2076
- // `exclusive_manual_compaction=true` is unclear beyond not trusting the code.
2077
- //
2078
- // HasPendingManualCompaction() is true when at least one thread is inside
2079
- // RunManualCompaction(), i.e. during that time no other compaction will
2080
- // get scheduled (see MaybeScheduleFlushOrCompaction).
2081
- //
2082
- // Note that the following loop doesn't stop more that one thread calling
2083
- // RunManualCompaction() from getting to the second while loop below.
2084
- // However, only one of them will actually schedule compaction, while
2085
- // others will wait on a condition variable until it completes.
2086
-
2087
- AddManualCompaction(&manual);
2088
- TEST_SYNC_POINT_CALLBACK("DBImpl::RunManualCompaction:NotScheduled", &mutex_);
2089
- if (exclusive) {
2090
- // Limitation: there's no way to wake up the below loop when user sets
2091
- // `*manual.canceled`. So `CompactRangeOptions::exclusive_manual_compaction`
2092
- // and `CompactRangeOptions::canceled` might not work well together.
2093
- while (bg_bottom_compaction_scheduled_ > 0 ||
2094
- bg_compaction_scheduled_ > 0) {
2095
- if (manual_compaction_paused_ > 0 || manual.canceled == true) {
2096
- // Pretend the error came from compaction so the below cleanup/error
2097
- // handling code can process it.
2098
- manual.done = true;
2099
- manual.status =
2100
- Status::Incomplete(Status::SubCode::kManualCompactionPaused);
2101
- break;
2102
- }
2103
- TEST_SYNC_POINT("DBImpl::RunManualCompaction:WaitScheduled");
2104
- ROCKS_LOG_INFO(
2105
- immutable_db_options_.info_log,
2106
- "[%s] Manual compaction waiting for all other scheduled background "
2107
- "compactions to finish",
2108
- cfd->GetName().c_str());
2109
- bg_cv_.Wait();
2110
- }
2111
- }
2112
-
2113
- LogBuffer log_buffer(InfoLogLevel::INFO_LEVEL,
2114
- immutable_db_options_.info_log.get());
2115
-
2116
- ROCKS_LOG_BUFFER(&log_buffer, "[%s] Manual compaction starting",
2117
- cfd->GetName().c_str());
2118
-
2119
- // We don't check bg_error_ here, because if we get the error in compaction,
2120
- // the compaction will set manual.status to bg_error_ and set manual.done to
2121
- // true.
2122
- while (!manual.done) {
2123
- assert(HasPendingManualCompaction());
2124
- manual_conflict = false;
2125
- Compaction* compaction = nullptr;
2126
- if (ShouldntRunManualCompaction(&manual) || (manual.in_progress == true) ||
2127
- scheduled ||
2128
- (((manual.manual_end = &manual.tmp_storage1) != nullptr) &&
2129
- ((compaction = manual.cfd->CompactRange(
2130
- *manual.cfd->GetLatestMutableCFOptions(), mutable_db_options_,
2131
- manual.input_level, manual.output_level, compact_range_options,
2132
- manual.begin, manual.end, &manual.manual_end, &manual_conflict,
2133
- max_file_num_to_ignore, trim_ts)) == nullptr &&
2134
- manual_conflict))) {
2135
- if (!manual.done) {
2136
- bg_cv_.Wait();
2137
- }
2138
- if (manual_compaction_paused_ > 0 && scheduled && !unscheduled) {
2139
- assert(thread_pool_priority != Env::Priority::TOTAL);
2140
- // unschedule all manual compactions
2141
- auto unscheduled_task_num = env_->UnSchedule(
2142
- GetTaskTag(TaskType::kManualCompaction), thread_pool_priority);
2143
- if (unscheduled_task_num > 0) {
2144
- ROCKS_LOG_INFO(
2145
- immutable_db_options_.info_log,
2146
- "[%s] Unscheduled %d number of manual compactions from the "
2147
- "thread-pool",
2148
- cfd->GetName().c_str(), unscheduled_task_num);
2149
- // it may unschedule other manual compactions, notify others.
2150
- bg_cv_.SignalAll();
2151
- }
2152
- unscheduled = true;
2153
- TEST_SYNC_POINT("DBImpl::RunManualCompaction:Unscheduled");
2154
- }
2155
- if (scheduled && manual.incomplete == true) {
2156
- assert(!manual.in_progress);
2157
- scheduled = false;
2158
- manual.incomplete = false;
2159
- }
2160
- } else if (!scheduled) {
2161
- if (compaction == nullptr) {
2162
- manual.done = true;
2163
- if (final_output_level) {
2164
- // No compaction needed or there is a conflicting compaction.
2165
- // Still set `final_output_level` to the level where we would
2166
- // have compacted to.
2167
- *final_output_level = output_level;
2168
- if (output_level == ColumnFamilyData::kCompactToBaseLevel) {
2169
- *final_output_level = cfd->current()->storage_info()->base_level();
2170
- }
2171
- }
2172
- bg_cv_.SignalAll();
2173
- continue;
2174
- }
2175
- ca = new CompactionArg;
2176
- ca->db = this;
2177
- ca->prepicked_compaction = new PrepickedCompaction;
2178
- ca->prepicked_compaction->manual_compaction_state = &manual;
2179
- ca->prepicked_compaction->compaction = compaction;
2180
- if (!RequestCompactionToken(
2181
- cfd, true, &ca->prepicked_compaction->task_token, &log_buffer)) {
2182
- // Don't throttle manual compaction, only count outstanding tasks.
2183
- assert(false);
2184
- }
2185
- manual.incomplete = false;
2186
- if (compaction->bottommost_level() &&
2187
- env_->GetBackgroundThreads(Env::Priority::BOTTOM) > 0) {
2188
- bg_bottom_compaction_scheduled_++;
2189
- ca->compaction_pri_ = Env::Priority::BOTTOM;
2190
- env_->Schedule(&DBImpl::BGWorkBottomCompaction, ca,
2191
- Env::Priority::BOTTOM,
2192
- GetTaskTag(TaskType::kManualCompaction),
2193
- &DBImpl::UnscheduleCompactionCallback);
2194
- thread_pool_priority = Env::Priority::BOTTOM;
2195
- } else {
2196
- bg_compaction_scheduled_++;
2197
- ca->compaction_pri_ = Env::Priority::LOW;
2198
- env_->Schedule(&DBImpl::BGWorkCompaction, ca, Env::Priority::LOW,
2199
- GetTaskTag(TaskType::kManualCompaction),
2200
- &DBImpl::UnscheduleCompactionCallback);
2201
- thread_pool_priority = Env::Priority::LOW;
2202
- }
2203
- scheduled = true;
2204
- TEST_SYNC_POINT("DBImpl::RunManualCompaction:Scheduled");
2205
- if (final_output_level) {
2206
- *final_output_level = compaction->output_level();
2207
- }
2208
- }
2209
- if (!scheduled) {
2210
- // There is nothing scheduled to wait on, so any cancellation can end the
2211
- // manual now.
2212
- if (manual_compaction_paused_ > 0 || manual.canceled == true) {
2213
- // Stop waiting since it was canceled. Pretend the error came from
2214
- // compaction so the below cleanup/error handling code can process it.
2215
- manual.done = true;
2216
- manual.status =
2217
- Status::Incomplete(Status::SubCode::kManualCompactionPaused);
2218
- }
2219
- }
2220
- }
2221
-
2222
- log_buffer.FlushBufferToLog();
2223
- assert(!manual.in_progress);
2224
- assert(HasPendingManualCompaction());
2225
- RemoveManualCompaction(&manual);
2226
- // if the manual job is unscheduled, try schedule other jobs in case there's
2227
- // any unscheduled compaction job which was blocked by exclusive manual
2228
- // compaction.
2229
- if (manual.status.IsIncomplete() &&
2230
- manual.status.subcode() == Status::SubCode::kManualCompactionPaused) {
2231
- MaybeScheduleFlushOrCompaction();
2232
- }
2233
- bg_cv_.SignalAll();
2234
- return manual.status;
2235
- }
2236
-
2237
- void DBImpl::GenerateFlushRequest(const autovector<ColumnFamilyData*>& cfds,
2238
- FlushReason flush_reason, FlushRequest* req) {
2239
- assert(req != nullptr);
2240
- req->flush_reason = flush_reason;
2241
- req->cfd_to_max_mem_id_to_persist.reserve(cfds.size());
2242
- for (const auto cfd : cfds) {
2243
- if (nullptr == cfd) {
2244
- // cfd may be null, see DBImpl::ScheduleFlushes
2245
- continue;
2246
- }
2247
- uint64_t max_memtable_id = cfd->imm()->GetLatestMemTableID(
2248
- immutable_db_options_.atomic_flush /* for_atomic_flush */);
2249
- req->cfd_to_max_mem_id_to_persist.emplace(cfd, max_memtable_id);
2250
- }
2251
- }
2252
-
2253
- void DBImpl::NotifyOnManualFlushScheduled(autovector<ColumnFamilyData*> cfds,
2254
- FlushReason flush_reason) {
2255
- if (immutable_db_options_.listeners.size() == 0U) {
2256
- return;
2257
- }
2258
- if (shutting_down_.load(std::memory_order_acquire)) {
2259
- return;
2260
- }
2261
- std::vector<ManualFlushInfo> info;
2262
- for (ColumnFamilyData* cfd : cfds) {
2263
- info.push_back({cfd->GetID(), cfd->GetName(), flush_reason});
2264
- }
2265
- for (const auto& listener : immutable_db_options_.listeners) {
2266
- listener->OnManualFlushScheduled(this, info);
2267
- }
2268
- }
2269
-
2270
- Status DBImpl::FlushMemTable(ColumnFamilyData* cfd,
2271
- const FlushOptions& flush_options,
2272
- FlushReason flush_reason,
2273
- bool entered_write_thread) {
2274
- // This method should not be called if atomic_flush is true.
2275
- assert(!immutable_db_options_.atomic_flush);
2276
- if (!flush_options.wait && write_controller_.IsStopped()) {
2277
- std::ostringstream oss;
2278
- oss << "Writes have been stopped, thus unable to perform manual flush. "
2279
- "Please try again later after writes are resumed";
2280
- return Status::TryAgain(oss.str());
2281
- }
2282
- Status s;
2283
- if (!flush_options.allow_write_stall) {
2284
- bool flush_needed = true;
2285
- s = WaitUntilFlushWouldNotStallWrites(cfd, &flush_needed);
2286
- TEST_SYNC_POINT("DBImpl::FlushMemTable:StallWaitDone");
2287
- if (!s.ok() || !flush_needed) {
2288
- return s;
2289
- }
2290
- }
2291
-
2292
- const bool needs_to_join_write_thread = !entered_write_thread;
2293
- autovector<FlushRequest> flush_reqs;
2294
- autovector<uint64_t> memtable_ids_to_wait;
2295
- {
2296
- WriteContext context;
2297
- InstrumentedMutexLock guard_lock(&mutex_);
2298
-
2299
- WriteThread::Writer w;
2300
- WriteThread::Writer nonmem_w;
2301
- if (needs_to_join_write_thread) {
2302
- write_thread_.EnterUnbatched(&w, &mutex_);
2303
- if (two_write_queues_) {
2304
- nonmem_write_thread_.EnterUnbatched(&nonmem_w, &mutex_);
2305
- }
2306
- }
2307
- WaitForPendingWrites();
2308
-
2309
- if (!cfd->mem()->IsEmpty() || !cached_recoverable_state_empty_.load() ||
2310
- IsRecoveryFlush(flush_reason)) {
2311
- s = SwitchMemtable(cfd, &context);
2312
- }
2313
- const uint64_t flush_memtable_id = std::numeric_limits<uint64_t>::max();
2314
- if (s.ok()) {
2315
- if (cfd->imm()->NumNotFlushed() != 0 || !cfd->mem()->IsEmpty() ||
2316
- !cached_recoverable_state_empty_.load() ||
2317
- IsRecoveryFlush(flush_reason)) {
2318
- FlushRequest req{flush_reason, {{cfd, flush_memtable_id}}};
2319
- flush_reqs.emplace_back(std::move(req));
2320
- memtable_ids_to_wait.emplace_back(
2321
- cfd->imm()->GetLatestMemTableID(false /* for_atomic_flush */));
2322
- }
2323
- if (immutable_db_options_.persist_stats_to_disk) {
2324
- ColumnFamilyData* cfd_stats =
2325
- versions_->GetColumnFamilySet()->GetColumnFamily(
2326
- kPersistentStatsColumnFamilyName);
2327
- if (cfd_stats != nullptr && cfd_stats != cfd &&
2328
- !cfd_stats->mem()->IsEmpty()) {
2329
- // only force flush stats CF when it will be the only CF lagging
2330
- // behind after the current flush
2331
- bool stats_cf_flush_needed = true;
2332
- for (auto* loop_cfd : *versions_->GetColumnFamilySet()) {
2333
- if (loop_cfd == cfd_stats || loop_cfd == cfd) {
2334
- continue;
2335
- }
2336
- if (loop_cfd->GetLogNumber() <= cfd_stats->GetLogNumber()) {
2337
- stats_cf_flush_needed = false;
2338
- }
2339
- }
2340
- if (stats_cf_flush_needed) {
2341
- ROCKS_LOG_INFO(immutable_db_options_.info_log,
2342
- "Force flushing stats CF with manual flush of %s "
2343
- "to avoid holding old logs",
2344
- cfd->GetName().c_str());
2345
- s = SwitchMemtable(cfd_stats, &context);
2346
- FlushRequest req{flush_reason, {{cfd_stats, flush_memtable_id}}};
2347
- flush_reqs.emplace_back(std::move(req));
2348
- memtable_ids_to_wait.emplace_back(
2349
- cfd_stats->imm()->GetLatestMemTableID(
2350
- false /* for_atomic_flush */));
2351
- }
2352
- }
2353
- }
2354
- }
2355
-
2356
- if (s.ok() && !flush_reqs.empty()) {
2357
- for (const auto& req : flush_reqs) {
2358
- assert(req.cfd_to_max_mem_id_to_persist.size() == 1);
2359
- ColumnFamilyData* loop_cfd =
2360
- req.cfd_to_max_mem_id_to_persist.begin()->first;
2361
- loop_cfd->imm()->FlushRequested();
2362
- }
2363
- // If the caller wants to wait for this flush to complete, it indicates
2364
- // that the caller expects the ColumnFamilyData not to be free'ed by
2365
- // other threads which may drop the column family concurrently.
2366
- // Therefore, we increase the cfd's ref count.
2367
- if (flush_options.wait) {
2368
- for (const auto& req : flush_reqs) {
2369
- assert(req.cfd_to_max_mem_id_to_persist.size() == 1);
2370
- ColumnFamilyData* loop_cfd =
2371
- req.cfd_to_max_mem_id_to_persist.begin()->first;
2372
- loop_cfd->Ref();
2373
- }
2374
- }
2375
- for (const auto& req : flush_reqs) {
2376
- assert(req.cfd_to_max_mem_id_to_persist.size() == 1);
2377
- ColumnFamilyData* loop_cfd =
2378
- req.cfd_to_max_mem_id_to_persist.begin()->first;
2379
- bool already_queued_for_flush = loop_cfd->queued_for_flush();
2380
- bool flush_req_enqueued = SchedulePendingFlush(req);
2381
- if (already_queued_for_flush || flush_req_enqueued) {
2382
- loop_cfd->SetFlushSkipReschedule();
2383
- }
2384
- }
2385
- MaybeScheduleFlushOrCompaction();
2386
- }
2387
-
2388
- if (needs_to_join_write_thread) {
2389
- write_thread_.ExitUnbatched(&w);
2390
- if (two_write_queues_) {
2391
- nonmem_write_thread_.ExitUnbatched(&nonmem_w);
2392
- }
2393
- }
2394
- }
2395
-
2396
- NotifyOnManualFlushScheduled({cfd}, flush_reason);
2397
- TEST_SYNC_POINT("DBImpl::FlushMemTable:AfterScheduleFlush");
2398
- TEST_SYNC_POINT("DBImpl::FlushMemTable:BeforeWaitForBgFlush");
2399
- if (s.ok() && flush_options.wait) {
2400
- autovector<ColumnFamilyData*> cfds;
2401
- autovector<const uint64_t*> flush_memtable_ids;
2402
- assert(flush_reqs.size() == memtable_ids_to_wait.size());
2403
- for (size_t i = 0; i < flush_reqs.size(); ++i) {
2404
- assert(flush_reqs[i].cfd_to_max_mem_id_to_persist.size() == 1);
2405
- cfds.push_back(flush_reqs[i].cfd_to_max_mem_id_to_persist.begin()->first);
2406
- flush_memtable_ids.push_back(&(memtable_ids_to_wait[i]));
2407
- }
2408
- s = WaitForFlushMemTables(
2409
- cfds, flush_memtable_ids,
2410
- flush_reason == FlushReason::kErrorRecovery /* resuming_from_bg_err */);
2411
- InstrumentedMutexLock lock_guard(&mutex_);
2412
- for (auto* tmp_cfd : cfds) {
2413
- tmp_cfd->UnrefAndTryDelete();
2414
- }
2415
- }
2416
- TEST_SYNC_POINT("DBImpl::FlushMemTable:FlushMemTableFinished");
2417
- return s;
2418
- }
2419
-
2420
- Status DBImpl::AtomicFlushMemTables(
2421
- const FlushOptions& flush_options, FlushReason flush_reason,
2422
- const autovector<ColumnFamilyData*>& provided_candidate_cfds,
2423
- bool entered_write_thread) {
2424
- assert(immutable_db_options_.atomic_flush);
2425
- if (!flush_options.wait && write_controller_.IsStopped()) {
2426
- std::ostringstream oss;
2427
- oss << "Writes have been stopped, thus unable to perform manual flush. "
2428
- "Please try again later after writes are resumed";
2429
- return Status::TryAgain(oss.str());
2430
- }
2431
- Status s;
2432
- autovector<ColumnFamilyData*> candidate_cfds;
2433
- if (provided_candidate_cfds.empty()) {
2434
- // Generate candidate cfds if not provided
2435
- {
2436
- InstrumentedMutexLock l(&mutex_);
2437
- for (ColumnFamilyData* cfd : *versions_->GetColumnFamilySet()) {
2438
- if (!cfd->IsDropped() && cfd->initialized()) {
2439
- cfd->Ref();
2440
- candidate_cfds.push_back(cfd);
2441
- }
2442
- }
2443
- }
2444
- } else {
2445
- candidate_cfds = provided_candidate_cfds;
2446
- }
2447
-
2448
- if (!flush_options.allow_write_stall) {
2449
- int num_cfs_to_flush = 0;
2450
- for (auto cfd : candidate_cfds) {
2451
- bool flush_needed = true;
2452
- s = WaitUntilFlushWouldNotStallWrites(cfd, &flush_needed);
2453
- if (!s.ok()) {
2454
- // Unref the newly generated candidate cfds (when not provided) in
2455
- // `candidate_cfds`
2456
- if (provided_candidate_cfds.empty()) {
2457
- for (auto candidate_cfd : candidate_cfds) {
2458
- candidate_cfd->UnrefAndTryDelete();
2459
- }
2460
- }
2461
- return s;
2462
- } else if (flush_needed) {
2463
- ++num_cfs_to_flush;
2464
- }
2465
- }
2466
- if (0 == num_cfs_to_flush) {
2467
- // Unref the newly generated candidate cfds (when not provided) in
2468
- // `candidate_cfds`
2469
- if (provided_candidate_cfds.empty()) {
2470
- for (auto candidate_cfd : candidate_cfds) {
2471
- candidate_cfd->UnrefAndTryDelete();
2472
- }
2473
- }
2474
- return s;
2475
- }
2476
- }
2477
- const bool needs_to_join_write_thread = !entered_write_thread;
2478
- FlushRequest flush_req;
2479
- autovector<ColumnFamilyData*> cfds;
2480
- {
2481
- WriteContext context;
2482
- InstrumentedMutexLock guard_lock(&mutex_);
2483
-
2484
- WriteThread::Writer w;
2485
- WriteThread::Writer nonmem_w;
2486
- if (needs_to_join_write_thread) {
2487
- write_thread_.EnterUnbatched(&w, &mutex_);
2488
- if (two_write_queues_) {
2489
- nonmem_write_thread_.EnterUnbatched(&nonmem_w, &mutex_);
2490
- }
2491
- }
2492
- WaitForPendingWrites();
2493
-
2494
- SelectColumnFamiliesForAtomicFlush(&cfds, candidate_cfds, flush_reason);
2495
-
2496
- // Unref the newly generated candidate cfds (when not provided) in
2497
- // `candidate_cfds`
2498
- if (provided_candidate_cfds.empty()) {
2499
- for (auto candidate_cfd : candidate_cfds) {
2500
- candidate_cfd->UnrefAndTryDelete();
2501
- }
2502
- }
2503
-
2504
- for (auto cfd : cfds) {
2505
- if (cfd->mem()->IsEmpty() && cached_recoverable_state_empty_.load() &&
2506
- !IsRecoveryFlush(flush_reason)) {
2507
- continue;
2508
- }
2509
- cfd->Ref();
2510
- s = SwitchMemtable(cfd, &context);
2511
- cfd->UnrefAndTryDelete();
2512
- if (!s.ok()) {
2513
- break;
2514
- }
2515
- }
2516
- if (s.ok()) {
2517
- AssignAtomicFlushSeq(cfds);
2518
- for (auto cfd : cfds) {
2519
- cfd->imm()->FlushRequested();
2520
- }
2521
- // If the caller wants to wait for this flush to complete, it indicates
2522
- // that the caller expects the ColumnFamilyData not to be free'ed by
2523
- // other threads which may drop the column family concurrently.
2524
- // Therefore, we increase the cfd's ref count.
2525
- if (flush_options.wait) {
2526
- for (auto cfd : cfds) {
2527
- cfd->Ref();
2528
- }
2529
- }
2530
- GenerateFlushRequest(cfds, flush_reason, &flush_req);
2531
- SchedulePendingFlush(flush_req);
2532
- MaybeScheduleFlushOrCompaction();
2533
- }
2534
-
2535
- if (needs_to_join_write_thread) {
2536
- write_thread_.ExitUnbatched(&w);
2537
- if (two_write_queues_) {
2538
- nonmem_write_thread_.ExitUnbatched(&nonmem_w);
2539
- }
2540
- }
2541
- }
2542
- NotifyOnManualFlushScheduled(cfds, flush_reason);
2543
- TEST_SYNC_POINT("DBImpl::AtomicFlushMemTables:AfterScheduleFlush");
2544
- TEST_SYNC_POINT("DBImpl::AtomicFlushMemTables:BeforeWaitForBgFlush");
2545
- if (s.ok() && flush_options.wait) {
2546
- autovector<const uint64_t*> flush_memtable_ids;
2547
- for (auto& iter : flush_req.cfd_to_max_mem_id_to_persist) {
2548
- flush_memtable_ids.push_back(&(iter.second));
2549
- }
2550
- s = WaitForFlushMemTables(
2551
- cfds, flush_memtable_ids,
2552
- flush_reason == FlushReason::kErrorRecovery /* resuming_from_bg_err */);
2553
- InstrumentedMutexLock lock_guard(&mutex_);
2554
- for (auto* cfd : cfds) {
2555
- cfd->UnrefAndTryDelete();
2556
- }
2557
- }
2558
- return s;
2559
- }
2560
-
2561
- Status DBImpl::RetryFlushesForErrorRecovery(FlushReason flush_reason,
2562
- bool wait) {
2563
- mutex_.AssertHeld();
2564
- assert(flush_reason == FlushReason::kErrorRecoveryRetryFlush ||
2565
- flush_reason == FlushReason::kCatchUpAfterErrorRecovery);
2566
-
2567
- // Collect referenced CFDs.
2568
- autovector<ColumnFamilyData*> cfds;
2569
- for (ColumnFamilyData* cfd : *versions_->GetColumnFamilySet()) {
2570
- if (!cfd->IsDropped() && cfd->initialized() &&
2571
- cfd->imm()->NumNotFlushed() != 0) {
2572
- cfd->Ref();
2573
- cfd->imm()->FlushRequested();
2574
- cfds.push_back(cfd);
2575
- }
2576
- }
2577
-
2578
- // Submit flush requests for all immutable memtables needing flush.
2579
- // `flush_memtable_ids` will be populated such that all immutable
2580
- // memtables eligible for flush are waited on before this function
2581
- // returns.
2582
- autovector<uint64_t> flush_memtable_ids;
2583
- if (immutable_db_options_.atomic_flush) {
2584
- FlushRequest flush_req;
2585
- GenerateFlushRequest(cfds, flush_reason, &flush_req);
2586
- SchedulePendingFlush(flush_req);
2587
- for (auto& iter : flush_req.cfd_to_max_mem_id_to_persist) {
2588
- flush_memtable_ids.push_back(iter.second);
2589
- }
2590
- } else {
2591
- for (auto cfd : cfds) {
2592
- flush_memtable_ids.push_back(
2593
- cfd->imm()->GetLatestMemTableID(false /* for_atomic_flush */));
2594
- // Impose no bound on the highest memtable ID flushed. There is no
2595
- // reason to do so outside of atomic flush.
2596
- FlushRequest flush_req{
2597
- flush_reason,
2598
- {{cfd,
2599
- std::numeric_limits<uint64_t>::max() /* max_mem_id_to_persist */}}};
2600
- if (SchedulePendingFlush(flush_req)) {
2601
- cfd->SetFlushSkipReschedule();
2602
- };
2603
- }
2604
- }
2605
- MaybeScheduleFlushOrCompaction();
2606
-
2607
- Status s;
2608
- if (wait) {
2609
- mutex_.Unlock();
2610
- autovector<const uint64_t*> flush_memtable_id_ptrs;
2611
- for (auto& flush_memtable_id : flush_memtable_ids) {
2612
- flush_memtable_id_ptrs.push_back(&flush_memtable_id);
2613
- }
2614
- s = WaitForFlushMemTables(cfds, flush_memtable_id_ptrs,
2615
- true /* resuming_from_bg_err */);
2616
- mutex_.Lock();
2617
- }
2618
-
2619
- for (auto* cfd : cfds) {
2620
- cfd->UnrefAndTryDelete();
2621
- }
2622
- return s;
2623
- }
2624
-
2625
- // Calling FlushMemTable(), whether from DB::Flush() or from Backup Engine, can
2626
- // cause write stall, for example if one memtable is being flushed already.
2627
- // This method tries to avoid write stall (similar to CompactRange() behavior)
2628
- // it emulates how the SuperVersion / LSM would change if flush happens, checks
2629
- // it against various constrains and delays flush if it'd cause write stall.
2630
- // Caller should check status and flush_needed to see if flush already happened.
2631
- Status DBImpl::WaitUntilFlushWouldNotStallWrites(ColumnFamilyData* cfd,
2632
- bool* flush_needed) {
2633
- {
2634
- *flush_needed = true;
2635
- InstrumentedMutexLock l(&mutex_);
2636
- uint64_t orig_active_memtable_id = cfd->mem()->GetID();
2637
- WriteStallCondition write_stall_condition = WriteStallCondition::kNormal;
2638
- do {
2639
- if (write_stall_condition != WriteStallCondition::kNormal) {
2640
- // Same error handling as user writes: Don't wait if there's a
2641
- // background error, even if it's a soft error. We might wait here
2642
- // indefinitely as the pending flushes/compactions may never finish
2643
- // successfully, resulting in the stall condition lasting indefinitely
2644
- if (error_handler_.IsBGWorkStopped()) {
2645
- return error_handler_.GetBGError();
2646
- }
2647
-
2648
- TEST_SYNC_POINT("DBImpl::WaitUntilFlushWouldNotStallWrites:StallWait");
2649
- ROCKS_LOG_INFO(immutable_db_options_.info_log,
2650
- "[%s] WaitUntilFlushWouldNotStallWrites"
2651
- " waiting on stall conditions to clear",
2652
- cfd->GetName().c_str());
2653
- bg_cv_.Wait();
2654
- }
2655
- if (cfd->IsDropped()) {
2656
- return Status::ColumnFamilyDropped();
2657
- }
2658
- if (shutting_down_.load(std::memory_order_acquire)) {
2659
- return Status::ShutdownInProgress();
2660
- }
2661
-
2662
- uint64_t earliest_memtable_id =
2663
- std::min(cfd->mem()->GetID(), cfd->imm()->GetEarliestMemTableID());
2664
- if (earliest_memtable_id > orig_active_memtable_id) {
2665
- // We waited so long that the memtable we were originally waiting on was
2666
- // flushed.
2667
- *flush_needed = false;
2668
- return Status::OK();
2669
- }
2670
-
2671
- const auto& mutable_cf_options = *cfd->GetLatestMutableCFOptions();
2672
- const auto* vstorage = cfd->current()->storage_info();
2673
-
2674
- // Skip stalling check if we're below auto-flush and auto-compaction
2675
- // triggers. If it stalled in these conditions, that'd mean the stall
2676
- // triggers are so low that stalling is needed for any background work. In
2677
- // that case we shouldn't wait since background work won't be scheduled.
2678
- if (cfd->imm()->NumNotFlushed() <
2679
- cfd->ioptions()->min_write_buffer_number_to_merge &&
2680
- vstorage->l0_delay_trigger_count() <
2681
- mutable_cf_options.level0_file_num_compaction_trigger) {
2682
- break;
2683
- }
2684
-
2685
- // check whether one extra immutable memtable or an extra L0 file would
2686
- // cause write stalling mode to be entered. It could still enter stall
2687
- // mode due to pending compaction bytes, but that's less common
2688
- // No extra immutable Memtable will be created if the current Memtable is
2689
- // empty.
2690
- write_stall_condition =
2691
- ColumnFamilyData::GetWriteStallConditionAndCause(
2692
- cfd->GetUnflushedMemTableCountForWriteStallCheck(),
2693
- vstorage->l0_delay_trigger_count() + 1,
2694
- vstorage->estimated_compaction_needed_bytes(), mutable_cf_options,
2695
- *cfd->ioptions())
2696
- .first;
2697
- } while (write_stall_condition != WriteStallCondition::kNormal);
2698
- }
2699
- return Status::OK();
2700
- }
2701
-
2702
- // Wait for memtables to be flushed for multiple column families.
2703
- // let N = cfds.size()
2704
- // for i in [0, N),
2705
- // 1) if flush_memtable_ids[i] is not null, then the memtables with lower IDs
2706
- // have to be flushed for THIS column family;
2707
- // 2) if flush_memtable_ids[i] is null, then all memtables in THIS column
2708
- // family have to be flushed.
2709
- // Finish waiting when ALL column families finish flushing memtables.
2710
- // resuming_from_bg_err indicates whether the caller is trying to resume from
2711
- // background error or in normal processing.
2712
- Status DBImpl::WaitForFlushMemTables(
2713
- const autovector<ColumnFamilyData*>& cfds,
2714
- const autovector<const uint64_t*>& flush_memtable_ids,
2715
- bool resuming_from_bg_err) {
2716
- int num = static_cast<int>(cfds.size());
2717
- // Wait until the compaction completes
2718
- InstrumentedMutexLock l(&mutex_);
2719
- Status s;
2720
- // If the caller is trying to resume from bg error, then
2721
- // error_handler_.IsDBStopped() is true.
2722
- while (resuming_from_bg_err || !error_handler_.IsDBStopped()) {
2723
- if (shutting_down_.load(std::memory_order_acquire)) {
2724
- s = Status::ShutdownInProgress();
2725
- return s;
2726
- }
2727
- // If an error has occurred during resumption, then no need to wait.
2728
- // But flush operation may fail because of this error, so need to
2729
- // return the status.
2730
- if (!error_handler_.GetRecoveryError().ok()) {
2731
- s = error_handler_.GetRecoveryError();
2732
- break;
2733
- }
2734
- // If BGWorkStopped, which indicate that there is a BG error and
2735
- // 1) soft error but requires no BG work, 2) no in auto_recovery_
2736
- if (!resuming_from_bg_err && error_handler_.IsBGWorkStopped() &&
2737
- error_handler_.GetBGError().severity() < Status::Severity::kHardError) {
2738
- s = error_handler_.GetBGError();
2739
- return s;
2740
- }
2741
-
2742
- // Number of column families that have been dropped.
2743
- int num_dropped = 0;
2744
- // Number of column families that have finished flush.
2745
- int num_finished = 0;
2746
- for (int i = 0; i < num; ++i) {
2747
- if (cfds[i]->IsDropped()) {
2748
- ++num_dropped;
2749
- } else if (cfds[i]->imm()->NumNotFlushed() == 0 ||
2750
- (flush_memtable_ids[i] != nullptr &&
2751
- cfds[i]->imm()->GetEarliestMemTableID() >
2752
- *flush_memtable_ids[i])) {
2753
- ++num_finished;
2754
- }
2755
- }
2756
- if (1 == num_dropped && 1 == num) {
2757
- s = Status::ColumnFamilyDropped();
2758
- return s;
2759
- }
2760
- // Column families involved in this flush request have either been dropped
2761
- // or finished flush. Then it's time to finish waiting.
2762
- if (num_dropped + num_finished == num) {
2763
- break;
2764
- }
2765
- bg_cv_.Wait();
2766
- }
2767
- // If not resuming from bg error, and an error has caused the DB to stop,
2768
- // then report the bg error to caller.
2769
- if (!resuming_from_bg_err && error_handler_.IsDBStopped()) {
2770
- s = error_handler_.GetBGError();
2771
- }
2772
- return s;
2773
- }
2774
-
2775
- Status DBImpl::EnableAutoCompaction(
2776
- const std::vector<ColumnFamilyHandle*>& column_family_handles) {
2777
- Status s;
2778
- for (auto cf_ptr : column_family_handles) {
2779
- Status status =
2780
- this->SetOptions(cf_ptr, {{"disable_auto_compactions", "false"}});
2781
- if (!status.ok()) {
2782
- s = status;
2783
- }
2784
- }
2785
-
2786
- return s;
2787
- }
2788
-
2789
- // NOTE: Calling DisableManualCompaction() may overwrite the
2790
- // user-provided canceled variable in CompactRangeOptions
2791
- void DBImpl::DisableManualCompaction() {
2792
- InstrumentedMutexLock l(&mutex_);
2793
- manual_compaction_paused_.fetch_add(1, std::memory_order_release);
2794
-
2795
- // Mark the canceled as true when the cancellation is triggered by
2796
- // manual_compaction_paused (may overwrite user-provided `canceled`)
2797
- for (const auto& manual_compaction : manual_compaction_dequeue_) {
2798
- manual_compaction->canceled = true;
2799
- }
2800
-
2801
- // Wake up manual compactions waiting to start.
2802
- bg_cv_.SignalAll();
2803
-
2804
- // Wait for any pending manual compactions to finish (typically through
2805
- // failing with `Status::Incomplete`) prior to returning. This way we are
2806
- // guaranteed no pending manual compaction will commit while manual
2807
- // compactions are "disabled".
2808
- while (HasPendingManualCompaction()) {
2809
- bg_cv_.Wait();
2810
- }
2811
- }
2812
-
2813
- // NOTE: In contrast to DisableManualCompaction(), calling
2814
- // EnableManualCompaction() does NOT overwrite the user-provided *canceled
2815
- // variable to be false since there is NO CHANCE a canceled compaction
2816
- // is uncanceled. In other words, a canceled compaction must have been
2817
- // dropped out of the manual compaction queue, when we disable it.
2818
- void DBImpl::EnableManualCompaction() {
2819
- InstrumentedMutexLock l(&mutex_);
2820
- assert(manual_compaction_paused_ > 0);
2821
- manual_compaction_paused_.fetch_sub(1, std::memory_order_release);
2822
- }
2823
-
2824
- void DBImpl::MaybeScheduleFlushOrCompaction() {
2825
- mutex_.AssertHeld();
2826
- TEST_SYNC_POINT("DBImpl::MaybeScheduleFlushOrCompaction:Start");
2827
- if (!opened_successfully_) {
2828
- // Compaction may introduce data race to DB open
2829
- return;
2830
- }
2831
- if (bg_work_paused_ > 0) {
2832
- // we paused the background work
2833
- return;
2834
- } else if (error_handler_.IsBGWorkStopped() &&
2835
- !error_handler_.IsRecoveryInProgress()) {
2836
- // There has been a hard error and this call is not part of the recovery
2837
- // sequence. Bail out here so we don't get into an endless loop of
2838
- // scheduling BG work which will again call this function
2839
- //
2840
- // Note that a non-recovery flush can still be scheduled if
2841
- // error_handler_.IsRecoveryInProgress() returns true. We rely on
2842
- // BackgroundCallFlush() to check flush reason and drop non-recovery
2843
- // flushes.
2844
- return;
2845
- } else if (shutting_down_.load(std::memory_order_acquire)) {
2846
- // DB is being deleted; no more background compactions
2847
- return;
2848
- }
2849
- auto bg_job_limits = GetBGJobLimits();
2850
- bool is_flush_pool_empty =
2851
- env_->GetBackgroundThreads(Env::Priority::HIGH) == 0;
2852
- while (!is_flush_pool_empty && unscheduled_flushes_ > 0 &&
2853
- bg_flush_scheduled_ < bg_job_limits.max_flushes) {
2854
- TEST_SYNC_POINT_CALLBACK(
2855
- "DBImpl::MaybeScheduleFlushOrCompaction:BeforeSchedule",
2856
- &unscheduled_flushes_);
2857
- bg_flush_scheduled_++;
2858
- FlushThreadArg* fta = new FlushThreadArg;
2859
- fta->db_ = this;
2860
- fta->thread_pri_ = Env::Priority::HIGH;
2861
- env_->Schedule(&DBImpl::BGWorkFlush, fta, Env::Priority::HIGH, this,
2862
- &DBImpl::UnscheduleFlushCallback);
2863
- --unscheduled_flushes_;
2864
- TEST_SYNC_POINT_CALLBACK(
2865
- "DBImpl::MaybeScheduleFlushOrCompaction:AfterSchedule:0",
2866
- &unscheduled_flushes_);
2867
- }
2868
-
2869
- // special case -- if high-pri (flush) thread pool is empty, then schedule
2870
- // flushes in low-pri (compaction) thread pool.
2871
- if (is_flush_pool_empty) {
2872
- while (unscheduled_flushes_ > 0 &&
2873
- bg_flush_scheduled_ + bg_compaction_scheduled_ <
2874
- bg_job_limits.max_flushes) {
2875
- bg_flush_scheduled_++;
2876
- FlushThreadArg* fta = new FlushThreadArg;
2877
- fta->db_ = this;
2878
- fta->thread_pri_ = Env::Priority::LOW;
2879
- env_->Schedule(&DBImpl::BGWorkFlush, fta, Env::Priority::LOW, this,
2880
- &DBImpl::UnscheduleFlushCallback);
2881
- --unscheduled_flushes_;
2882
- }
2883
- }
2884
-
2885
- if (bg_compaction_paused_ > 0) {
2886
- // we paused the background compaction
2887
- return;
2888
- } else if (error_handler_.IsBGWorkStopped()) {
2889
- // Compaction is not part of the recovery sequence from a hard error. We
2890
- // might get here because recovery might do a flush and install a new
2891
- // super version, which will try to schedule pending compactions. Bail
2892
- // out here and let the higher level recovery handle compactions
2893
- return;
2894
- }
2895
-
2896
- if (HasExclusiveManualCompaction()) {
2897
- // only manual compactions are allowed to run. don't schedule automatic
2898
- // compactions
2899
- TEST_SYNC_POINT("DBImpl::MaybeScheduleFlushOrCompaction:Conflict");
2900
- return;
2901
- }
2902
-
2903
- while (bg_compaction_scheduled_ + bg_bottom_compaction_scheduled_ <
2904
- bg_job_limits.max_compactions &&
2905
- unscheduled_compactions_ > 0) {
2906
- CompactionArg* ca = new CompactionArg;
2907
- ca->db = this;
2908
- ca->compaction_pri_ = Env::Priority::LOW;
2909
- ca->prepicked_compaction = nullptr;
2910
- bg_compaction_scheduled_++;
2911
- unscheduled_compactions_--;
2912
- env_->Schedule(&DBImpl::BGWorkCompaction, ca, Env::Priority::LOW, this,
2913
- &DBImpl::UnscheduleCompactionCallback);
2914
- }
2915
- }
2916
-
2917
- DBImpl::BGJobLimits DBImpl::GetBGJobLimits() const {
2918
- mutex_.AssertHeld();
2919
- return GetBGJobLimits(mutable_db_options_.max_background_flushes,
2920
- mutable_db_options_.max_background_compactions,
2921
- mutable_db_options_.max_background_jobs,
2922
- write_controller_.NeedSpeedupCompaction());
2923
- }
2924
-
2925
- DBImpl::BGJobLimits DBImpl::GetBGJobLimits(int max_background_flushes,
2926
- int max_background_compactions,
2927
- int max_background_jobs,
2928
- bool parallelize_compactions) {
2929
- BGJobLimits res;
2930
- if (max_background_flushes == -1 && max_background_compactions == -1) {
2931
- // for our first stab implementing max_background_jobs, simply allocate a
2932
- // quarter of the threads to flushes.
2933
- res.max_flushes = std::max(1, max_background_jobs / 4);
2934
- res.max_compactions = std::max(1, max_background_jobs - res.max_flushes);
2935
- } else {
2936
- // compatibility code in case users haven't migrated to max_background_jobs,
2937
- // which automatically computes flush/compaction limits
2938
- res.max_flushes = std::max(1, max_background_flushes);
2939
- res.max_compactions = std::max(1, max_background_compactions);
2940
- }
2941
- if (!parallelize_compactions) {
2942
- // throttle background compactions until we deem necessary
2943
- res.max_compactions = 1;
2944
- }
2945
- return res;
2946
- }
2947
-
2948
- void DBImpl::AddToCompactionQueue(ColumnFamilyData* cfd) {
2949
- assert(!cfd->queued_for_compaction());
2950
- cfd->Ref();
2951
- compaction_queue_.push_back(cfd);
2952
- cfd->set_queued_for_compaction(true);
2953
- }
2954
-
2955
- ColumnFamilyData* DBImpl::PopFirstFromCompactionQueue() {
2956
- assert(!compaction_queue_.empty());
2957
- auto cfd = *compaction_queue_.begin();
2958
- compaction_queue_.pop_front();
2959
- assert(cfd->queued_for_compaction());
2960
- cfd->set_queued_for_compaction(false);
2961
- return cfd;
2962
- }
2963
-
2964
- DBImpl::FlushRequest DBImpl::PopFirstFromFlushQueue() {
2965
- assert(!flush_queue_.empty());
2966
- FlushRequest flush_req = std::move(flush_queue_.front());
2967
- flush_queue_.pop_front();
2968
- if (!immutable_db_options_.atomic_flush) {
2969
- assert(flush_req.cfd_to_max_mem_id_to_persist.size() == 1);
2970
- }
2971
- for (const auto& elem : flush_req.cfd_to_max_mem_id_to_persist) {
2972
- if (!immutable_db_options_.atomic_flush) {
2973
- ColumnFamilyData* cfd = elem.first;
2974
- assert(cfd);
2975
- assert(cfd->queued_for_flush());
2976
- cfd->set_queued_for_flush(false);
2977
- }
2978
- }
2979
- return flush_req;
2980
- }
2981
-
2982
- ColumnFamilyData* DBImpl::PickCompactionFromQueue(
2983
- std::unique_ptr<TaskLimiterToken>* token, LogBuffer* log_buffer) {
2984
- assert(!compaction_queue_.empty());
2985
- assert(*token == nullptr);
2986
- autovector<ColumnFamilyData*> throttled_candidates;
2987
- ColumnFamilyData* cfd = nullptr;
2988
- while (!compaction_queue_.empty()) {
2989
- auto first_cfd = *compaction_queue_.begin();
2990
- compaction_queue_.pop_front();
2991
- assert(first_cfd->queued_for_compaction());
2992
- if (!RequestCompactionToken(first_cfd, false, token, log_buffer)) {
2993
- throttled_candidates.push_back(first_cfd);
2994
- continue;
2995
- }
2996
- cfd = first_cfd;
2997
- cfd->set_queued_for_compaction(false);
2998
- break;
2999
- }
3000
- // Add throttled compaction candidates back to queue in the original order.
3001
- for (auto iter = throttled_candidates.rbegin();
3002
- iter != throttled_candidates.rend(); ++iter) {
3003
- compaction_queue_.push_front(*iter);
3004
- }
3005
- return cfd;
3006
- }
3007
-
3008
- bool DBImpl::SchedulePendingFlush(const FlushRequest& flush_req) {
3009
- mutex_.AssertHeld();
3010
- bool enqueued = false;
3011
- if (reject_new_background_jobs_) {
3012
- return enqueued;
3013
- }
3014
- if (flush_req.cfd_to_max_mem_id_to_persist.empty()) {
3015
- return enqueued;
3016
- }
3017
- if (!immutable_db_options_.atomic_flush) {
3018
- // For the non-atomic flush case, we never schedule multiple column
3019
- // families in the same flush request.
3020
- assert(flush_req.cfd_to_max_mem_id_to_persist.size() == 1);
3021
- ColumnFamilyData* cfd =
3022
- flush_req.cfd_to_max_mem_id_to_persist.begin()->first;
3023
- assert(cfd);
3024
-
3025
- if (!cfd->queued_for_flush() && cfd->imm()->IsFlushPending()) {
3026
- cfd->Ref();
3027
- cfd->set_queued_for_flush(true);
3028
- ++unscheduled_flushes_;
3029
- flush_queue_.push_back(flush_req);
3030
- enqueued = true;
3031
- }
3032
- } else {
3033
- for (auto& iter : flush_req.cfd_to_max_mem_id_to_persist) {
3034
- ColumnFamilyData* cfd = iter.first;
3035
- cfd->Ref();
3036
- }
3037
- ++unscheduled_flushes_;
3038
- flush_queue_.push_back(flush_req);
3039
- enqueued = true;
3040
- }
3041
- return enqueued;
3042
- }
3043
-
3044
- void DBImpl::SchedulePendingCompaction(ColumnFamilyData* cfd) {
3045
- mutex_.AssertHeld();
3046
- if (reject_new_background_jobs_) {
3047
- return;
3048
- }
3049
- if (!cfd->queued_for_compaction() && cfd->NeedsCompaction()) {
3050
- TEST_SYNC_POINT_CALLBACK("SchedulePendingCompaction::cfd",
3051
- static_cast<void*>(cfd));
3052
- AddToCompactionQueue(cfd);
3053
- ++unscheduled_compactions_;
3054
- }
3055
- }
3056
-
3057
- void DBImpl::SchedulePendingPurge(std::string fname, std::string dir_to_sync,
3058
- FileType type, uint64_t number, int job_id) {
3059
- mutex_.AssertHeld();
3060
- if (reject_new_background_jobs_) {
3061
- return;
3062
- }
3063
- PurgeFileInfo file_info(fname, dir_to_sync, type, number, job_id);
3064
- purge_files_.insert({{number, std::move(file_info)}});
3065
- }
3066
-
3067
- void DBImpl::BGWorkFlush(void* arg) {
3068
- FlushThreadArg fta = *(static_cast<FlushThreadArg*>(arg));
3069
- delete static_cast<FlushThreadArg*>(arg);
3070
-
3071
- IOSTATS_SET_THREAD_POOL_ID(fta.thread_pri_);
3072
- TEST_SYNC_POINT("DBImpl::BGWorkFlush");
3073
- static_cast_with_check<DBImpl>(fta.db_)->BackgroundCallFlush(fta.thread_pri_);
3074
- TEST_SYNC_POINT("DBImpl::BGWorkFlush:done");
3075
- }
3076
-
3077
- void DBImpl::BGWorkCompaction(void* arg) {
3078
- CompactionArg ca = *(static_cast<CompactionArg*>(arg));
3079
- delete static_cast<CompactionArg*>(arg);
3080
- IOSTATS_SET_THREAD_POOL_ID(Env::Priority::LOW);
3081
- TEST_SYNC_POINT("DBImpl::BGWorkCompaction");
3082
- auto prepicked_compaction =
3083
- static_cast<PrepickedCompaction*>(ca.prepicked_compaction);
3084
- static_cast_with_check<DBImpl>(ca.db)->BackgroundCallCompaction(
3085
- prepicked_compaction, Env::Priority::LOW);
3086
- delete prepicked_compaction;
3087
- }
3088
-
3089
- void DBImpl::BGWorkBottomCompaction(void* arg) {
3090
- CompactionArg ca = *(static_cast<CompactionArg*>(arg));
3091
- delete static_cast<CompactionArg*>(arg);
3092
- IOSTATS_SET_THREAD_POOL_ID(Env::Priority::BOTTOM);
3093
- TEST_SYNC_POINT("DBImpl::BGWorkBottomCompaction");
3094
- auto* prepicked_compaction = ca.prepicked_compaction;
3095
- assert(prepicked_compaction && prepicked_compaction->compaction);
3096
- ca.db->BackgroundCallCompaction(prepicked_compaction, Env::Priority::BOTTOM);
3097
- delete prepicked_compaction;
3098
- }
3099
-
3100
- void DBImpl::BGWorkPurge(void* db) {
3101
- IOSTATS_SET_THREAD_POOL_ID(Env::Priority::HIGH);
3102
- TEST_SYNC_POINT("DBImpl::BGWorkPurge:start");
3103
- static_cast<DBImpl*>(db)->BackgroundCallPurge();
3104
- TEST_SYNC_POINT("DBImpl::BGWorkPurge:end");
3105
- }
3106
-
3107
- void DBImpl::UnscheduleCompactionCallback(void* arg) {
3108
- CompactionArg* ca_ptr = static_cast<CompactionArg*>(arg);
3109
- Env::Priority compaction_pri = ca_ptr->compaction_pri_;
3110
- if (Env::Priority::BOTTOM == compaction_pri) {
3111
- // Decrement bg_bottom_compaction_scheduled_ if priority is BOTTOM
3112
- ca_ptr->db->bg_bottom_compaction_scheduled_--;
3113
- } else if (Env::Priority::LOW == compaction_pri) {
3114
- // Decrement bg_compaction_scheduled_ if priority is LOW
3115
- ca_ptr->db->bg_compaction_scheduled_--;
3116
- }
3117
- CompactionArg ca = *(ca_ptr);
3118
- delete static_cast<CompactionArg*>(arg);
3119
- if (ca.prepicked_compaction != nullptr) {
3120
- // if it's a manual compaction, set status to ManualCompactionPaused
3121
- if (ca.prepicked_compaction->manual_compaction_state) {
3122
- ca.prepicked_compaction->manual_compaction_state->done = true;
3123
- ca.prepicked_compaction->manual_compaction_state->status =
3124
- Status::Incomplete(Status::SubCode::kManualCompactionPaused);
3125
- }
3126
- if (ca.prepicked_compaction->compaction != nullptr) {
3127
- ca.prepicked_compaction->compaction->ReleaseCompactionFiles(
3128
- Status::Incomplete(Status::SubCode::kManualCompactionPaused));
3129
- delete ca.prepicked_compaction->compaction;
3130
- }
3131
- delete ca.prepicked_compaction;
3132
- }
3133
- TEST_SYNC_POINT("DBImpl::UnscheduleCompactionCallback");
3134
- }
3135
-
3136
- void DBImpl::UnscheduleFlushCallback(void* arg) {
3137
- // Decrement bg_flush_scheduled_ in flush callback
3138
- static_cast<FlushThreadArg*>(arg)->db_->bg_flush_scheduled_--;
3139
- Env::Priority flush_pri = static_cast<FlushThreadArg*>(arg)->thread_pri_;
3140
- if (Env::Priority::LOW == flush_pri) {
3141
- TEST_SYNC_POINT("DBImpl::UnscheduleLowFlushCallback");
3142
- } else if (Env::Priority::HIGH == flush_pri) {
3143
- TEST_SYNC_POINT("DBImpl::UnscheduleHighFlushCallback");
3144
- }
3145
- delete static_cast<FlushThreadArg*>(arg);
3146
- TEST_SYNC_POINT("DBImpl::UnscheduleFlushCallback");
3147
- }
3148
-
3149
- Status DBImpl::BackgroundFlush(bool* made_progress, JobContext* job_context,
3150
- LogBuffer* log_buffer, FlushReason* reason,
3151
- bool* flush_rescheduled_to_retain_udt,
3152
- Env::Priority thread_pri) {
3153
- mutex_.AssertHeld();
3154
-
3155
- Status status;
3156
- *reason = FlushReason::kOthers;
3157
- // If BG work is stopped due to an error, but a recovery is in progress,
3158
- // that means this flush is part of the recovery. So allow it to go through
3159
- if (!error_handler_.IsBGWorkStopped()) {
3160
- if (shutting_down_.load(std::memory_order_acquire)) {
3161
- status = Status::ShutdownInProgress();
3162
- }
3163
- } else if (!error_handler_.IsRecoveryInProgress()) {
3164
- status = error_handler_.GetBGError();
3165
- }
3166
-
3167
- if (!status.ok()) {
3168
- return status;
3169
- }
3170
-
3171
- autovector<BGFlushArg> bg_flush_args;
3172
- std::vector<SuperVersionContext>& superversion_contexts =
3173
- job_context->superversion_contexts;
3174
- autovector<ColumnFamilyData*> column_families_not_to_flush;
3175
- while (!flush_queue_.empty()) {
3176
- // This cfd is already referenced
3177
- FlushRequest flush_req = PopFirstFromFlushQueue();
3178
- FlushReason flush_reason = flush_req.flush_reason;
3179
- if (!error_handler_.GetBGError().ok() && error_handler_.IsBGWorkStopped() &&
3180
- flush_reason != FlushReason::kErrorRecovery &&
3181
- flush_reason != FlushReason::kErrorRecoveryRetryFlush) {
3182
- // Stop non-recovery flush when bg work is stopped
3183
- // Note that we drop the flush request here.
3184
- // Recovery thread should schedule further flushes after bg error
3185
- // is cleared.
3186
- status = error_handler_.GetBGError();
3187
- assert(!status.ok());
3188
- ROCKS_LOG_BUFFER(log_buffer,
3189
- "[JOB %d] Abort flush due to background error %s",
3190
- job_context->job_id, status.ToString().c_str());
3191
- *reason = flush_reason;
3192
- for (auto item : flush_req.cfd_to_max_mem_id_to_persist) {
3193
- item.first->UnrefAndTryDelete();
3194
- }
3195
- return status;
3196
- }
3197
- if (!immutable_db_options_.atomic_flush &&
3198
- ShouldRescheduleFlushRequestToRetainUDT(flush_req)) {
3199
- assert(flush_req.cfd_to_max_mem_id_to_persist.size() == 1);
3200
- ColumnFamilyData* cfd =
3201
- flush_req.cfd_to_max_mem_id_to_persist.begin()->first;
3202
- if (cfd->UnrefAndTryDelete()) {
3203
- return Status::OK();
3204
- }
3205
- ROCKS_LOG_BUFFER(log_buffer,
3206
- "FlushRequest for column family %s is re-scheduled to "
3207
- "retain user-defined timestamps.",
3208
- cfd->GetName().c_str());
3209
- // Reschedule the `FlushRequest` as is without checking dropped column
3210
- // family etc. The follow-up job will do the check anyways, so save the
3211
- // duplication. Column family is deduplicated by `SchdulePendingFlush` and
3212
- // `PopFirstFromFlushQueue` contains at flush request enqueueing and
3213
- // dequeueing time.
3214
- // This flush request is rescheduled right after it's popped from the
3215
- // queue while the db mutex is held, so there should be no other
3216
- // FlushRequest for the same column family with higher `max_memtable_id`
3217
- // in the queue to block the reschedule from succeeding.
3218
- #ifndef NDEBUG
3219
- flush_req.reschedule_count += 1;
3220
- #endif /* !NDEBUG */
3221
- SchedulePendingFlush(flush_req);
3222
- *reason = flush_reason;
3223
- *flush_rescheduled_to_retain_udt = true;
3224
- return Status::TryAgain();
3225
- }
3226
- superversion_contexts.clear();
3227
- superversion_contexts.reserve(
3228
- flush_req.cfd_to_max_mem_id_to_persist.size());
3229
-
3230
- for (const auto& [cfd, max_memtable_id] :
3231
- flush_req.cfd_to_max_mem_id_to_persist) {
3232
- if (cfd->GetMempurgeUsed()) {
3233
- // If imm() contains silent memtables (e.g.: because
3234
- // MemPurge was activated), requesting a flush will
3235
- // mark the imm_needed as true.
3236
- cfd->imm()->FlushRequested();
3237
- }
3238
-
3239
- if (cfd->IsDropped() || !cfd->imm()->IsFlushPending()) {
3240
- // can't flush this CF, try next one
3241
- column_families_not_to_flush.push_back(cfd);
3242
- continue;
3243
- }
3244
- superversion_contexts.emplace_back(true);
3245
- bg_flush_args.emplace_back(cfd, max_memtable_id,
3246
- &(superversion_contexts.back()), flush_reason);
3247
- }
3248
- // `MaybeScheduleFlushOrCompaction` schedules as many `BackgroundCallFlush`
3249
- // jobs as the number of `FlushRequest` in the `flush_queue_`, a.k.a
3250
- // `unscheduled_flushes_`. So it's sufficient to make each `BackgroundFlush`
3251
- // handle one `FlushRequest` and each have a Status returned.
3252
- if (!bg_flush_args.empty() || !column_families_not_to_flush.empty()) {
3253
- TEST_SYNC_POINT_CALLBACK("DBImpl::BackgroundFlush:CheckFlushRequest:cb",
3254
- const_cast<int*>(&flush_req.reschedule_count));
3255
- break;
3256
- }
3257
- }
3258
-
3259
- if (!bg_flush_args.empty()) {
3260
- auto bg_job_limits = GetBGJobLimits();
3261
- for (const auto& arg : bg_flush_args) {
3262
- ColumnFamilyData* cfd = arg.cfd_;
3263
- ROCKS_LOG_BUFFER(
3264
- log_buffer,
3265
- "Calling FlushMemTableToOutputFile with column "
3266
- "family [%s], flush slots available %d, compaction slots available "
3267
- "%d, "
3268
- "flush slots scheduled %d, compaction slots scheduled %d",
3269
- cfd->GetName().c_str(), bg_job_limits.max_flushes,
3270
- bg_job_limits.max_compactions, bg_flush_scheduled_,
3271
- bg_compaction_scheduled_);
3272
- }
3273
- status = FlushMemTablesToOutputFiles(bg_flush_args, made_progress,
3274
- job_context, log_buffer, thread_pri);
3275
- TEST_SYNC_POINT("DBImpl::BackgroundFlush:BeforeFlush");
3276
- // All the CFD/bg_flush_arg in the FlushReq must have the same flush reason, so
3277
- // just grab the first one
3278
- #ifndef NDEBUG
3279
- for (const auto& bg_flush_arg : bg_flush_args) {
3280
- assert(bg_flush_arg.flush_reason_ == bg_flush_args[0].flush_reason_);
3281
- }
3282
- #endif /* !NDEBUG */
3283
- *reason = bg_flush_args[0].flush_reason_;
3284
- for (auto& arg : bg_flush_args) {
3285
- ColumnFamilyData* cfd = arg.cfd_;
3286
- if (cfd->UnrefAndTryDelete()) {
3287
- arg.cfd_ = nullptr;
3288
- }
3289
- }
3290
- }
3291
- for (auto cfd : column_families_not_to_flush) {
3292
- cfd->UnrefAndTryDelete();
3293
- }
3294
- return status;
3295
- }
3296
-
3297
- void DBImpl::BackgroundCallFlush(Env::Priority thread_pri) {
3298
- bool made_progress = false;
3299
- JobContext job_context(next_job_id_.fetch_add(1), true);
3300
-
3301
- TEST_SYNC_POINT_CALLBACK("DBImpl::BackgroundCallFlush:start", nullptr);
3302
-
3303
- LogBuffer log_buffer(InfoLogLevel::INFO_LEVEL,
3304
- immutable_db_options_.info_log.get());
3305
- TEST_SYNC_POINT("DBImpl::BackgroundCallFlush:Start:1");
3306
- TEST_SYNC_POINT("DBImpl::BackgroundCallFlush:Start:2");
3307
- {
3308
- InstrumentedMutexLock l(&mutex_);
3309
- assert(bg_flush_scheduled_);
3310
- num_running_flushes_++;
3311
-
3312
- std::unique_ptr<std::list<uint64_t>::iterator>
3313
- pending_outputs_inserted_elem(new std::list<uint64_t>::iterator(
3314
- CaptureCurrentFileNumberInPendingOutputs()));
3315
- FlushReason reason;
3316
- bool flush_rescheduled_to_retain_udt = false;
3317
- Status s =
3318
- BackgroundFlush(&made_progress, &job_context, &log_buffer, &reason,
3319
- &flush_rescheduled_to_retain_udt, thread_pri);
3320
- if (s.IsTryAgain() && flush_rescheduled_to_retain_udt) {
3321
- bg_cv_.SignalAll(); // In case a waiter can proceed despite the error
3322
- mutex_.Unlock();
3323
- TEST_SYNC_POINT_CALLBACK("DBImpl::AfterRetainUDTReschedule:cb", nullptr);
3324
- immutable_db_options_.clock->SleepForMicroseconds(
3325
- 100000); // prevent hot loop
3326
- mutex_.Lock();
3327
- } else if (!s.ok() && !s.IsShutdownInProgress() &&
3328
- !s.IsColumnFamilyDropped() &&
3329
- reason != FlushReason::kErrorRecovery) {
3330
- // Wait a little bit before retrying background flush in
3331
- // case this is an environmental problem and we do not want to
3332
- // chew up resources for failed flushes for the duration of
3333
- // the problem.
3334
- uint64_t error_cnt =
3335
- default_cf_internal_stats_->BumpAndGetBackgroundErrorCount();
3336
- bg_cv_.SignalAll(); // In case a waiter can proceed despite the error
3337
- mutex_.Unlock();
3338
- ROCKS_LOG_ERROR(immutable_db_options_.info_log,
3339
- "[JOB %d] Waiting after background flush error: %s, "
3340
- "Accumulated background error counts: %" PRIu64,
3341
- job_context.job_id, s.ToString().c_str(), error_cnt);
3342
- log_buffer.FlushBufferToLog();
3343
- LogFlush(immutable_db_options_.info_log);
3344
- immutable_db_options_.clock->SleepForMicroseconds(1000000);
3345
- mutex_.Lock();
3346
- }
3347
-
3348
- TEST_SYNC_POINT("DBImpl::BackgroundCallFlush:FlushFinish:0");
3349
- ReleaseFileNumberFromPendingOutputs(pending_outputs_inserted_elem);
3350
- // There is no need to find obsolete files if the flush job is rescheduled
3351
- // to retain user-defined timestamps because the job doesn't get to the
3352
- // stage of actually flushing the MemTables.
3353
- if (!flush_rescheduled_to_retain_udt) {
3354
- // If flush failed, we want to delete all temporary files that we might
3355
- // have created. Thus, we force full scan in FindObsoleteFiles()
3356
- FindObsoleteFiles(&job_context, !s.ok() && !s.IsShutdownInProgress() &&
3357
- !s.IsColumnFamilyDropped());
3358
- }
3359
- // delete unnecessary files if any, this is done outside the mutex
3360
- if (job_context.HaveSomethingToClean() ||
3361
- job_context.HaveSomethingToDelete() || !log_buffer.IsEmpty()) {
3362
- mutex_.Unlock();
3363
- TEST_SYNC_POINT("DBImpl::BackgroundCallFlush:FilesFound");
3364
- // Have to flush the info logs before bg_flush_scheduled_--
3365
- // because if bg_flush_scheduled_ becomes 0 and the lock is
3366
- // released, the deconstructor of DB can kick in and destroy all the
3367
- // states of DB so info_log might not be available after that point.
3368
- // It also applies to access other states that DB owns.
3369
- log_buffer.FlushBufferToLog();
3370
- if (job_context.HaveSomethingToDelete()) {
3371
- PurgeObsoleteFiles(job_context);
3372
- }
3373
- job_context.Clean();
3374
- mutex_.Lock();
3375
- }
3376
- TEST_SYNC_POINT("DBImpl::BackgroundCallFlush:ContextCleanedUp");
3377
-
3378
- assert(num_running_flushes_ > 0);
3379
- num_running_flushes_--;
3380
- bg_flush_scheduled_--;
3381
- // See if there's more work to be done
3382
- MaybeScheduleFlushOrCompaction();
3383
- atomic_flush_install_cv_.SignalAll();
3384
- bg_cv_.SignalAll();
3385
- // IMPORTANT: there should be no code after calling SignalAll. This call may
3386
- // signal the DB destructor that it's OK to proceed with destruction. In
3387
- // that case, all DB variables will be dealloacated and referencing them
3388
- // will cause trouble.
3389
- }
3390
- }
3391
-
3392
- void DBImpl::BackgroundCallCompaction(PrepickedCompaction* prepicked_compaction,
3393
- Env::Priority bg_thread_pri) {
3394
- bool made_progress = false;
3395
- JobContext job_context(next_job_id_.fetch_add(1), true);
3396
- TEST_SYNC_POINT("BackgroundCallCompaction:0");
3397
- LogBuffer log_buffer(InfoLogLevel::INFO_LEVEL,
3398
- immutable_db_options_.info_log.get());
3399
- {
3400
- InstrumentedMutexLock l(&mutex_);
3401
-
3402
- num_running_compactions_++;
3403
-
3404
- std::unique_ptr<std::list<uint64_t>::iterator>
3405
- pending_outputs_inserted_elem(new std::list<uint64_t>::iterator(
3406
- CaptureCurrentFileNumberInPendingOutputs()));
3407
-
3408
- assert((bg_thread_pri == Env::Priority::BOTTOM &&
3409
- bg_bottom_compaction_scheduled_) ||
3410
- (bg_thread_pri == Env::Priority::LOW && bg_compaction_scheduled_));
3411
- Status s = BackgroundCompaction(&made_progress, &job_context, &log_buffer,
3412
- prepicked_compaction, bg_thread_pri);
3413
- TEST_SYNC_POINT("BackgroundCallCompaction:1");
3414
- if (s.IsBusy()) {
3415
- bg_cv_.SignalAll(); // In case a waiter can proceed despite the error
3416
- mutex_.Unlock();
3417
- immutable_db_options_.clock->SleepForMicroseconds(
3418
- 10000); // prevent hot loop
3419
- mutex_.Lock();
3420
- } else if (!s.ok() && !s.IsShutdownInProgress() &&
3421
- !s.IsManualCompactionPaused() && !s.IsColumnFamilyDropped()) {
3422
- // Wait a little bit before retrying background compaction in
3423
- // case this is an environmental problem and we do not want to
3424
- // chew up resources for failed compactions for the duration of
3425
- // the problem.
3426
- uint64_t error_cnt =
3427
- default_cf_internal_stats_->BumpAndGetBackgroundErrorCount();
3428
- bg_cv_.SignalAll(); // In case a waiter can proceed despite the error
3429
- mutex_.Unlock();
3430
- log_buffer.FlushBufferToLog();
3431
- ROCKS_LOG_ERROR(immutable_db_options_.info_log,
3432
- "Waiting after background compaction error: %s, "
3433
- "Accumulated background error counts: %" PRIu64,
3434
- s.ToString().c_str(), error_cnt);
3435
- LogFlush(immutable_db_options_.info_log);
3436
- immutable_db_options_.clock->SleepForMicroseconds(1000000);
3437
- mutex_.Lock();
3438
- } else if (s.IsManualCompactionPaused()) {
3439
- assert(prepicked_compaction);
3440
- ManualCompactionState* m = prepicked_compaction->manual_compaction_state;
3441
- assert(m);
3442
- ROCKS_LOG_BUFFER(&log_buffer, "[%s] [JOB %d] Manual compaction paused",
3443
- m->cfd->GetName().c_str(), job_context.job_id);
3444
- }
3445
-
3446
- ReleaseFileNumberFromPendingOutputs(pending_outputs_inserted_elem);
3447
-
3448
- // If compaction failed, we want to delete all temporary files that we
3449
- // might have created (they might not be all recorded in job_context in
3450
- // case of a failure). Thus, we force full scan in FindObsoleteFiles()
3451
- FindObsoleteFiles(&job_context, !s.ok() && !s.IsShutdownInProgress() &&
3452
- !s.IsManualCompactionPaused() &&
3453
- !s.IsColumnFamilyDropped() &&
3454
- !s.IsBusy());
3455
- TEST_SYNC_POINT("DBImpl::BackgroundCallCompaction:FoundObsoleteFiles");
3456
-
3457
- // delete unnecessary files if any, this is done outside the mutex
3458
- if (job_context.HaveSomethingToClean() ||
3459
- job_context.HaveSomethingToDelete() || !log_buffer.IsEmpty()) {
3460
- mutex_.Unlock();
3461
- // Have to flush the info logs before bg_compaction_scheduled_--
3462
- // because if bg_flush_scheduled_ becomes 0 and the lock is
3463
- // released, the deconstructor of DB can kick in and destroy all the
3464
- // states of DB so info_log might not be available after that point.
3465
- // It also applies to access other states that DB owns.
3466
- log_buffer.FlushBufferToLog();
3467
- if (job_context.HaveSomethingToDelete()) {
3468
- PurgeObsoleteFiles(job_context);
3469
- TEST_SYNC_POINT("DBImpl::BackgroundCallCompaction:PurgedObsoleteFiles");
3470
- }
3471
- job_context.Clean();
3472
- mutex_.Lock();
3473
- }
3474
-
3475
- assert(num_running_compactions_ > 0);
3476
- num_running_compactions_--;
3477
-
3478
- if (bg_thread_pri == Env::Priority::LOW) {
3479
- bg_compaction_scheduled_--;
3480
- } else {
3481
- assert(bg_thread_pri == Env::Priority::BOTTOM);
3482
- bg_bottom_compaction_scheduled_--;
3483
- }
3484
-
3485
- // See if there's more work to be done
3486
- MaybeScheduleFlushOrCompaction();
3487
-
3488
- if (prepicked_compaction != nullptr &&
3489
- prepicked_compaction->task_token != nullptr) {
3490
- // Releasing task tokens affects (and asserts on) the DB state, so
3491
- // must be done before we potentially signal the DB close process to
3492
- // proceed below.
3493
- prepicked_compaction->task_token.reset();
3494
- }
3495
-
3496
- if (made_progress ||
3497
- (bg_compaction_scheduled_ == 0 &&
3498
- bg_bottom_compaction_scheduled_ == 0) ||
3499
- HasPendingManualCompaction() || unscheduled_compactions_ == 0) {
3500
- // signal if
3501
- // * made_progress -- need to wakeup DelayWrite
3502
- // * bg_{bottom,}_compaction_scheduled_ == 0 -- need to wakeup ~DBImpl
3503
- // * HasPendingManualCompaction -- need to wakeup RunManualCompaction
3504
- // If none of this is true, there is no need to signal since nobody is
3505
- // waiting for it
3506
- bg_cv_.SignalAll();
3507
- }
3508
- // IMPORTANT: there should be no code after calling SignalAll. This call may
3509
- // signal the DB destructor that it's OK to proceed with destruction. In
3510
- // that case, all DB variables will be dealloacated and referencing them
3511
- // will cause trouble.
3512
- }
3513
- }
3514
-
3515
- Status DBImpl::BackgroundCompaction(bool* made_progress,
3516
- JobContext* job_context,
3517
- LogBuffer* log_buffer,
3518
- PrepickedCompaction* prepicked_compaction,
3519
- Env::Priority thread_pri) {
3520
- ManualCompactionState* manual_compaction =
3521
- prepicked_compaction == nullptr
3522
- ? nullptr
3523
- : prepicked_compaction->manual_compaction_state;
3524
- *made_progress = false;
3525
- mutex_.AssertHeld();
3526
- TEST_SYNC_POINT("DBImpl::BackgroundCompaction:Start");
3527
-
3528
- const ReadOptions read_options(Env::IOActivity::kCompaction);
3529
- const WriteOptions write_options(Env::IOActivity::kCompaction);
3530
-
3531
- bool is_manual = (manual_compaction != nullptr);
3532
- std::unique_ptr<Compaction> c;
3533
- if (prepicked_compaction != nullptr &&
3534
- prepicked_compaction->compaction != nullptr) {
3535
- c.reset(prepicked_compaction->compaction);
3536
- }
3537
- bool is_prepicked = is_manual || c;
3538
-
3539
- // (manual_compaction->in_progress == false);
3540
- bool trivial_move_disallowed =
3541
- is_manual && manual_compaction->disallow_trivial_move;
3542
-
3543
- CompactionJobStats compaction_job_stats;
3544
- Status status;
3545
- if (!error_handler_.IsBGWorkStopped()) {
3546
- if (shutting_down_.load(std::memory_order_acquire)) {
3547
- status = Status::ShutdownInProgress();
3548
- } else if (is_manual &&
3549
- manual_compaction->canceled.load(std::memory_order_acquire)) {
3550
- status = Status::Incomplete(Status::SubCode::kManualCompactionPaused);
3551
- }
3552
- } else {
3553
- status = error_handler_.GetBGError();
3554
- // If we get here, it means a hard error happened after this compaction
3555
- // was scheduled by MaybeScheduleFlushOrCompaction(), but before it got
3556
- // a chance to execute. Since we didn't pop a cfd from the compaction
3557
- // queue, increment unscheduled_compactions_
3558
- unscheduled_compactions_++;
3559
- }
3560
-
3561
- if (!status.ok()) {
3562
- if (is_manual) {
3563
- manual_compaction->status = status;
3564
- manual_compaction->done = true;
3565
- manual_compaction->in_progress = false;
3566
- manual_compaction = nullptr;
3567
- }
3568
- if (c) {
3569
- c->ReleaseCompactionFiles(status);
3570
- c.reset();
3571
- }
3572
- return status;
3573
- }
3574
-
3575
- if (is_manual) {
3576
- // another thread cannot pick up the same work
3577
- manual_compaction->in_progress = true;
3578
- }
3579
-
3580
- TEST_SYNC_POINT("DBImpl::BackgroundCompaction:InProgress");
3581
-
3582
- std::unique_ptr<TaskLimiterToken> task_token;
3583
-
3584
- bool sfm_reserved_compact_space = false;
3585
- if (is_manual) {
3586
- ManualCompactionState* m = manual_compaction;
3587
- assert(m->in_progress);
3588
- if (!c) {
3589
- m->done = true;
3590
- m->manual_end = nullptr;
3591
- ROCKS_LOG_BUFFER(
3592
- log_buffer,
3593
- "[%s] Manual compaction from level-%d from %s .. "
3594
- "%s; nothing to do\n",
3595
- m->cfd->GetName().c_str(), m->input_level,
3596
- (m->begin ? m->begin->DebugString(true).c_str() : "(begin)"),
3597
- (m->end ? m->end->DebugString(true).c_str() : "(end)"));
3598
- } else {
3599
- // First check if we have enough room to do the compaction
3600
- bool enough_room = EnoughRoomForCompaction(
3601
- m->cfd, *(c->inputs()), &sfm_reserved_compact_space, log_buffer);
3602
-
3603
- if (!enough_room) {
3604
- // Then don't do the compaction
3605
- c->ReleaseCompactionFiles(status);
3606
- c.reset();
3607
- // m's vars will get set properly at the end of this function,
3608
- // as long as status == CompactionTooLarge
3609
- status = Status::CompactionTooLarge();
3610
- } else {
3611
- ROCKS_LOG_BUFFER(
3612
- log_buffer,
3613
- "[%s] Manual compaction from level-%d to level-%d from %s .. "
3614
- "%s; will stop at %s\n",
3615
- m->cfd->GetName().c_str(), m->input_level, c->output_level(),
3616
- (m->begin ? m->begin->DebugString(true).c_str() : "(begin)"),
3617
- (m->end ? m->end->DebugString(true).c_str() : "(end)"),
3618
- ((m->done || m->manual_end == nullptr)
3619
- ? "(end)"
3620
- : m->manual_end->DebugString(true).c_str()));
3621
- }
3622
- }
3623
- } else if (!is_prepicked && !compaction_queue_.empty()) {
3624
- if (HasExclusiveManualCompaction()) {
3625
- // Can't compact right now, but try again later
3626
- TEST_SYNC_POINT("DBImpl::BackgroundCompaction()::Conflict");
3627
-
3628
- // Stay in the compaction queue.
3629
- unscheduled_compactions_++;
3630
-
3631
- return Status::OK();
3632
- }
3633
-
3634
- auto cfd = PickCompactionFromQueue(&task_token, log_buffer);
3635
- if (cfd == nullptr) {
3636
- // Can't find any executable task from the compaction queue.
3637
- // All tasks have been throttled by compaction thread limiter.
3638
- ++unscheduled_compactions_;
3639
- return Status::Busy();
3640
- }
3641
-
3642
- // We unreference here because the following code will take a Ref() on
3643
- // this cfd if it is going to use it (Compaction class holds a
3644
- // reference).
3645
- // This will all happen under a mutex so we don't have to be afraid of
3646
- // somebody else deleting it.
3647
- if (cfd->UnrefAndTryDelete()) {
3648
- // This was the last reference of the column family, so no need to
3649
- // compact.
3650
- return Status::OK();
3651
- }
3652
-
3653
- // Pick up latest mutable CF Options and use it throughout the
3654
- // compaction job
3655
- // Compaction makes a copy of the latest MutableCFOptions. It should be used
3656
- // throughout the compaction procedure to make sure consistency. It will
3657
- // eventually be installed into SuperVersion
3658
- auto* mutable_cf_options = cfd->GetLatestMutableCFOptions();
3659
- if (!mutable_cf_options->disable_auto_compactions && !cfd->IsDropped()) {
3660
- // NOTE: try to avoid unnecessary copy of MutableCFOptions if
3661
- // compaction is not necessary. Need to make sure mutex is held
3662
- // until we make a copy in the following code
3663
- TEST_SYNC_POINT("DBImpl::BackgroundCompaction():BeforePickCompaction");
3664
- c.reset(cfd->PickCompaction(*mutable_cf_options, mutable_db_options_,
3665
- log_buffer));
3666
- TEST_SYNC_POINT("DBImpl::BackgroundCompaction():AfterPickCompaction");
3667
-
3668
- if (c != nullptr) {
3669
- bool enough_room = EnoughRoomForCompaction(
3670
- cfd, *(c->inputs()), &sfm_reserved_compact_space, log_buffer);
3671
-
3672
- if (!enough_room) {
3673
- // Then don't do the compaction
3674
- c->ReleaseCompactionFiles(status);
3675
- c->column_family_data()
3676
- ->current()
3677
- ->storage_info()
3678
- ->ComputeCompactionScore(*(c->immutable_options()),
3679
- *(c->mutable_cf_options()));
3680
- AddToCompactionQueue(cfd);
3681
- ++unscheduled_compactions_;
3682
-
3683
- c.reset();
3684
- // Don't need to sleep here, because BackgroundCallCompaction
3685
- // will sleep if !s.ok()
3686
- status = Status::CompactionTooLarge();
3687
- } else {
3688
- // update statistics
3689
- size_t num_files = 0;
3690
- for (auto& each_level : *c->inputs()) {
3691
- num_files += each_level.files.size();
3692
- }
3693
- RecordInHistogram(stats_, NUM_FILES_IN_SINGLE_COMPACTION, num_files);
3694
-
3695
- // There are three things that can change compaction score:
3696
- // 1) When flush or compaction finish. This case is covered by
3697
- // InstallSuperVersionAndScheduleWork
3698
- // 2) When MutableCFOptions changes. This case is also covered by
3699
- // InstallSuperVersionAndScheduleWork, because this is when the new
3700
- // options take effect.
3701
- // 3) When we Pick a new compaction, we "remove" those files being
3702
- // compacted from the calculation, which then influences compaction
3703
- // score. Here we check if we need the new compaction even without the
3704
- // files that are currently being compacted. If we need another
3705
- // compaction, we might be able to execute it in parallel, so we add
3706
- // it to the queue and schedule a new thread.
3707
- if (cfd->NeedsCompaction()) {
3708
- // Yes, we need more compactions!
3709
- AddToCompactionQueue(cfd);
3710
- ++unscheduled_compactions_;
3711
- MaybeScheduleFlushOrCompaction();
3712
- }
3713
- }
3714
- }
3715
- }
3716
- }
3717
-
3718
- IOStatus io_s;
3719
- bool compaction_released = false;
3720
- if (!c) {
3721
- // Nothing to do
3722
- ROCKS_LOG_BUFFER(log_buffer, "Compaction nothing to do");
3723
- } else if (c->deletion_compaction()) {
3724
- // TODO(icanadi) Do we want to honor snapshots here? i.e. not delete old
3725
- // file if there is alive snapshot pointing to it
3726
- TEST_SYNC_POINT_CALLBACK("DBImpl::BackgroundCompaction:BeforeCompaction",
3727
- c->column_family_data());
3728
- assert(c->num_input_files(1) == 0);
3729
- assert(c->column_family_data()->ioptions()->compaction_style ==
3730
- kCompactionStyleFIFO);
3731
-
3732
- compaction_job_stats.num_input_files = c->num_input_files(0);
3733
-
3734
- NotifyOnCompactionBegin(c->column_family_data(), c.get(), status,
3735
- compaction_job_stats, job_context->job_id);
3736
-
3737
- for (const auto& f : *c->inputs(0)) {
3738
- c->edit()->DeleteFile(c->level(), f->fd.GetNumber());
3739
- }
3740
- status = versions_->LogAndApply(
3741
- c->column_family_data(), *c->mutable_cf_options(), read_options,
3742
- write_options, c->edit(), &mutex_, directories_.GetDbDir(),
3743
- /*new_descriptor_log=*/false, /*column_family_options=*/nullptr,
3744
- [&c, &compaction_released](const Status& s) {
3745
- c->ReleaseCompactionFiles(s);
3746
- compaction_released = true;
3747
- });
3748
- io_s = versions_->io_status();
3749
- InstallSuperVersionAndScheduleWork(
3750
- c->column_family_data(), job_context->superversion_contexts.data(),
3751
- *c->mutable_cf_options());
3752
- ROCKS_LOG_BUFFER(log_buffer, "[%s] Deleted %d files\n",
3753
- c->column_family_data()->GetName().c_str(),
3754
- c->num_input_files(0));
3755
- if (status.ok() && io_s.ok()) {
3756
- UpdateDeletionCompactionStats(c);
3757
- }
3758
- *made_progress = true;
3759
- TEST_SYNC_POINT_CALLBACK("DBImpl::BackgroundCompaction:AfterCompaction",
3760
- c->column_family_data());
3761
- } else if (!trivial_move_disallowed && c->IsTrivialMove()) {
3762
- TEST_SYNC_POINT("DBImpl::BackgroundCompaction:TrivialMove");
3763
- TEST_SYNC_POINT_CALLBACK("DBImpl::BackgroundCompaction:BeforeCompaction",
3764
- c->column_family_data());
3765
- // Instrument for event update
3766
- // TODO(yhchiang): add op details for showing trivial-move.
3767
- ThreadStatusUtil::SetColumnFamily(c->column_family_data());
3768
- ThreadStatusUtil::SetThreadOperation(ThreadStatus::OP_COMPACTION);
3769
-
3770
- compaction_job_stats.num_input_files = c->num_input_files(0);
3771
-
3772
- NotifyOnCompactionBegin(c->column_family_data(), c.get(), status,
3773
- compaction_job_stats, job_context->job_id);
3774
-
3775
- // Move files to next level
3776
- int32_t moved_files = 0;
3777
- int64_t moved_bytes = 0;
3778
- for (unsigned int l = 0; l < c->num_input_levels(); l++) {
3779
- if (c->level(l) == c->output_level()) {
3780
- continue;
3781
- }
3782
- for (size_t i = 0; i < c->num_input_files(l); i++) {
3783
- FileMetaData* f = c->input(l, i);
3784
- c->edit()->DeleteFile(c->level(l), f->fd.GetNumber());
3785
- c->edit()->AddFile(
3786
- c->output_level(), f->fd.GetNumber(), f->fd.GetPathId(),
3787
- f->fd.GetFileSize(), f->smallest, f->largest, f->fd.smallest_seqno,
3788
- f->fd.largest_seqno, f->marked_for_compaction, f->temperature,
3789
- f->oldest_blob_file_number, f->oldest_ancester_time,
3790
- f->file_creation_time, f->epoch_number, f->file_checksum,
3791
- f->file_checksum_func_name, f->unique_id,
3792
- f->compensated_range_deletion_size, f->tail_size,
3793
- f->user_defined_timestamps_persisted);
3794
-
3795
- ROCKS_LOG_BUFFER(
3796
- log_buffer,
3797
- "[%s] Moving #%" PRIu64 " to level-%d %" PRIu64 " bytes\n",
3798
- c->column_family_data()->GetName().c_str(), f->fd.GetNumber(),
3799
- c->output_level(), f->fd.GetFileSize());
3800
- ++moved_files;
3801
- moved_bytes += f->fd.GetFileSize();
3802
- }
3803
- }
3804
- if (c->compaction_reason() == CompactionReason::kLevelMaxLevelSize &&
3805
- c->immutable_options()->compaction_pri == kRoundRobin) {
3806
- int start_level = c->start_level();
3807
- if (start_level > 0) {
3808
- auto vstorage = c->input_version()->storage_info();
3809
- c->edit()->AddCompactCursor(
3810
- start_level,
3811
- vstorage->GetNextCompactCursor(start_level, c->num_input_files(0)));
3812
- }
3813
- }
3814
- status = versions_->LogAndApply(
3815
- c->column_family_data(), *c->mutable_cf_options(), read_options,
3816
- write_options, c->edit(), &mutex_, directories_.GetDbDir(),
3817
- /*new_descriptor_log=*/false, /*column_family_options=*/nullptr,
3818
- [&c, &compaction_released](const Status& s) {
3819
- c->ReleaseCompactionFiles(s);
3820
- compaction_released = true;
3821
- });
3822
- io_s = versions_->io_status();
3823
- // Use latest MutableCFOptions
3824
- InstallSuperVersionAndScheduleWork(
3825
- c->column_family_data(), job_context->superversion_contexts.data(),
3826
- *c->mutable_cf_options());
3827
-
3828
- VersionStorageInfo::LevelSummaryStorage tmp;
3829
- c->column_family_data()->internal_stats()->IncBytesMoved(c->output_level(),
3830
- moved_bytes);
3831
- {
3832
- event_logger_.LogToBuffer(log_buffer)
3833
- << "job" << job_context->job_id << "event"
3834
- << "trivial_move"
3835
- << "destination_level" << c->output_level() << "files" << moved_files
3836
- << "total_files_size" << moved_bytes;
3837
- }
3838
- ROCKS_LOG_BUFFER(
3839
- log_buffer,
3840
- "[%s] Moved #%d files to level-%d %" PRIu64 " bytes %s: %s\n",
3841
- c->column_family_data()->GetName().c_str(), moved_files,
3842
- c->output_level(), moved_bytes, status.ToString().c_str(),
3843
- c->column_family_data()->current()->storage_info()->LevelSummary(&tmp));
3844
- *made_progress = true;
3845
-
3846
- // Clear Instrument
3847
- ThreadStatusUtil::ResetThreadStatus();
3848
- TEST_SYNC_POINT_CALLBACK("DBImpl::BackgroundCompaction:AfterCompaction",
3849
- c->column_family_data());
3850
- } else if (!is_prepicked && c->output_level() > 0 &&
3851
- c->output_level() ==
3852
- c->column_family_data()
3853
- ->current()
3854
- ->storage_info()
3855
- ->MaxOutputLevel(
3856
- immutable_db_options_.allow_ingest_behind) &&
3857
- env_->GetBackgroundThreads(Env::Priority::BOTTOM) > 0) {
3858
- // Forward compactions involving last level to the bottom pool if it exists,
3859
- // such that compactions unlikely to contribute to write stalls can be
3860
- // delayed or deprioritized.
3861
- TEST_SYNC_POINT("DBImpl::BackgroundCompaction:ForwardToBottomPriPool");
3862
- CompactionArg* ca = new CompactionArg;
3863
- ca->db = this;
3864
- ca->compaction_pri_ = Env::Priority::BOTTOM;
3865
- ca->prepicked_compaction = new PrepickedCompaction;
3866
- ca->prepicked_compaction->compaction = c.release();
3867
- ca->prepicked_compaction->manual_compaction_state = nullptr;
3868
- // Transfer requested token, so it doesn't need to do it again.
3869
- ca->prepicked_compaction->task_token = std::move(task_token);
3870
- ++bg_bottom_compaction_scheduled_;
3871
- assert(c == nullptr);
3872
- env_->Schedule(&DBImpl::BGWorkBottomCompaction, ca, Env::Priority::BOTTOM,
3873
- this, &DBImpl::UnscheduleCompactionCallback);
3874
- } else {
3875
- TEST_SYNC_POINT_CALLBACK("DBImpl::BackgroundCompaction:BeforeCompaction",
3876
- c->column_family_data());
3877
- int output_level __attribute__((__unused__));
3878
- output_level = c->output_level();
3879
- TEST_SYNC_POINT_CALLBACK("DBImpl::BackgroundCompaction:NonTrivial",
3880
- &output_level);
3881
- std::vector<SequenceNumber> snapshot_seqs;
3882
- SequenceNumber earliest_write_conflict_snapshot;
3883
- SnapshotChecker* snapshot_checker;
3884
- GetSnapshotContext(job_context, &snapshot_seqs,
3885
- &earliest_write_conflict_snapshot, &snapshot_checker);
3886
- assert(is_snapshot_supported_ || snapshots_.empty());
3887
-
3888
- CompactionJob compaction_job(
3889
- job_context->job_id, c.get(), immutable_db_options_,
3890
- mutable_db_options_, file_options_for_compaction_, versions_.get(),
3891
- &shutting_down_, log_buffer, directories_.GetDbDir(),
3892
- GetDataDir(c->column_family_data(), c->output_path_id()),
3893
- GetDataDir(c->column_family_data(), 0), stats_, &mutex_,
3894
- &error_handler_, snapshot_seqs, earliest_write_conflict_snapshot,
3895
- snapshot_checker, job_context, table_cache_, &event_logger_,
3896
- c->mutable_cf_options()->paranoid_file_checks,
3897
- c->mutable_cf_options()->report_bg_io_stats, dbname_,
3898
- &compaction_job_stats, thread_pri, io_tracer_,
3899
- is_manual ? manual_compaction->canceled
3900
- : kManualCompactionCanceledFalse_,
3901
- db_id_, db_session_id_, c->column_family_data()->GetFullHistoryTsLow(),
3902
- c->trim_ts(), &blob_callback_, &bg_compaction_scheduled_,
3903
- &bg_bottom_compaction_scheduled_);
3904
- compaction_job.Prepare();
3905
-
3906
- NotifyOnCompactionBegin(c->column_family_data(), c.get(), status,
3907
- compaction_job_stats, job_context->job_id);
3908
- mutex_.Unlock();
3909
- TEST_SYNC_POINT_CALLBACK(
3910
- "DBImpl::BackgroundCompaction:NonTrivial:BeforeRun", nullptr);
3911
- // Should handle error?
3912
- compaction_job.Run().PermitUncheckedError();
3913
- TEST_SYNC_POINT("DBImpl::BackgroundCompaction:NonTrivial:AfterRun");
3914
- mutex_.Lock();
3915
- status =
3916
- compaction_job.Install(*c->mutable_cf_options(), &compaction_released);
3917
- io_s = compaction_job.io_status();
3918
- if (status.ok()) {
3919
- InstallSuperVersionAndScheduleWork(
3920
- c->column_family_data(), job_context->superversion_contexts.data(),
3921
- *c->mutable_cf_options());
3922
- }
3923
- *made_progress = true;
3924
- TEST_SYNC_POINT_CALLBACK("DBImpl::BackgroundCompaction:AfterCompaction",
3925
- c->column_family_data());
3926
- }
3927
-
3928
- if (status.ok() && !io_s.ok()) {
3929
- status = io_s;
3930
- } else {
3931
- io_s.PermitUncheckedError();
3932
- }
3933
-
3934
- if (c != nullptr) {
3935
- if (!compaction_released) {
3936
- c->ReleaseCompactionFiles(status);
3937
- } else {
3938
- #ifndef NDEBUG
3939
- // Sanity checking that compaction files are freed.
3940
- for (size_t i = 0; i < c->num_input_levels(); i++) {
3941
- for (size_t j = 0; j < c->inputs(i)->size(); j++) {
3942
- assert(!c->input(i, j)->being_compacted);
3943
- }
3944
- }
3945
- std::unordered_set<Compaction*>* cip = c->column_family_data()
3946
- ->compaction_picker()
3947
- ->compactions_in_progress();
3948
- assert(cip->find(c.get()) == cip->end());
3949
- #endif
3950
- }
3951
-
3952
- *made_progress = true;
3953
-
3954
- // Need to make sure SstFileManager does its bookkeeping
3955
- auto sfm = static_cast<SstFileManagerImpl*>(
3956
- immutable_db_options_.sst_file_manager.get());
3957
- if (sfm && sfm_reserved_compact_space) {
3958
- sfm->OnCompactionCompletion(c.get());
3959
- }
3960
-
3961
- NotifyOnCompactionCompleted(c->column_family_data(), c.get(), status,
3962
- compaction_job_stats, job_context->job_id);
3963
- }
3964
-
3965
- if (status.ok() || status.IsCompactionTooLarge() ||
3966
- status.IsManualCompactionPaused()) {
3967
- // Done
3968
- } else if (status.IsColumnFamilyDropped() || status.IsShutdownInProgress()) {
3969
- // Ignore compaction errors found during shutting down
3970
- } else {
3971
- ROCKS_LOG_WARN(immutable_db_options_.info_log, "Compaction error: %s",
3972
- status.ToString().c_str());
3973
- if (!io_s.ok()) {
3974
- // Error while writing to MANIFEST.
3975
- // In fact, versions_->io_status() can also be the result of renaming
3976
- // CURRENT file. With current code, it's just difficult to tell. So just
3977
- // be pessimistic and try write to a new MANIFEST.
3978
- // TODO: distinguish between MANIFEST write and CURRENT renaming
3979
- auto err_reason = versions_->io_status().ok()
3980
- ? BackgroundErrorReason::kCompaction
3981
- : BackgroundErrorReason::kManifestWrite;
3982
- error_handler_.SetBGError(io_s, err_reason);
3983
- } else {
3984
- error_handler_.SetBGError(status, BackgroundErrorReason::kCompaction);
3985
- }
3986
- if (c != nullptr && !is_manual && !error_handler_.IsBGWorkStopped()) {
3987
- // Put this cfd back in the compaction queue so we can retry after some
3988
- // time
3989
- auto cfd = c->column_family_data();
3990
- assert(cfd != nullptr);
3991
- // Since this compaction failed, we need to recompute the score so it
3992
- // takes the original input files into account
3993
- c->column_family_data()
3994
- ->current()
3995
- ->storage_info()
3996
- ->ComputeCompactionScore(*(c->immutable_options()),
3997
- *(c->mutable_cf_options()));
3998
- if (!cfd->queued_for_compaction()) {
3999
- AddToCompactionQueue(cfd);
4000
- ++unscheduled_compactions_;
4001
- }
4002
- }
4003
- }
4004
- // this will unref its input_version and column_family_data
4005
- c.reset();
4006
-
4007
- if (is_manual) {
4008
- ManualCompactionState* m = manual_compaction;
4009
- if (!status.ok()) {
4010
- m->status = status;
4011
- m->done = true;
4012
- }
4013
- // For universal compaction:
4014
- // Because universal compaction always happens at level 0, so one
4015
- // compaction will pick up all overlapped files. No files will be
4016
- // filtered out due to size limit and left for a successive compaction.
4017
- // So we can safely conclude the current compaction.
4018
- //
4019
- // Also note that, if we don't stop here, then the current compaction
4020
- // writes a new file back to level 0, which will be used in successive
4021
- // compaction. Hence the manual compaction will never finish.
4022
- //
4023
- // Stop the compaction if manual_end points to nullptr -- this means
4024
- // that we compacted the whole range. manual_end should always point
4025
- // to nullptr in case of universal compaction
4026
- if (m->manual_end == nullptr) {
4027
- m->done = true;
4028
- }
4029
- if (!m->done) {
4030
- // We only compacted part of the requested range. Update *m
4031
- // to the range that is left to be compacted.
4032
- // Universal and FIFO compactions should always compact the whole range
4033
- assert(m->cfd->ioptions()->compaction_style !=
4034
- kCompactionStyleUniversal ||
4035
- m->cfd->ioptions()->num_levels > 1);
4036
- assert(m->cfd->ioptions()->compaction_style != kCompactionStyleFIFO);
4037
- m->tmp_storage = *m->manual_end;
4038
- m->begin = &m->tmp_storage;
4039
- m->incomplete = true;
4040
- }
4041
- m->in_progress = false; // not being processed anymore
4042
- }
4043
- TEST_SYNC_POINT("DBImpl::BackgroundCompaction:Finish");
4044
- return status;
4045
- }
4046
-
4047
- bool DBImpl::HasPendingManualCompaction() {
4048
- return (!manual_compaction_dequeue_.empty());
4049
- }
4050
-
4051
- void DBImpl::AddManualCompaction(DBImpl::ManualCompactionState* m) {
4052
- assert(manual_compaction_paused_ == 0);
4053
- manual_compaction_dequeue_.push_back(m);
4054
- }
4055
-
4056
- void DBImpl::RemoveManualCompaction(DBImpl::ManualCompactionState* m) {
4057
- // Remove from queue
4058
- std::deque<ManualCompactionState*>::iterator it =
4059
- manual_compaction_dequeue_.begin();
4060
- while (it != manual_compaction_dequeue_.end()) {
4061
- if (m == (*it)) {
4062
- it = manual_compaction_dequeue_.erase(it);
4063
- return;
4064
- }
4065
- ++it;
4066
- }
4067
- assert(false);
4068
- }
4069
-
4070
- bool DBImpl::ShouldntRunManualCompaction(ManualCompactionState* m) {
4071
- if (m->exclusive) {
4072
- return (bg_bottom_compaction_scheduled_ > 0 ||
4073
- bg_compaction_scheduled_ > 0);
4074
- }
4075
- std::deque<ManualCompactionState*>::iterator it =
4076
- manual_compaction_dequeue_.begin();
4077
- bool seen = false;
4078
- while (it != manual_compaction_dequeue_.end()) {
4079
- if (m == (*it)) {
4080
- ++it;
4081
- seen = true;
4082
- continue;
4083
- } else if (MCOverlap(m, (*it)) && (!seen && !(*it)->in_progress)) {
4084
- // Consider the other manual compaction *it, conflicts if:
4085
- // overlaps with m
4086
- // and (*it) is ahead in the queue and is not yet in progress
4087
- return true;
4088
- }
4089
- ++it;
4090
- }
4091
- return false;
4092
- }
4093
-
4094
- bool DBImpl::HaveManualCompaction(ColumnFamilyData* cfd) {
4095
- // Remove from priority queue
4096
- std::deque<ManualCompactionState*>::iterator it =
4097
- manual_compaction_dequeue_.begin();
4098
- while (it != manual_compaction_dequeue_.end()) {
4099
- if ((*it)->exclusive) {
4100
- return true;
4101
- }
4102
- if ((cfd == (*it)->cfd) && (!((*it)->in_progress || (*it)->done))) {
4103
- // Allow automatic compaction if manual compaction is
4104
- // in progress
4105
- return true;
4106
- }
4107
- ++it;
4108
- }
4109
- return false;
4110
- }
4111
-
4112
- bool DBImpl::HasExclusiveManualCompaction() {
4113
- // Remove from priority queue
4114
- std::deque<ManualCompactionState*>::iterator it =
4115
- manual_compaction_dequeue_.begin();
4116
- while (it != manual_compaction_dequeue_.end()) {
4117
- if ((*it)->exclusive) {
4118
- return true;
4119
- }
4120
- ++it;
4121
- }
4122
- return false;
4123
- }
4124
-
4125
- bool DBImpl::MCOverlap(ManualCompactionState* m, ManualCompactionState* m1) {
4126
- if ((m->exclusive) || (m1->exclusive)) {
4127
- return true;
4128
- }
4129
- if (m->cfd != m1->cfd) {
4130
- return false;
4131
- }
4132
- return false;
4133
- }
4134
-
4135
- void DBImpl::UpdateDeletionCompactionStats(
4136
- const std::unique_ptr<Compaction>& c) {
4137
- if (c == nullptr) {
4138
- return;
4139
- }
4140
-
4141
- CompactionReason reason = c->compaction_reason();
4142
-
4143
- switch (reason) {
4144
- case CompactionReason::kFIFOMaxSize:
4145
- RecordTick(stats_, FIFO_MAX_SIZE_COMPACTIONS);
4146
- break;
4147
- case CompactionReason::kFIFOTtl:
4148
- RecordTick(stats_, FIFO_TTL_COMPACTIONS);
4149
- break;
4150
- default:
4151
- assert(false);
4152
- break;
4153
- }
4154
- }
4155
-
4156
- void DBImpl::BuildCompactionJobInfo(
4157
- const ColumnFamilyData* cfd, Compaction* c, const Status& st,
4158
- const CompactionJobStats& compaction_job_stats, const int job_id,
4159
- CompactionJobInfo* compaction_job_info) const {
4160
- assert(compaction_job_info != nullptr);
4161
- compaction_job_info->cf_id = cfd->GetID();
4162
- compaction_job_info->cf_name = cfd->GetName();
4163
- compaction_job_info->status = st;
4164
- compaction_job_info->thread_id = env_->GetThreadID();
4165
- compaction_job_info->job_id = job_id;
4166
- compaction_job_info->base_input_level = c->start_level();
4167
- compaction_job_info->output_level = c->output_level();
4168
- compaction_job_info->stats = compaction_job_stats;
4169
- const auto& input_table_properties = c->GetOrInitInputTableProperties();
4170
- const auto& output_table_properties = c->GetOutputTableProperties();
4171
- compaction_job_info->table_properties.insert(input_table_properties.begin(),
4172
- input_table_properties.end());
4173
- compaction_job_info->table_properties.insert(output_table_properties.begin(),
4174
- output_table_properties.end());
4175
- compaction_job_info->compaction_reason = c->compaction_reason();
4176
- compaction_job_info->compression = c->output_compression();
4177
-
4178
- const ReadOptions read_options(Env::IOActivity::kCompaction);
4179
- for (size_t i = 0; i < c->num_input_levels(); ++i) {
4180
- for (const auto fmd : *c->inputs(i)) {
4181
- const FileDescriptor& desc = fmd->fd;
4182
- const uint64_t file_number = desc.GetNumber();
4183
- auto fn = TableFileName(c->immutable_options()->cf_paths, file_number,
4184
- desc.GetPathId());
4185
- compaction_job_info->input_files.push_back(fn);
4186
- compaction_job_info->input_file_infos.push_back(CompactionFileInfo{
4187
- static_cast<int>(i), file_number, fmd->oldest_blob_file_number});
4188
- }
4189
- }
4190
-
4191
- for (const auto& newf : c->edit()->GetNewFiles()) {
4192
- const FileMetaData& meta = newf.second;
4193
- const FileDescriptor& desc = meta.fd;
4194
- const uint64_t file_number = desc.GetNumber();
4195
- compaction_job_info->output_files.push_back(TableFileName(
4196
- c->immutable_options()->cf_paths, file_number, desc.GetPathId()));
4197
- compaction_job_info->output_file_infos.push_back(CompactionFileInfo{
4198
- newf.first, file_number, meta.oldest_blob_file_number});
4199
- }
4200
- compaction_job_info->blob_compression_type =
4201
- c->mutable_cf_options()->blob_compression_type;
4202
-
4203
- // Update BlobFilesInfo.
4204
- for (const auto& blob_file : c->edit()->GetBlobFileAdditions()) {
4205
- BlobFileAdditionInfo blob_file_addition_info(
4206
- BlobFileName(c->immutable_options()->cf_paths.front().path,
4207
- blob_file.GetBlobFileNumber()) /*blob_file_path*/,
4208
- blob_file.GetBlobFileNumber(), blob_file.GetTotalBlobCount(),
4209
- blob_file.GetTotalBlobBytes());
4210
- compaction_job_info->blob_file_addition_infos.emplace_back(
4211
- std::move(blob_file_addition_info));
4212
- }
4213
-
4214
- // Update BlobFilesGarbageInfo.
4215
- for (const auto& blob_file : c->edit()->GetBlobFileGarbages()) {
4216
- BlobFileGarbageInfo blob_file_garbage_info(
4217
- BlobFileName(c->immutable_options()->cf_paths.front().path,
4218
- blob_file.GetBlobFileNumber()) /*blob_file_path*/,
4219
- blob_file.GetBlobFileNumber(), blob_file.GetGarbageBlobCount(),
4220
- blob_file.GetGarbageBlobBytes());
4221
- compaction_job_info->blob_file_garbage_infos.emplace_back(
4222
- std::move(blob_file_garbage_info));
4223
- }
4224
- }
4225
-
4226
- // SuperVersionContext gets created and destructed outside of the lock --
4227
- // we use this conveniently to:
4228
- // * malloc one SuperVersion() outside of the lock -- new_superversion
4229
- // * delete SuperVersion()s outside of the lock -- superversions_to_free
4230
- //
4231
- // However, if InstallSuperVersionAndScheduleWork() gets called twice with the
4232
- // same sv_context, we can't reuse the SuperVersion() that got
4233
- // malloced because
4234
- // first call already used it. In that rare case, we take a hit and create a
4235
- // new SuperVersion() inside of the mutex. We do similar thing
4236
- // for superversion_to_free
4237
-
4238
- void DBImpl::InstallSuperVersionAndScheduleWork(
4239
- ColumnFamilyData* cfd, SuperVersionContext* sv_context,
4240
- const MutableCFOptions& mutable_cf_options) {
4241
- mutex_.AssertHeld();
4242
-
4243
- // Update max_total_in_memory_state_
4244
- size_t old_memtable_size = 0;
4245
- auto* old_sv = cfd->GetSuperVersion();
4246
- if (old_sv) {
4247
- old_memtable_size = old_sv->mutable_cf_options.write_buffer_size *
4248
- old_sv->mutable_cf_options.max_write_buffer_number;
4249
- }
4250
-
4251
- // this branch is unlikely to step in
4252
- if (UNLIKELY(sv_context->new_superversion == nullptr)) {
4253
- sv_context->NewSuperVersion();
4254
- }
4255
- cfd->InstallSuperVersion(sv_context, mutable_cf_options);
4256
-
4257
- // There may be a small data race here. The snapshot tricking bottommost
4258
- // compaction may already be released here. But assuming there will always be
4259
- // newer snapshot created and released frequently, the compaction will be
4260
- // triggered soon anyway.
4261
- bottommost_files_mark_threshold_ = kMaxSequenceNumber;
4262
- for (auto* my_cfd : *versions_->GetColumnFamilySet()) {
4263
- if (!my_cfd->ioptions()->allow_ingest_behind) {
4264
- bottommost_files_mark_threshold_ = std::min(
4265
- bottommost_files_mark_threshold_,
4266
- my_cfd->current()->storage_info()->bottommost_files_mark_threshold());
4267
- }
4268
- }
4269
-
4270
- // Whenever we install new SuperVersion, we might need to issue new flushes or
4271
- // compactions.
4272
- SchedulePendingCompaction(cfd);
4273
- MaybeScheduleFlushOrCompaction();
4274
-
4275
- // Update max_total_in_memory_state_
4276
- max_total_in_memory_state_ = max_total_in_memory_state_ - old_memtable_size +
4277
- mutable_cf_options.write_buffer_size *
4278
- mutable_cf_options.max_write_buffer_number;
4279
- }
4280
-
4281
- // ShouldPurge is called by FindObsoleteFiles when doing a full scan,
4282
- // and db mutex (mutex_) should already be held.
4283
- // Actually, the current implementation of FindObsoleteFiles with
4284
- // full_scan=true can issue I/O requests to obtain list of files in
4285
- // directories, e.g. env_->getChildren while holding db mutex.
4286
- bool DBImpl::ShouldPurge(uint64_t file_number) const {
4287
- return files_grabbed_for_purge_.find(file_number) ==
4288
- files_grabbed_for_purge_.end() &&
4289
- purge_files_.find(file_number) == purge_files_.end();
4290
- }
4291
-
4292
- // MarkAsGrabbedForPurge is called by FindObsoleteFiles, and db mutex
4293
- // (mutex_) should already be held.
4294
- void DBImpl::MarkAsGrabbedForPurge(uint64_t file_number) {
4295
- files_grabbed_for_purge_.insert(file_number);
4296
- }
4297
-
4298
- void DBImpl::SetSnapshotChecker(SnapshotChecker* snapshot_checker) {
4299
- InstrumentedMutexLock l(&mutex_);
4300
- // snapshot_checker_ should only set once. If we need to set it multiple
4301
- // times, we need to make sure the old one is not deleted while it is still
4302
- // using by a compaction job.
4303
- assert(!snapshot_checker_);
4304
- snapshot_checker_.reset(snapshot_checker);
4305
- }
4306
-
4307
- void DBImpl::GetSnapshotContext(
4308
- JobContext* job_context, std::vector<SequenceNumber>* snapshot_seqs,
4309
- SequenceNumber* earliest_write_conflict_snapshot,
4310
- SnapshotChecker** snapshot_checker_ptr) {
4311
- mutex_.AssertHeld();
4312
- assert(job_context != nullptr);
4313
- assert(snapshot_seqs != nullptr);
4314
- assert(earliest_write_conflict_snapshot != nullptr);
4315
- assert(snapshot_checker_ptr != nullptr);
4316
-
4317
- *snapshot_checker_ptr = snapshot_checker_.get();
4318
- if (use_custom_gc_ && *snapshot_checker_ptr == nullptr) {
4319
- *snapshot_checker_ptr = DisableGCSnapshotChecker::Instance();
4320
- }
4321
- if (*snapshot_checker_ptr != nullptr) {
4322
- // If snapshot_checker is used, that means the flush/compaction may
4323
- // contain values not visible to snapshot taken after
4324
- // flush/compaction job starts. Take a snapshot and it will appear
4325
- // in snapshot_seqs and force compaction iterator to consider such
4326
- // snapshots.
4327
- const Snapshot* job_snapshot =
4328
- GetSnapshotImpl(false /*write_conflict_boundary*/, false /*lock*/);
4329
- job_context->job_snapshot.reset(new ManagedSnapshot(this, job_snapshot));
4330
- }
4331
- *snapshot_seqs = snapshots_.GetAll(earliest_write_conflict_snapshot);
4332
- }
4333
-
4334
- Status DBImpl::WaitForCompact(
4335
- const WaitForCompactOptions& wait_for_compact_options) {
4336
- InstrumentedMutexLock l(&mutex_);
4337
- if (wait_for_compact_options.flush) {
4338
- Status s = DBImpl::FlushAllColumnFamilies(FlushOptions(),
4339
- FlushReason::kManualFlush);
4340
- if (!s.ok()) {
4341
- return s;
4342
- }
4343
- } else if (wait_for_compact_options.close_db &&
4344
- has_unpersisted_data_.load(std::memory_order_relaxed) &&
4345
- !mutable_db_options_.avoid_flush_during_shutdown) {
4346
- Status s =
4347
- DBImpl::FlushAllColumnFamilies(FlushOptions(), FlushReason::kShutDown);
4348
- if (!s.ok()) {
4349
- return s;
4350
- }
4351
- }
4352
- TEST_SYNC_POINT("DBImpl::WaitForCompact:StartWaiting");
4353
- const auto deadline = immutable_db_options_.clock->NowMicros() +
4354
- wait_for_compact_options.timeout.count();
4355
- for (;;) {
4356
- if (shutting_down_.load(std::memory_order_acquire)) {
4357
- return Status::ShutdownInProgress();
4358
- }
4359
- if (bg_work_paused_ && wait_for_compact_options.abort_on_pause) {
4360
- return Status::Aborted();
4361
- }
4362
- if ((bg_bottom_compaction_scheduled_ || bg_compaction_scheduled_ ||
4363
- bg_flush_scheduled_ || unscheduled_compactions_ ||
4364
- (wait_for_compact_options.wait_for_purge && bg_purge_scheduled_) ||
4365
- unscheduled_flushes_ || error_handler_.IsRecoveryInProgress()) &&
4366
- (error_handler_.GetBGError().ok())) {
4367
- if (wait_for_compact_options.timeout.count()) {
4368
- if (bg_cv_.TimedWait(deadline)) {
4369
- return Status::TimedOut();
4370
- }
4371
- } else {
4372
- TEST_SYNC_POINT("DBImpl::WaitForCompact:InsideLoop");
4373
- bg_cv_.Wait();
4374
- }
4375
- } else if (wait_for_compact_options.close_db) {
4376
- reject_new_background_jobs_ = true;
4377
- mutex_.Unlock();
4378
- Status s = Close();
4379
- mutex_.Lock();
4380
- if (!s.ok()) {
4381
- reject_new_background_jobs_ = false;
4382
- }
4383
- return s;
4384
- } else {
4385
- return error_handler_.GetBGError();
4386
- }
4387
- }
4388
- }
4389
-
4390
- } // namespace ROCKSDB_NAMESPACE