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,3357 +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
-
10
-
11
- #include <algorithm>
12
- #include <atomic>
13
- #include <cinttypes>
14
- #include <cstdlib>
15
- #include <exception>
16
- #include <functional>
17
- #include <future>
18
- #include <limits>
19
- #include <map>
20
- #include <mutex>
21
- #include <optional>
22
- #include <sstream>
23
- #include <string>
24
- #include <thread>
25
- #include <unordered_map>
26
- #include <unordered_set>
27
- #include <vector>
28
-
29
- #include "env/composite_env_wrapper.h"
30
- #include "env/fs_readonly.h"
31
- #include "env/fs_remap.h"
32
- #include "file/filename.h"
33
- #include "file/line_file_reader.h"
34
- #include "file/sequence_file_reader.h"
35
- #include "file/writable_file_writer.h"
36
- #include "logging/logging.h"
37
- #include "monitoring/iostats_context_imp.h"
38
- #include "options/options_helper.h"
39
- #include "port/port.h"
40
- #include "rocksdb/advanced_options.h"
41
- #include "rocksdb/env.h"
42
- #include "rocksdb/rate_limiter.h"
43
- #include "rocksdb/statistics.h"
44
- #include "rocksdb/transaction_log.h"
45
- #include "table/sst_file_dumper.h"
46
- #include "test_util/sync_point.h"
47
- #include "util/cast_util.h"
48
- #include "util/channel.h"
49
- #include "util/coding.h"
50
- #include "util/crc32c.h"
51
- #include "util/math.h"
52
- #include "util/rate_limiter_impl.h"
53
- #include "util/string_util.h"
54
- #include "utilities/backup/backup_engine_impl.h"
55
- #include "utilities/checkpoint/checkpoint_impl.h"
56
-
57
- namespace ROCKSDB_NAMESPACE {
58
-
59
- namespace {
60
- using ShareFilesNaming = BackupEngineOptions::ShareFilesNaming;
61
-
62
- constexpr BackupID kLatestBackupIDMarker = static_cast<BackupID>(-2);
63
-
64
- inline uint32_t ChecksumHexToInt32(const std::string& checksum_hex) {
65
- std::string checksum_str;
66
- Slice(checksum_hex).DecodeHex(&checksum_str);
67
- return EndianSwapValue(DecodeFixed32(checksum_str.c_str()));
68
- }
69
- inline std::string ChecksumStrToHex(const std::string& checksum_str) {
70
- return Slice(checksum_str).ToString(true);
71
- }
72
- inline std::string ChecksumInt32ToHex(const uint32_t& checksum_value) {
73
- std::string checksum_str;
74
- PutFixed32(&checksum_str, EndianSwapValue(checksum_value));
75
- return ChecksumStrToHex(checksum_str);
76
- }
77
-
78
- const std::string kPrivateDirName = "private";
79
- const std::string kMetaDirName = "meta";
80
- const std::string kSharedDirName = "shared";
81
- const std::string kSharedChecksumDirName = "shared_checksum";
82
- const std::string kPrivateDirSlash = kPrivateDirName + "/";
83
- const std::string kMetaDirSlash = kMetaDirName + "/";
84
- const std::string kSharedDirSlash = kSharedDirName + "/";
85
- const std::string kSharedChecksumDirSlash = kSharedChecksumDirName + "/";
86
-
87
- } // namespace
88
-
89
- void BackupStatistics::IncrementNumberSuccessBackup() {
90
- number_success_backup++;
91
- }
92
- void BackupStatistics::IncrementNumberFailBackup() { number_fail_backup++; }
93
-
94
- uint32_t BackupStatistics::GetNumberSuccessBackup() const {
95
- return number_success_backup;
96
- }
97
- uint32_t BackupStatistics::GetNumberFailBackup() const {
98
- return number_fail_backup;
99
- }
100
-
101
- std::string BackupStatistics::ToString() const {
102
- char result[50];
103
- snprintf(result, sizeof(result), "# success backup: %u, # fail backup: %u",
104
- GetNumberSuccessBackup(), GetNumberFailBackup());
105
- return result;
106
- }
107
-
108
- void BackupEngineOptions::Dump(Logger* logger) const {
109
- ROCKS_LOG_INFO(logger, " Options.backup_dir: %s",
110
- backup_dir.c_str());
111
- ROCKS_LOG_INFO(logger, " Options.backup_env: %p", backup_env);
112
- ROCKS_LOG_INFO(logger, " Options.share_table_files: %d",
113
- static_cast<int>(share_table_files));
114
- ROCKS_LOG_INFO(logger, " Options.info_log: %p", info_log);
115
- ROCKS_LOG_INFO(logger, " Options.sync: %d",
116
- static_cast<int>(sync));
117
- ROCKS_LOG_INFO(logger, " Options.destroy_old_data: %d",
118
- static_cast<int>(destroy_old_data));
119
- ROCKS_LOG_INFO(logger, " Options.backup_log_files: %d",
120
- static_cast<int>(backup_log_files));
121
- ROCKS_LOG_INFO(logger, " Options.backup_rate_limit: %" PRIu64,
122
- backup_rate_limit);
123
- ROCKS_LOG_INFO(logger, " Options.restore_rate_limit: %" PRIu64,
124
- restore_rate_limit);
125
- ROCKS_LOG_INFO(logger, "Options.max_background_operations: %d",
126
- max_background_operations);
127
- }
128
-
129
- namespace {
130
- // -------- BackupEngineImpl class ---------
131
- class BackupEngineImpl {
132
- public:
133
- BackupEngineImpl(const BackupEngineOptions& options, Env* db_env,
134
- bool read_only = false);
135
- ~BackupEngineImpl();
136
-
137
- IOStatus CreateNewBackupWithMetadata(const CreateBackupOptions& options,
138
- DB* db, const std::string& app_metadata,
139
- BackupID* new_backup_id_ptr);
140
-
141
- IOStatus PurgeOldBackups(uint32_t num_backups_to_keep);
142
-
143
- IOStatus DeleteBackup(BackupID backup_id);
144
-
145
- void StopBackup() { stop_backup_.store(true, std::memory_order_release); }
146
-
147
- IOStatus GarbageCollect();
148
-
149
- // The returned BackupInfos are in chronological order, which means the
150
- // latest backup comes last.
151
- void GetBackupInfo(std::vector<BackupInfo>* backup_info,
152
- bool include_file_details) const;
153
-
154
- Status GetBackupInfo(BackupID backup_id, BackupInfo* backup_info,
155
- bool include_file_details = false) const;
156
-
157
- void GetCorruptedBackups(std::vector<BackupID>* corrupt_backup_ids) const;
158
-
159
- IOStatus RestoreDBFromBackup(
160
- const RestoreOptions& options, BackupID backup_id,
161
- const std::string& db_dir, const std::string& wal_dir,
162
- const std::list<const BackupEngineImpl*>& locked_restore_from_dirs) const;
163
-
164
- IOStatus VerifyBackup(BackupID backup_id,
165
- bool verify_with_checksum = false) const;
166
-
167
- IOStatus Initialize();
168
-
169
- ShareFilesNaming GetNamingNoFlags() const {
170
- return options_.share_files_with_checksum_naming &
171
- BackupEngineOptions::kMaskNoNamingFlags;
172
- }
173
- ShareFilesNaming GetNamingFlags() const {
174
- return options_.share_files_with_checksum_naming &
175
- BackupEngineOptions::kMaskNamingFlags;
176
- }
177
-
178
- void TEST_SetDefaultRateLimitersClock(
179
- const std::shared_ptr<SystemClock>& backup_rate_limiter_clock,
180
- const std::shared_ptr<SystemClock>& restore_rate_limiter_clock) {
181
- if (backup_rate_limiter_clock) {
182
- static_cast<GenericRateLimiter*>(options_.backup_rate_limiter.get())
183
- ->TEST_SetClock(backup_rate_limiter_clock);
184
- }
185
-
186
- if (restore_rate_limiter_clock) {
187
- static_cast<GenericRateLimiter*>(options_.restore_rate_limiter.get())
188
- ->TEST_SetClock(restore_rate_limiter_clock);
189
- }
190
- }
191
-
192
- private:
193
- void DeleteChildren(const std::string& dir,
194
- uint32_t file_type_filter = 0) const;
195
- IOStatus DeleteBackupNoGC(BackupID backup_id);
196
-
197
- // Extends the "result" map with pathname->size mappings for the contents of
198
- // "dir" in "env". Pathnames are prefixed with "dir".
199
- IOStatus ReadChildFileCurrentSizes(
200
- const std::string& dir, const std::shared_ptr<FileSystem>&,
201
- std::unordered_map<std::string, uint64_t>* result) const;
202
-
203
- struct FileInfo {
204
- FileInfo(const std::string& fname, uint64_t sz, const std::string& checksum,
205
- const std::string& id, const std::string& sid, Temperature _temp)
206
- : refs(0),
207
- filename(fname),
208
- size(sz),
209
- checksum_hex(checksum),
210
- db_id(id),
211
- db_session_id(sid),
212
- temp(_temp) {}
213
-
214
- FileInfo(const FileInfo&) = delete;
215
- FileInfo& operator=(const FileInfo&) = delete;
216
-
217
- int refs;
218
- // Relative path from backup dir
219
- const std::string filename;
220
- const uint64_t size;
221
- // crc32c checksum as hex. empty == unknown / unavailable
222
- std::string checksum_hex;
223
- // DB identities
224
- // db_id is obtained for potential usage in the future but not used
225
- // currently
226
- const std::string db_id;
227
- // db_session_id appears in the backup SST filename if the table naming
228
- // option is kUseDbSessionId
229
- const std::string db_session_id;
230
- Temperature temp;
231
-
232
- std::string GetDbFileName() const {
233
- std::string rv;
234
- // extract the filename part
235
- size_t slash = filename.find_last_of('/');
236
- // file will either be shared/<file>, shared_checksum/<file_crc32c_size>,
237
- // shared_checksum/<file_session>, shared_checksum/<file_crc32c_session>,
238
- // or private/<number>/<file>
239
- assert(slash != std::string::npos);
240
- rv = filename.substr(slash + 1);
241
-
242
- // if the file was in shared_checksum, extract the real file name
243
- // in this case the file is <number>_<checksum>_<size>.<type>,
244
- // <number>_<session>.<type>, or <number>_<checksum>_<session>.<type>
245
- if (filename.substr(0, slash) == kSharedChecksumDirName) {
246
- rv = GetFileFromChecksumFile(rv);
247
- }
248
- return rv;
249
- }
250
- };
251
-
252
- // TODO: deprecate this function once we migrate all BackupEngine's rate
253
- // limiting to lower-level ones (i.e, ones in file access wrapper level like
254
- // `WritableFileWriter`)
255
- static void LoopRateLimitRequestHelper(const size_t total_bytes_to_request,
256
- RateLimiter* rate_limiter,
257
- const Env::IOPriority pri,
258
- Statistics* stats,
259
- const RateLimiter::OpType op_type);
260
-
261
- static inline std::string WithoutTrailingSlash(const std::string& path) {
262
- if (path.empty() || path.back() != '/') {
263
- return path;
264
- } else {
265
- return path.substr(path.size() - 1);
266
- }
267
- }
268
-
269
- static inline std::string WithTrailingSlash(const std::string& path) {
270
- if (path.empty() || path.back() != '/') {
271
- return path + '/';
272
- } else {
273
- return path;
274
- }
275
- }
276
-
277
- // A filesystem wrapper that makes shared backup files appear to be in the
278
- // private backup directory (dst_dir), so that the private backup dir can
279
- // be opened as a read-only DB.
280
- class RemapSharedFileSystem : public RemapFileSystem {
281
- public:
282
- RemapSharedFileSystem(const std::shared_ptr<FileSystem>& base,
283
- const std::string& dst_dir,
284
- const std::string& src_base_dir,
285
- const std::vector<std::shared_ptr<FileInfo>>& files)
286
- : RemapFileSystem(base),
287
- dst_dir_(WithoutTrailingSlash(dst_dir)),
288
- dst_dir_slash_(WithTrailingSlash(dst_dir)),
289
- src_base_dir_(WithTrailingSlash(src_base_dir)) {
290
- for (auto& info : files) {
291
- if (!StartsWith(info->filename, kPrivateDirSlash)) {
292
- assert(StartsWith(info->filename, kSharedDirSlash) ||
293
- StartsWith(info->filename, kSharedChecksumDirSlash));
294
- remaps_[info->GetDbFileName()] = info;
295
- }
296
- }
297
- }
298
-
299
- const char* Name() const override {
300
- return "BackupEngineImpl::RemapSharedFileSystem";
301
- }
302
-
303
- // Sometimes a directory listing is required in opening a DB
304
- IOStatus GetChildren(const std::string& dir, const IOOptions& options,
305
- std::vector<std::string>* result,
306
- IODebugContext* dbg) override {
307
- IOStatus s = RemapFileSystem::GetChildren(dir, options, result, dbg);
308
- if (s.ok() && (dir == dst_dir_ || dir == dst_dir_slash_)) {
309
- // Assume remapped files exist
310
- for (auto& r : remaps_) {
311
- result->push_back(r.first);
312
- }
313
- }
314
- return s;
315
- }
316
-
317
- // Sometimes a directory listing is required in opening a DB
318
- IOStatus GetChildrenFileAttributes(const std::string& dir,
319
- const IOOptions& options,
320
- std::vector<FileAttributes>* result,
321
- IODebugContext* dbg) override {
322
- IOStatus s =
323
- RemapFileSystem::GetChildrenFileAttributes(dir, options, result, dbg);
324
- if (s.ok() && (dir == dst_dir_ || dir == dst_dir_slash_)) {
325
- // Assume remapped files exist with recorded size
326
- for (auto& r : remaps_) {
327
- result->emplace_back(); // clean up with C++20
328
- FileAttributes& attr = result->back();
329
- attr.name = r.first;
330
- attr.size_bytes = r.second->size;
331
- }
332
- }
333
- return s;
334
- }
335
-
336
- protected:
337
- // When a file in dst_dir is requested, see if we need to remap to shared
338
- // file path.
339
- std::pair<IOStatus, std::string> EncodePath(
340
- const std::string& path) override {
341
- if (path.empty() || path[0] != '/') {
342
- return {IOStatus::InvalidArgument(path, "Not an absolute path"), ""};
343
- }
344
- std::pair<IOStatus, std::string> rv{IOStatus(), path};
345
- if (StartsWith(path, dst_dir_slash_)) {
346
- std::string relative = path.substr(dst_dir_slash_.size());
347
- auto it = remaps_.find(relative);
348
- if (it != remaps_.end()) {
349
- rv.second = src_base_dir_ + it->second->filename;
350
- }
351
- }
352
- return rv;
353
- }
354
-
355
- private:
356
- // Absolute path to a directory that some extra files will be mapped into.
357
- const std::string dst_dir_;
358
- // Includes a trailing slash.
359
- const std::string dst_dir_slash_;
360
- // Absolute path to a directory containing some files to be mapped into
361
- // dst_dir_. Includes a trailing slash.
362
- const std::string src_base_dir_;
363
- // If remaps_[x] exists, attempt to read dst_dir_ / x should instead read
364
- // src_base_dir_ / remaps_[x]->filename. FileInfo is used to maximize
365
- // sharing with other backup data in memory.
366
- std::unordered_map<std::string, std::shared_ptr<FileInfo>> remaps_;
367
- };
368
-
369
- class BackupMeta {
370
- public:
371
- BackupMeta(
372
- const std::string& meta_filename, const std::string& meta_tmp_filename,
373
- std::unordered_map<std::string, std::shared_ptr<FileInfo>>* file_infos,
374
- Env* env, const std::shared_ptr<FileSystem>& fs)
375
- : timestamp_(0),
376
- sequence_number_(0),
377
- size_(0),
378
- meta_filename_(meta_filename),
379
- meta_tmp_filename_(meta_tmp_filename),
380
- file_infos_(file_infos),
381
- env_(env),
382
- fs_(fs) {}
383
-
384
- BackupMeta(const BackupMeta&) = delete;
385
- BackupMeta& operator=(const BackupMeta&) = delete;
386
-
387
- ~BackupMeta() = default;
388
-
389
- void RecordTimestamp() {
390
- // Best effort
391
- Status s = env_->GetCurrentTime(&timestamp_);
392
- if (!s.ok()) {
393
- timestamp_ = /* something clearly fabricated */ 1;
394
- }
395
- }
396
- int64_t GetTimestamp() const { return timestamp_; }
397
- uint64_t GetSize() const { return size_; }
398
- uint32_t GetNumberFiles() const {
399
- return static_cast<uint32_t>(files_.size());
400
- }
401
- void SetSequenceNumber(uint64_t sequence_number) {
402
- sequence_number_ = sequence_number;
403
- }
404
- uint64_t GetSequenceNumber() const { return sequence_number_; }
405
-
406
- const std::string& GetAppMetadata() const { return app_metadata_; }
407
-
408
- void SetAppMetadata(const std::string& app_metadata) {
409
- app_metadata_ = app_metadata;
410
- }
411
-
412
- IOStatus AddFile(std::shared_ptr<FileInfo> file_info);
413
-
414
- void AddExcludedFile(const std::string& relative_file) {
415
- excluded_files_.emplace_back(relative_file);
416
- }
417
-
418
- IOStatus Delete(bool delete_meta = true);
419
-
420
- bool Empty() const { return files_.empty(); }
421
-
422
- std::shared_ptr<FileInfo> GetFile(const std::string& filename) const {
423
- auto it = file_infos_->find(filename);
424
- if (it == file_infos_->end()) {
425
- return nullptr;
426
- }
427
- return it->second;
428
- }
429
-
430
- const std::vector<std::shared_ptr<FileInfo>>& GetFiles() const {
431
- return files_;
432
- }
433
-
434
- const std::vector<BackupExcludedFileInfo>& GetExcludedFiles() const {
435
- return excluded_files_;
436
- }
437
-
438
- // @param abs_path_to_size Pre-fetched file sizes (bytes).
439
- IOStatus LoadFromFile(
440
- const std::string& backup_dir,
441
- const std::unordered_map<std::string, uint64_t>& abs_path_to_size,
442
- RateLimiter* rate_limiter, Logger* info_log,
443
- std::unordered_set<std::string>* reported_ignored_fields);
444
- IOStatus StoreToFile(
445
- bool sync, int schema_version,
446
- const TEST_BackupMetaSchemaOptions* schema_test_options);
447
-
448
- std::string GetInfoString() {
449
- std::ostringstream ss;
450
- ss << "Timestamp: " << timestamp_ << std::endl;
451
- char human_size[16];
452
- AppendHumanBytes(size_, human_size, sizeof(human_size));
453
- ss << "Size: " << human_size << std::endl;
454
- ss << "Files:" << std::endl;
455
- for (const auto& file : files_) {
456
- AppendHumanBytes(file->size, human_size, sizeof(human_size));
457
- ss << file->filename << ", size " << human_size << ", refs "
458
- << file->refs << std::endl;
459
- }
460
- return ss.str();
461
- }
462
-
463
- const std::shared_ptr<Env>& GetEnvForOpen() const {
464
- if (!env_for_open_) {
465
- // Lazy initialize
466
- // Find directories
467
- std::string dst_dir = meta_filename_;
468
- auto i = dst_dir.rfind(kMetaDirSlash);
469
- assert(i != std::string::npos);
470
- std::string src_base_dir = dst_dir.substr(0, i);
471
- dst_dir.replace(i, kMetaDirSlash.size(), kPrivateDirSlash);
472
- // Make the RemapSharedFileSystem
473
- std::shared_ptr<FileSystem> remap_fs =
474
- std::make_shared<RemapSharedFileSystem>(fs_, dst_dir, src_base_dir,
475
- files_);
476
- // Make it read-only for safety
477
- remap_fs = std::make_shared<ReadOnlyFileSystem>(remap_fs);
478
- // Make an Env wrapper
479
- env_for_open_ = std::make_shared<CompositeEnvWrapper>(env_, remap_fs);
480
- }
481
- return env_for_open_;
482
- }
483
-
484
- private:
485
- int64_t timestamp_;
486
- // sequence number is only approximate, should not be used
487
- // by clients
488
- uint64_t sequence_number_;
489
- uint64_t size_;
490
- std::string app_metadata_;
491
- std::string const meta_filename_;
492
- std::string const meta_tmp_filename_;
493
- // files with relative paths (without "/" prefix!!)
494
- std::vector<std::shared_ptr<FileInfo>> files_;
495
- std::vector<BackupExcludedFileInfo> excluded_files_;
496
- std::unordered_map<std::string, std::shared_ptr<FileInfo>>* file_infos_;
497
- Env* env_;
498
- mutable std::shared_ptr<Env> env_for_open_;
499
- std::shared_ptr<FileSystem> fs_;
500
- IOOptions iooptions_ = IOOptions();
501
- }; // BackupMeta
502
-
503
- void SetBackupInfoFromBackupMeta(BackupID id, const BackupMeta& meta,
504
- BackupInfo* backup_info,
505
- bool include_file_details) const;
506
-
507
- inline std::string GetAbsolutePath(
508
- const std::string& relative_path = "") const {
509
- assert(relative_path.size() == 0 || relative_path[0] != '/');
510
- return options_.backup_dir + "/" + relative_path;
511
- }
512
- inline std::string GetPrivateFileRel(BackupID backup_id, bool tmp = false,
513
- const std::string& file = "") const {
514
- assert(file.size() == 0 || file[0] != '/');
515
- return kPrivateDirSlash + std::to_string(backup_id) + (tmp ? ".tmp" : "") +
516
- "/" + file;
517
- }
518
- inline std::string GetSharedFileRel(const std::string& file = "",
519
- bool tmp = false) const {
520
- assert(file.size() == 0 || file[0] != '/');
521
- return kSharedDirSlash + std::string(tmp ? "." : "") + file +
522
- (tmp ? ".tmp" : "");
523
- }
524
- inline std::string GetSharedFileWithChecksumRel(const std::string& file = "",
525
- bool tmp = false) const {
526
- assert(file.size() == 0 || file[0] != '/');
527
- return kSharedChecksumDirSlash + std::string(tmp ? "." : "") + file +
528
- (tmp ? ".tmp" : "");
529
- }
530
- inline bool UseLegacyNaming(const std::string& sid) const {
531
- return GetNamingNoFlags() ==
532
- BackupEngineOptions::kLegacyCrc32cAndFileSize ||
533
- sid.empty();
534
- }
535
- inline std::string GetSharedFileWithChecksum(
536
- const std::string& file, const std::string& checksum_hex,
537
- const uint64_t file_size, const std::string& db_session_id) const {
538
- assert(file.size() == 0 || file[0] != '/');
539
- std::string file_copy = file;
540
- if (UseLegacyNaming(db_session_id)) {
541
- assert(!checksum_hex.empty());
542
- file_copy.insert(file_copy.find_last_of('.'),
543
- "_" + std::to_string(ChecksumHexToInt32(checksum_hex)) +
544
- "_" + std::to_string(file_size));
545
- } else {
546
- file_copy.insert(file_copy.find_last_of('.'), "_s" + db_session_id);
547
- if (GetNamingFlags() & BackupEngineOptions::kFlagIncludeFileSize) {
548
- file_copy.insert(file_copy.find_last_of('.'),
549
- "_" + std::to_string(file_size));
550
- }
551
- }
552
- return file_copy;
553
- }
554
- static inline std::string GetFileFromChecksumFile(const std::string& file) {
555
- assert(file.size() == 0 || file[0] != '/');
556
- std::string file_copy = file;
557
- size_t first_underscore = file_copy.find_first_of('_');
558
- return file_copy.erase(first_underscore,
559
- file_copy.find_last_of('.') - first_underscore);
560
- }
561
- inline std::string GetBackupMetaFile(BackupID backup_id, bool tmp) const {
562
- return GetAbsolutePath(kMetaDirName) + "/" + (tmp ? "." : "") +
563
- std::to_string(backup_id) + (tmp ? ".tmp" : "");
564
- }
565
-
566
- // If size_limit == 0, there is no size limit, copy everything.
567
- //
568
- // Exactly one of src and contents must be non-empty.
569
- //
570
- // @param src If non-empty, the file is copied from this pathname.
571
- // @param contents If non-empty, the file will be created with these contents.
572
- // @param src_temperature Pass in expected temperature of src, return back
573
- // temperature reported by FileSystem
574
- IOStatus CopyOrCreateFile(const std::string& src, const std::string& dst,
575
- const std::string& contents, uint64_t size_limit,
576
- Env* src_env, Env* dst_env,
577
- const EnvOptions& src_env_options, bool sync,
578
- RateLimiter* rate_limiter,
579
- std::function<void()> progress_callback,
580
- Temperature* src_temperature,
581
- Temperature dst_temperature,
582
- uint64_t* bytes_toward_next_callback,
583
- uint64_t* size, std::string* checksum_hex);
584
-
585
- IOStatus ReadFileAndComputeChecksum(const std::string& src,
586
- const std::shared_ptr<FileSystem>& src_fs,
587
- const EnvOptions& src_env_options,
588
- uint64_t size_limit,
589
- std::string* checksum_hex,
590
- const Temperature src_temperature) const;
591
-
592
- // Obtain db_id and db_session_id from the table properties of file_path
593
- Status GetFileDbIdentities(Env* src_env, const EnvOptions& src_env_options,
594
- const std::string& file_path,
595
- Temperature file_temp, RateLimiter* rate_limiter,
596
- std::string* db_id, std::string* db_session_id);
597
-
598
- struct CopyOrCreateResult {
599
- ~CopyOrCreateResult() {
600
- // The Status needs to be ignored here for two reasons.
601
- // First, if the BackupEngineImpl shuts down with jobs outstanding, then
602
- // it is possible that the Status in the future/promise is never read,
603
- // resulting in an unchecked Status. Second, if there are items in the
604
- // channel when the BackupEngineImpl is shutdown, these will also have
605
- // Status that have not been checked. This
606
- // TODO: Fix those issues so that the Status
607
- io_status.PermitUncheckedError();
608
- }
609
- uint64_t size;
610
- std::string checksum_hex;
611
- std::string db_id;
612
- std::string db_session_id;
613
- IOStatus io_status;
614
- Temperature expected_src_temperature = Temperature::kUnknown;
615
- Temperature current_src_temperature = Temperature::kUnknown;
616
- };
617
-
618
- // Exactly one of src_path and contents must be non-empty. If src_path is
619
- // non-empty, the file is copied from this pathname. Otherwise, if contents is
620
- // non-empty, the file will be created at dst_path with these contents.
621
- struct CopyOrCreateWorkItem {
622
- std::string src_path;
623
- std::string dst_path;
624
- Temperature src_temperature;
625
- Temperature dst_temperature;
626
- std::string contents;
627
- Env* src_env;
628
- Env* dst_env;
629
- EnvOptions src_env_options;
630
- bool sync;
631
- RateLimiter* rate_limiter;
632
- uint64_t size_limit;
633
- Statistics* stats;
634
- std::promise<CopyOrCreateResult> result;
635
- std::function<void()> progress_callback;
636
- std::string src_checksum_func_name;
637
- std::string src_checksum_hex;
638
- std::string db_id;
639
- std::string db_session_id;
640
-
641
- CopyOrCreateWorkItem()
642
- : src_temperature(Temperature::kUnknown),
643
- dst_temperature(Temperature::kUnknown),
644
-
645
- src_env(nullptr),
646
- dst_env(nullptr),
647
- src_env_options(),
648
- sync(false),
649
- rate_limiter(nullptr),
650
- size_limit(0),
651
- stats(nullptr),
652
- src_checksum_func_name(kUnknownFileChecksumFuncName) {}
653
-
654
- CopyOrCreateWorkItem(const CopyOrCreateWorkItem&) = delete;
655
- CopyOrCreateWorkItem& operator=(const CopyOrCreateWorkItem&) = delete;
656
-
657
- CopyOrCreateWorkItem(CopyOrCreateWorkItem&& o) noexcept {
658
- *this = std::move(o);
659
- }
660
-
661
- CopyOrCreateWorkItem& operator=(CopyOrCreateWorkItem&& o) noexcept {
662
- src_path = std::move(o.src_path);
663
- dst_path = std::move(o.dst_path);
664
- src_temperature = std::move(o.src_temperature);
665
- dst_temperature = std::move(o.dst_temperature);
666
- contents = std::move(o.contents);
667
- src_env = o.src_env;
668
- dst_env = o.dst_env;
669
- src_env_options = std::move(o.src_env_options);
670
- sync = o.sync;
671
- rate_limiter = o.rate_limiter;
672
- size_limit = o.size_limit;
673
- stats = o.stats;
674
- result = std::move(o.result);
675
- progress_callback = std::move(o.progress_callback);
676
- src_checksum_func_name = std::move(o.src_checksum_func_name);
677
- src_checksum_hex = std::move(o.src_checksum_hex);
678
- db_id = std::move(o.db_id);
679
- db_session_id = std::move(o.db_session_id);
680
- src_temperature = o.src_temperature;
681
- return *this;
682
- }
683
-
684
- CopyOrCreateWorkItem(std::string _src_path, std::string _dst_path,
685
- const Temperature _src_temperature,
686
- const Temperature _dst_temperature,
687
- std::string _contents, Env* _src_env, Env* _dst_env,
688
- EnvOptions _src_env_options, bool _sync,
689
- RateLimiter* _rate_limiter, uint64_t _size_limit,
690
- Statistics* _stats,
691
- std::function<void()> _progress_callback = {},
692
- const std::string& _src_checksum_func_name =
693
- kUnknownFileChecksumFuncName,
694
- const std::string& _src_checksum_hex = "",
695
- const std::string& _db_id = "",
696
- const std::string& _db_session_id = "")
697
- : src_path(std::move(_src_path)),
698
- dst_path(std::move(_dst_path)),
699
- src_temperature(_src_temperature),
700
- dst_temperature(_dst_temperature),
701
- contents(std::move(_contents)),
702
- src_env(_src_env),
703
- dst_env(_dst_env),
704
- src_env_options(std::move(_src_env_options)),
705
- sync(_sync),
706
- rate_limiter(_rate_limiter),
707
- size_limit(_size_limit),
708
- stats(_stats),
709
- progress_callback(_progress_callback),
710
- src_checksum_func_name(_src_checksum_func_name),
711
- src_checksum_hex(_src_checksum_hex),
712
- db_id(_db_id),
713
- db_session_id(_db_session_id) {}
714
- };
715
-
716
- struct BackupAfterCopyOrCreateWorkItem {
717
- std::future<CopyOrCreateResult> result;
718
- bool shared;
719
- bool needed_to_copy;
720
- Env* backup_env;
721
- std::string dst_path_tmp;
722
- std::string dst_path;
723
- std::string dst_relative;
724
- BackupAfterCopyOrCreateWorkItem()
725
- : shared(false), needed_to_copy(false), backup_env(nullptr) {}
726
-
727
- BackupAfterCopyOrCreateWorkItem(
728
- BackupAfterCopyOrCreateWorkItem&& o) noexcept {
729
- *this = std::move(o);
730
- }
731
-
732
- BackupAfterCopyOrCreateWorkItem& operator=(
733
- BackupAfterCopyOrCreateWorkItem&& o) noexcept {
734
- result = std::move(o.result);
735
- shared = o.shared;
736
- needed_to_copy = o.needed_to_copy;
737
- backup_env = o.backup_env;
738
- dst_path_tmp = std::move(o.dst_path_tmp);
739
- dst_path = std::move(o.dst_path);
740
- dst_relative = std::move(o.dst_relative);
741
- return *this;
742
- }
743
-
744
- BackupAfterCopyOrCreateWorkItem(std::future<CopyOrCreateResult>&& _result,
745
- bool _shared, bool _needed_to_copy,
746
- Env* _backup_env, std::string _dst_path_tmp,
747
- std::string _dst_path,
748
- std::string _dst_relative)
749
- : result(std::move(_result)),
750
- shared(_shared),
751
- needed_to_copy(_needed_to_copy),
752
- backup_env(_backup_env),
753
- dst_path_tmp(std::move(_dst_path_tmp)),
754
- dst_path(std::move(_dst_path)),
755
- dst_relative(std::move(_dst_relative)) {}
756
- };
757
-
758
- using BackupWorkItemPair =
759
- std::pair<CopyOrCreateWorkItem, BackupAfterCopyOrCreateWorkItem>;
760
-
761
- struct RestoreAfterCopyOrCreateWorkItem {
762
- std::future<CopyOrCreateResult> result;
763
- std::string from_file;
764
- std::string to_file;
765
- std::string checksum_hex;
766
- RestoreAfterCopyOrCreateWorkItem() {}
767
- RestoreAfterCopyOrCreateWorkItem(std::future<CopyOrCreateResult>&& _result,
768
- const std::string& _from_file,
769
- const std::string& _to_file,
770
- const std::string& _checksum_hex)
771
- : result(std::move(_result)),
772
- from_file(_from_file),
773
- to_file(_to_file),
774
- checksum_hex(_checksum_hex) {}
775
- RestoreAfterCopyOrCreateWorkItem(
776
- RestoreAfterCopyOrCreateWorkItem&& o) noexcept {
777
- *this = std::move(o);
778
- }
779
-
780
- RestoreAfterCopyOrCreateWorkItem& operator=(
781
- RestoreAfterCopyOrCreateWorkItem&& o) noexcept {
782
- result = std::move(o.result);
783
- checksum_hex = std::move(o.checksum_hex);
784
- return *this;
785
- }
786
- };
787
-
788
- bool initialized_;
789
- std::mutex byte_report_mutex_;
790
- mutable channel<CopyOrCreateWorkItem> files_to_copy_or_create_;
791
- std::vector<port::Thread> threads_;
792
- std::atomic<CpuPriority> threads_cpu_priority_;
793
-
794
- // Certain operations like PurgeOldBackups and DeleteBackup will trigger
795
- // automatic GarbageCollect (true) unless we've already done one in this
796
- // session and have not failed to delete backup files since then (false).
797
- bool might_need_garbage_collect_ = true;
798
-
799
- // Adds a file to the backup work queue to be copied or created if it doesn't
800
- // already exist.
801
- //
802
- // Exactly one of src_dir and contents must be non-empty.
803
- //
804
- // @param src_dir If non-empty, the file in this directory named fname will be
805
- // copied.
806
- // @param fname Name of destination file and, in case of copy, source file.
807
- // @param contents If non-empty, the file will be created with these contents.
808
- IOStatus AddBackupFileWorkItem(
809
- std::unordered_set<std::string>& live_dst_paths,
810
- std::deque<BackupAfterCopyOrCreateWorkItem>& backup_items_to_finish,
811
- std::deque<BackupWorkItemPair>* excludable_items, BackupID backup_id,
812
- bool shared, const std::string& src_dir,
813
- const std::string& fname, // starts with "/"
814
- const EnvOptions& src_env_options, RateLimiter* rate_limiter,
815
- FileType file_type, uint64_t size_bytes, Statistics* stats,
816
- uint64_t size_limit = 0, bool shared_checksum = false,
817
- std::function<void()> progress_callback = {},
818
- const std::string& contents = std::string(),
819
- const std::string& src_checksum_func_name = kUnknownFileChecksumFuncName,
820
- const std::string& src_checksum_str = kUnknownFileChecksum,
821
- const Temperature src_temperature = Temperature::kUnknown);
822
-
823
- // backup state data
824
- BackupID latest_backup_id_;
825
- BackupID latest_valid_backup_id_;
826
- std::map<BackupID, std::unique_ptr<BackupMeta>> backups_;
827
- std::map<BackupID, std::pair<IOStatus, std::unique_ptr<BackupMeta>>>
828
- corrupt_backups_;
829
- std::unordered_map<std::string, std::shared_ptr<FileInfo>>
830
- backuped_file_infos_;
831
- std::atomic<bool> stop_backup_;
832
-
833
- // options data
834
- BackupEngineOptions options_;
835
- Env* db_env_;
836
- Env* backup_env_;
837
-
838
- // directories
839
- std::unique_ptr<FSDirectory> backup_directory_;
840
- std::unique_ptr<FSDirectory> shared_directory_;
841
- std::unique_ptr<FSDirectory> meta_directory_;
842
- std::unique_ptr<FSDirectory> private_directory_;
843
-
844
- static const size_t kDefaultCopyFileBufferSize = 5 * 1024 * 1024LL; // 5MB
845
- bool read_only_;
846
- BackupStatistics backup_statistics_;
847
- std::unordered_set<std::string> reported_ignored_fields_;
848
- static const size_t kMaxAppMetaSize = 1024 * 1024; // 1MB
849
- std::shared_ptr<FileSystem> db_fs_;
850
- std::shared_ptr<FileSystem> backup_fs_;
851
- IOOptions io_options_ = IOOptions();
852
-
853
- public:
854
- std::unique_ptr<TEST_BackupMetaSchemaOptions> schema_test_options_;
855
- };
856
-
857
- // -------- BackupEngineImplThreadSafe class ---------
858
- // This locking layer for thread safety in the public API is layered on
859
- // top to prevent accidental recursive locking with RWMutex, which is UB.
860
- // Note: BackupEngineReadOnlyBase inherited twice, but has no fields
861
- class BackupEngineImplThreadSafe : public BackupEngine,
862
- public BackupEngineReadOnly {
863
- public:
864
- BackupEngineImplThreadSafe(const BackupEngineOptions& options, Env* db_env,
865
- bool read_only = false)
866
- : impl_(options, db_env, read_only) {}
867
- ~BackupEngineImplThreadSafe() override = default;
868
-
869
- using BackupEngine::CreateNewBackupWithMetadata;
870
- IOStatus CreateNewBackupWithMetadata(const CreateBackupOptions& options,
871
- DB* db, const std::string& app_metadata,
872
- BackupID* new_backup_id) override {
873
- WriteLock lock(&mutex_);
874
- return impl_.CreateNewBackupWithMetadata(options, db, app_metadata,
875
- new_backup_id);
876
- }
877
-
878
- IOStatus PurgeOldBackups(uint32_t num_backups_to_keep) override {
879
- WriteLock lock(&mutex_);
880
- return impl_.PurgeOldBackups(num_backups_to_keep);
881
- }
882
-
883
- IOStatus DeleteBackup(BackupID backup_id) override {
884
- WriteLock lock(&mutex_);
885
- return impl_.DeleteBackup(backup_id);
886
- }
887
-
888
- void StopBackup() override {
889
- // No locking needed
890
- impl_.StopBackup();
891
- }
892
-
893
- IOStatus GarbageCollect() override {
894
- WriteLock lock(&mutex_);
895
- return impl_.GarbageCollect();
896
- }
897
-
898
- Status GetLatestBackupInfo(BackupInfo* backup_info,
899
- bool include_file_details = false) const override {
900
- ReadLock lock(&mutex_);
901
- return impl_.GetBackupInfo(kLatestBackupIDMarker, backup_info,
902
- include_file_details);
903
- }
904
-
905
- Status GetBackupInfo(BackupID backup_id, BackupInfo* backup_info,
906
- bool include_file_details = false) const override {
907
- ReadLock lock(&mutex_);
908
- return impl_.GetBackupInfo(backup_id, backup_info, include_file_details);
909
- }
910
-
911
- void GetBackupInfo(std::vector<BackupInfo>* backup_info,
912
- bool include_file_details) const override {
913
- ReadLock lock(&mutex_);
914
- impl_.GetBackupInfo(backup_info, include_file_details);
915
- }
916
-
917
- void GetCorruptedBackups(
918
- std::vector<BackupID>* corrupt_backup_ids) const override {
919
- ReadLock lock(&mutex_);
920
- impl_.GetCorruptedBackups(corrupt_backup_ids);
921
- }
922
-
923
- using BackupEngine::RestoreDBFromBackup;
924
- IOStatus RestoreDBFromBackup(const RestoreOptions& options,
925
- BackupID backup_id, const std::string& db_dir,
926
- const std::string& wal_dir) const override {
927
- // TSAN reports a lock inversion (potential deadlock) if we acquire read
928
- // locks in different orders. Assuming the implementation of RWMutex
929
- // allows simultaneous read locks, there should be no deadlock, because
930
- // there is no write lock involved here. Nevertheless, to appease TSAN and
931
- // in case of degraded RWMutex implementation, we lock the BackupEngines
932
- // including this one and those in options.alternate_dirs in a consistent
933
- // order.
934
- // However, locked_restore_from_dirs is kept in "search" order.
935
- std::list<const BackupEngineImpl*> locked_restore_from_dirs;
936
- std::vector<port::RWMutex*> mutexes;
937
-
938
- // Add `this`
939
- locked_restore_from_dirs.emplace_back(&impl_);
940
- mutexes.push_back(&mutex_);
941
-
942
- // Add alternates
943
- for (BackupEngineReadOnlyBase* be : options.alternate_dirs) {
944
- BackupEngineImplThreadSafe* bets =
945
- static_cast_with_check<BackupEngineImplThreadSafe>(
946
- be->AsBackupEngine());
947
- locked_restore_from_dirs.emplace_back(&bets->impl_);
948
- mutexes.push_back(&bets->mutex_);
949
- }
950
-
951
- // Acquire read locks in pointer order
952
- std::sort(mutexes.begin(), mutexes.end());
953
- std::vector<ReadLock> locks(mutexes.begin(), mutexes.end());
954
-
955
- // Impl
956
- return impl_.RestoreDBFromBackup(options, backup_id, db_dir, wal_dir,
957
- locked_restore_from_dirs);
958
- }
959
-
960
- using BackupEngine::RestoreDBFromLatestBackup;
961
- IOStatus RestoreDBFromLatestBackup(
962
- const RestoreOptions& options, const std::string& db_dir,
963
- const std::string& wal_dir) const override {
964
- // Defer to above function, which locks
965
- return RestoreDBFromBackup(options, kLatestBackupIDMarker, db_dir, wal_dir);
966
- }
967
-
968
- IOStatus VerifyBackup(BackupID backup_id,
969
- bool verify_with_checksum = false) const override {
970
- ReadLock lock(&mutex_);
971
- return impl_.VerifyBackup(backup_id, verify_with_checksum);
972
- }
973
-
974
- BackupEngine* AsBackupEngine() override { return this; }
975
-
976
- // Not public API but needed
977
- IOStatus Initialize() {
978
- // No locking needed
979
- return impl_.Initialize();
980
- }
981
-
982
- // Not public API but used in testing
983
- void TEST_SetBackupMetaSchemaOptions(
984
- const TEST_BackupMetaSchemaOptions& options) {
985
- impl_.schema_test_options_.reset(new TEST_BackupMetaSchemaOptions(options));
986
- }
987
-
988
- // Not public API but used in testing
989
- void TEST_SetDefaultRateLimitersClock(
990
- const std::shared_ptr<SystemClock>& backup_rate_limiter_clock = nullptr,
991
- const std::shared_ptr<SystemClock>& restore_rate_limiter_clock =
992
- nullptr) {
993
- impl_.TEST_SetDefaultRateLimitersClock(backup_rate_limiter_clock,
994
- restore_rate_limiter_clock);
995
- }
996
-
997
- private:
998
- mutable port::RWMutex mutex_;
999
- BackupEngineImpl impl_;
1000
- };
1001
-
1002
- } // namespace
1003
-
1004
- IOStatus BackupEngine::Open(const BackupEngineOptions& options, Env* env,
1005
- BackupEngine** backup_engine_ptr) {
1006
- std::unique_ptr<BackupEngineImplThreadSafe> backup_engine(
1007
- new BackupEngineImplThreadSafe(options, env));
1008
- auto s = backup_engine->Initialize();
1009
- if (!s.ok()) {
1010
- *backup_engine_ptr = nullptr;
1011
- return s;
1012
- }
1013
- *backup_engine_ptr = backup_engine.release();
1014
- return IOStatus::OK();
1015
- }
1016
-
1017
- namespace {
1018
- BackupEngineImpl::BackupEngineImpl(const BackupEngineOptions& options,
1019
- Env* db_env, bool read_only)
1020
- : initialized_(false),
1021
- threads_cpu_priority_(),
1022
- latest_backup_id_(0),
1023
- latest_valid_backup_id_(0),
1024
- stop_backup_(false),
1025
- options_(options),
1026
- db_env_(db_env),
1027
- backup_env_(options.backup_env != nullptr ? options.backup_env : db_env_),
1028
- read_only_(read_only) {
1029
- if (options_.backup_rate_limiter == nullptr &&
1030
- options_.backup_rate_limit > 0) {
1031
- options_.backup_rate_limiter.reset(
1032
- NewGenericRateLimiter(options_.backup_rate_limit));
1033
- }
1034
- if (options_.restore_rate_limiter == nullptr &&
1035
- options_.restore_rate_limit > 0) {
1036
- options_.restore_rate_limiter.reset(
1037
- NewGenericRateLimiter(options_.restore_rate_limit));
1038
- }
1039
- db_fs_ = db_env_->GetFileSystem();
1040
- backup_fs_ = backup_env_->GetFileSystem();
1041
- }
1042
-
1043
- BackupEngineImpl::~BackupEngineImpl() {
1044
- files_to_copy_or_create_.sendEof();
1045
- for (auto& t : threads_) {
1046
- t.join();
1047
- }
1048
- LogFlush(options_.info_log);
1049
- for (const auto& it : corrupt_backups_) {
1050
- it.second.first.PermitUncheckedError();
1051
- }
1052
- }
1053
-
1054
- IOStatus BackupEngineImpl::Initialize() {
1055
- assert(!initialized_);
1056
- initialized_ = true;
1057
- if (read_only_) {
1058
- ROCKS_LOG_INFO(options_.info_log, "Starting read_only backup engine");
1059
- }
1060
- options_.Dump(options_.info_log);
1061
-
1062
- auto meta_path = GetAbsolutePath(kMetaDirName);
1063
-
1064
- if (!read_only_) {
1065
- // we might need to clean up from previous crash or I/O errors
1066
- might_need_garbage_collect_ = true;
1067
-
1068
- if (options_.max_valid_backups_to_open !=
1069
- std::numeric_limits<int32_t>::max()) {
1070
- options_.max_valid_backups_to_open = std::numeric_limits<int32_t>::max();
1071
- ROCKS_LOG_WARN(
1072
- options_.info_log,
1073
- "`max_valid_backups_to_open` is not set to the default value. "
1074
- "Ignoring its value since BackupEngine is not read-only.");
1075
- }
1076
-
1077
- // gather the list of directories that we need to create
1078
- std::vector<std::pair<std::string, std::unique_ptr<FSDirectory>*>>
1079
- directories;
1080
- directories.emplace_back(GetAbsolutePath(), &backup_directory_);
1081
- if (options_.share_table_files) {
1082
- if (options_.share_files_with_checksum) {
1083
- directories.emplace_back(
1084
- GetAbsolutePath(GetSharedFileWithChecksumRel()),
1085
- &shared_directory_);
1086
- } else {
1087
- directories.emplace_back(GetAbsolutePath(GetSharedFileRel()),
1088
- &shared_directory_);
1089
- }
1090
- }
1091
- directories.emplace_back(GetAbsolutePath(kPrivateDirName),
1092
- &private_directory_);
1093
- directories.emplace_back(meta_path, &meta_directory_);
1094
- // create all the dirs we need
1095
- for (const auto& d : directories) {
1096
- IOStatus io_s =
1097
- backup_fs_->CreateDirIfMissing(d.first, io_options_, nullptr);
1098
- if (io_s.ok()) {
1099
- io_s =
1100
- backup_fs_->NewDirectory(d.first, io_options_, d.second, nullptr);
1101
- }
1102
- if (!io_s.ok()) {
1103
- return io_s;
1104
- }
1105
- }
1106
- }
1107
-
1108
- std::vector<std::string> backup_meta_files;
1109
- {
1110
- IOStatus io_s = backup_fs_->GetChildren(meta_path, io_options_,
1111
- &backup_meta_files, nullptr);
1112
- if (io_s.IsNotFound()) {
1113
- return IOStatus::NotFound(meta_path + " is missing");
1114
- } else if (!io_s.ok()) {
1115
- return io_s;
1116
- }
1117
- }
1118
- // create backups_ structure
1119
- for (auto& file : backup_meta_files) {
1120
- ROCKS_LOG_INFO(options_.info_log, "Detected backup %s", file.c_str());
1121
- BackupID backup_id = 0;
1122
- sscanf(file.c_str(), "%u", &backup_id);
1123
- if (backup_id == 0 || file != std::to_string(backup_id)) {
1124
- // Invalid file name, will be deleted with auto-GC when user
1125
- // initiates an append or write operation. (Behave as read-only until
1126
- // then.)
1127
- ROCKS_LOG_INFO(options_.info_log, "Skipping unrecognized meta file %s",
1128
- file.c_str());
1129
- continue;
1130
- }
1131
- assert(backups_.find(backup_id) == backups_.end());
1132
- // Insert all the (backup_id, BackupMeta) that will be loaded later
1133
- // The loading performed later will check whether there are corrupt backups
1134
- // and move the corrupt backups to corrupt_backups_
1135
- backups_.insert(std::make_pair(
1136
- backup_id, std::unique_ptr<BackupMeta>(new BackupMeta(
1137
- GetBackupMetaFile(backup_id, false /* tmp */),
1138
- GetBackupMetaFile(backup_id, true /* tmp */),
1139
- &backuped_file_infos_, backup_env_, backup_fs_))));
1140
- }
1141
-
1142
- latest_backup_id_ = 0;
1143
- latest_valid_backup_id_ = 0;
1144
- if (options_.destroy_old_data) { // Destroy old data
1145
- assert(!read_only_);
1146
- ROCKS_LOG_INFO(
1147
- options_.info_log,
1148
- "Backup Engine started with destroy_old_data == true, deleting all "
1149
- "backups");
1150
- IOStatus io_s = PurgeOldBackups(0);
1151
- if (io_s.ok()) {
1152
- io_s = GarbageCollect();
1153
- }
1154
- if (!io_s.ok()) {
1155
- return io_s;
1156
- }
1157
- } else { // Load data from storage
1158
- // abs_path_to_size: maps absolute paths of files in backup directory to
1159
- // their corresponding sizes
1160
- std::unordered_map<std::string, uint64_t> abs_path_to_size;
1161
- // Insert files and their sizes in backup sub-directories (shared and
1162
- // shared_checksum) to abs_path_to_size
1163
- for (const auto& rel_dir :
1164
- {GetSharedFileRel(), GetSharedFileWithChecksumRel()}) {
1165
- const auto abs_dir = GetAbsolutePath(rel_dir);
1166
- IOStatus io_s =
1167
- ReadChildFileCurrentSizes(abs_dir, backup_fs_, &abs_path_to_size);
1168
- if (!io_s.ok()) {
1169
- // I/O error likely impacting all backups
1170
- return io_s;
1171
- }
1172
- }
1173
- // load the backups if any, until valid_backups_to_open of the latest
1174
- // non-corrupted backups have been successfully opened.
1175
- int valid_backups_to_open = options_.max_valid_backups_to_open;
1176
- for (auto backup_iter = backups_.rbegin(); backup_iter != backups_.rend();
1177
- ++backup_iter) {
1178
- assert(latest_backup_id_ == 0 || latest_backup_id_ > backup_iter->first);
1179
- if (latest_backup_id_ == 0) {
1180
- latest_backup_id_ = backup_iter->first;
1181
- }
1182
- if (valid_backups_to_open == 0) {
1183
- break;
1184
- }
1185
-
1186
- // Insert files and their sizes in backup sub-directories
1187
- // (private/backup_id) to abs_path_to_size
1188
- IOStatus io_s = ReadChildFileCurrentSizes(
1189
- GetAbsolutePath(GetPrivateFileRel(backup_iter->first)), backup_fs_,
1190
- &abs_path_to_size);
1191
- if (io_s.ok()) {
1192
- io_s = backup_iter->second->LoadFromFile(
1193
- options_.backup_dir, abs_path_to_size,
1194
- options_.backup_rate_limiter.get(), options_.info_log,
1195
- &reported_ignored_fields_);
1196
- }
1197
- if (io_s.IsCorruption() || io_s.IsNotSupported()) {
1198
- ROCKS_LOG_INFO(options_.info_log, "Backup %u corrupted -- %s",
1199
- backup_iter->first, io_s.ToString().c_str());
1200
- corrupt_backups_.insert(std::make_pair(
1201
- backup_iter->first,
1202
- std::make_pair(io_s, std::move(backup_iter->second))));
1203
- } else if (!io_s.ok()) {
1204
- // Distinguish corruption errors from errors in the backup Env.
1205
- // Errors in the backup Env (i.e., this code path) will cause Open() to
1206
- // fail, whereas corruption errors would not cause Open() failures.
1207
- return io_s;
1208
- } else {
1209
- ROCKS_LOG_INFO(options_.info_log, "Loading backup %" PRIu32 " OK:\n%s",
1210
- backup_iter->first,
1211
- backup_iter->second->GetInfoString().c_str());
1212
- assert(latest_valid_backup_id_ == 0 ||
1213
- latest_valid_backup_id_ > backup_iter->first);
1214
- if (latest_valid_backup_id_ == 0) {
1215
- latest_valid_backup_id_ = backup_iter->first;
1216
- }
1217
- --valid_backups_to_open;
1218
- }
1219
- }
1220
-
1221
- for (const auto& corrupt : corrupt_backups_) {
1222
- backups_.erase(backups_.find(corrupt.first));
1223
- }
1224
- // erase the backups before max_valid_backups_to_open
1225
- int num_unopened_backups;
1226
- if (options_.max_valid_backups_to_open == 0) {
1227
- num_unopened_backups = 0;
1228
- } else {
1229
- num_unopened_backups =
1230
- std::max(0, static_cast<int>(backups_.size()) -
1231
- options_.max_valid_backups_to_open);
1232
- }
1233
- for (int i = 0; i < num_unopened_backups; ++i) {
1234
- assert(backups_.begin()->second->Empty());
1235
- backups_.erase(backups_.begin());
1236
- }
1237
- }
1238
-
1239
- ROCKS_LOG_INFO(options_.info_log, "Latest backup is %u", latest_backup_id_);
1240
- ROCKS_LOG_INFO(options_.info_log, "Latest valid backup is %u",
1241
- latest_valid_backup_id_);
1242
-
1243
- // set up threads perform copies from files_to_copy_or_create_ in the
1244
- // background
1245
- threads_cpu_priority_ = CpuPriority::kNormal;
1246
- threads_.reserve(options_.max_background_operations);
1247
- for (int t = 0; t < options_.max_background_operations; t++) {
1248
- threads_.emplace_back([this]() {
1249
- #if defined(_GNU_SOURCE) && defined(__GLIBC_PREREQ)
1250
- #if __GLIBC_PREREQ(2, 12)
1251
- pthread_setname_np(pthread_self(), "backup_engine");
1252
- #endif
1253
- #endif
1254
- CpuPriority current_priority = CpuPriority::kNormal;
1255
- CopyOrCreateWorkItem work_item;
1256
- uint64_t bytes_toward_next_callback = 0;
1257
- while (files_to_copy_or_create_.read(work_item)) {
1258
- CpuPriority priority = threads_cpu_priority_;
1259
- if (current_priority != priority) {
1260
- TEST_SYNC_POINT_CALLBACK(
1261
- "BackupEngineImpl::Initialize:SetCpuPriority", &priority);
1262
- port::SetCpuPriority(0, priority);
1263
- current_priority = priority;
1264
- }
1265
- // `bytes_read` and `bytes_written` stats are enabled based on
1266
- // compile-time support and cannot be dynamically toggled. So we do not
1267
- // need to worry about `PerfLevel` here, unlike many other
1268
- // `IOStatsContext` / `PerfContext` stats.
1269
- uint64_t prev_bytes_read = IOSTATS(bytes_read);
1270
- uint64_t prev_bytes_written = IOSTATS(bytes_written);
1271
-
1272
- CopyOrCreateResult result;
1273
- Temperature temp = work_item.src_temperature;
1274
- result.io_status = CopyOrCreateFile(
1275
- work_item.src_path, work_item.dst_path, work_item.contents,
1276
- work_item.size_limit, work_item.src_env, work_item.dst_env,
1277
- work_item.src_env_options, work_item.sync, work_item.rate_limiter,
1278
- work_item.progress_callback, &temp, work_item.dst_temperature,
1279
- &bytes_toward_next_callback, &result.size, &result.checksum_hex);
1280
-
1281
- RecordTick(work_item.stats, BACKUP_READ_BYTES,
1282
- IOSTATS(bytes_read) - prev_bytes_read);
1283
- RecordTick(work_item.stats, BACKUP_WRITE_BYTES,
1284
- IOSTATS(bytes_written) - prev_bytes_written);
1285
-
1286
- result.db_id = work_item.db_id;
1287
- result.db_session_id = work_item.db_session_id;
1288
- result.expected_src_temperature = work_item.src_temperature;
1289
- result.current_src_temperature = temp;
1290
- if (result.io_status.ok() && !work_item.src_checksum_hex.empty()) {
1291
- // unknown checksum function name implies no db table file checksum in
1292
- // db manifest; work_item.src_checksum_hex not empty means
1293
- // backup engine has calculated its crc32c checksum for the table
1294
- // file; therefore, we are able to compare the checksums.
1295
- if (work_item.src_checksum_func_name ==
1296
- kUnknownFileChecksumFuncName ||
1297
- work_item.src_checksum_func_name == kDbFileChecksumFuncName) {
1298
- if (work_item.src_checksum_hex != result.checksum_hex) {
1299
- std::string checksum_info(
1300
- "Expected checksum is " + work_item.src_checksum_hex +
1301
- " while computed checksum is " + result.checksum_hex);
1302
- result.io_status = IOStatus::Corruption(
1303
- "Checksum mismatch after copying to " + work_item.dst_path +
1304
- ": " + checksum_info);
1305
- }
1306
- } else {
1307
- // FIXME(peterd): dead code?
1308
- std::string checksum_function_info(
1309
- "Existing checksum function is " +
1310
- work_item.src_checksum_func_name +
1311
- " while provided checksum function is " +
1312
- kBackupFileChecksumFuncName);
1313
- ROCKS_LOG_INFO(
1314
- options_.info_log,
1315
- "Unable to verify checksum after copying to %s: %s\n",
1316
- work_item.dst_path.c_str(), checksum_function_info.c_str());
1317
- }
1318
- }
1319
- work_item.result.set_value(std::move(result));
1320
- }
1321
- });
1322
- }
1323
- ROCKS_LOG_INFO(options_.info_log, "Initialized BackupEngine");
1324
- return IOStatus::OK();
1325
- }
1326
-
1327
- IOStatus BackupEngineImpl::CreateNewBackupWithMetadata(
1328
- const CreateBackupOptions& options, DB* db, const std::string& app_metadata,
1329
- BackupID* new_backup_id_ptr) {
1330
- assert(initialized_);
1331
- assert(!read_only_);
1332
- if (app_metadata.size() > kMaxAppMetaSize) {
1333
- return IOStatus::InvalidArgument("App metadata too large");
1334
- }
1335
-
1336
- bool maybe_exclude_items = bool{options.exclude_files_callback};
1337
- if (maybe_exclude_items && options_.schema_version < 2) {
1338
- return IOStatus::InvalidArgument(
1339
- "exclude_files_callback requires schema_version >= 2");
1340
- }
1341
-
1342
- if (options.decrease_background_thread_cpu_priority) {
1343
- if (options.background_thread_cpu_priority < threads_cpu_priority_) {
1344
- threads_cpu_priority_.store(options.background_thread_cpu_priority);
1345
- }
1346
- }
1347
-
1348
- BackupID new_backup_id = latest_backup_id_ + 1;
1349
-
1350
- // `bytes_read` and `bytes_written` stats are enabled based on compile-time
1351
- // support and cannot be dynamically toggled. So we do not need to worry about
1352
- // `PerfLevel` here, unlike many other `IOStatsContext` / `PerfContext` stats.
1353
- uint64_t prev_bytes_read = IOSTATS(bytes_read);
1354
- uint64_t prev_bytes_written = IOSTATS(bytes_written);
1355
-
1356
- assert(backups_.find(new_backup_id) == backups_.end());
1357
-
1358
- auto private_dir = GetAbsolutePath(GetPrivateFileRel(new_backup_id));
1359
- IOStatus io_s = backup_fs_->FileExists(private_dir, io_options_, nullptr);
1360
- if (io_s.ok()) {
1361
- // maybe last backup failed and left partial state behind, clean it up.
1362
- // need to do this before updating backups_ such that a private dir
1363
- // named after new_backup_id will be cleaned up.
1364
- // (If an incomplete new backup is followed by an incomplete delete
1365
- // of the latest full backup, then there could be more than one next
1366
- // id with a private dir, the last thing to be deleted in delete
1367
- // backup, but all will be cleaned up with a GarbageCollect.)
1368
- io_s = GarbageCollect();
1369
- } else if (io_s.IsNotFound()) {
1370
- // normal case, the new backup's private dir doesn't exist yet
1371
- io_s = IOStatus::OK();
1372
- }
1373
-
1374
- auto ret = backups_.insert(std::make_pair(
1375
- new_backup_id, std::unique_ptr<BackupMeta>(new BackupMeta(
1376
- GetBackupMetaFile(new_backup_id, false /* tmp */),
1377
- GetBackupMetaFile(new_backup_id, true /* tmp */),
1378
- &backuped_file_infos_, backup_env_, backup_fs_))));
1379
- assert(ret.second == true);
1380
- auto& new_backup = ret.first->second;
1381
- new_backup->RecordTimestamp();
1382
- new_backup->SetAppMetadata(app_metadata);
1383
-
1384
- auto start_backup = backup_env_->NowMicros();
1385
-
1386
- ROCKS_LOG_INFO(options_.info_log,
1387
- "Started the backup process -- creating backup %u",
1388
- new_backup_id);
1389
-
1390
- if (options_.share_table_files && !options_.share_files_with_checksum) {
1391
- ROCKS_LOG_WARN(options_.info_log,
1392
- "BackupEngineOptions::share_files_with_checksum=false is "
1393
- "DEPRECATED and could lead to data loss.");
1394
- }
1395
-
1396
- if (io_s.ok()) {
1397
- io_s = backup_fs_->CreateDir(private_dir, io_options_, nullptr);
1398
- }
1399
-
1400
- // A set into which we will insert the dst_paths that are calculated for live
1401
- // files and live WAL files.
1402
- // This is used to check whether a live files shares a dst_path with another
1403
- // live file.
1404
- std::unordered_set<std::string> live_dst_paths;
1405
-
1406
- std::deque<BackupWorkItemPair> excludable_items;
1407
- std::deque<BackupAfterCopyOrCreateWorkItem> backup_items_to_finish;
1408
- // Add a CopyOrCreateWorkItem to the channel for each live file
1409
- Status disabled = db->DisableFileDeletions();
1410
- DBOptions db_options = db->GetDBOptions();
1411
- Statistics* stats = db_options.statistics.get();
1412
- if (io_s.ok()) {
1413
- CheckpointImpl checkpoint(db);
1414
- uint64_t sequence_number = 0;
1415
- FileChecksumGenFactory* db_checksum_factory =
1416
- db_options.file_checksum_gen_factory.get();
1417
- const std::string kFileChecksumGenFactoryName =
1418
- "FileChecksumGenCrc32cFactory";
1419
- bool compare_checksum =
1420
- db_checksum_factory != nullptr &&
1421
- db_checksum_factory->Name() == kFileChecksumGenFactoryName
1422
- ? true
1423
- : false;
1424
- EnvOptions src_raw_env_options(db_options);
1425
- RateLimiter* rate_limiter = options_.backup_rate_limiter.get();
1426
- io_s = status_to_io_status(checkpoint.CreateCustomCheckpoint(
1427
- [&](const std::string& /*src_dirname*/, const std::string& /*fname*/,
1428
- FileType) {
1429
- // custom checkpoint will switch to calling copy_file_cb after it sees
1430
- // NotSupported returned from link_file_cb.
1431
- return IOStatus::NotSupported();
1432
- } /* link_file_cb */,
1433
- [&](const std::string& src_dirname, const std::string& fname,
1434
- uint64_t size_limit_bytes, FileType type,
1435
- const std::string& checksum_func_name,
1436
- const std::string& checksum_val,
1437
- const Temperature src_temperature) {
1438
- if (type == kWalFile && !options_.backup_log_files) {
1439
- return IOStatus::OK();
1440
- }
1441
- Log(options_.info_log, "add file for backup %s", fname.c_str());
1442
- uint64_t size_bytes = 0;
1443
- IOStatus io_st;
1444
- if (type == kTableFile || type == kBlobFile) {
1445
- io_st = db_fs_->GetFileSize(src_dirname + "/" + fname, io_options_,
1446
- &size_bytes, nullptr);
1447
- if (!io_st.ok()) {
1448
- Log(options_.info_log, "GetFileSize is failed: %s",
1449
- io_st.ToString().c_str());
1450
- return io_st;
1451
- }
1452
- }
1453
- EnvOptions src_env_options;
1454
- switch (type) {
1455
- case kWalFile:
1456
- src_env_options =
1457
- db_env_->OptimizeForLogRead(src_raw_env_options);
1458
- break;
1459
- case kTableFile:
1460
- src_env_options = db_env_->OptimizeForCompactionTableRead(
1461
- src_raw_env_options, ImmutableDBOptions(db_options));
1462
- break;
1463
- case kDescriptorFile:
1464
- src_env_options =
1465
- db_env_->OptimizeForManifestRead(src_raw_env_options);
1466
- break;
1467
- case kBlobFile:
1468
- src_env_options = db_env_->OptimizeForBlobFileRead(
1469
- src_raw_env_options, ImmutableDBOptions(db_options));
1470
- break;
1471
- default:
1472
- // Other backed up files (like options file) are not read by live
1473
- // DB, so don't need to worry about avoiding mixing buffered and
1474
- // direct I/O. Just use plain defaults.
1475
- src_env_options = src_raw_env_options;
1476
- break;
1477
- }
1478
- io_st = AddBackupFileWorkItem(
1479
- live_dst_paths, backup_items_to_finish,
1480
- maybe_exclude_items ? &excludable_items : nullptr, new_backup_id,
1481
- options_.share_table_files &&
1482
- (type == kTableFile || type == kBlobFile),
1483
- src_dirname, fname, src_env_options, rate_limiter, type,
1484
- size_bytes, db_options.statistics.get(), size_limit_bytes,
1485
- options_.share_files_with_checksum &&
1486
- (type == kTableFile || type == kBlobFile),
1487
- options.progress_callback, "" /* contents */, checksum_func_name,
1488
- checksum_val, src_temperature);
1489
- return io_st;
1490
- } /* copy_file_cb */,
1491
- [&](const std::string& fname, const std::string& contents,
1492
- FileType type) {
1493
- Log(options_.info_log, "add file for backup %s", fname.c_str());
1494
- return AddBackupFileWorkItem(
1495
- live_dst_paths, backup_items_to_finish,
1496
- maybe_exclude_items ? &excludable_items : nullptr, new_backup_id,
1497
- false /* shared */, "" /* src_dir */, fname,
1498
- EnvOptions() /* src_env_options */, rate_limiter, type,
1499
- contents.size(), db_options.statistics.get(), 0 /* size_limit */,
1500
- false /* shared_checksum */, options.progress_callback, contents);
1501
- } /* create_file_cb */,
1502
- &sequence_number,
1503
- options.flush_before_backup ? 0 : std::numeric_limits<uint64_t>::max(),
1504
- compare_checksum));
1505
- if (io_s.ok()) {
1506
- new_backup->SetSequenceNumber(sequence_number);
1507
- }
1508
- }
1509
- ROCKS_LOG_INFO(options_.info_log, "add files for backup done.");
1510
- if (io_s.ok() && maybe_exclude_items) {
1511
- assert(options.exclude_files_callback);
1512
- size_t count = excludable_items.size();
1513
- std::vector<MaybeExcludeBackupFile> maybe_exclude_files;
1514
- maybe_exclude_files.reserve(count);
1515
- for (auto& e : excludable_items) {
1516
- maybe_exclude_files.emplace_back(
1517
- BackupExcludedFileInfo(e.second.dst_relative));
1518
- }
1519
- if (count > 0) {
1520
- try {
1521
- options.exclude_files_callback(
1522
- &maybe_exclude_files.front(),
1523
- /*end pointer*/ &maybe_exclude_files.back() + 1);
1524
- } catch (const std::exception& exn) {
1525
- io_s = IOStatus::Aborted("Exception in exclude_files_callback: " +
1526
- std::string(exn.what()));
1527
- } catch (...) {
1528
- io_s = IOStatus::Aborted("Unknown exception in exclude_files_callback");
1529
- }
1530
- }
1531
- if (io_s.ok()) {
1532
- for (size_t i = 0; i < count; ++i) {
1533
- auto& e = excludable_items[i];
1534
- if (maybe_exclude_files[i].exclude_decision) {
1535
- new_backup.get()->AddExcludedFile(e.second.dst_relative);
1536
- } else {
1537
- files_to_copy_or_create_.write(std::move(e.first));
1538
- backup_items_to_finish.push_back(std::move(e.second));
1539
- }
1540
- }
1541
- }
1542
- excludable_items.clear();
1543
- } else {
1544
- assert(!options.exclude_files_callback);
1545
- assert(excludable_items.empty());
1546
- }
1547
- ROCKS_LOG_INFO(options_.info_log,
1548
- "dispatch files for backup done, wait for finish.");
1549
- for (auto& item : backup_items_to_finish) {
1550
- item.result.wait();
1551
- auto result = item.result.get();
1552
- IOStatus item_io_status = result.io_status;
1553
- Temperature temp = result.expected_src_temperature;
1554
- if (result.current_src_temperature != Temperature::kUnknown &&
1555
- (temp == Temperature::kUnknown ||
1556
- options_.current_temperatures_override_manifest)) {
1557
- temp = result.current_src_temperature;
1558
- }
1559
- if (item_io_status.ok() && item.shared && item.needed_to_copy) {
1560
- item_io_status = item.backup_env->GetFileSystem()->RenameFile(
1561
- item.dst_path_tmp, item.dst_path, io_options_, nullptr);
1562
- }
1563
- if (item_io_status.ok()) {
1564
- item_io_status = new_backup.get()->AddFile(std::make_shared<FileInfo>(
1565
- item.dst_relative, result.size, result.checksum_hex, result.db_id,
1566
- result.db_session_id, temp));
1567
- }
1568
- if (!item_io_status.ok()) {
1569
- io_s = std::move(item_io_status);
1570
- io_s.MustCheck();
1571
- }
1572
- }
1573
-
1574
- // we copied all the files, enable file deletions
1575
- if (disabled.ok()) { // If we successfully disabled file deletions
1576
- db->EnableFileDeletions().PermitUncheckedError();
1577
- }
1578
- auto backup_time = backup_env_->NowMicros() - start_backup;
1579
-
1580
- if (io_s.ok()) {
1581
- // persist the backup metadata on the disk
1582
- io_s = new_backup->StoreToFile(options_.sync, options_.schema_version,
1583
- schema_test_options_.get());
1584
- }
1585
- if (io_s.ok() && options_.sync) {
1586
- std::unique_ptr<FSDirectory> backup_private_directory;
1587
- backup_fs_
1588
- ->NewDirectory(GetAbsolutePath(GetPrivateFileRel(new_backup_id, false)),
1589
- io_options_, &backup_private_directory, nullptr)
1590
- .PermitUncheckedError();
1591
- if (backup_private_directory != nullptr) {
1592
- io_s = backup_private_directory->FsyncWithDirOptions(io_options_, nullptr,
1593
- DirFsyncOptions());
1594
- }
1595
- if (io_s.ok() && private_directory_ != nullptr) {
1596
- io_s = private_directory_->FsyncWithDirOptions(io_options_, nullptr,
1597
- DirFsyncOptions());
1598
- }
1599
- if (io_s.ok() && meta_directory_ != nullptr) {
1600
- io_s = meta_directory_->FsyncWithDirOptions(io_options_, nullptr,
1601
- DirFsyncOptions());
1602
- }
1603
- if (io_s.ok() && shared_directory_ != nullptr) {
1604
- io_s = shared_directory_->FsyncWithDirOptions(io_options_, nullptr,
1605
- DirFsyncOptions());
1606
- }
1607
- if (io_s.ok() && backup_directory_ != nullptr) {
1608
- io_s = backup_directory_->FsyncWithDirOptions(io_options_, nullptr,
1609
- DirFsyncOptions());
1610
- }
1611
- }
1612
-
1613
- if (io_s.ok()) {
1614
- backup_statistics_.IncrementNumberSuccessBackup();
1615
- // here we know that we succeeded and installed the new backup
1616
- latest_backup_id_ = new_backup_id;
1617
- latest_valid_backup_id_ = new_backup_id;
1618
- if (new_backup_id_ptr) {
1619
- *new_backup_id_ptr = new_backup_id;
1620
- }
1621
- ROCKS_LOG_INFO(options_.info_log, "Backup DONE. All is good");
1622
-
1623
- // backup_speed is in byte/second
1624
- double backup_speed = new_backup->GetSize() / (1.048576 * backup_time);
1625
- ROCKS_LOG_INFO(options_.info_log, "Backup number of files: %u",
1626
- new_backup->GetNumberFiles());
1627
- char human_size[16];
1628
- AppendHumanBytes(new_backup->GetSize(), human_size, sizeof(human_size));
1629
- ROCKS_LOG_INFO(options_.info_log, "Backup size: %s", human_size);
1630
- ROCKS_LOG_INFO(options_.info_log, "Backup time: %" PRIu64 " microseconds",
1631
- backup_time);
1632
- ROCKS_LOG_INFO(options_.info_log, "Backup speed: %.3f MB/s", backup_speed);
1633
- ROCKS_LOG_INFO(options_.info_log, "Backup Statistics %s",
1634
- backup_statistics_.ToString().c_str());
1635
- } else {
1636
- backup_statistics_.IncrementNumberFailBackup();
1637
- // clean all the files we might have created
1638
- ROCKS_LOG_INFO(options_.info_log, "Backup failed -- %s",
1639
- io_s.ToString().c_str());
1640
- ROCKS_LOG_INFO(options_.info_log, "Backup Statistics %s\n",
1641
- backup_statistics_.ToString().c_str());
1642
- // delete files that we might have already written
1643
- might_need_garbage_collect_ = true;
1644
- DeleteBackup(new_backup_id).PermitUncheckedError();
1645
- }
1646
-
1647
- RecordTick(stats, BACKUP_READ_BYTES, IOSTATS(bytes_read) - prev_bytes_read);
1648
- RecordTick(stats, BACKUP_WRITE_BYTES,
1649
- IOSTATS(bytes_written) - prev_bytes_written);
1650
- return io_s;
1651
- }
1652
-
1653
- IOStatus BackupEngineImpl::PurgeOldBackups(uint32_t num_backups_to_keep) {
1654
- assert(initialized_);
1655
- assert(!read_only_);
1656
-
1657
- // Best effort deletion even with errors
1658
- IOStatus overall_status = IOStatus::OK();
1659
-
1660
- ROCKS_LOG_INFO(options_.info_log, "Purging old backups, keeping %u",
1661
- num_backups_to_keep);
1662
- std::vector<BackupID> to_delete;
1663
- auto itr = backups_.begin();
1664
- while ((backups_.size() - to_delete.size()) > num_backups_to_keep) {
1665
- to_delete.push_back(itr->first);
1666
- itr++;
1667
- }
1668
- for (auto backup_id : to_delete) {
1669
- // Do not GC until end
1670
- IOStatus io_s = DeleteBackupNoGC(backup_id);
1671
- if (!io_s.ok()) {
1672
- overall_status = io_s;
1673
- }
1674
- }
1675
- // Clean up after any incomplete backup deletion, potentially from
1676
- // earlier session.
1677
- if (might_need_garbage_collect_) {
1678
- IOStatus io_s = GarbageCollect();
1679
- if (!io_s.ok() && overall_status.ok()) {
1680
- overall_status = io_s;
1681
- }
1682
- }
1683
- return overall_status;
1684
- }
1685
-
1686
- IOStatus BackupEngineImpl::DeleteBackup(BackupID backup_id) {
1687
- IOStatus s1 = DeleteBackupNoGC(backup_id);
1688
- IOStatus s2 = IOStatus::OK();
1689
-
1690
- // Clean up after any incomplete backup deletion, potentially from
1691
- // earlier session.
1692
- if (might_need_garbage_collect_) {
1693
- s2 = GarbageCollect();
1694
- }
1695
-
1696
- if (!s1.ok()) {
1697
- // Any failure in the primary objective trumps any failure in the
1698
- // secondary objective.
1699
- s2.PermitUncheckedError();
1700
- return s1;
1701
- } else {
1702
- return s2;
1703
- }
1704
- }
1705
-
1706
- // Does not auto-GarbageCollect nor lock
1707
- IOStatus BackupEngineImpl::DeleteBackupNoGC(BackupID backup_id) {
1708
- assert(initialized_);
1709
- assert(!read_only_);
1710
-
1711
- ROCKS_LOG_INFO(options_.info_log, "Deleting backup %u", backup_id);
1712
- auto backup = backups_.find(backup_id);
1713
- if (backup != backups_.end()) {
1714
- IOStatus io_s = backup->second->Delete();
1715
- if (!io_s.ok()) {
1716
- return io_s;
1717
- }
1718
- backups_.erase(backup);
1719
- if (backups_.empty()) {
1720
- latest_valid_backup_id_ = 0;
1721
- } else {
1722
- latest_valid_backup_id_ = backups_.rbegin()->first;
1723
- }
1724
- } else {
1725
- auto corrupt = corrupt_backups_.find(backup_id);
1726
- if (corrupt == corrupt_backups_.end()) {
1727
- return IOStatus::NotFound("Backup not found");
1728
- }
1729
- IOStatus io_s = corrupt->second.second->Delete();
1730
- if (!io_s.ok()) {
1731
- return io_s;
1732
- }
1733
- corrupt->second.first.PermitUncheckedError();
1734
- corrupt_backups_.erase(corrupt);
1735
- }
1736
-
1737
- // After removing meta file, best effort deletion even with errors.
1738
- // (Don't delete other files if we can't delete the meta file right
1739
- // now.)
1740
- std::vector<std::string> to_delete;
1741
- for (auto& itr : backuped_file_infos_) {
1742
- if (itr.second->refs == 0) {
1743
- IOStatus io_s = backup_fs_->DeleteFile(GetAbsolutePath(itr.first),
1744
- io_options_, nullptr);
1745
- ROCKS_LOG_INFO(options_.info_log, "Deleting %s -- %s", itr.first.c_str(),
1746
- io_s.ToString().c_str());
1747
- to_delete.push_back(itr.first);
1748
- if (!io_s.ok()) {
1749
- // Trying again later might work
1750
- might_need_garbage_collect_ = true;
1751
- }
1752
- }
1753
- }
1754
- for (auto& td : to_delete) {
1755
- backuped_file_infos_.erase(td);
1756
- }
1757
-
1758
- // take care of private dirs -- GarbageCollect() will take care of them
1759
- // if they are not empty
1760
- std::string private_dir = GetPrivateFileRel(backup_id);
1761
- IOStatus io_s =
1762
- backup_fs_->DeleteDir(GetAbsolutePath(private_dir), io_options_, nullptr);
1763
- ROCKS_LOG_INFO(options_.info_log, "Deleting private dir %s -- %s",
1764
- private_dir.c_str(), io_s.ToString().c_str());
1765
- if (!io_s.ok()) {
1766
- // Full gc or trying again later might work
1767
- might_need_garbage_collect_ = true;
1768
- }
1769
- return IOStatus::OK();
1770
- }
1771
-
1772
- void BackupEngineImpl::SetBackupInfoFromBackupMeta(
1773
- BackupID id, const BackupMeta& meta, BackupInfo* backup_info,
1774
- bool include_file_details) const {
1775
- *backup_info = BackupInfo(id, meta.GetTimestamp(), meta.GetSize(),
1776
- meta.GetNumberFiles(), meta.GetAppMetadata());
1777
- std::string dir =
1778
- options_.backup_dir + "/" + kPrivateDirSlash + std::to_string(id);
1779
- if (include_file_details) {
1780
- auto& file_details = backup_info->file_details;
1781
- file_details.reserve(meta.GetFiles().size());
1782
- for (auto& file_ptr : meta.GetFiles()) {
1783
- BackupFileInfo& finfo = file_details.emplace_back();
1784
- finfo.relative_filename = file_ptr->filename;
1785
- finfo.size = file_ptr->size;
1786
- finfo.directory = dir;
1787
- uint64_t number;
1788
- FileType type;
1789
- bool ok = ParseFileName(file_ptr->filename, &number, &type);
1790
- if (ok) {
1791
- finfo.file_number = number;
1792
- finfo.file_type = type;
1793
- }
1794
- // TODO: temperature, file_checksum, file_checksum_func_name
1795
- // finfo.temperature = file_ptr->temp;
1796
- }
1797
- backup_info->excluded_files = meta.GetExcludedFiles();
1798
-
1799
- backup_info->name_for_open = GetAbsolutePath(GetPrivateFileRel(id));
1800
- backup_info->name_for_open.pop_back(); // remove trailing '/'
1801
- backup_info->env_for_open = meta.GetEnvForOpen();
1802
- }
1803
- }
1804
-
1805
- Status BackupEngineImpl::GetBackupInfo(BackupID backup_id,
1806
- BackupInfo* backup_info,
1807
- bool include_file_details) const {
1808
- assert(initialized_);
1809
- if (backup_id == kLatestBackupIDMarker) {
1810
- // Note: Read latest_valid_backup_id_ inside of lock
1811
- backup_id = latest_valid_backup_id_;
1812
- }
1813
- auto corrupt_itr = corrupt_backups_.find(backup_id);
1814
- if (corrupt_itr != corrupt_backups_.end()) {
1815
- return Status::Corruption(corrupt_itr->second.first.ToString());
1816
- }
1817
- auto backup_itr = backups_.find(backup_id);
1818
- if (backup_itr == backups_.end()) {
1819
- return Status::NotFound("Backup not found");
1820
- }
1821
- auto& backup = backup_itr->second;
1822
- if (backup->Empty()) {
1823
- return Status::NotFound("Backup not found");
1824
- }
1825
-
1826
- SetBackupInfoFromBackupMeta(backup_id, *backup, backup_info,
1827
- include_file_details);
1828
- return Status::OK();
1829
- }
1830
-
1831
- void BackupEngineImpl::GetBackupInfo(std::vector<BackupInfo>* backup_info,
1832
- bool include_file_details) const {
1833
- assert(initialized_);
1834
- backup_info->resize(backups_.size());
1835
- size_t i = 0;
1836
- for (auto& backup : backups_) {
1837
- const BackupMeta& meta = *backup.second;
1838
- if (!meta.Empty()) {
1839
- SetBackupInfoFromBackupMeta(backup.first, meta, &backup_info->at(i++),
1840
- include_file_details);
1841
- }
1842
- }
1843
- }
1844
-
1845
- void BackupEngineImpl::GetCorruptedBackups(
1846
- std::vector<BackupID>* corrupt_backup_ids) const {
1847
- assert(initialized_);
1848
- corrupt_backup_ids->reserve(corrupt_backups_.size());
1849
- for (auto& backup : corrupt_backups_) {
1850
- corrupt_backup_ids->push_back(backup.first);
1851
- }
1852
- }
1853
-
1854
- IOStatus BackupEngineImpl::RestoreDBFromBackup(
1855
- const RestoreOptions& options, BackupID backup_id,
1856
- const std::string& db_dir, const std::string& wal_dir,
1857
- const std::list<const BackupEngineImpl*>& locked_restore_from_dirs) const {
1858
- assert(initialized_);
1859
- if (backup_id == kLatestBackupIDMarker) {
1860
- // Note: Read latest_valid_backup_id_ inside of lock
1861
- backup_id = latest_valid_backup_id_;
1862
- }
1863
- auto corrupt_itr = corrupt_backups_.find(backup_id);
1864
- if (corrupt_itr != corrupt_backups_.end()) {
1865
- return corrupt_itr->second.first;
1866
- }
1867
- auto backup_itr = backups_.find(backup_id);
1868
- if (backup_itr == backups_.end()) {
1869
- return IOStatus::NotFound("Backup not found");
1870
- }
1871
- auto& backup = backup_itr->second;
1872
- if (backup->Empty()) {
1873
- return IOStatus::NotFound("Backup not found");
1874
- }
1875
-
1876
- ROCKS_LOG_INFO(options_.info_log, "Restoring backup id %u\n", backup_id);
1877
- ROCKS_LOG_INFO(options_.info_log, "keep_log_files: %d\n",
1878
- static_cast<int>(options.keep_log_files));
1879
-
1880
- // just in case. Ignore errors
1881
- db_fs_->CreateDirIfMissing(db_dir, io_options_, nullptr)
1882
- .PermitUncheckedError();
1883
- db_fs_->CreateDirIfMissing(wal_dir, io_options_, nullptr)
1884
- .PermitUncheckedError();
1885
-
1886
- if (options.keep_log_files) {
1887
- // delete files in db_dir, but keep all the log files
1888
- DeleteChildren(db_dir, 1 << kWalFile);
1889
- // move all the files from archive dir to wal_dir
1890
- std::string archive_dir = ArchivalDirectory(wal_dir);
1891
- std::vector<std::string> archive_files;
1892
- db_fs_->GetChildren(archive_dir, io_options_, &archive_files, nullptr)
1893
- .PermitUncheckedError(); // ignore errors
1894
- for (const auto& f : archive_files) {
1895
- uint64_t number;
1896
- FileType type;
1897
- bool ok = ParseFileName(f, &number, &type);
1898
- if (ok && type == kWalFile) {
1899
- ROCKS_LOG_INFO(options_.info_log,
1900
- "Moving log file from archive/ to wal_dir: %s",
1901
- f.c_str());
1902
- IOStatus io_s = db_fs_->RenameFile(
1903
- archive_dir + "/" + f, wal_dir + "/" + f, io_options_, nullptr);
1904
- if (!io_s.ok()) {
1905
- // if we can't move log file from archive_dir to wal_dir,
1906
- // we should fail, since it might mean data loss
1907
- return io_s;
1908
- }
1909
- }
1910
- }
1911
- } else {
1912
- DeleteChildren(wal_dir);
1913
- DeleteChildren(ArchivalDirectory(wal_dir));
1914
- DeleteChildren(db_dir);
1915
- }
1916
-
1917
- // Files to restore, and from where (taking into account excluded files)
1918
- std::vector<std::pair<const BackupEngineImpl*, const FileInfo*>>
1919
- restore_file_infos;
1920
- restore_file_infos.reserve(backup->GetFiles().size() +
1921
- backup->GetExcludedFiles().size());
1922
-
1923
- for (const auto& ef : backup->GetExcludedFiles()) {
1924
- const std::string& file = ef.relative_file;
1925
-
1926
- bool found = false;
1927
- for (auto be : locked_restore_from_dirs) {
1928
- auto it = be->backuped_file_infos_.find(file);
1929
- if (it != backuped_file_infos_.end()) {
1930
- restore_file_infos.emplace_back(be, &*it->second);
1931
- found = true;
1932
- break;
1933
- }
1934
- }
1935
- if (!found) {
1936
- return IOStatus::InvalidArgument(
1937
- "Excluded file " + file + " not found in other backups nor in " +
1938
- std::to_string(locked_restore_from_dirs.size() - 1) +
1939
- " alternate backup directories");
1940
- }
1941
- }
1942
-
1943
- // Non-excluded files
1944
- for (const auto& file_info_shared : backup->GetFiles()) {
1945
- restore_file_infos.emplace_back(this, &*file_info_shared);
1946
- }
1947
-
1948
- IOStatus io_s;
1949
- std::vector<RestoreAfterCopyOrCreateWorkItem> restore_items_to_finish;
1950
- std::string temporary_current_file;
1951
- std::string final_current_file;
1952
- std::unique_ptr<FSDirectory> db_dir_for_fsync;
1953
- std::unique_ptr<FSDirectory> wal_dir_for_fsync;
1954
-
1955
- for (const auto& engine_and_file_info : restore_file_infos) {
1956
- const FileInfo* file_info = engine_and_file_info.second;
1957
- const std::string& file = file_info->filename;
1958
- std::string absolute_file =
1959
- engine_and_file_info.first->GetAbsolutePath(file);
1960
- Env* src_env = engine_and_file_info.first->backup_env_;
1961
-
1962
- // 1. get DB filename
1963
- std::string dst = file_info->GetDbFileName();
1964
-
1965
- // 2. find the filetype
1966
- uint64_t number;
1967
- FileType type;
1968
- bool ok = ParseFileName(dst, &number, &type);
1969
- if (!ok) {
1970
- return IOStatus::Corruption("Backup corrupted: Fail to parse filename " +
1971
- dst);
1972
- }
1973
- // 3. Construct the final path
1974
- // kWalFile lives in wal_dir and all the rest live in db_dir
1975
- if (type == kWalFile) {
1976
- dst = wal_dir + "/" + dst;
1977
- if (options_.sync && !wal_dir_for_fsync) {
1978
- io_s = db_fs_->NewDirectory(wal_dir, io_options_, &wal_dir_for_fsync,
1979
- nullptr);
1980
- if (!io_s.ok()) {
1981
- return io_s;
1982
- }
1983
- }
1984
- } else {
1985
- dst = db_dir + "/" + dst;
1986
- if (options_.sync && !db_dir_for_fsync) {
1987
- io_s = db_fs_->NewDirectory(db_dir, io_options_, &db_dir_for_fsync,
1988
- nullptr);
1989
- if (!io_s.ok()) {
1990
- return io_s;
1991
- }
1992
- }
1993
- }
1994
- // For atomicity, initially restore CURRENT file to a temporary name.
1995
- // This is useful even without options_.sync e.g. in case the restore
1996
- // process is interrupted.
1997
- if (type == kCurrentFile) {
1998
- final_current_file = dst;
1999
- dst = temporary_current_file = dst + ".tmp";
2000
- }
2001
-
2002
- ROCKS_LOG_INFO(options_.info_log, "Restoring %s to %s\n", file.c_str(),
2003
- dst.c_str());
2004
- CopyOrCreateWorkItem copy_or_create_work_item(
2005
- absolute_file, dst, Temperature::kUnknown /* src_temp */,
2006
- file_info->temp, "" /* contents */, src_env, db_env_,
2007
- EnvOptions() /* src_env_options */, options_.sync,
2008
- options_.restore_rate_limiter.get(), file_info->size,
2009
- nullptr /* stats */);
2010
- RestoreAfterCopyOrCreateWorkItem after_copy_or_create_work_item(
2011
- copy_or_create_work_item.result.get_future(), file, dst,
2012
- file_info->checksum_hex);
2013
- files_to_copy_or_create_.write(std::move(copy_or_create_work_item));
2014
- restore_items_to_finish.push_back(
2015
- std::move(after_copy_or_create_work_item));
2016
- }
2017
- IOStatus item_io_status;
2018
- for (auto& item : restore_items_to_finish) {
2019
- item.result.wait();
2020
- auto result = item.result.get();
2021
- item_io_status = result.io_status;
2022
- // Note: It is possible that both of the following bad-status cases occur
2023
- // during copying. But, we only return one status.
2024
- if (!item_io_status.ok()) {
2025
- io_s = item_io_status;
2026
- break;
2027
- } else if (!item.checksum_hex.empty() &&
2028
- item.checksum_hex != result.checksum_hex) {
2029
- io_s = IOStatus::Corruption(
2030
- "While restoring " + item.from_file + " -> " + item.to_file +
2031
- ": expected checksum is " + item.checksum_hex +
2032
- " while computed checksum is " + result.checksum_hex);
2033
- break;
2034
- }
2035
- }
2036
-
2037
- // When enabled, the first FsyncWithDirOptions is to ensure all files are
2038
- // fully persisted before renaming CURRENT.tmp
2039
- if (io_s.ok() && db_dir_for_fsync) {
2040
- ROCKS_LOG_INFO(options_.info_log, "Restore: fsync\n");
2041
- io_s = db_dir_for_fsync->FsyncWithDirOptions(io_options_, nullptr,
2042
- DirFsyncOptions());
2043
- }
2044
-
2045
- if (io_s.ok() && wal_dir_for_fsync) {
2046
- io_s = wal_dir_for_fsync->FsyncWithDirOptions(io_options_, nullptr,
2047
- DirFsyncOptions());
2048
- }
2049
-
2050
- if (io_s.ok() && !temporary_current_file.empty()) {
2051
- ROCKS_LOG_INFO(options_.info_log, "Restore: atomic rename CURRENT.tmp\n");
2052
- assert(!final_current_file.empty());
2053
- io_s = db_fs_->RenameFile(temporary_current_file, final_current_file,
2054
- io_options_, nullptr);
2055
- }
2056
-
2057
- if (io_s.ok() && db_dir_for_fsync && !temporary_current_file.empty()) {
2058
- // Second FsyncWithDirOptions is to ensure the final atomic rename of DB
2059
- // restore is fully persisted even if power goes out right after restore
2060
- // operation returns success
2061
- assert(db_dir_for_fsync);
2062
- io_s = db_dir_for_fsync->FsyncWithDirOptions(
2063
- io_options_, nullptr, DirFsyncOptions(final_current_file));
2064
- }
2065
-
2066
- ROCKS_LOG_INFO(options_.info_log, "Restoring done -- %s\n",
2067
- io_s.ToString().c_str());
2068
- return io_s;
2069
- }
2070
-
2071
- IOStatus BackupEngineImpl::VerifyBackup(BackupID backup_id,
2072
- bool verify_with_checksum) const {
2073
- assert(initialized_);
2074
- // Check if backup_id is corrupted, or valid and registered
2075
- auto corrupt_itr = corrupt_backups_.find(backup_id);
2076
- if (corrupt_itr != corrupt_backups_.end()) {
2077
- return corrupt_itr->second.first;
2078
- }
2079
-
2080
- auto backup_itr = backups_.find(backup_id);
2081
- if (backup_itr == backups_.end()) {
2082
- return IOStatus::NotFound();
2083
- }
2084
-
2085
- auto& backup = backup_itr->second;
2086
- if (backup->Empty()) {
2087
- return IOStatus::NotFound();
2088
- }
2089
-
2090
- ROCKS_LOG_INFO(options_.info_log, "Verifying backup id %u\n", backup_id);
2091
-
2092
- // Find all existing backup files belong to backup_id
2093
- std::unordered_map<std::string, uint64_t> curr_abs_path_to_size;
2094
- for (const auto& rel_dir : {GetPrivateFileRel(backup_id), GetSharedFileRel(),
2095
- GetSharedFileWithChecksumRel()}) {
2096
- const auto abs_dir = GetAbsolutePath(rel_dir);
2097
- // Shared directories allowed to be missing in some cases. Expected but
2098
- // missing files will be reported a few lines down.
2099
- ReadChildFileCurrentSizes(abs_dir, backup_fs_, &curr_abs_path_to_size)
2100
- .PermitUncheckedError();
2101
- }
2102
-
2103
- // For all files registered in backup
2104
- for (const auto& file_info : backup->GetFiles()) {
2105
- const auto abs_path = GetAbsolutePath(file_info->filename);
2106
- // check existence of the file
2107
- if (curr_abs_path_to_size.find(abs_path) == curr_abs_path_to_size.end()) {
2108
- return IOStatus::NotFound("File missing: " + abs_path);
2109
- }
2110
- // verify file size
2111
- if (file_info->size != curr_abs_path_to_size[abs_path]) {
2112
- std::string size_info("Expected file size is " +
2113
- std::to_string(file_info->size) +
2114
- " while found file size is " +
2115
- std::to_string(curr_abs_path_to_size[abs_path]));
2116
- return IOStatus::Corruption("File corrupted: File size mismatch for " +
2117
- abs_path + ": " + size_info);
2118
- }
2119
- if (verify_with_checksum && !file_info->checksum_hex.empty()) {
2120
- // verify file checksum
2121
- std::string checksum_hex;
2122
- ROCKS_LOG_INFO(options_.info_log, "Verifying %s checksum...\n",
2123
- abs_path.c_str());
2124
- IOStatus io_s = ReadFileAndComputeChecksum(
2125
- abs_path, backup_fs_, EnvOptions(), 0 /* size_limit */, &checksum_hex,
2126
- Temperature::kUnknown);
2127
- if (!io_s.ok()) {
2128
- return io_s;
2129
- } else if (file_info->checksum_hex != checksum_hex) {
2130
- std::string checksum_info(
2131
- "Expected checksum is " + file_info->checksum_hex +
2132
- " while computed checksum is " + checksum_hex);
2133
- return IOStatus::Corruption("File corrupted: Checksum mismatch for " +
2134
- abs_path + ": " + checksum_info);
2135
- }
2136
- }
2137
- }
2138
- return IOStatus::OK();
2139
- }
2140
-
2141
- IOStatus BackupEngineImpl::CopyOrCreateFile(
2142
- const std::string& src, const std::string& dst, const std::string& contents,
2143
- uint64_t size_limit, Env* src_env, Env* dst_env,
2144
- const EnvOptions& src_env_options, bool sync, RateLimiter* rate_limiter,
2145
- std::function<void()> progress_callback, Temperature* src_temperature,
2146
- Temperature dst_temperature, uint64_t* bytes_toward_next_callback,
2147
- uint64_t* size, std::string* checksum_hex) {
2148
- assert(src.empty() != contents.empty());
2149
- IOStatus io_s;
2150
- std::unique_ptr<FSWritableFile> dst_file;
2151
- std::unique_ptr<FSSequentialFile> src_file;
2152
- FileOptions dst_file_options;
2153
- dst_file_options.use_mmap_writes = false;
2154
- dst_file_options.temperature = dst_temperature;
2155
- // TODO:(gzh) maybe use direct reads/writes here if possible
2156
- if (size != nullptr) {
2157
- *size = 0;
2158
- }
2159
- uint32_t checksum_value = 0;
2160
-
2161
- // Check if size limit is set. if not, set it to very big number
2162
- if (size_limit == 0) {
2163
- size_limit = std::numeric_limits<uint64_t>::max();
2164
- }
2165
-
2166
- io_s = dst_env->GetFileSystem()->NewWritableFile(dst, dst_file_options,
2167
- &dst_file, nullptr);
2168
- if (io_s.ok() && !src.empty()) {
2169
- auto src_file_options = FileOptions(src_env_options);
2170
- src_file_options.temperature = *src_temperature;
2171
- io_s = src_env->GetFileSystem()->NewSequentialFile(src, src_file_options,
2172
- &src_file, nullptr);
2173
- }
2174
- if (io_s.IsPathNotFound() && *src_temperature != Temperature::kUnknown) {
2175
- // Retry without temperature hint in case the FileSystem is strict with
2176
- // non-kUnknown temperature option
2177
- io_s = src_env->GetFileSystem()->NewSequentialFile(
2178
- src, FileOptions(src_env_options), &src_file, nullptr);
2179
- }
2180
- if (!io_s.ok()) {
2181
- return io_s;
2182
- }
2183
-
2184
- size_t buf_size =
2185
- rate_limiter ? static_cast<size_t>(rate_limiter->GetSingleBurstBytes())
2186
- : kDefaultCopyFileBufferSize;
2187
-
2188
- // TODO: pass in Histograms if the destination file is sst or blob
2189
- std::unique_ptr<WritableFileWriter> dest_writer(
2190
- new WritableFileWriter(std::move(dst_file), dst, dst_file_options));
2191
- std::unique_ptr<SequentialFileReader> src_reader;
2192
- std::unique_ptr<char[]> buf;
2193
- if (!src.empty()) {
2194
- // Return back current temperature in FileSystem
2195
- *src_temperature = src_file->GetTemperature();
2196
-
2197
- src_reader.reset(new SequentialFileReader(
2198
- std::move(src_file), src, nullptr /* io_tracer */, {}, rate_limiter));
2199
- buf.reset(new char[buf_size]);
2200
- }
2201
-
2202
- Slice data;
2203
- const IOOptions opts;
2204
- do {
2205
- if (stop_backup_.load(std::memory_order_acquire)) {
2206
- return status_to_io_status(Status::Incomplete("Backup stopped"));
2207
- }
2208
- if (!src.empty()) {
2209
- size_t buffer_to_read =
2210
- (buf_size < size_limit) ? buf_size : static_cast<size_t>(size_limit);
2211
- io_s = src_reader->Read(buffer_to_read, &data, buf.get(),
2212
- Env::IO_LOW /* rate_limiter_priority */);
2213
- *bytes_toward_next_callback += data.size();
2214
- } else {
2215
- data = contents;
2216
- }
2217
- size_limit -= data.size();
2218
- TEST_SYNC_POINT_CALLBACK(
2219
- "BackupEngineImpl::CopyOrCreateFile:CorruptionDuringBackup",
2220
- (src.length() > 4 && src.rfind(".sst") == src.length() - 4) ? &data
2221
- : nullptr);
2222
-
2223
- if (!io_s.ok()) {
2224
- return io_s;
2225
- }
2226
-
2227
- if (size != nullptr) {
2228
- *size += data.size();
2229
- }
2230
- if (checksum_hex != nullptr) {
2231
- checksum_value = crc32c::Extend(checksum_value, data.data(), data.size());
2232
- }
2233
-
2234
- io_s = dest_writer->Append(opts, data);
2235
-
2236
- if (rate_limiter != nullptr) {
2237
- if (!src.empty()) {
2238
- rate_limiter->Request(data.size(), Env::IO_LOW, nullptr /* stats */,
2239
- RateLimiter::OpType::kWrite);
2240
- } else {
2241
- LoopRateLimitRequestHelper(data.size(), rate_limiter, Env::IO_LOW,
2242
- nullptr /* stats */,
2243
- RateLimiter::OpType::kWrite);
2244
- }
2245
- }
2246
- while (*bytes_toward_next_callback >=
2247
- options_.callback_trigger_interval_size) {
2248
- *bytes_toward_next_callback -= options_.callback_trigger_interval_size;
2249
- if (progress_callback) {
2250
- std::lock_guard<std::mutex> lock(byte_report_mutex_);
2251
- try {
2252
- progress_callback();
2253
- } catch (const std::exception& exn) {
2254
- io_s = IOStatus::Aborted("Exception in progress_callback: " +
2255
- std::string(exn.what()));
2256
- break;
2257
- } catch (...) {
2258
- io_s = IOStatus::Aborted("Unknown exception in progress_callback");
2259
- break;
2260
- }
2261
- }
2262
- }
2263
- } while (io_s.ok() && contents.empty() && data.size() > 0 && size_limit > 0);
2264
-
2265
- // Convert uint32_t checksum to hex checksum
2266
- if (checksum_hex != nullptr) {
2267
- checksum_hex->assign(ChecksumInt32ToHex(checksum_value));
2268
- }
2269
-
2270
- if (io_s.ok() && sync) {
2271
- io_s = dest_writer->Sync(opts, false);
2272
- }
2273
- if (io_s.ok()) {
2274
- io_s = dest_writer->Close(opts);
2275
- }
2276
- return io_s;
2277
- }
2278
-
2279
- // fname will always start with "/"
2280
- IOStatus BackupEngineImpl::AddBackupFileWorkItem(
2281
- std::unordered_set<std::string>& live_dst_paths,
2282
- std::deque<BackupAfterCopyOrCreateWorkItem>& backup_items_to_finish,
2283
- std::deque<BackupWorkItemPair>* excludable_items, BackupID backup_id,
2284
- bool shared, const std::string& src_dir, const std::string& fname,
2285
- const EnvOptions& src_env_options, RateLimiter* rate_limiter,
2286
- FileType file_type, uint64_t size_bytes, Statistics* stats,
2287
- uint64_t size_limit, bool shared_checksum,
2288
- std::function<void()> progress_callback, const std::string& contents,
2289
- const std::string& src_checksum_func_name,
2290
- const std::string& src_checksum_str, const Temperature src_temperature) {
2291
- assert(contents.empty() != src_dir.empty());
2292
-
2293
- std::string src_path = src_dir + "/" + fname;
2294
- std::string dst_relative;
2295
- std::string dst_relative_tmp;
2296
- std::string db_id;
2297
- std::string db_session_id;
2298
- // crc32c checksum in hex. empty == unavailable / unknown
2299
- std::string checksum_hex;
2300
-
2301
- // Whenever a default checksum function name is passed in, we will compares
2302
- // the corresponding checksum values after copying. Note that only table and
2303
- // blob files may have a known checksum function name passed in.
2304
- //
2305
- // If no default checksum function name is passed in and db session id is not
2306
- // available, we will calculate the checksum *before* copying in two cases
2307
- // (we always calcuate checksums when copying or creating for any file types):
2308
- // a) share_files_with_checksum is true and file type is table;
2309
- // b) share_table_files is true and the file exists already.
2310
- //
2311
- // Step 0: Check if default checksum function name is passed in
2312
- if (kDbFileChecksumFuncName == src_checksum_func_name) {
2313
- if (src_checksum_str == kUnknownFileChecksum) {
2314
- return status_to_io_status(
2315
- Status::Aborted("Unknown checksum value for " + fname));
2316
- }
2317
- checksum_hex = ChecksumStrToHex(src_checksum_str);
2318
- }
2319
-
2320
- // Step 1: Prepare the relative path to destination
2321
- if (shared && shared_checksum) {
2322
- if (GetNamingNoFlags() != BackupEngineOptions::kLegacyCrc32cAndFileSize &&
2323
- file_type != kBlobFile) {
2324
- // Prepare db_session_id to add to the file name
2325
- Status s = GetFileDbIdentities(db_env_, src_env_options, src_path,
2326
- src_temperature, rate_limiter, &db_id,
2327
- &db_session_id);
2328
- if (s.IsPathNotFound()) {
2329
- // Retry with any temperature
2330
- s = GetFileDbIdentities(db_env_, src_env_options, src_path,
2331
- Temperature::kUnknown, rate_limiter, &db_id,
2332
- &db_session_id);
2333
- }
2334
- if (s.IsNotFound()) {
2335
- // db_id and db_session_id will be empty, which is OK for old files
2336
- } else if (!s.ok()) {
2337
- return status_to_io_status(std::move(s));
2338
- }
2339
- }
2340
- // Calculate checksum if checksum and db session id are not available.
2341
- // If db session id is available, we will not calculate the checksum
2342
- // since the session id should suffice to avoid file name collision in
2343
- // the shared_checksum directory.
2344
- if (checksum_hex.empty() && db_session_id.empty()) {
2345
- IOStatus io_s = ReadFileAndComputeChecksum(
2346
- src_path, db_fs_, src_env_options, size_limit, &checksum_hex,
2347
- src_temperature);
2348
- if (!io_s.ok()) {
2349
- return io_s;
2350
- }
2351
- }
2352
- if (size_bytes == std::numeric_limits<uint64_t>::max()) {
2353
- return IOStatus::NotFound("File missing: " + src_path);
2354
- }
2355
- // dst_relative depends on the following conditions:
2356
- // 1) the naming scheme is kUseDbSessionId,
2357
- // 2) db_session_id is not empty,
2358
- // 3) checksum is available in the DB manifest.
2359
- // If 1,2,3) are satisfied, then dst_relative will be of the form:
2360
- // shared_checksum/<file_number>_<checksum>_<db_session_id>.sst
2361
- // If 1,2) are satisfied, then dst_relative will be of the form:
2362
- // shared_checksum/<file_number>_<db_session_id>.sst
2363
- // Otherwise, dst_relative is of the form
2364
- // shared_checksum/<file_number>_<checksum>_<size>.sst
2365
- //
2366
- // For blob files, db_session_id is not supported with the blob file format.
2367
- // It uses original/legacy naming scheme.
2368
- // dst_relative will be of the form:
2369
- // shared_checksum/<file_number>_<checksum>_<size>.blob
2370
- dst_relative = GetSharedFileWithChecksum(fname, checksum_hex, size_bytes,
2371
- db_session_id);
2372
- dst_relative_tmp = GetSharedFileWithChecksumRel(dst_relative, true);
2373
- dst_relative = GetSharedFileWithChecksumRel(dst_relative, false);
2374
- } else if (shared) {
2375
- dst_relative_tmp = GetSharedFileRel(fname, true);
2376
- dst_relative = GetSharedFileRel(fname, false);
2377
- } else {
2378
- dst_relative = GetPrivateFileRel(backup_id, false, fname);
2379
- }
2380
-
2381
- // We copy into `temp_dest_path` and, once finished, rename it to
2382
- // `final_dest_path`. This allows files to atomically appear at
2383
- // `final_dest_path`. We can copy directly to the final path when atomicity
2384
- // is unnecessary, like for files in private backup directories.
2385
- const std::string* copy_dest_path;
2386
- std::string temp_dest_path;
2387
- std::string final_dest_path = GetAbsolutePath(dst_relative);
2388
- if (!dst_relative_tmp.empty()) {
2389
- temp_dest_path = GetAbsolutePath(dst_relative_tmp);
2390
- copy_dest_path = &temp_dest_path;
2391
- } else {
2392
- copy_dest_path = &final_dest_path;
2393
- }
2394
-
2395
- // Step 2: Determine whether to copy or not
2396
- // if it's shared, we also need to check if it exists -- if it does, no need
2397
- // to copy it again.
2398
- bool need_to_copy = true;
2399
- // true if final_dest_path is the same path as another live file
2400
- const bool same_path =
2401
- live_dst_paths.find(final_dest_path) != live_dst_paths.end();
2402
-
2403
- bool file_exists = false;
2404
- if (shared && !same_path) {
2405
- // Should be in shared directory but not a live path, check existence in
2406
- // shared directory
2407
- IOStatus exist =
2408
- backup_fs_->FileExists(final_dest_path, io_options_, nullptr);
2409
- if (exist.ok()) {
2410
- file_exists = true;
2411
- } else if (exist.IsNotFound()) {
2412
- file_exists = false;
2413
- } else {
2414
- return exist;
2415
- }
2416
- }
2417
-
2418
- if (!contents.empty()) {
2419
- need_to_copy = false;
2420
- } else if (shared && (same_path || file_exists)) {
2421
- need_to_copy = false;
2422
- auto find_result = backuped_file_infos_.find(dst_relative);
2423
- if (find_result == backuped_file_infos_.end() && !same_path) {
2424
- // file exists but not referenced
2425
- ROCKS_LOG_INFO(
2426
- options_.info_log,
2427
- "%s already present, but not referenced by any backup. We will "
2428
- "overwrite the file.",
2429
- fname.c_str());
2430
- need_to_copy = true;
2431
- // Defer any failure reporting to when we try to write the file
2432
- backup_fs_->DeleteFile(final_dest_path, io_options_, nullptr)
2433
- .PermitUncheckedError();
2434
- } else {
2435
- // file exists and referenced
2436
- if (checksum_hex.empty()) {
2437
- // same_path should not happen for a standard DB, so OK to
2438
- // read file contents to check for checksum mismatch between
2439
- // two files from same DB getting same name.
2440
- // For compatibility with future meta file that might not have
2441
- // crc32c checksum available, consider it might be empty, but
2442
- // we don't currently generate meta file without crc32c checksum.
2443
- // Therefore we have to read & compute it if we don't have it.
2444
- if (!same_path && !find_result->second->checksum_hex.empty()) {
2445
- assert(find_result != backuped_file_infos_.end());
2446
- // Note: to save I/O on incremental backups, we copy prior known
2447
- // checksum of the file instead of reading entire file contents
2448
- // to recompute it.
2449
- checksum_hex = find_result->second->checksum_hex;
2450
- // Regarding corruption detection, consider:
2451
- // (a) the DB file is corrupt (since previous backup) and the backup
2452
- // file is OK: we failed to detect, but the backup is safe. DB can
2453
- // be repaired/restored once its corruption is detected.
2454
- // (b) the backup file is corrupt (since previous backup) and the
2455
- // db file is OK: we failed to detect, but the backup is corrupt.
2456
- // CreateNewBackup should support fast incremental backups and
2457
- // there's no way to support that without reading all the files.
2458
- // We might add an option for extra checks on incremental backup,
2459
- // but until then, use VerifyBackups to check existing backup data.
2460
- // (c) file name collision with legitimately different content.
2461
- // This is almost inconceivable with a well-generated DB session
2462
- // ID, but even in that case, we double check the file sizes in
2463
- // BackupMeta::AddFile.
2464
- } else {
2465
- IOStatus io_s = ReadFileAndComputeChecksum(
2466
- src_path, db_fs_, src_env_options, size_limit, &checksum_hex,
2467
- src_temperature);
2468
- if (!io_s.ok()) {
2469
- return io_s;
2470
- }
2471
- }
2472
- }
2473
- if (!db_session_id.empty()) {
2474
- ROCKS_LOG_INFO(options_.info_log,
2475
- "%s already present, with checksum %s, size %" PRIu64
2476
- " and DB session identity %s",
2477
- fname.c_str(), checksum_hex.c_str(), size_bytes,
2478
- db_session_id.c_str());
2479
- } else {
2480
- ROCKS_LOG_INFO(options_.info_log,
2481
- "%s already present, with checksum %s and size %" PRIu64,
2482
- fname.c_str(), checksum_hex.c_str(), size_bytes);
2483
- }
2484
- }
2485
- }
2486
- live_dst_paths.insert(final_dest_path);
2487
-
2488
- // Step 3: Add work item
2489
- if (!contents.empty() || need_to_copy) {
2490
- CopyOrCreateWorkItem copy_or_create_work_item(
2491
- src_dir.empty() ? "" : src_path, *copy_dest_path, src_temperature,
2492
- Temperature::kUnknown /*dst_temp*/, contents, db_env_, backup_env_,
2493
- src_env_options, options_.sync, rate_limiter, size_limit, stats,
2494
- progress_callback, src_checksum_func_name, checksum_hex, db_id,
2495
- db_session_id);
2496
- BackupAfterCopyOrCreateWorkItem after_copy_or_create_work_item(
2497
- copy_or_create_work_item.result.get_future(), shared, need_to_copy,
2498
- backup_env_, temp_dest_path, final_dest_path, dst_relative);
2499
- if (excludable_items != nullptr && shared && shared_checksum &&
2500
- need_to_copy) {
2501
- ROCKS_LOG_INFO(options_.info_log, "Copying (if not excluded) %s to %s",
2502
- fname.c_str(), copy_dest_path->c_str());
2503
- excludable_items->emplace_back(std::move(copy_or_create_work_item),
2504
- std::move(after_copy_or_create_work_item));
2505
- } else {
2506
- // For files known not excluded, can start copying even before finishing
2507
- // the checkpoint
2508
- ROCKS_LOG_INFO(options_.info_log, "Copying %s to %s", fname.c_str(),
2509
- copy_dest_path->c_str());
2510
- files_to_copy_or_create_.write(std::move(copy_or_create_work_item));
2511
- backup_items_to_finish.push_back(
2512
- std::move(after_copy_or_create_work_item));
2513
- }
2514
- } else {
2515
- std::promise<CopyOrCreateResult> promise_result;
2516
- BackupAfterCopyOrCreateWorkItem after_copy_or_create_work_item(
2517
- promise_result.get_future(), shared, need_to_copy, backup_env_,
2518
- temp_dest_path, final_dest_path, dst_relative);
2519
- backup_items_to_finish.push_back(std::move(after_copy_or_create_work_item));
2520
- CopyOrCreateResult result;
2521
- result.io_status = IOStatus::OK();
2522
- result.size = size_bytes;
2523
- result.checksum_hex = std::move(checksum_hex);
2524
- result.db_id = std::move(db_id);
2525
- result.db_session_id = std::move(db_session_id);
2526
- promise_result.set_value(std::move(result));
2527
- }
2528
- return IOStatus::OK();
2529
- }
2530
-
2531
- IOStatus BackupEngineImpl::ReadFileAndComputeChecksum(
2532
- const std::string& src, const std::shared_ptr<FileSystem>& src_fs,
2533
- const EnvOptions& src_env_options, uint64_t size_limit,
2534
- std::string* checksum_hex, const Temperature src_temperature) const {
2535
- if (checksum_hex == nullptr) {
2536
- return status_to_io_status(Status::Aborted("Checksum pointer is null"));
2537
- }
2538
- uint32_t checksum_value = 0;
2539
- if (size_limit == 0) {
2540
- size_limit = std::numeric_limits<uint64_t>::max();
2541
- }
2542
-
2543
- std::unique_ptr<SequentialFileReader> src_reader;
2544
- auto file_options = FileOptions(src_env_options);
2545
- file_options.temperature = src_temperature;
2546
- RateLimiter* rate_limiter = options_.backup_rate_limiter.get();
2547
- IOStatus io_s = SequentialFileReader::Create(
2548
- src_fs, src, file_options, &src_reader, nullptr /* dbg */, rate_limiter);
2549
- if (io_s.IsPathNotFound() && src_temperature != Temperature::kUnknown) {
2550
- // Retry without temperature hint in case the FileSystem is strict with
2551
- // non-kUnknown temperature option
2552
- file_options.temperature = Temperature::kUnknown;
2553
- io_s = SequentialFileReader::Create(src_fs, src, file_options, &src_reader,
2554
- nullptr /* dbg */, rate_limiter);
2555
- }
2556
- if (!io_s.ok()) {
2557
- return io_s;
2558
- }
2559
-
2560
- size_t buf_size = kDefaultCopyFileBufferSize;
2561
- std::unique_ptr<char[]> buf(new char[buf_size]);
2562
- Slice data;
2563
-
2564
- do {
2565
- if (stop_backup_.load(std::memory_order_acquire)) {
2566
- return status_to_io_status(Status::Incomplete("Backup stopped"));
2567
- }
2568
- size_t buffer_to_read =
2569
- (buf_size < size_limit) ? buf_size : static_cast<size_t>(size_limit);
2570
- io_s = src_reader->Read(buffer_to_read, &data, buf.get(),
2571
- Env::IO_LOW /* rate_limiter_priority */);
2572
- if (!io_s.ok()) {
2573
- return io_s;
2574
- }
2575
-
2576
- size_limit -= data.size();
2577
- checksum_value = crc32c::Extend(checksum_value, data.data(), data.size());
2578
- } while (data.size() > 0 && size_limit > 0);
2579
-
2580
- checksum_hex->assign(ChecksumInt32ToHex(checksum_value));
2581
-
2582
- return io_s;
2583
- }
2584
-
2585
- Status BackupEngineImpl::GetFileDbIdentities(
2586
- Env* src_env, const EnvOptions& src_env_options,
2587
- const std::string& file_path, Temperature file_temp,
2588
- RateLimiter* rate_limiter, std::string* db_id, std::string* db_session_id) {
2589
- assert(db_id != nullptr || db_session_id != nullptr);
2590
-
2591
- Options options;
2592
- options.env = src_env;
2593
- SstFileDumper sst_reader(options, file_path, file_temp,
2594
- 2 * 1024 * 1024
2595
- /* readahead_size */,
2596
- true /* verify_checksum */, false /* output_hex */,
2597
- false /* decode_blob_index */, src_env_options,
2598
- true /* silent */);
2599
-
2600
- const TableProperties* table_properties = nullptr;
2601
- std::shared_ptr<const TableProperties> tp;
2602
- Status s = sst_reader.getStatus();
2603
-
2604
- if (s.ok()) {
2605
- // Try to get table properties from the table reader of sst_reader
2606
- if (!sst_reader.ReadTableProperties(&tp).ok()) {
2607
- // FIXME (peterd): this logic is untested and seems obsolete.
2608
- // Try to use table properites from the initialization of sst_reader
2609
- table_properties = sst_reader.GetInitTableProperties();
2610
- } else {
2611
- table_properties = tp.get();
2612
- if (table_properties != nullptr && rate_limiter != nullptr) {
2613
- // sizeof(*table_properties) is a sufficent but far-from-exact
2614
- // approximation of read bytes due to metaindex block, std::string
2615
- // properties and varint compression
2616
- LoopRateLimitRequestHelper(sizeof(*table_properties), rate_limiter,
2617
- Env::IO_LOW, nullptr /* stats */,
2618
- RateLimiter::OpType::kRead);
2619
- }
2620
- }
2621
- } else {
2622
- ROCKS_LOG_INFO(options_.info_log, "Failed to read %s: %s",
2623
- file_path.c_str(), s.ToString().c_str());
2624
- return s;
2625
- }
2626
-
2627
- if (table_properties != nullptr) {
2628
- if (db_id != nullptr) {
2629
- db_id->assign(table_properties->db_id);
2630
- }
2631
- if (db_session_id != nullptr) {
2632
- db_session_id->assign(table_properties->db_session_id);
2633
- if (db_session_id->empty()) {
2634
- s = Status::NotFound("DB session identity not found in " + file_path);
2635
- ROCKS_LOG_INFO(options_.info_log, "%s", s.ToString().c_str());
2636
- return s;
2637
- }
2638
- }
2639
- return Status::OK();
2640
- } else {
2641
- s = Status::Corruption("Table properties missing in " + file_path);
2642
- ROCKS_LOG_INFO(options_.info_log, "%s", s.ToString().c_str());
2643
- return s;
2644
- }
2645
- }
2646
-
2647
- void BackupEngineImpl::LoopRateLimitRequestHelper(
2648
- const size_t total_bytes_to_request, RateLimiter* rate_limiter,
2649
- const Env::IOPriority pri, Statistics* stats,
2650
- const RateLimiter::OpType op_type) {
2651
- assert(rate_limiter != nullptr);
2652
- size_t remaining_bytes = total_bytes_to_request;
2653
- size_t request_bytes = 0;
2654
- while (remaining_bytes > 0) {
2655
- request_bytes =
2656
- std::min(static_cast<size_t>(rate_limiter->GetSingleBurstBytes()),
2657
- remaining_bytes);
2658
- rate_limiter->Request(request_bytes, pri, stats, op_type);
2659
- remaining_bytes -= request_bytes;
2660
- }
2661
- }
2662
-
2663
- void BackupEngineImpl::DeleteChildren(const std::string& dir,
2664
- uint32_t file_type_filter) const {
2665
- std::vector<std::string> children;
2666
- db_fs_->GetChildren(dir, io_options_, &children, nullptr)
2667
- .PermitUncheckedError(); // ignore errors
2668
-
2669
- for (const auto& f : children) {
2670
- uint64_t number;
2671
- FileType type;
2672
- bool ok = ParseFileName(f, &number, &type);
2673
- if (ok && (file_type_filter & (1 << type))) {
2674
- // don't delete this file
2675
- continue;
2676
- }
2677
- db_fs_->DeleteFile(dir + "/" + f, io_options_, nullptr)
2678
- .PermitUncheckedError(); // ignore errors
2679
- }
2680
- }
2681
-
2682
- IOStatus BackupEngineImpl::ReadChildFileCurrentSizes(
2683
- const std::string& dir, const std::shared_ptr<FileSystem>& fs,
2684
- std::unordered_map<std::string, uint64_t>* result) const {
2685
- assert(result != nullptr);
2686
- std::vector<Env::FileAttributes> files_attrs;
2687
- IOStatus io_status = fs->FileExists(dir, io_options_, nullptr);
2688
- if (io_status.ok()) {
2689
- io_status =
2690
- fs->GetChildrenFileAttributes(dir, io_options_, &files_attrs, nullptr);
2691
- } else if (io_status.IsNotFound()) {
2692
- // Insert no entries can be considered success
2693
- io_status = IOStatus::OK();
2694
- }
2695
- const bool slash_needed = dir.empty() || dir.back() != '/';
2696
- for (const auto& file_attrs : files_attrs) {
2697
- result->emplace(dir + (slash_needed ? "/" : "") + file_attrs.name,
2698
- file_attrs.size_bytes);
2699
- }
2700
- return io_status;
2701
- }
2702
-
2703
- IOStatus BackupEngineImpl::GarbageCollect() {
2704
- assert(!read_only_);
2705
-
2706
- // We will make a best effort to remove all garbage even in the presence
2707
- // of inconsistencies or I/O failures that inhibit finding garbage.
2708
- IOStatus overall_status = IOStatus::OK();
2709
- // If all goes well, we don't need another auto-GC this session
2710
- might_need_garbage_collect_ = false;
2711
-
2712
- ROCKS_LOG_INFO(options_.info_log, "Starting garbage collection");
2713
-
2714
- // delete obsolete shared files
2715
- for (bool with_checksum : {false, true}) {
2716
- std::vector<std::string> shared_children;
2717
- {
2718
- std::string shared_path;
2719
- if (with_checksum) {
2720
- shared_path = GetAbsolutePath(GetSharedFileWithChecksumRel());
2721
- } else {
2722
- shared_path = GetAbsolutePath(GetSharedFileRel());
2723
- }
2724
- IOStatus io_s = backup_fs_->FileExists(shared_path, io_options_, nullptr);
2725
- if (io_s.ok()) {
2726
- io_s = backup_fs_->GetChildren(shared_path, io_options_,
2727
- &shared_children, nullptr);
2728
- } else if (io_s.IsNotFound()) {
2729
- io_s = IOStatus::OK();
2730
- }
2731
- if (!io_s.ok()) {
2732
- overall_status = io_s;
2733
- // Trying again later might work
2734
- might_need_garbage_collect_ = true;
2735
- }
2736
- }
2737
- for (auto& child : shared_children) {
2738
- std::string rel_fname;
2739
- if (with_checksum) {
2740
- rel_fname = GetSharedFileWithChecksumRel(child);
2741
- } else {
2742
- rel_fname = GetSharedFileRel(child);
2743
- }
2744
- auto child_itr = backuped_file_infos_.find(rel_fname);
2745
- // if it's not refcounted, delete it
2746
- if (child_itr == backuped_file_infos_.end() ||
2747
- child_itr->second->refs == 0) {
2748
- // this might be a directory, but DeleteFile will just fail in that
2749
- // case, so we're good
2750
- IOStatus io_s = backup_fs_->DeleteFile(GetAbsolutePath(rel_fname),
2751
- io_options_, nullptr);
2752
- ROCKS_LOG_INFO(options_.info_log, "Deleting %s -- %s",
2753
- rel_fname.c_str(), io_s.ToString().c_str());
2754
- backuped_file_infos_.erase(rel_fname);
2755
- if (!io_s.ok()) {
2756
- // Trying again later might work
2757
- might_need_garbage_collect_ = true;
2758
- }
2759
- }
2760
- }
2761
- }
2762
-
2763
- // delete obsolete private files
2764
- std::vector<std::string> private_children;
2765
- {
2766
- IOStatus io_s =
2767
- backup_fs_->GetChildren(GetAbsolutePath(kPrivateDirName), io_options_,
2768
- &private_children, nullptr);
2769
- if (!io_s.ok()) {
2770
- overall_status = io_s;
2771
- // Trying again later might work
2772
- might_need_garbage_collect_ = true;
2773
- }
2774
- }
2775
- for (auto& child : private_children) {
2776
- BackupID backup_id = 0;
2777
- bool tmp_dir = child.find(".tmp") != std::string::npos;
2778
- sscanf(child.c_str(), "%u", &backup_id);
2779
- if (!tmp_dir && // if it's tmp_dir, delete it
2780
- (backup_id == 0 || backups_.find(backup_id) != backups_.end())) {
2781
- // it's either not a number or it's still alive. continue
2782
- continue;
2783
- }
2784
- // here we have to delete the dir and all its children
2785
- std::string full_private_path =
2786
- GetAbsolutePath(GetPrivateFileRel(backup_id));
2787
- std::vector<std::string> subchildren;
2788
- if (backup_fs_
2789
- ->GetChildren(full_private_path, io_options_, &subchildren, nullptr)
2790
- .ok()) {
2791
- for (auto& subchild : subchildren) {
2792
- IOStatus io_s = backup_fs_->DeleteFile(full_private_path + subchild,
2793
- io_options_, nullptr);
2794
- ROCKS_LOG_INFO(options_.info_log, "Deleting %s -- %s",
2795
- (full_private_path + subchild).c_str(),
2796
- io_s.ToString().c_str());
2797
- if (!io_s.ok()) {
2798
- // Trying again later might work
2799
- might_need_garbage_collect_ = true;
2800
- }
2801
- }
2802
- }
2803
- // finally delete the private dir
2804
- IOStatus io_s =
2805
- backup_fs_->DeleteDir(full_private_path, io_options_, nullptr);
2806
- ROCKS_LOG_INFO(options_.info_log, "Deleting dir %s -- %s",
2807
- full_private_path.c_str(), io_s.ToString().c_str());
2808
- if (!io_s.ok()) {
2809
- // Trying again later might work
2810
- might_need_garbage_collect_ = true;
2811
- }
2812
- }
2813
-
2814
- assert(overall_status.ok() || might_need_garbage_collect_);
2815
- return overall_status;
2816
- }
2817
-
2818
- // ------- BackupMeta class --------
2819
-
2820
- IOStatus BackupEngineImpl::BackupMeta::AddFile(
2821
- std::shared_ptr<FileInfo> file_info) {
2822
- auto itr = file_infos_->find(file_info->filename);
2823
- if (itr == file_infos_->end()) {
2824
- auto ret = file_infos_->insert({file_info->filename, file_info});
2825
- if (ret.second) {
2826
- itr = ret.first;
2827
- itr->second->refs = 1;
2828
- } else {
2829
- // if this happens, something is seriously wrong
2830
- return IOStatus::Corruption("In memory metadata insertion error");
2831
- }
2832
- } else {
2833
- // Compare sizes, because we scanned that off the filesystem on both
2834
- // ends. This is like a check in VerifyBackup.
2835
- if (itr->second->size != file_info->size) {
2836
- std::string msg = "Size mismatch for existing backup file: ";
2837
- msg.append(file_info->filename);
2838
- msg.append(" Size in backup is " + std::to_string(itr->second->size) +
2839
- " while size in DB is " + std::to_string(file_info->size));
2840
- msg.append(
2841
- " If this DB file checks as not corrupt, try deleting old"
2842
- " backups or backing up to a different backup directory.");
2843
- return IOStatus::Corruption(msg);
2844
- }
2845
- if (file_info->checksum_hex.empty()) {
2846
- // No checksum available to check
2847
- } else if (itr->second->checksum_hex.empty()) {
2848
- // Remember checksum if newly acquired
2849
- itr->second->checksum_hex = file_info->checksum_hex;
2850
- } else if (itr->second->checksum_hex != file_info->checksum_hex) {
2851
- // Note: to save I/O, these will be equal trivially on already backed
2852
- // up files that don't have the checksum in their name. And it should
2853
- // never fail for files that do have checksum in their name.
2854
-
2855
- // Should never reach here, but produce an appropriate corruption
2856
- // message in case we do in a release build.
2857
- assert(false);
2858
- std::string msg = "Checksum mismatch for existing backup file: ";
2859
- msg.append(file_info->filename);
2860
- msg.append(" Expected checksum is " + itr->second->checksum_hex +
2861
- " while computed checksum is " + file_info->checksum_hex);
2862
- msg.append(
2863
- " If this DB file checks as not corrupt, try deleting old"
2864
- " backups or backing up to a different backup directory.");
2865
- return IOStatus::Corruption(msg);
2866
- }
2867
- ++itr->second->refs; // increase refcount if already present
2868
- }
2869
-
2870
- size_ += file_info->size;
2871
- files_.push_back(itr->second);
2872
-
2873
- return IOStatus::OK();
2874
- }
2875
-
2876
- IOStatus BackupEngineImpl::BackupMeta::Delete(bool delete_meta) {
2877
- IOStatus io_s;
2878
- for (const auto& file : files_) {
2879
- --file->refs; // decrease refcount
2880
- }
2881
- files_.clear();
2882
- // delete meta file
2883
- if (delete_meta) {
2884
- io_s = fs_->FileExists(meta_filename_, iooptions_, nullptr);
2885
- if (io_s.ok()) {
2886
- io_s = fs_->DeleteFile(meta_filename_, iooptions_, nullptr);
2887
- } else if (io_s.IsNotFound()) {
2888
- io_s = IOStatus::OK(); // nothing to delete
2889
- }
2890
- }
2891
- timestamp_ = 0;
2892
- return io_s;
2893
- }
2894
-
2895
- // Constants for backup meta file schema (see LoadFromFile)
2896
- const std::string kSchemaVersionPrefix{"schema_version "};
2897
- const std::string kFooterMarker{"// FOOTER"};
2898
-
2899
- const std::string kAppMetaDataFieldName{"metadata"};
2900
-
2901
- // WART: The checksums are crc32c but named "crc32"
2902
- const std::string kFileCrc32cFieldName{"crc32"};
2903
- const std::string kFileSizeFieldName{"size"};
2904
- const std::string kTemperatureFieldName{"temp"};
2905
- const std::string kExcludedFieldName{"ni::excluded"};
2906
-
2907
- // Marks a (future) field that should cause failure if not recognized.
2908
- // Other fields are assumed to be ignorable. For example, in the future
2909
- // we might add
2910
- // ni::file_name_escape uri_percent
2911
- // to indicate all file names have had spaces and special characters
2912
- // escaped using a URI percent encoding.
2913
- const std::string kNonIgnorableFieldPrefix{"ni::"};
2914
-
2915
- // Each backup meta file is of the format (schema version 1):
2916
- //----------------------------------------------------------
2917
- // <timestamp>
2918
- // <seq number>
2919
- // metadata <metadata> (optional)
2920
- // <number of files>
2921
- // <file1> crc32 <crc32c_as_unsigned_decimal>
2922
- // <file2> crc32 <crc32c_as_unsigned_decimal>
2923
- // ...
2924
- //----------------------------------------------------------
2925
- //
2926
- // For schema version 2.x:
2927
- //----------------------------------------------------------
2928
- // schema_version <ver>
2929
- // <timestamp>
2930
- // <seq number>
2931
- // [<field name> <field data>]
2932
- // ...
2933
- // <number of files>
2934
- // <file1>( <field name> <field data no spaces>)*
2935
- // <file2>( <field name> <field data no spaces>)*
2936
- // ...
2937
- // [// FOOTER]
2938
- // [<field name> <field data>]
2939
- // ...
2940
- //----------------------------------------------------------
2941
- // where
2942
- // <ver> ::= [0-9]+([.][0-9]+)
2943
- // <field name> ::= [A-Za-z_][A-Za-z_0-9.]+
2944
- // <field data> is anything but newline
2945
- // <field data no spaces> is anything but space and newline
2946
- // Although "// FOOTER" wouldn't strictly be required as a delimiter
2947
- // given the number of files is included, it is there for parsing
2948
- // sanity in case of corruption. It is only required if followed
2949
- // by footer fields, such as a checksum of the meta file (so far).
2950
- // Unrecognized fields are ignored, to support schema evolution on
2951
- // non-critical features with forward compatibility. Update schema
2952
- // major version for breaking changes. Schema minor versions are indicated
2953
- // only for diagnostic/debugging purposes.
2954
- //
2955
- // Fields in schema version 2.0:
2956
- // * Top-level meta fields:
2957
- // * Only "metadata" as in schema version 1
2958
- // * File meta fields:
2959
- // * "crc32" - a crc32c checksum as in schema version 1
2960
- // * "size" - the size of the file (new)
2961
- // * Footer meta fields:
2962
- // * None yet (future use for meta file checksum anticipated)
2963
- //
2964
- IOStatus BackupEngineImpl::BackupMeta::LoadFromFile(
2965
- const std::string& backup_dir,
2966
- const std::unordered_map<std::string, uint64_t>& abs_path_to_size,
2967
- RateLimiter* rate_limiter, Logger* info_log,
2968
- std::unordered_set<std::string>* reported_ignored_fields) {
2969
- assert(reported_ignored_fields);
2970
- assert(Empty());
2971
-
2972
- std::unique_ptr<LineFileReader> backup_meta_reader;
2973
- {
2974
- IOStatus io_s = LineFileReader::Create(fs_, meta_filename_, FileOptions(),
2975
- &backup_meta_reader,
2976
- nullptr /* dbg */, rate_limiter);
2977
- if (!io_s.ok()) {
2978
- return io_s;
2979
- }
2980
- }
2981
-
2982
- // If we don't read an explicit schema_version, that implies version 1,
2983
- // which is what we call the original backup meta schema.
2984
- int schema_major_version = 1;
2985
-
2986
- // Failures handled at the end
2987
- std::string line;
2988
- if (backup_meta_reader->ReadLine(&line,
2989
- Env::IO_LOW /* rate_limiter_priority */)) {
2990
- if (StartsWith(line, kSchemaVersionPrefix)) {
2991
- std::string ver = line.substr(kSchemaVersionPrefix.size());
2992
- if (ver == "2" || StartsWith(ver, "2.")) {
2993
- schema_major_version = 2;
2994
- } else {
2995
- return IOStatus::NotSupported(
2996
- "Unsupported/unrecognized schema version: " + ver);
2997
- }
2998
- line.clear();
2999
- } else if (line.empty()) {
3000
- return IOStatus::Corruption("Unexpected empty line");
3001
- }
3002
- }
3003
- if (!line.empty()) {
3004
- timestamp_ = std::strtoull(line.c_str(), nullptr, /*base*/ 10);
3005
- } else if (backup_meta_reader->ReadLine(
3006
- &line, Env::IO_LOW /* rate_limiter_priority */)) {
3007
- timestamp_ = std::strtoull(line.c_str(), nullptr, /*base*/ 10);
3008
- }
3009
- if (backup_meta_reader->ReadLine(&line,
3010
- Env::IO_LOW /* rate_limiter_priority */)) {
3011
- sequence_number_ = std::strtoull(line.c_str(), nullptr, /*base*/ 10);
3012
- }
3013
- uint32_t num_files = UINT32_MAX;
3014
- while (backup_meta_reader->ReadLine(
3015
- &line, Env::IO_LOW /* rate_limiter_priority */)) {
3016
- if (line.empty()) {
3017
- return IOStatus::Corruption("Unexpected empty line");
3018
- }
3019
- // Number -> number of files -> exit loop reading optional meta fields
3020
- if (line[0] >= '0' && line[0] <= '9') {
3021
- num_files = static_cast<uint32_t>(strtoul(line.c_str(), nullptr, 10));
3022
- break;
3023
- }
3024
- // else, must be a meta field assignment
3025
- auto space_pos = line.find_first_of(' ');
3026
- if (space_pos == std::string::npos) {
3027
- return IOStatus::Corruption("Expected number of files or meta field");
3028
- }
3029
- std::string field_name = line.substr(0, space_pos);
3030
- std::string field_data = line.substr(space_pos + 1);
3031
- if (field_name == kAppMetaDataFieldName) {
3032
- // app metadata present
3033
- bool decode_success = Slice(field_data).DecodeHex(&app_metadata_);
3034
- if (!decode_success) {
3035
- return IOStatus::Corruption(
3036
- "Failed to decode stored hex encoded app metadata");
3037
- }
3038
- } else if (schema_major_version < 2) {
3039
- return IOStatus::Corruption("Expected number of files or \"" +
3040
- kAppMetaDataFieldName + "\" field");
3041
- } else if (StartsWith(field_name, kNonIgnorableFieldPrefix)) {
3042
- return IOStatus::NotSupported("Unrecognized non-ignorable meta field " +
3043
- field_name + " (from future version?)");
3044
- } else {
3045
- // Warn the first time we see any particular unrecognized meta field
3046
- if (reported_ignored_fields->insert("meta:" + field_name).second) {
3047
- ROCKS_LOG_WARN(info_log, "Ignoring unrecognized backup meta field %s",
3048
- field_name.c_str());
3049
- }
3050
- }
3051
- }
3052
- std::vector<std::shared_ptr<FileInfo>> files;
3053
- bool footer_present = false;
3054
- while (backup_meta_reader->ReadLine(
3055
- &line, Env::IO_LOW /* rate_limiter_priority */)) {
3056
- std::vector<std::string> components = StringSplit(line, ' ');
3057
-
3058
- if (components.size() < 1) {
3059
- return IOStatus::Corruption("Empty line instead of file entry.");
3060
- }
3061
- if (schema_major_version >= 2 && components.size() == 2 &&
3062
- line == kFooterMarker) {
3063
- footer_present = true;
3064
- break;
3065
- }
3066
-
3067
- const std::string& filename = components[0];
3068
-
3069
- if (schema_major_version >= 2) {
3070
- if (components.size() % 2 != 1) {
3071
- return IOStatus::Corruption(
3072
- "Bad number of line components for file entry.");
3073
- }
3074
- } else {
3075
- // Check restricted original schema
3076
- if (components.size() < 3) {
3077
- return IOStatus::Corruption("File checksum is missing for " + filename +
3078
- " in " + meta_filename_);
3079
- }
3080
- if (components[1] != kFileCrc32cFieldName) {
3081
- return IOStatus::Corruption("Unknown checksum type for " + filename +
3082
- " in " + meta_filename_);
3083
- }
3084
- if (components.size() > 3) {
3085
- return IOStatus::Corruption("Extra data for entry " + filename +
3086
- " in " + meta_filename_);
3087
- }
3088
- }
3089
-
3090
- std::optional<uint64_t> expected_size{};
3091
- std::string checksum_hex;
3092
- Temperature temp = Temperature::kUnknown;
3093
- bool excluded = false;
3094
- for (unsigned i = 1; i < components.size(); i += 2) {
3095
- const std::string& field_name = components[i];
3096
- const std::string& field_data = components[i + 1];
3097
-
3098
- if (field_name == kFileCrc32cFieldName) {
3099
- uint32_t checksum_value =
3100
- static_cast<uint32_t>(strtoul(field_data.c_str(), nullptr, 10));
3101
- if (field_data != std::to_string(checksum_value)) {
3102
- return IOStatus::Corruption("Invalid checksum value for " + filename +
3103
- " in " + meta_filename_);
3104
- }
3105
- checksum_hex = ChecksumInt32ToHex(checksum_value);
3106
- } else if (field_name == kFileSizeFieldName) {
3107
- expected_size = std::strtoull(field_data.c_str(), nullptr, /*base*/ 10);
3108
- } else if (field_name == kTemperatureFieldName) {
3109
- auto iter = temperature_string_map.find(field_data);
3110
- if (iter != temperature_string_map.end()) {
3111
- temp = iter->second;
3112
- } else {
3113
- // Could report corruption, but in case of new temperatures added
3114
- // in future, letting those map to kUnknown which should generally
3115
- // be safe.
3116
- temp = Temperature::kUnknown;
3117
- }
3118
- } else if (field_name == kExcludedFieldName) {
3119
- if (field_data == "true") {
3120
- excluded = true;
3121
- } else if (field_data == "false") {
3122
- excluded = false;
3123
- } else {
3124
- return IOStatus::NotSupported("Unrecognized value \"" + field_data +
3125
- "\" for field " + field_name);
3126
- }
3127
- } else if (StartsWith(field_name, kNonIgnorableFieldPrefix)) {
3128
- return IOStatus::NotSupported("Unrecognized non-ignorable file field " +
3129
- field_name + " (from future version?)");
3130
- } else {
3131
- // Warn the first time we see any particular unrecognized file field
3132
- if (reported_ignored_fields->insert("file:" + field_name).second) {
3133
- ROCKS_LOG_WARN(info_log, "Ignoring unrecognized backup file field %s",
3134
- field_name.c_str());
3135
- }
3136
- }
3137
- }
3138
-
3139
- if (excluded) {
3140
- excluded_files_.emplace_back(filename);
3141
- } else {
3142
- // Verify file exists, with expected size
3143
- std::string abs_path = backup_dir + "/" + filename;
3144
- auto e = abs_path_to_size.find(abs_path);
3145
- if (e == abs_path_to_size.end()) {
3146
- return IOStatus::Corruption(
3147
- "Pathname in meta file not found on disk: " + abs_path);
3148
- }
3149
- uint64_t actual_size = e->second;
3150
- if (expected_size.has_value() && *expected_size != actual_size) {
3151
- return IOStatus::Corruption("For file " + filename + " expected size " +
3152
- std::to_string(*expected_size) +
3153
- " but found size" +
3154
- std::to_string(actual_size));
3155
- }
3156
-
3157
- // NOTE: FileInfo will be coalesced for sharing later (AddFile below)
3158
- files.emplace_back(
3159
- std::make_shared<FileInfo>(filename, actual_size, checksum_hex,
3160
- /*id*/ "", /*sid*/ "", temp));
3161
- }
3162
- }
3163
-
3164
- if (footer_present) {
3165
- assert(schema_major_version >= 2);
3166
- while (backup_meta_reader->ReadLine(
3167
- &line, Env::IO_LOW /* rate_limiter_priority */)) {
3168
- if (line.empty()) {
3169
- return IOStatus::Corruption("Unexpected empty line");
3170
- }
3171
- auto space_pos = line.find_first_of(' ');
3172
- if (space_pos == std::string::npos) {
3173
- return IOStatus::Corruption("Expected footer field");
3174
- }
3175
- std::string field_name = line.substr(0, space_pos);
3176
- std::string field_data = line.substr(space_pos + 1);
3177
- if (StartsWith(field_name, kNonIgnorableFieldPrefix)) {
3178
- return IOStatus::NotSupported("Unrecognized non-ignorable field " +
3179
- field_name + " (from future version?)");
3180
- } else if (reported_ignored_fields->insert("footer:" + field_name)
3181
- .second) {
3182
- // Warn the first time we see any particular unrecognized footer field
3183
- ROCKS_LOG_WARN(info_log,
3184
- "Ignoring unrecognized backup meta footer field %s",
3185
- field_name.c_str());
3186
- }
3187
- }
3188
- }
3189
-
3190
- {
3191
- IOStatus io_s = backup_meta_reader->GetStatus();
3192
- if (!io_s.ok()) {
3193
- return io_s;
3194
- }
3195
- }
3196
-
3197
- if (num_files != files.size()) {
3198
- return IOStatus::Corruption(
3199
- "Inconsistent number of files or missing/incomplete header in " +
3200
- meta_filename_);
3201
- }
3202
-
3203
- files_.reserve(files.size());
3204
- for (const auto& file_info : files) {
3205
- IOStatus io_s = AddFile(file_info);
3206
- if (!io_s.ok()) {
3207
- return io_s;
3208
- }
3209
- }
3210
-
3211
- return IOStatus::OK();
3212
- }
3213
-
3214
- const std::vector<std::string> minor_version_strings{
3215
- "", // invalid major version 0
3216
- "", // implicit major version 1
3217
- "2.1",
3218
- };
3219
-
3220
- IOStatus BackupEngineImpl::BackupMeta::StoreToFile(
3221
- bool sync, int schema_version,
3222
- const TEST_BackupMetaSchemaOptions* schema_test_options) {
3223
- if (schema_version < 1) {
3224
- return IOStatus::InvalidArgument(
3225
- "BackupEngineOptions::schema_version must be >= 1");
3226
- }
3227
- if (schema_version > static_cast<int>(minor_version_strings.size() - 1)) {
3228
- return IOStatus::NotSupported(
3229
- "Only BackupEngineOptions::schema_version <= " +
3230
- std::to_string(minor_version_strings.size() - 1) + " is supported");
3231
- }
3232
- std::string ver = minor_version_strings[schema_version];
3233
-
3234
- // Need schema_version >= 2 for TEST_BackupMetaSchemaOptions
3235
- assert(schema_version >= 2 || schema_test_options == nullptr);
3236
-
3237
- IOStatus io_s;
3238
- std::unique_ptr<FSWritableFile> backup_meta_file;
3239
- FileOptions file_options;
3240
- file_options.use_mmap_writes = false;
3241
- file_options.use_direct_writes = false;
3242
- io_s = fs_->NewWritableFile(meta_tmp_filename_, file_options,
3243
- &backup_meta_file, nullptr);
3244
- if (!io_s.ok()) {
3245
- return io_s;
3246
- }
3247
-
3248
- std::ostringstream buf;
3249
- if (schema_test_options) {
3250
- // override for testing
3251
- ver = schema_test_options->version;
3252
- }
3253
- if (!ver.empty()) {
3254
- assert(schema_version >= 2);
3255
- buf << kSchemaVersionPrefix << ver << "\n";
3256
- }
3257
- buf << static_cast<unsigned long long>(timestamp_) << "\n";
3258
- buf << sequence_number_ << "\n";
3259
-
3260
- if (!app_metadata_.empty()) {
3261
- std::string hex_encoded_metadata =
3262
- Slice(app_metadata_).ToString(/* hex */ true);
3263
- buf << kAppMetaDataFieldName << " " << hex_encoded_metadata << "\n";
3264
- }
3265
- if (schema_test_options) {
3266
- for (auto& e : schema_test_options->meta_fields) {
3267
- buf << e.first << " " << e.second << "\n";
3268
- }
3269
- }
3270
- buf << files_.size() << "\n";
3271
-
3272
- for (const auto& file : files_) {
3273
- buf << file->filename;
3274
- if (schema_test_options == nullptr ||
3275
- schema_test_options->crc32c_checksums) {
3276
- // use crc32c for now, switch to something else if needed
3277
- buf << " " << kFileCrc32cFieldName << " "
3278
- << ChecksumHexToInt32(file->checksum_hex);
3279
- }
3280
- if (schema_version >= 2 && file->temp != Temperature::kUnknown) {
3281
- buf << " " << kTemperatureFieldName << " "
3282
- << temperature_to_string[file->temp];
3283
- }
3284
- if (schema_test_options && schema_test_options->file_sizes) {
3285
- buf << " " << kFileSizeFieldName << " " << std::to_string(file->size);
3286
- }
3287
- if (schema_test_options) {
3288
- for (auto& e : schema_test_options->file_fields) {
3289
- buf << " " << e.first << " " << e.second;
3290
- }
3291
- }
3292
- buf << "\n";
3293
- }
3294
-
3295
- for (const auto& file : excluded_files_) {
3296
- assert(schema_version >= 2);
3297
- buf << file.relative_file << " " << kExcludedFieldName << " true\n";
3298
- }
3299
-
3300
- if (schema_test_options && !schema_test_options->footer_fields.empty()) {
3301
- buf << kFooterMarker << "\n";
3302
- for (auto& e : schema_test_options->footer_fields) {
3303
- buf << e.first << " " << e.second << "\n";
3304
- }
3305
- }
3306
-
3307
- io_s = backup_meta_file->Append(Slice(buf.str()), iooptions_, nullptr);
3308
- IOSTATS_ADD(bytes_written, buf.str().size());
3309
- if (io_s.ok() && sync) {
3310
- io_s = backup_meta_file->Sync(iooptions_, nullptr);
3311
- }
3312
- if (io_s.ok()) {
3313
- io_s = backup_meta_file->Close(iooptions_, nullptr);
3314
- }
3315
- if (io_s.ok()) {
3316
- io_s = fs_->RenameFile(meta_tmp_filename_, meta_filename_, iooptions_,
3317
- nullptr);
3318
- }
3319
- return io_s;
3320
- }
3321
- } // namespace
3322
-
3323
- IOStatus BackupEngineReadOnly::Open(const BackupEngineOptions& options,
3324
- Env* env,
3325
- BackupEngineReadOnly** backup_engine_ptr) {
3326
- if (options.destroy_old_data) {
3327
- return IOStatus::InvalidArgument(
3328
- "Can't destroy old data with ReadOnly BackupEngine");
3329
- }
3330
- std::unique_ptr<BackupEngineImplThreadSafe> backup_engine(
3331
- new BackupEngineImplThreadSafe(options, env, true /*read_only*/));
3332
- auto s = backup_engine->Initialize();
3333
- if (!s.ok()) {
3334
- *backup_engine_ptr = nullptr;
3335
- return s;
3336
- }
3337
- *backup_engine_ptr = backup_engine.release();
3338
- return IOStatus::OK();
3339
- }
3340
-
3341
- void TEST_SetBackupMetaSchemaOptions(
3342
- BackupEngine* engine, const TEST_BackupMetaSchemaOptions& options) {
3343
- BackupEngineImplThreadSafe* impl =
3344
- static_cast_with_check<BackupEngineImplThreadSafe>(engine);
3345
- impl->TEST_SetBackupMetaSchemaOptions(options);
3346
- }
3347
-
3348
- void TEST_SetDefaultRateLimitersClock(
3349
- BackupEngine* engine,
3350
- const std::shared_ptr<SystemClock>& backup_rate_limiter_clock,
3351
- const std::shared_ptr<SystemClock>& restore_rate_limiter_clock) {
3352
- BackupEngineImplThreadSafe* impl =
3353
- static_cast_with_check<BackupEngineImplThreadSafe>(engine);
3354
- impl->TEST_SetDefaultRateLimitersClock(backup_rate_limiter_clock,
3355
- restore_rate_limiter_clock);
3356
- }
3357
- } // namespace ROCKSDB_NAMESPACE