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,3657 +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
- #include "cache/clock_cache.h"
11
-
12
- #include <algorithm>
13
- #include <atomic>
14
- #include <bitset>
15
- #include <cassert>
16
- #include <cinttypes>
17
- #include <cstddef>
18
- #include <cstdint>
19
- #include <exception>
20
- #include <functional>
21
- #include <numeric>
22
- #include <string>
23
- #include <thread>
24
- #include <type_traits>
25
-
26
- #include "cache/cache_key.h"
27
- #include "cache/secondary_cache_adapter.h"
28
- #include "logging/logging.h"
29
- #include "monitoring/perf_context_imp.h"
30
- #include "monitoring/statistics_impl.h"
31
- #include "port/lang.h"
32
- #include "rocksdb/env.h"
33
- #include "util/hash.h"
34
- #include "util/math.h"
35
- #include "util/random.h"
36
-
37
- namespace ROCKSDB_NAMESPACE {
38
-
39
- namespace clock_cache {
40
-
41
- namespace {
42
- inline uint64_t GetRefcount(uint64_t meta) {
43
- return ((meta >> ClockHandle::kAcquireCounterShift) -
44
- (meta >> ClockHandle::kReleaseCounterShift)) &
45
- ClockHandle::kCounterMask;
46
- }
47
-
48
- inline uint64_t GetInitialCountdown(Cache::Priority priority) {
49
- // Set initial clock data from priority
50
- // TODO: configuration parameters for priority handling and clock cycle
51
- // count?
52
- switch (priority) {
53
- case Cache::Priority::HIGH:
54
- return ClockHandle::kHighCountdown;
55
- case Cache::Priority::LOW:
56
- return ClockHandle::kLowCountdown;
57
- case Cache::Priority::BOTTOM:
58
- return ClockHandle::kBottomCountdown;
59
- }
60
- // Switch should have been exhaustive.
61
- assert(false);
62
- // For release build, fall back on something reasonable.
63
- return ClockHandle::kLowCountdown;
64
- }
65
-
66
- inline void MarkEmpty(ClockHandle& h) {
67
- #ifndef NDEBUG
68
- // Mark slot as empty, with assertion
69
- uint64_t meta = h.meta.Exchange(0);
70
- assert(meta >> ClockHandle::kStateShift == ClockHandle::kStateConstruction);
71
- #else
72
- // Mark slot as empty
73
- h.meta.Store(0);
74
- #endif
75
- }
76
-
77
- inline void FreeDataMarkEmpty(ClockHandle& h, MemoryAllocator* allocator) {
78
- // NOTE: in theory there's more room for parallelism if we copy the handle
79
- // data and delay actions like this until after marking the entry as empty,
80
- // but performance tests only show a regression by copying the few words
81
- // of data.
82
- h.FreeData(allocator);
83
-
84
- MarkEmpty(h);
85
- }
86
-
87
- // Called to undo the effect of referencing an entry for internal purposes,
88
- // so it should not be marked as having been used.
89
- inline void Unref(const ClockHandle& h, uint64_t count = 1) {
90
- // Pretend we never took the reference
91
- // WART: there's a tiny chance we release last ref to invisible
92
- // entry here. If that happens, we let eviction take care of it.
93
- uint64_t old_meta = h.meta.FetchSub(ClockHandle::kAcquireIncrement * count);
94
- assert(GetRefcount(old_meta) != 0);
95
- (void)old_meta;
96
- }
97
-
98
- inline bool ClockUpdate(ClockHandle& h, BaseClockTable::EvictionData* data,
99
- bool* purgeable = nullptr) {
100
- uint64_t meta;
101
- if (purgeable) {
102
- assert(*purgeable == false);
103
- // In AutoHCC, our eviction process follows the chain structure, so we
104
- // should ensure that we see the latest state of each entry, at least for
105
- // assertion checking.
106
- meta = h.meta.Load();
107
- } else {
108
- // In FixedHCC, our eviction process is a simple iteration without regard
109
- // to probing order, displacements, etc., so it doesn't matter if we see
110
- // somewhat stale data.
111
- meta = h.meta.LoadRelaxed();
112
- }
113
-
114
- if (((meta >> ClockHandle::kStateShift) & ClockHandle::kStateShareableBit) ==
115
- 0) {
116
- // Only clock update Shareable entries
117
- if (purgeable) {
118
- *purgeable = true;
119
- // AutoHCC only: make sure we only attempt to update non-empty slots
120
- assert((meta >> ClockHandle::kStateShift) &
121
- ClockHandle::kStateOccupiedBit);
122
- }
123
- return false;
124
- }
125
- uint64_t acquire_count =
126
- (meta >> ClockHandle::kAcquireCounterShift) & ClockHandle::kCounterMask;
127
- uint64_t release_count =
128
- (meta >> ClockHandle::kReleaseCounterShift) & ClockHandle::kCounterMask;
129
- if (acquire_count != release_count) {
130
- // Only clock update entries with no outstanding refs
131
- data->seen_pinned_count++;
132
- return false;
133
- }
134
- if ((meta >> ClockHandle::kStateShift == ClockHandle::kStateVisible) &&
135
- acquire_count > 0) {
136
- // Decrement clock
137
- uint64_t new_count =
138
- std::min(acquire_count - 1, uint64_t{ClockHandle::kMaxCountdown} - 1);
139
- // Compare-exchange in the decremented clock info, but
140
- // not aggressively
141
- uint64_t new_meta =
142
- (uint64_t{ClockHandle::kStateVisible} << ClockHandle::kStateShift) |
143
- (meta & ClockHandle::kHitBitMask) |
144
- (new_count << ClockHandle::kReleaseCounterShift) |
145
- (new_count << ClockHandle::kAcquireCounterShift);
146
- h.meta.CasStrongRelaxed(meta, new_meta);
147
- return false;
148
- }
149
- // Otherwise, remove entry (either unreferenced invisible or
150
- // unreferenced and expired visible).
151
- if (h.meta.CasStrong(meta, (uint64_t{ClockHandle::kStateConstruction}
152
- << ClockHandle::kStateShift) |
153
- (meta & ClockHandle::kHitBitMask))) {
154
- // Took ownership.
155
- data->freed_charge += h.GetTotalCharge();
156
- data->freed_count += 1;
157
- return true;
158
- } else {
159
- // Compare-exchange failing probably
160
- // indicates the entry was used, so skip it in that case.
161
- return false;
162
- }
163
- }
164
-
165
- // If an entry doesn't receive clock updates but is repeatedly referenced &
166
- // released, the acquire and release counters could overflow without some
167
- // intervention. This is that intervention, which should be inexpensive
168
- // because it only incurs a simple, very predictable check. (Applying a bit
169
- // mask in addition to an increment to every Release likely would be
170
- // relatively expensive, because it's an extra atomic update.)
171
- //
172
- // We do have to assume that we never have many millions of simultaneous
173
- // references to a cache handle, because we cannot represent so many
174
- // references with the difference in counters, masked to the number of
175
- // counter bits. Similarly, we assume there aren't millions of threads
176
- // holding transient references (which might be "undone" rather than
177
- // released by the way).
178
- //
179
- // Consider these possible states for each counter:
180
- // low: less than kMaxCountdown
181
- // medium: kMaxCountdown to half way to overflow + kMaxCountdown
182
- // high: half way to overflow + kMaxCountdown, or greater
183
- //
184
- // And these possible states for the combination of counters:
185
- // acquire / release
186
- // ------- -------
187
- // low low - Normal / common, with caveats (see below)
188
- // medium low - Can happen while holding some refs
189
- // high low - Violates assumptions (too many refs)
190
- // low medium - Violates assumptions (refs underflow, etc.)
191
- // medium medium - Normal (very read heavy cache)
192
- // high medium - Can happen while holding some refs
193
- // low high - This function is supposed to prevent
194
- // medium high - Violates assumptions (refs underflow, etc.)
195
- // high high - Needs CorrectNearOverflow
196
- //
197
- // Basically, this function detects (high, high) state (inferred from
198
- // release alone being high) and bumps it back down to (medium, medium)
199
- // state with the same refcount and the same logical countdown counter
200
- // (everything > kMaxCountdown is logically the same). Note that bumping
201
- // down to (low, low) would modify the countdown counter, so is "reserved"
202
- // in a sense.
203
- //
204
- // If near-overflow correction is triggered here, there's no guarantee
205
- // that another thread hasn't freed the entry and replaced it with another.
206
- // Therefore, it must be the case that the correction does not affect
207
- // entries unless they are very old (many millions of acquire-release cycles).
208
- // (Our bit manipulation is indeed idempotent and only affects entries in
209
- // exceptional cases.) We assume a pre-empted thread will not stall that long.
210
- // If it did, the state could be corrupted in the (unlikely) case that the top
211
- // bit of the acquire counter is set but not the release counter, and thus
212
- // we only clear the top bit of the acquire counter on resumption. It would
213
- // then appear that there are too many refs and the entry would be permanently
214
- // pinned (which is not terrible for an exceptionally rare occurrence), unless
215
- // it is referenced enough (at least kMaxCountdown more times) for the release
216
- // counter to reach "high" state again and bumped back to "medium." (This
217
- // motivates only checking for release counter in high state, not both in high
218
- // state.)
219
- inline void CorrectNearOverflow(uint64_t old_meta,
220
- AcqRelAtomic<uint64_t>& meta) {
221
- // We clear both top-most counter bits at the same time.
222
- constexpr uint64_t kCounterTopBit = uint64_t{1}
223
- << (ClockHandle::kCounterNumBits - 1);
224
- constexpr uint64_t kClearBits =
225
- (kCounterTopBit << ClockHandle::kAcquireCounterShift) |
226
- (kCounterTopBit << ClockHandle::kReleaseCounterShift);
227
- // A simple check that allows us to initiate clearing the top bits for
228
- // a large portion of the "high" state space on release counter.
229
- constexpr uint64_t kCheckBits =
230
- (kCounterTopBit | (ClockHandle::kMaxCountdown + 1))
231
- << ClockHandle::kReleaseCounterShift;
232
-
233
- if (UNLIKELY(old_meta & kCheckBits)) {
234
- meta.FetchAndRelaxed(~kClearBits);
235
- }
236
- }
237
-
238
- inline bool BeginSlotInsert(const ClockHandleBasicData& proto, ClockHandle& h,
239
- uint64_t initial_countdown, bool* already_matches) {
240
- assert(*already_matches == false);
241
- // Optimistically transition the slot from "empty" to
242
- // "under construction" (no effect on other states)
243
- uint64_t old_meta = h.meta.FetchOr(uint64_t{ClockHandle::kStateOccupiedBit}
244
- << ClockHandle::kStateShift);
245
- uint64_t old_state = old_meta >> ClockHandle::kStateShift;
246
-
247
- if (old_state == ClockHandle::kStateEmpty) {
248
- // We've started inserting into an available slot, and taken
249
- // ownership.
250
- return true;
251
- } else if (old_state != ClockHandle::kStateVisible) {
252
- // Slot not usable / touchable now
253
- return false;
254
- }
255
- // Existing, visible entry, which might be a match.
256
- // But first, we need to acquire a ref to read it. In fact, number of
257
- // refs for initial countdown, so that we boost the clock state if
258
- // this is a match.
259
- old_meta =
260
- h.meta.FetchAdd(ClockHandle::kAcquireIncrement * initial_countdown);
261
- // Like Lookup
262
- if ((old_meta >> ClockHandle::kStateShift) == ClockHandle::kStateVisible) {
263
- // Acquired a read reference
264
- if (h.hashed_key == proto.hashed_key) {
265
- // Match. Release in a way that boosts the clock state
266
- old_meta =
267
- h.meta.FetchAdd(ClockHandle::kReleaseIncrement * initial_countdown);
268
- // Correct for possible (but rare) overflow
269
- CorrectNearOverflow(old_meta, h.meta);
270
- // Insert detached instead (only if return handle needed)
271
- *already_matches = true;
272
- return false;
273
- } else {
274
- // Mismatch.
275
- Unref(h, initial_countdown);
276
- }
277
- } else if (UNLIKELY((old_meta >> ClockHandle::kStateShift) ==
278
- ClockHandle::kStateInvisible)) {
279
- // Pretend we never took the reference
280
- Unref(h, initial_countdown);
281
- } else {
282
- // For other states, incrementing the acquire counter has no effect
283
- // so we don't need to undo it.
284
- // Slot not usable / touchable now.
285
- }
286
- return false;
287
- }
288
-
289
- inline void FinishSlotInsert(const ClockHandleBasicData& proto, ClockHandle& h,
290
- uint64_t initial_countdown, bool keep_ref) {
291
- // Save data fields
292
- ClockHandleBasicData* h_alias = &h;
293
- *h_alias = proto;
294
-
295
- // Transition from "under construction" state to "visible" state
296
- uint64_t new_meta = uint64_t{ClockHandle::kStateVisible}
297
- << ClockHandle::kStateShift;
298
-
299
- // Maybe with an outstanding reference
300
- new_meta |= initial_countdown << ClockHandle::kAcquireCounterShift;
301
- new_meta |= (initial_countdown - keep_ref)
302
- << ClockHandle::kReleaseCounterShift;
303
-
304
- #ifndef NDEBUG
305
- // Save the state transition, with assertion
306
- uint64_t old_meta = h.meta.Exchange(new_meta);
307
- assert(old_meta >> ClockHandle::kStateShift ==
308
- ClockHandle::kStateConstruction);
309
- #else
310
- // Save the state transition
311
- h.meta.Store(new_meta);
312
- #endif
313
- }
314
-
315
- bool TryInsert(const ClockHandleBasicData& proto, ClockHandle& h,
316
- uint64_t initial_countdown, bool keep_ref,
317
- bool* already_matches) {
318
- bool b = BeginSlotInsert(proto, h, initial_countdown, already_matches);
319
- if (b) {
320
- FinishSlotInsert(proto, h, initial_countdown, keep_ref);
321
- }
322
- return b;
323
- }
324
-
325
- // Func must be const HandleImpl& -> void callable
326
- template <class HandleImpl, class Func>
327
- void ConstApplyToEntriesRange(const Func& func, const HandleImpl* begin,
328
- const HandleImpl* end,
329
- bool apply_if_will_be_deleted) {
330
- uint64_t check_state_mask = ClockHandle::kStateShareableBit;
331
- if (!apply_if_will_be_deleted) {
332
- check_state_mask |= ClockHandle::kStateVisibleBit;
333
- }
334
-
335
- for (const HandleImpl* h = begin; h < end; ++h) {
336
- // Note: to avoid using compare_exchange, we have to be extra careful.
337
- uint64_t old_meta = h->meta.LoadRelaxed();
338
- // Check if it's an entry visible to lookups
339
- if ((old_meta >> ClockHandle::kStateShift) & check_state_mask) {
340
- // Increment acquire counter. Note: it's possible that the entry has
341
- // completely changed since we loaded old_meta, but incrementing acquire
342
- // count is always safe. (Similar to optimistic Lookup here.)
343
- old_meta = h->meta.FetchAdd(ClockHandle::kAcquireIncrement);
344
- // Check whether we actually acquired a reference.
345
- if ((old_meta >> ClockHandle::kStateShift) &
346
- ClockHandle::kStateShareableBit) {
347
- // Apply func if appropriate
348
- if ((old_meta >> ClockHandle::kStateShift) & check_state_mask) {
349
- func(*h);
350
- }
351
- // Pretend we never took the reference
352
- Unref(*h);
353
- // No net change, so don't need to check for overflow
354
- } else {
355
- // For other states, incrementing the acquire counter has no effect
356
- // so we don't need to undo it. Furthermore, we cannot safely undo
357
- // it because we did not acquire a read reference to lock the
358
- // entry in a Shareable state.
359
- }
360
- }
361
- }
362
- }
363
-
364
- constexpr uint32_t kStrictCapacityLimitBit = 1u << 31;
365
-
366
- uint32_t SanitizeEncodeEecAndScl(int eviction_effort_cap,
367
- bool strict_capacit_limit) {
368
- eviction_effort_cap = std::max(int{1}, eviction_effort_cap);
369
- eviction_effort_cap =
370
- std::min(static_cast<int>(~kStrictCapacityLimitBit), eviction_effort_cap);
371
- uint32_t eec_and_scl = static_cast<uint32_t>(eviction_effort_cap);
372
- eec_and_scl |= strict_capacit_limit ? kStrictCapacityLimitBit : 0;
373
- return eec_and_scl;
374
- }
375
-
376
- } // namespace
377
-
378
- void ClockHandleBasicData::FreeData(MemoryAllocator* allocator) const {
379
- if (helper->del_cb) {
380
- helper->del_cb(value, allocator);
381
- }
382
- }
383
-
384
- template <class HandleImpl>
385
- HandleImpl* BaseClockTable::StandaloneInsert(
386
- const ClockHandleBasicData& proto) {
387
- // Heap allocated separate from table
388
- HandleImpl* h = new HandleImpl();
389
- ClockHandleBasicData* h_alias = h;
390
- *h_alias = proto;
391
- h->SetStandalone();
392
- // Single reference (standalone entries only created if returning a refed
393
- // Handle back to user)
394
- uint64_t meta = uint64_t{ClockHandle::kStateInvisible}
395
- << ClockHandle::kStateShift;
396
- meta |= uint64_t{1} << ClockHandle::kAcquireCounterShift;
397
- h->meta.Store(meta);
398
- // Keep track of how much of usage is standalone
399
- standalone_usage_.FetchAddRelaxed(proto.GetTotalCharge());
400
- return h;
401
- }
402
-
403
- template <class Table>
404
- typename Table::HandleImpl* BaseClockTable::CreateStandalone(
405
- ClockHandleBasicData& proto, size_t capacity, uint32_t eec_and_scl,
406
- bool allow_uncharged) {
407
- Table& derived = static_cast<Table&>(*this);
408
- typename Table::InsertState state;
409
- derived.StartInsert(state);
410
-
411
- const size_t total_charge = proto.GetTotalCharge();
412
- // NOTE: we can use eec_and_scl as eviction_effort_cap below because
413
- // strict_capacity_limit=true is supposed to disable the limit on eviction
414
- // effort, and a large value effectively does that.
415
- if (eec_and_scl & kStrictCapacityLimitBit) {
416
- Status s = ChargeUsageMaybeEvictStrict<Table>(
417
- total_charge, capacity,
418
- /*need_evict_for_occupancy=*/false, eec_and_scl, state);
419
- if (!s.ok()) {
420
- if (allow_uncharged) {
421
- proto.total_charge = 0;
422
- } else {
423
- return nullptr;
424
- }
425
- }
426
- } else {
427
- // Case strict_capacity_limit == false
428
- bool success = ChargeUsageMaybeEvictNonStrict<Table>(
429
- total_charge, capacity,
430
- /*need_evict_for_occupancy=*/false, eec_and_scl, state);
431
- if (!success) {
432
- // Force the issue
433
- usage_.FetchAddRelaxed(total_charge);
434
- }
435
- }
436
-
437
- return StandaloneInsert<typename Table::HandleImpl>(proto);
438
- }
439
-
440
- template <class Table>
441
- Status BaseClockTable::ChargeUsageMaybeEvictStrict(
442
- size_t total_charge, size_t capacity, bool need_evict_for_occupancy,
443
- uint32_t eviction_effort_cap, typename Table::InsertState& state) {
444
- if (total_charge > capacity) {
445
- return Status::MemoryLimit(
446
- "Cache entry too large for a single cache shard: " +
447
- std::to_string(total_charge) + " > " + std::to_string(capacity));
448
- }
449
- // Grab any available capacity, and free up any more required.
450
- size_t old_usage = usage_.LoadRelaxed();
451
- size_t new_usage;
452
- do {
453
- new_usage = std::min(capacity, old_usage + total_charge);
454
- if (new_usage == old_usage) {
455
- // No change needed
456
- break;
457
- }
458
- } while (!usage_.CasWeakRelaxed(old_usage, new_usage));
459
- // How much do we need to evict then?
460
- size_t need_evict_charge = old_usage + total_charge - new_usage;
461
- size_t request_evict_charge = need_evict_charge;
462
- if (UNLIKELY(need_evict_for_occupancy) && request_evict_charge == 0) {
463
- // Require at least 1 eviction.
464
- request_evict_charge = 1;
465
- }
466
- if (request_evict_charge > 0) {
467
- EvictionData data;
468
- static_cast<Table*>(this)->Evict(request_evict_charge, state, &data,
469
- eviction_effort_cap);
470
- occupancy_.FetchSub(data.freed_count);
471
- if (LIKELY(data.freed_charge > need_evict_charge)) {
472
- assert(data.freed_count > 0);
473
- // Evicted more than enough
474
- usage_.FetchSubRelaxed(data.freed_charge - need_evict_charge);
475
- } else if (data.freed_charge < need_evict_charge ||
476
- (UNLIKELY(need_evict_for_occupancy) && data.freed_count == 0)) {
477
- // Roll back to old usage minus evicted
478
- usage_.FetchSubRelaxed(data.freed_charge + (new_usage - old_usage));
479
- if (data.freed_charge < need_evict_charge) {
480
- return Status::MemoryLimit(
481
- "Insert failed because unable to evict entries to stay within "
482
- "capacity limit.");
483
- } else {
484
- return Status::MemoryLimit(
485
- "Insert failed because unable to evict entries to stay within "
486
- "table occupancy limit.");
487
- }
488
- }
489
- // If we needed to evict something and we are proceeding, we must have
490
- // evicted something.
491
- assert(data.freed_count > 0);
492
- }
493
- return Status::OK();
494
- }
495
-
496
- template <class Table>
497
- inline bool BaseClockTable::ChargeUsageMaybeEvictNonStrict(
498
- size_t total_charge, size_t capacity, bool need_evict_for_occupancy,
499
- uint32_t eviction_effort_cap, typename Table::InsertState& state) {
500
- // For simplicity, we consider that either the cache can accept the insert
501
- // with no evictions, or we must evict enough to make (at least) enough
502
- // space. It could lead to unnecessary failures or excessive evictions in
503
- // some extreme cases, but allows a fast, simple protocol. If we allow a
504
- // race to get us over capacity, then we might never get back to capacity
505
- // limit if the sizes of entries allow each insertion to evict the minimum
506
- // charge. Thus, we should evict some extra if it's not a signifcant
507
- // portion of the shard capacity. This can have the side benefit of
508
- // involving fewer threads in eviction.
509
- size_t old_usage = usage_.LoadRelaxed();
510
- size_t need_evict_charge;
511
- // NOTE: if total_charge > old_usage, there isn't yet enough to evict
512
- // `total_charge` amount. Even if we only try to evict `old_usage` amount,
513
- // there's likely something referenced and we would eat CPU looking for
514
- // enough to evict.
515
- if (old_usage + total_charge <= capacity || total_charge > old_usage) {
516
- // Good enough for me (might run over with a race)
517
- need_evict_charge = 0;
518
- } else {
519
- // Try to evict enough space, and maybe some extra
520
- need_evict_charge = total_charge;
521
- if (old_usage > capacity) {
522
- // Not too much to avoid thundering herd while avoiding strict
523
- // synchronization, such as the compare_exchange used with strict
524
- // capacity limit.
525
- need_evict_charge += std::min(capacity / 1024, total_charge) + 1;
526
- }
527
- }
528
- if (UNLIKELY(need_evict_for_occupancy) && need_evict_charge == 0) {
529
- // Special case: require at least 1 eviction if we only have to
530
- // deal with occupancy
531
- need_evict_charge = 1;
532
- }
533
- EvictionData data;
534
- if (need_evict_charge > 0) {
535
- static_cast<Table*>(this)->Evict(need_evict_charge, state, &data,
536
- eviction_effort_cap);
537
- // Deal with potential occupancy deficit
538
- if (UNLIKELY(need_evict_for_occupancy) && data.freed_count == 0) {
539
- assert(data.freed_charge == 0);
540
- // Can't meet occupancy requirement
541
- return false;
542
- } else {
543
- // Update occupancy for evictions
544
- occupancy_.FetchSub(data.freed_count);
545
- }
546
- }
547
- // Track new usage even if we weren't able to evict enough
548
- usage_.FetchAddRelaxed(total_charge - data.freed_charge);
549
- // No underflow
550
- assert(usage_.LoadRelaxed() < SIZE_MAX / 2);
551
- // Success
552
- return true;
553
- }
554
-
555
- void BaseClockTable::TrackAndReleaseEvictedEntry(ClockHandle* h) {
556
- bool took_value_ownership = false;
557
- if (eviction_callback_) {
558
- // For key reconstructed from hash
559
- UniqueId64x2 unhashed;
560
- took_value_ownership =
561
- eviction_callback_(ClockCacheShard<FixedHyperClockTable>::ReverseHash(
562
- h->GetHash(), &unhashed, hash_seed_),
563
- static_cast<Cache::Handle*>(h),
564
- h->meta.LoadRelaxed() & ClockHandle::kHitBitMask);
565
- }
566
- if (!took_value_ownership) {
567
- h->FreeData(allocator_);
568
- }
569
- MarkEmpty(*h);
570
- }
571
-
572
- bool IsEvictionEffortExceeded(const BaseClockTable::EvictionData& data,
573
- uint32_t eviction_effort_cap) {
574
- // Basically checks whether the ratio of useful effort to wasted effort is
575
- // too low, with a start-up allowance for wasted effort before any useful
576
- // effort.
577
- return (data.freed_count + 1U) * uint64_t{eviction_effort_cap} <=
578
- data.seen_pinned_count;
579
- }
580
-
581
- template <class Table>
582
- Status BaseClockTable::Insert(const ClockHandleBasicData& proto,
583
- typename Table::HandleImpl** handle,
584
- Cache::Priority priority, size_t capacity,
585
- uint32_t eec_and_scl) {
586
- using HandleImpl = typename Table::HandleImpl;
587
- Table& derived = static_cast<Table&>(*this);
588
-
589
- typename Table::InsertState state;
590
- derived.StartInsert(state);
591
-
592
- // Do we have the available occupancy? Optimistically assume we do
593
- // and deal with it if we don't.
594
- size_t old_occupancy = occupancy_.FetchAdd(1);
595
- // Whether we over-committed and need an eviction to make up for it
596
- bool need_evict_for_occupancy =
597
- !derived.GrowIfNeeded(old_occupancy + 1, state);
598
-
599
- // Usage/capacity handling is somewhat different depending on
600
- // strict_capacity_limit, but mostly pessimistic.
601
- bool use_standalone_insert = false;
602
- const size_t total_charge = proto.GetTotalCharge();
603
- // NOTE: we can use eec_and_scl as eviction_effort_cap below because
604
- // strict_capacity_limit=true is supposed to disable the limit on eviction
605
- // effort, and a large value effectively does that.
606
- if (eec_and_scl & kStrictCapacityLimitBit) {
607
- Status s = ChargeUsageMaybeEvictStrict<Table>(
608
- total_charge, capacity, need_evict_for_occupancy, eec_and_scl, state);
609
- if (!s.ok()) {
610
- // Revert occupancy
611
- occupancy_.FetchSubRelaxed(1);
612
- return s;
613
- }
614
- } else {
615
- // Case strict_capacity_limit == false
616
- bool success = ChargeUsageMaybeEvictNonStrict<Table>(
617
- total_charge, capacity, need_evict_for_occupancy, eec_and_scl, state);
618
- if (!success) {
619
- // Revert occupancy
620
- occupancy_.FetchSubRelaxed(1);
621
- if (handle == nullptr) {
622
- // Don't insert the entry but still return ok, as if the entry
623
- // inserted into cache and evicted immediately.
624
- proto.FreeData(allocator_);
625
- return Status::OK();
626
- } else {
627
- // Need to track usage of fallback standalone insert
628
- usage_.FetchAddRelaxed(total_charge);
629
- use_standalone_insert = true;
630
- }
631
- }
632
- }
633
-
634
- if (!use_standalone_insert) {
635
- // Attempt a table insert, but abort if we find an existing entry for the
636
- // key. If we were to overwrite old entries, we would either
637
- // * Have to gain ownership over an existing entry to overwrite it, which
638
- // would only work if there are no outstanding (read) references and would
639
- // create a small gap in availability of the entry (old or new) to lookups.
640
- // * Have to insert into a suboptimal location (more probes) so that the
641
- // old entry can be kept around as well.
642
-
643
- uint64_t initial_countdown = GetInitialCountdown(priority);
644
- assert(initial_countdown > 0);
645
-
646
- HandleImpl* e =
647
- derived.DoInsert(proto, initial_countdown, handle != nullptr, state);
648
-
649
- if (e) {
650
- // Successfully inserted
651
- if (handle) {
652
- *handle = e;
653
- }
654
- return Status::OK();
655
- }
656
- // Not inserted
657
- // Revert occupancy
658
- occupancy_.FetchSubRelaxed(1);
659
- // Maybe fall back on standalone insert
660
- if (handle == nullptr) {
661
- // Revert usage
662
- usage_.FetchSubRelaxed(total_charge);
663
- // No underflow
664
- assert(usage_.LoadRelaxed() < SIZE_MAX / 2);
665
- // As if unrefed entry immdiately evicted
666
- proto.FreeData(allocator_);
667
- return Status::OK();
668
- }
669
-
670
- use_standalone_insert = true;
671
- }
672
-
673
- // Run standalone insert
674
- assert(use_standalone_insert);
675
-
676
- *handle = StandaloneInsert<HandleImpl>(proto);
677
-
678
- // The OkOverwritten status is used to count "redundant" insertions into
679
- // block cache. This implementation doesn't strictly check for redundant
680
- // insertions, but we instead are probably interested in how many insertions
681
- // didn't go into the table (instead "standalone"), which could be redundant
682
- // Insert or some other reason (use_standalone_insert reasons above).
683
- return Status::OkOverwritten();
684
- }
685
-
686
- void BaseClockTable::Ref(ClockHandle& h) {
687
- // Increment acquire counter
688
- uint64_t old_meta = h.meta.FetchAdd(ClockHandle::kAcquireIncrement);
689
-
690
- assert((old_meta >> ClockHandle::kStateShift) &
691
- ClockHandle::kStateShareableBit);
692
- // Must have already had a reference
693
- assert(GetRefcount(old_meta) > 0);
694
- (void)old_meta;
695
- }
696
-
697
- #ifndef NDEBUG
698
- void BaseClockTable::TEST_RefN(ClockHandle& h, size_t n) {
699
- // Increment acquire counter
700
- uint64_t old_meta = h.meta.FetchAdd(n * ClockHandle::kAcquireIncrement);
701
-
702
- assert((old_meta >> ClockHandle::kStateShift) &
703
- ClockHandle::kStateShareableBit);
704
- (void)old_meta;
705
- }
706
-
707
- void BaseClockTable::TEST_ReleaseNMinus1(ClockHandle* h, size_t n) {
708
- assert(n > 0);
709
-
710
- // Like n-1 Releases, but assumes one more will happen in the caller to take
711
- // care of anything like erasing an unreferenced, invisible entry.
712
- uint64_t old_meta =
713
- h->meta.FetchAdd((n - 1) * ClockHandle::kReleaseIncrement);
714
- assert((old_meta >> ClockHandle::kStateShift) &
715
- ClockHandle::kStateShareableBit);
716
- (void)old_meta;
717
- }
718
- #endif
719
-
720
- FixedHyperClockTable::FixedHyperClockTable(
721
- size_t capacity, CacheMetadataChargePolicy metadata_charge_policy,
722
- MemoryAllocator* allocator,
723
- const Cache::EvictionCallback* eviction_callback, const uint32_t* hash_seed,
724
- const Opts& opts)
725
- : BaseClockTable(metadata_charge_policy, allocator, eviction_callback,
726
- hash_seed),
727
- length_bits_(CalcHashBits(capacity, opts.estimated_value_size,
728
- metadata_charge_policy)),
729
- length_bits_mask_((size_t{1} << length_bits_) - 1),
730
- occupancy_limit_(static_cast<size_t>((uint64_t{1} << length_bits_) *
731
- kStrictLoadFactor)),
732
- array_(new HandleImpl[size_t{1} << length_bits_]) {
733
- if (metadata_charge_policy ==
734
- CacheMetadataChargePolicy::kFullChargeCacheMetadata) {
735
- usage_.FetchAddRelaxed(size_t{GetTableSize()} * sizeof(HandleImpl));
736
- }
737
-
738
- static_assert(sizeof(HandleImpl) == 64U,
739
- "Expecting size / alignment with common cache line size");
740
- }
741
-
742
- FixedHyperClockTable::~FixedHyperClockTable() {
743
- // Assumes there are no references or active operations on any slot/element
744
- // in the table.
745
- for (size_t i = 0; i < GetTableSize(); i++) {
746
- HandleImpl& h = array_[i];
747
- switch (h.meta.LoadRelaxed() >> ClockHandle::kStateShift) {
748
- case ClockHandle::kStateEmpty:
749
- // noop
750
- break;
751
- case ClockHandle::kStateInvisible: // rare but possible
752
- case ClockHandle::kStateVisible:
753
- assert(GetRefcount(h.meta.LoadRelaxed()) == 0);
754
- h.FreeData(allocator_);
755
- #ifndef NDEBUG
756
- Rollback(h.hashed_key, &h);
757
- ReclaimEntryUsage(h.GetTotalCharge());
758
- #endif
759
- break;
760
- // otherwise
761
- default:
762
- assert(false);
763
- break;
764
- }
765
- }
766
-
767
- #ifndef NDEBUG
768
- for (size_t i = 0; i < GetTableSize(); i++) {
769
- assert(array_[i].displacements.LoadRelaxed() == 0);
770
- }
771
- #endif
772
-
773
- assert(usage_.LoadRelaxed() == 0 ||
774
- usage_.LoadRelaxed() == size_t{GetTableSize()} * sizeof(HandleImpl));
775
- assert(occupancy_.LoadRelaxed() == 0);
776
- }
777
-
778
- void FixedHyperClockTable::StartInsert(InsertState&) {}
779
-
780
- bool FixedHyperClockTable::GrowIfNeeded(size_t new_occupancy, InsertState&) {
781
- return new_occupancy <= occupancy_limit_;
782
- }
783
-
784
- FixedHyperClockTable::HandleImpl* FixedHyperClockTable::DoInsert(
785
- const ClockHandleBasicData& proto, uint64_t initial_countdown,
786
- bool keep_ref, InsertState&) {
787
- bool already_matches = false;
788
- HandleImpl* e = FindSlot(
789
- proto.hashed_key,
790
- [&](HandleImpl* h) {
791
- return TryInsert(proto, *h, initial_countdown, keep_ref,
792
- &already_matches);
793
- },
794
- [&](HandleImpl* h) {
795
- if (already_matches) {
796
- // Stop searching & roll back displacements
797
- Rollback(proto.hashed_key, h);
798
- return true;
799
- } else {
800
- // Keep going
801
- return false;
802
- }
803
- },
804
- [&](HandleImpl* h, bool is_last) {
805
- if (is_last) {
806
- // Search is ending. Roll back displacements
807
- Rollback(proto.hashed_key, h);
808
- } else {
809
- h->displacements.FetchAddRelaxed(1);
810
- }
811
- });
812
- if (already_matches) {
813
- // Insertion skipped
814
- return nullptr;
815
- }
816
- if (e != nullptr) {
817
- // Successfully inserted
818
- return e;
819
- }
820
- // Else, no available slot found. Occupancy check should generally prevent
821
- // this, except it's theoretically possible for other threads to evict and
822
- // replace entries in the right order to hit every slot when it is populated.
823
- // Assuming random hashing, the chance of that should be no higher than
824
- // pow(kStrictLoadFactor, n) for n slots. That should be infeasible for
825
- // roughly n >= 256, so if this assertion fails, that suggests something is
826
- // going wrong.
827
- assert(GetTableSize() < 256);
828
- return nullptr;
829
- }
830
-
831
- FixedHyperClockTable::HandleImpl* FixedHyperClockTable::Lookup(
832
- const UniqueId64x2& hashed_key) {
833
- HandleImpl* e = FindSlot(
834
- hashed_key,
835
- [&](HandleImpl* h) {
836
- // Mostly branch-free version (similar performance)
837
- /*
838
- uint64_t old_meta = h->meta.FetchAdd(ClockHandle::kAcquireIncrement,
839
- std::memory_order_acquire);
840
- bool Shareable = (old_meta >> (ClockHandle::kStateShift + 1)) & 1U;
841
- bool visible = (old_meta >> ClockHandle::kStateShift) & 1U;
842
- bool match = (h->key == key) & visible;
843
- h->meta.FetchSub(static_cast<uint64_t>(Shareable & !match) <<
844
- ClockHandle::kAcquireCounterShift); return
845
- match;
846
- */
847
- // Optimistic lookup should pay off when the table is relatively
848
- // sparse.
849
- constexpr bool kOptimisticLookup = true;
850
- uint64_t old_meta;
851
- if (!kOptimisticLookup) {
852
- old_meta = h->meta.Load();
853
- if ((old_meta >> ClockHandle::kStateShift) !=
854
- ClockHandle::kStateVisible) {
855
- return false;
856
- }
857
- }
858
- // (Optimistically) increment acquire counter
859
- old_meta = h->meta.FetchAdd(ClockHandle::kAcquireIncrement);
860
- // Check if it's an entry visible to lookups
861
- if ((old_meta >> ClockHandle::kStateShift) ==
862
- ClockHandle::kStateVisible) {
863
- // Acquired a read reference
864
- if (h->hashed_key == hashed_key) {
865
- // Match
866
- // Update the hit bit
867
- if (eviction_callback_) {
868
- h->meta.FetchOrRelaxed(uint64_t{1} << ClockHandle::kHitBitShift);
869
- }
870
- return true;
871
- } else {
872
- // Mismatch. Pretend we never took the reference
873
- Unref(*h);
874
- }
875
- } else if (UNLIKELY((old_meta >> ClockHandle::kStateShift) ==
876
- ClockHandle::kStateInvisible)) {
877
- // Pretend we never took the reference
878
- Unref(*h);
879
- } else {
880
- // For other states, incrementing the acquire counter has no effect
881
- // so we don't need to undo it. Furthermore, we cannot safely undo
882
- // it because we did not acquire a read reference to lock the
883
- // entry in a Shareable state.
884
- }
885
- return false;
886
- },
887
- [&](HandleImpl* h) { return h->displacements.LoadRelaxed() == 0; },
888
- [&](HandleImpl* /*h*/, bool /*is_last*/) {});
889
-
890
- return e;
891
- }
892
-
893
- bool FixedHyperClockTable::Release(HandleImpl* h, bool useful,
894
- bool erase_if_last_ref) {
895
- // In contrast with LRUCache's Release, this function won't delete the handle
896
- // when the cache is above capacity and the reference is the last one. Space
897
- // is only freed up by EvictFromClock (called by Insert when space is needed)
898
- // and Erase. We do this to avoid an extra atomic read of the variable usage_.
899
-
900
- uint64_t old_meta;
901
- if (useful) {
902
- // Increment release counter to indicate was used
903
- old_meta = h->meta.FetchAdd(ClockHandle::kReleaseIncrement);
904
- } else {
905
- // Decrement acquire counter to pretend it never happened
906
- old_meta = h->meta.FetchSub(ClockHandle::kAcquireIncrement);
907
- }
908
-
909
- assert((old_meta >> ClockHandle::kStateShift) &
910
- ClockHandle::kStateShareableBit);
911
- // No underflow
912
- assert(((old_meta >> ClockHandle::kAcquireCounterShift) &
913
- ClockHandle::kCounterMask) !=
914
- ((old_meta >> ClockHandle::kReleaseCounterShift) &
915
- ClockHandle::kCounterMask));
916
-
917
- if (erase_if_last_ref || UNLIKELY(old_meta >> ClockHandle::kStateShift ==
918
- ClockHandle::kStateInvisible)) {
919
- // FIXME: There's a chance here that another thread could replace this
920
- // entry and we end up erasing the wrong one.
921
-
922
- // Update for last FetchAdd op
923
- if (useful) {
924
- old_meta += ClockHandle::kReleaseIncrement;
925
- } else {
926
- old_meta -= ClockHandle::kAcquireIncrement;
927
- }
928
- // Take ownership if no refs
929
- do {
930
- if (GetRefcount(old_meta) != 0) {
931
- // Not last ref at some point in time during this Release call
932
- // Correct for possible (but rare) overflow
933
- CorrectNearOverflow(old_meta, h->meta);
934
- return false;
935
- }
936
- if ((old_meta & (uint64_t{ClockHandle::kStateShareableBit}
937
- << ClockHandle::kStateShift)) == 0) {
938
- // Someone else took ownership
939
- return false;
940
- }
941
- // Note that there's a small chance that we release, another thread
942
- // replaces this entry with another, reaches zero refs, and then we end
943
- // up erasing that other entry. That's an acceptable risk / imprecision.
944
- } while (
945
- !h->meta.CasWeak(old_meta, uint64_t{ClockHandle::kStateConstruction}
946
- << ClockHandle::kStateShift));
947
- // Took ownership
948
- size_t total_charge = h->GetTotalCharge();
949
- if (UNLIKELY(h->IsStandalone())) {
950
- h->FreeData(allocator_);
951
- // Delete standalone handle
952
- delete h;
953
- standalone_usage_.FetchSubRelaxed(total_charge);
954
- usage_.FetchSubRelaxed(total_charge);
955
- } else {
956
- Rollback(h->hashed_key, h);
957
- FreeDataMarkEmpty(*h, allocator_);
958
- ReclaimEntryUsage(total_charge);
959
- }
960
- return true;
961
- } else {
962
- // Correct for possible (but rare) overflow
963
- CorrectNearOverflow(old_meta, h->meta);
964
- return false;
965
- }
966
- }
967
-
968
- #ifndef NDEBUG
969
- void FixedHyperClockTable::TEST_ReleaseN(HandleImpl* h, size_t n) {
970
- if (n > 0) {
971
- // Do n-1 simple releases first
972
- TEST_ReleaseNMinus1(h, n);
973
-
974
- // Then the last release might be more involved
975
- Release(h, /*useful*/ true, /*erase_if_last_ref*/ false);
976
- }
977
- }
978
- #endif
979
-
980
- void FixedHyperClockTable::Erase(const UniqueId64x2& hashed_key) {
981
- (void)FindSlot(
982
- hashed_key,
983
- [&](HandleImpl* h) {
984
- // Could be multiple entries in rare cases. Erase them all.
985
- // Optimistically increment acquire counter
986
- uint64_t old_meta = h->meta.FetchAdd(ClockHandle::kAcquireIncrement);
987
- // Check if it's an entry visible to lookups
988
- if ((old_meta >> ClockHandle::kStateShift) ==
989
- ClockHandle::kStateVisible) {
990
- // Acquired a read reference
991
- if (h->hashed_key == hashed_key) {
992
- // Match. Set invisible.
993
- old_meta =
994
- h->meta.FetchAnd(~(uint64_t{ClockHandle::kStateVisibleBit}
995
- << ClockHandle::kStateShift));
996
- // Apply update to local copy
997
- old_meta &= ~(uint64_t{ClockHandle::kStateVisibleBit}
998
- << ClockHandle::kStateShift);
999
- for (;;) {
1000
- uint64_t refcount = GetRefcount(old_meta);
1001
- assert(refcount > 0);
1002
- if (refcount > 1) {
1003
- // Not last ref at some point in time during this Erase call
1004
- // Pretend we never took the reference
1005
- Unref(*h);
1006
- break;
1007
- } else if (h->meta.CasWeak(
1008
- old_meta, uint64_t{ClockHandle::kStateConstruction}
1009
- << ClockHandle::kStateShift)) {
1010
- // Took ownership
1011
- assert(hashed_key == h->hashed_key);
1012
- size_t total_charge = h->GetTotalCharge();
1013
- FreeDataMarkEmpty(*h, allocator_);
1014
- ReclaimEntryUsage(total_charge);
1015
- // We already have a copy of hashed_key in this case, so OK to
1016
- // delay Rollback until after releasing the entry
1017
- Rollback(hashed_key, h);
1018
- break;
1019
- }
1020
- }
1021
- } else {
1022
- // Mismatch. Pretend we never took the reference
1023
- Unref(*h);
1024
- }
1025
- } else if (UNLIKELY((old_meta >> ClockHandle::kStateShift) ==
1026
- ClockHandle::kStateInvisible)) {
1027
- // Pretend we never took the reference
1028
- Unref(*h);
1029
- } else {
1030
- // For other states, incrementing the acquire counter has no effect
1031
- // so we don't need to undo it.
1032
- }
1033
- return false;
1034
- },
1035
- [&](HandleImpl* h) { return h->displacements.LoadRelaxed() == 0; },
1036
- [&](HandleImpl* /*h*/, bool /*is_last*/) {});
1037
- }
1038
-
1039
- void FixedHyperClockTable::EraseUnRefEntries() {
1040
- for (size_t i = 0; i <= this->length_bits_mask_; i++) {
1041
- HandleImpl& h = array_[i];
1042
-
1043
- uint64_t old_meta = h.meta.LoadRelaxed();
1044
- if (old_meta & (uint64_t{ClockHandle::kStateShareableBit}
1045
- << ClockHandle::kStateShift) &&
1046
- GetRefcount(old_meta) == 0 &&
1047
- h.meta.CasStrong(old_meta, uint64_t{ClockHandle::kStateConstruction}
1048
- << ClockHandle::kStateShift)) {
1049
- // Took ownership
1050
- size_t total_charge = h.GetTotalCharge();
1051
- Rollback(h.hashed_key, &h);
1052
- FreeDataMarkEmpty(h, allocator_);
1053
- ReclaimEntryUsage(total_charge);
1054
- }
1055
- }
1056
- }
1057
-
1058
- template <typename MatchFn, typename AbortFn, typename UpdateFn>
1059
- inline FixedHyperClockTable::HandleImpl* FixedHyperClockTable::FindSlot(
1060
- const UniqueId64x2& hashed_key, const MatchFn& match_fn,
1061
- const AbortFn& abort_fn, const UpdateFn& update_fn) {
1062
- // NOTE: upper 32 bits of hashed_key[0] is used for sharding
1063
- //
1064
- // We use double-hashing probing. Every probe in the sequence is a
1065
- // pseudorandom integer, computed as a linear function of two random hashes,
1066
- // which we call base and increment. Specifically, the i-th probe is base + i
1067
- // * increment modulo the table size.
1068
- size_t base = static_cast<size_t>(hashed_key[1]);
1069
- // We use an odd increment, which is relatively prime with the power-of-two
1070
- // table size. This implies that we cycle back to the first probe only
1071
- // after probing every slot exactly once.
1072
- // TODO: we could also reconsider linear probing, though locality benefits
1073
- // are limited because each slot is a full cache line
1074
- size_t increment = static_cast<size_t>(hashed_key[0]) | 1U;
1075
- size_t first = ModTableSize(base);
1076
- size_t current = first;
1077
- bool is_last;
1078
- do {
1079
- HandleImpl* h = &array_[current];
1080
- if (match_fn(h)) {
1081
- return h;
1082
- }
1083
- if (abort_fn(h)) {
1084
- return nullptr;
1085
- }
1086
- current = ModTableSize(current + increment);
1087
- is_last = current == first;
1088
- update_fn(h, is_last);
1089
- } while (!is_last);
1090
- // We looped back.
1091
- return nullptr;
1092
- }
1093
-
1094
- inline void FixedHyperClockTable::Rollback(const UniqueId64x2& hashed_key,
1095
- const HandleImpl* h) {
1096
- size_t current = ModTableSize(hashed_key[1]);
1097
- size_t increment = static_cast<size_t>(hashed_key[0]) | 1U;
1098
- while (&array_[current] != h) {
1099
- array_[current].displacements.FetchSubRelaxed(1);
1100
- current = ModTableSize(current + increment);
1101
- }
1102
- }
1103
-
1104
- inline void FixedHyperClockTable::ReclaimEntryUsage(size_t total_charge) {
1105
- auto old_occupancy = occupancy_.FetchSub(1U);
1106
- (void)old_occupancy;
1107
- // No underflow
1108
- assert(old_occupancy > 0);
1109
- auto old_usage = usage_.FetchSubRelaxed(total_charge);
1110
- (void)old_usage;
1111
- // No underflow
1112
- assert(old_usage >= total_charge);
1113
- }
1114
-
1115
- inline void FixedHyperClockTable::Evict(size_t requested_charge, InsertState&,
1116
- EvictionData* data,
1117
- uint32_t eviction_effort_cap) {
1118
- // precondition
1119
- assert(requested_charge > 0);
1120
-
1121
- // TODO: make a tuning parameter?
1122
- constexpr size_t step_size = 4;
1123
-
1124
- // First (concurrent) increment clock pointer
1125
- uint64_t old_clock_pointer = clock_pointer_.FetchAddRelaxed(step_size);
1126
-
1127
- // Cap the eviction effort at this thread (along with those operating in
1128
- // parallel) circling through the whole structure kMaxCountdown times.
1129
- // In other words, this eviction run must find something/anything that is
1130
- // unreferenced at start of and during the eviction run that isn't reclaimed
1131
- // by a concurrent eviction run.
1132
- uint64_t max_clock_pointer =
1133
- old_clock_pointer + (ClockHandle::kMaxCountdown << length_bits_);
1134
-
1135
- for (;;) {
1136
- for (size_t i = 0; i < step_size; i++) {
1137
- HandleImpl& h = array_[ModTableSize(Lower32of64(old_clock_pointer + i))];
1138
- bool evicting = ClockUpdate(h, data);
1139
- if (evicting) {
1140
- Rollback(h.hashed_key, &h);
1141
- TrackAndReleaseEvictedEntry(&h);
1142
- }
1143
- }
1144
-
1145
- // Loop exit condition
1146
- if (data->freed_charge >= requested_charge) {
1147
- return;
1148
- }
1149
- if (old_clock_pointer >= max_clock_pointer) {
1150
- return;
1151
- }
1152
- if (IsEvictionEffortExceeded(*data, eviction_effort_cap)) {
1153
- eviction_effort_exceeded_count_.FetchAddRelaxed(1);
1154
- return;
1155
- }
1156
-
1157
- // Advance clock pointer (concurrently)
1158
- old_clock_pointer = clock_pointer_.FetchAddRelaxed(step_size);
1159
- }
1160
- }
1161
-
1162
- template <class Table>
1163
- ClockCacheShard<Table>::ClockCacheShard(
1164
- size_t capacity, bool strict_capacity_limit,
1165
- CacheMetadataChargePolicy metadata_charge_policy,
1166
- MemoryAllocator* allocator,
1167
- const Cache::EvictionCallback* eviction_callback, const uint32_t* hash_seed,
1168
- const typename Table::Opts& opts)
1169
- : CacheShardBase(metadata_charge_policy),
1170
- table_(capacity, metadata_charge_policy, allocator, eviction_callback,
1171
- hash_seed, opts),
1172
- capacity_(capacity),
1173
- eec_and_scl_(SanitizeEncodeEecAndScl(opts.eviction_effort_cap,
1174
- strict_capacity_limit)) {
1175
- // Initial charge metadata should not exceed capacity
1176
- assert(table_.GetUsage() <= capacity_.LoadRelaxed() ||
1177
- capacity_.LoadRelaxed() < sizeof(HandleImpl));
1178
- }
1179
-
1180
- template <class Table>
1181
- void ClockCacheShard<Table>::EraseUnRefEntries() {
1182
- table_.EraseUnRefEntries();
1183
- }
1184
-
1185
- template <class Table>
1186
- void ClockCacheShard<Table>::ApplyToSomeEntries(
1187
- const std::function<void(const Slice& key, Cache::ObjectPtr value,
1188
- size_t charge,
1189
- const Cache::CacheItemHelper* helper)>& callback,
1190
- size_t average_entries_per_lock, size_t* state) {
1191
- // The state will be a simple index into the table. Even with a dynamic
1192
- // hyper clock cache, entries will generally stay in their existing
1193
- // slots, so we don't need to be aware of the high-level organization
1194
- // that makes lookup efficient.
1195
- size_t length = table_.GetTableSize();
1196
-
1197
- assert(average_entries_per_lock > 0);
1198
-
1199
- size_t index_begin = *state;
1200
- size_t index_end = index_begin + average_entries_per_lock;
1201
- if (index_end >= length) {
1202
- // Going to end.
1203
- index_end = length;
1204
- *state = SIZE_MAX;
1205
- } else {
1206
- *state = index_end;
1207
- }
1208
-
1209
- auto hash_seed = table_.GetHashSeed();
1210
- ConstApplyToEntriesRange(
1211
- [callback, hash_seed](const HandleImpl& h) {
1212
- UniqueId64x2 unhashed;
1213
- callback(ReverseHash(h.hashed_key, &unhashed, hash_seed), h.value,
1214
- h.GetTotalCharge(), h.helper);
1215
- },
1216
- table_.HandlePtr(index_begin), table_.HandlePtr(index_end), false);
1217
- }
1218
-
1219
- int FixedHyperClockTable::CalcHashBits(
1220
- size_t capacity, size_t estimated_value_size,
1221
- CacheMetadataChargePolicy metadata_charge_policy) {
1222
- double average_slot_charge = estimated_value_size * kLoadFactor;
1223
- if (metadata_charge_policy == kFullChargeCacheMetadata) {
1224
- average_slot_charge += sizeof(HandleImpl);
1225
- }
1226
- assert(average_slot_charge > 0.0);
1227
- uint64_t num_slots =
1228
- static_cast<uint64_t>(capacity / average_slot_charge + 0.999999);
1229
-
1230
- int hash_bits = FloorLog2((num_slots << 1) - 1);
1231
- if (metadata_charge_policy == kFullChargeCacheMetadata) {
1232
- // For very small estimated value sizes, it's possible to overshoot
1233
- while (hash_bits > 0 &&
1234
- uint64_t{sizeof(HandleImpl)} << hash_bits > capacity) {
1235
- hash_bits--;
1236
- }
1237
- }
1238
- return hash_bits;
1239
- }
1240
-
1241
- template <class Table>
1242
- void ClockCacheShard<Table>::SetCapacity(size_t capacity) {
1243
- capacity_.StoreRelaxed(capacity);
1244
- // next Insert will take care of any necessary evictions
1245
- }
1246
-
1247
- template <class Table>
1248
- void ClockCacheShard<Table>::SetStrictCapacityLimit(
1249
- bool strict_capacity_limit) {
1250
- if (strict_capacity_limit) {
1251
- eec_and_scl_.FetchOrRelaxed(kStrictCapacityLimitBit);
1252
- } else {
1253
- eec_and_scl_.FetchAndRelaxed(~kStrictCapacityLimitBit);
1254
- }
1255
- // next Insert will take care of any necessary evictions
1256
- }
1257
-
1258
- template <class Table>
1259
- Status ClockCacheShard<Table>::Insert(const Slice& key,
1260
- const UniqueId64x2& hashed_key,
1261
- Cache::ObjectPtr value,
1262
- const Cache::CacheItemHelper* helper,
1263
- size_t charge, HandleImpl** handle,
1264
- Cache::Priority priority) {
1265
- if (UNLIKELY(key.size() != kCacheKeySize)) {
1266
- return Status::NotSupported("ClockCache only supports key size " +
1267
- std::to_string(kCacheKeySize) + "B");
1268
- }
1269
- ClockHandleBasicData proto;
1270
- proto.hashed_key = hashed_key;
1271
- proto.value = value;
1272
- proto.helper = helper;
1273
- proto.total_charge = charge;
1274
- return table_.template Insert<Table>(proto, handle, priority,
1275
- capacity_.LoadRelaxed(),
1276
- eec_and_scl_.LoadRelaxed());
1277
- }
1278
-
1279
- template <class Table>
1280
- typename Table::HandleImpl* ClockCacheShard<Table>::CreateStandalone(
1281
- const Slice& key, const UniqueId64x2& hashed_key, Cache::ObjectPtr obj,
1282
- const Cache::CacheItemHelper* helper, size_t charge, bool allow_uncharged) {
1283
- if (UNLIKELY(key.size() != kCacheKeySize)) {
1284
- return nullptr;
1285
- }
1286
- ClockHandleBasicData proto;
1287
- proto.hashed_key = hashed_key;
1288
- proto.value = obj;
1289
- proto.helper = helper;
1290
- proto.total_charge = charge;
1291
- return table_.template CreateStandalone<Table>(proto, capacity_.LoadRelaxed(),
1292
- eec_and_scl_.LoadRelaxed(),
1293
- allow_uncharged);
1294
- }
1295
-
1296
- template <class Table>
1297
- typename ClockCacheShard<Table>::HandleImpl* ClockCacheShard<Table>::Lookup(
1298
- const Slice& key, const UniqueId64x2& hashed_key) {
1299
- if (UNLIKELY(key.size() != kCacheKeySize)) {
1300
- return nullptr;
1301
- }
1302
- return table_.Lookup(hashed_key);
1303
- }
1304
-
1305
- template <class Table>
1306
- bool ClockCacheShard<Table>::Ref(HandleImpl* h) {
1307
- if (h == nullptr) {
1308
- return false;
1309
- }
1310
- table_.Ref(*h);
1311
- return true;
1312
- }
1313
-
1314
- template <class Table>
1315
- bool ClockCacheShard<Table>::Release(HandleImpl* handle, bool useful,
1316
- bool erase_if_last_ref) {
1317
- if (handle == nullptr) {
1318
- return false;
1319
- }
1320
- return table_.Release(handle, useful, erase_if_last_ref);
1321
- }
1322
-
1323
- #ifndef NDEBUG
1324
- template <class Table>
1325
- void ClockCacheShard<Table>::TEST_RefN(HandleImpl* h, size_t n) {
1326
- table_.TEST_RefN(*h, n);
1327
- }
1328
-
1329
- template <class Table>
1330
- void ClockCacheShard<Table>::TEST_ReleaseN(HandleImpl* h, size_t n) {
1331
- table_.TEST_ReleaseN(h, n);
1332
- }
1333
- #endif
1334
-
1335
- template <class Table>
1336
- bool ClockCacheShard<Table>::Release(HandleImpl* handle,
1337
- bool erase_if_last_ref) {
1338
- return Release(handle, /*useful=*/true, erase_if_last_ref);
1339
- }
1340
-
1341
- template <class Table>
1342
- void ClockCacheShard<Table>::Erase(const Slice& key,
1343
- const UniqueId64x2& hashed_key) {
1344
- if (UNLIKELY(key.size() != kCacheKeySize)) {
1345
- return;
1346
- }
1347
- table_.Erase(hashed_key);
1348
- }
1349
-
1350
- template <class Table>
1351
- size_t ClockCacheShard<Table>::GetUsage() const {
1352
- return table_.GetUsage();
1353
- }
1354
-
1355
- template <class Table>
1356
- size_t ClockCacheShard<Table>::GetStandaloneUsage() const {
1357
- return table_.GetStandaloneUsage();
1358
- }
1359
-
1360
- template <class Table>
1361
- size_t ClockCacheShard<Table>::GetCapacity() const {
1362
- return capacity_.LoadRelaxed();
1363
- }
1364
-
1365
- template <class Table>
1366
- size_t ClockCacheShard<Table>::GetPinnedUsage() const {
1367
- // Computes the pinned usage by scanning the whole hash table. This
1368
- // is slow, but avoids keeping an exact counter on the clock usage,
1369
- // i.e., the number of not externally referenced elements.
1370
- // Why avoid this counter? Because Lookup removes elements from the clock
1371
- // list, so it would need to update the pinned usage every time,
1372
- // which creates additional synchronization costs.
1373
- size_t table_pinned_usage = 0;
1374
- const bool charge_metadata =
1375
- metadata_charge_policy_ == kFullChargeCacheMetadata;
1376
- ConstApplyToEntriesRange(
1377
- [&table_pinned_usage, charge_metadata](const HandleImpl& h) {
1378
- uint64_t meta = h.meta.LoadRelaxed();
1379
- uint64_t refcount = GetRefcount(meta);
1380
- // Holding one ref for ConstApplyToEntriesRange
1381
- assert(refcount > 0);
1382
- if (refcount > 1) {
1383
- table_pinned_usage += h.GetTotalCharge();
1384
- if (charge_metadata) {
1385
- table_pinned_usage += sizeof(HandleImpl);
1386
- }
1387
- }
1388
- },
1389
- table_.HandlePtr(0), table_.HandlePtr(table_.GetTableSize()), true);
1390
-
1391
- return table_pinned_usage + table_.GetStandaloneUsage();
1392
- }
1393
-
1394
- template <class Table>
1395
- size_t ClockCacheShard<Table>::GetOccupancyCount() const {
1396
- return table_.GetOccupancy();
1397
- }
1398
-
1399
- template <class Table>
1400
- size_t ClockCacheShard<Table>::GetOccupancyLimit() const {
1401
- return table_.GetOccupancyLimit();
1402
- }
1403
-
1404
- template <class Table>
1405
- size_t ClockCacheShard<Table>::GetTableAddressCount() const {
1406
- return table_.GetTableSize();
1407
- }
1408
-
1409
- // Explicit instantiation
1410
- template class ClockCacheShard<FixedHyperClockTable>;
1411
- template class ClockCacheShard<AutoHyperClockTable>;
1412
-
1413
- template <class Table>
1414
- BaseHyperClockCache<Table>::BaseHyperClockCache(
1415
- const HyperClockCacheOptions& opts)
1416
- : ShardedCache<ClockCacheShard<Table>>(opts) {
1417
- // TODO: should not need to go through two levels of pointer indirection to
1418
- // get to table entries
1419
- size_t per_shard = this->GetPerShardCapacity();
1420
- MemoryAllocator* alloc = this->memory_allocator();
1421
- this->InitShards([&](Shard* cs) {
1422
- typename Table::Opts table_opts{opts};
1423
- new (cs) Shard(per_shard, opts.strict_capacity_limit,
1424
- opts.metadata_charge_policy, alloc,
1425
- &this->eviction_callback_, &this->hash_seed_, table_opts);
1426
- });
1427
- }
1428
-
1429
- template <class Table>
1430
- Cache::ObjectPtr BaseHyperClockCache<Table>::Value(Handle* handle) {
1431
- return static_cast<const typename Table::HandleImpl*>(handle)->value;
1432
- }
1433
-
1434
- template <class Table>
1435
- size_t BaseHyperClockCache<Table>::GetCharge(Handle* handle) const {
1436
- return static_cast<const typename Table::HandleImpl*>(handle)
1437
- ->GetTotalCharge();
1438
- }
1439
-
1440
- template <class Table>
1441
- const Cache::CacheItemHelper* BaseHyperClockCache<Table>::GetCacheItemHelper(
1442
- Handle* handle) const {
1443
- auto h = static_cast<const typename Table::HandleImpl*>(handle);
1444
- return h->helper;
1445
- }
1446
-
1447
- namespace {
1448
-
1449
- // For each cache shard, estimate what the table load factor would be if
1450
- // cache filled to capacity with average entries. This is considered
1451
- // indicative of a potential problem if the shard is essentially operating
1452
- // "at limit", which we define as high actual usage (>80% of capacity)
1453
- // or actual occupancy very close to limit (>95% of limit).
1454
- // Also, for each shard compute the recommended estimated_entry_charge,
1455
- // and keep the minimum one for use as overall recommendation.
1456
- void AddShardEvaluation(const FixedHyperClockCache::Shard& shard,
1457
- std::vector<double>& predicted_load_factors,
1458
- size_t& min_recommendation) {
1459
- size_t usage = shard.GetUsage() - shard.GetStandaloneUsage();
1460
- size_t capacity = shard.GetCapacity();
1461
- double usage_ratio = 1.0 * usage / capacity;
1462
-
1463
- size_t occupancy = shard.GetOccupancyCount();
1464
- size_t occ_limit = shard.GetOccupancyLimit();
1465
- double occ_ratio = 1.0 * occupancy / occ_limit;
1466
- if (usage == 0 || occupancy == 0 || (usage_ratio < 0.8 && occ_ratio < 0.95)) {
1467
- // Skip as described above
1468
- return;
1469
- }
1470
-
1471
- // If filled to capacity, what would the occupancy ratio be?
1472
- double ratio = occ_ratio / usage_ratio;
1473
- // Given max load factor, what that load factor be?
1474
- double lf = ratio * FixedHyperClockTable::kStrictLoadFactor;
1475
- predicted_load_factors.push_back(lf);
1476
-
1477
- // Update min_recommendation also
1478
- size_t recommendation = usage / occupancy;
1479
- min_recommendation = std::min(min_recommendation, recommendation);
1480
- }
1481
-
1482
- bool IsSlotOccupied(const ClockHandle& h) {
1483
- return (h.meta.LoadRelaxed() >> ClockHandle::kStateShift) != 0;
1484
- }
1485
- } // namespace
1486
-
1487
- // NOTE: GCC might warn about subobject linkage if this is in anon namespace
1488
- template <size_t N = 500>
1489
- class LoadVarianceStats {
1490
- public:
1491
- std::string Report() const {
1492
- return "Overall " + PercentStr(positive_count_, samples_) + " (" +
1493
- std::to_string(positive_count_) + "/" + std::to_string(samples_) +
1494
- "), Min/Max/Window = " + PercentStr(min_, N) + "/" +
1495
- PercentStr(max_, N) + "/" + std::to_string(N) +
1496
- ", MaxRun{Pos/Neg} = " + std::to_string(max_pos_run_) + "/" +
1497
- std::to_string(max_neg_run_);
1498
- }
1499
-
1500
- void Add(bool positive) {
1501
- recent_[samples_ % N] = positive;
1502
- if (positive) {
1503
- ++positive_count_;
1504
- ++cur_pos_run_;
1505
- max_pos_run_ = std::max(max_pos_run_, cur_pos_run_);
1506
- cur_neg_run_ = 0;
1507
- } else {
1508
- ++cur_neg_run_;
1509
- max_neg_run_ = std::max(max_neg_run_, cur_neg_run_);
1510
- cur_pos_run_ = 0;
1511
- }
1512
- ++samples_;
1513
- if (samples_ >= N) {
1514
- size_t count_set = recent_.count();
1515
- max_ = std::max(max_, count_set);
1516
- min_ = std::min(min_, count_set);
1517
- }
1518
- }
1519
-
1520
- private:
1521
- size_t max_ = 0;
1522
- size_t min_ = N;
1523
- size_t positive_count_ = 0;
1524
- size_t samples_ = 0;
1525
- size_t max_pos_run_ = 0;
1526
- size_t cur_pos_run_ = 0;
1527
- size_t max_neg_run_ = 0;
1528
- size_t cur_neg_run_ = 0;
1529
- std::bitset<N> recent_;
1530
-
1531
- static std::string PercentStr(size_t a, size_t b) {
1532
- if (b == 0) {
1533
- return "??%";
1534
- } else {
1535
- return std::to_string(uint64_t{100} * a / b) + "%";
1536
- }
1537
- }
1538
- };
1539
-
1540
- template <class Table>
1541
- void BaseHyperClockCache<Table>::ReportProblems(
1542
- const std::shared_ptr<Logger>& info_log) const {
1543
- if (info_log->GetInfoLogLevel() <= InfoLogLevel::DEBUG_LEVEL) {
1544
- LoadVarianceStats slot_stats;
1545
- uint64_t eviction_effort_exceeded_count = 0;
1546
- this->ForEachShard([&](const BaseHyperClockCache<Table>::Shard* shard) {
1547
- size_t count = shard->GetTableAddressCount();
1548
- for (size_t i = 0; i < count; ++i) {
1549
- slot_stats.Add(IsSlotOccupied(*shard->GetTable().HandlePtr(i)));
1550
- }
1551
- eviction_effort_exceeded_count +=
1552
- shard->GetTable().GetEvictionEffortExceededCount();
1553
- });
1554
- ROCKS_LOG_AT_LEVEL(info_log, InfoLogLevel::DEBUG_LEVEL,
1555
- "Slot occupancy stats: %s", slot_stats.Report().c_str());
1556
- ROCKS_LOG_AT_LEVEL(info_log, InfoLogLevel::DEBUG_LEVEL,
1557
- "Eviction effort exceeded: %" PRIu64,
1558
- eviction_effort_exceeded_count);
1559
- }
1560
- }
1561
-
1562
- void FixedHyperClockCache::ReportProblems(
1563
- const std::shared_ptr<Logger>& info_log) const {
1564
- BaseHyperClockCache::ReportProblems(info_log);
1565
-
1566
- uint32_t shard_count = GetNumShards();
1567
- std::vector<double> predicted_load_factors;
1568
- size_t min_recommendation = SIZE_MAX;
1569
- ForEachShard([&](const FixedHyperClockCache::Shard* shard) {
1570
- AddShardEvaluation(*shard, predicted_load_factors, min_recommendation);
1571
- });
1572
-
1573
- if (predicted_load_factors.empty()) {
1574
- // None operating "at limit" -> nothing to report
1575
- return;
1576
- }
1577
- std::sort(predicted_load_factors.begin(), predicted_load_factors.end());
1578
-
1579
- // First, if the average load factor is within spec, we aren't going to
1580
- // complain about a few shards being out of spec.
1581
- // NOTE: this is only the average among cache shards operating "at limit,"
1582
- // which should be representative of what we care about. It it normal, even
1583
- // desirable, for a cache to operate "at limit" so this should not create
1584
- // selection bias. See AddShardEvaluation().
1585
- // TODO: Consider detecting cases where decreasing the number of shards
1586
- // would be good, e.g. serious imbalance among shards.
1587
- double average_load_factor =
1588
- std::accumulate(predicted_load_factors.begin(),
1589
- predicted_load_factors.end(), 0.0) /
1590
- shard_count;
1591
-
1592
- constexpr double kLowSpecLoadFactor = FixedHyperClockTable::kLoadFactor / 2;
1593
- constexpr double kMidSpecLoadFactor =
1594
- FixedHyperClockTable::kLoadFactor / 1.414;
1595
- if (average_load_factor > FixedHyperClockTable::kLoadFactor) {
1596
- // Out of spec => Consider reporting load factor too high
1597
- // Estimate effective overall capacity loss due to enforcing occupancy limit
1598
- double lost_portion = 0.0;
1599
- int over_count = 0;
1600
- for (double lf : predicted_load_factors) {
1601
- if (lf > FixedHyperClockTable::kStrictLoadFactor) {
1602
- ++over_count;
1603
- lost_portion +=
1604
- (lf - FixedHyperClockTable::kStrictLoadFactor) / lf / shard_count;
1605
- }
1606
- }
1607
- // >= 20% loss -> error
1608
- // >= 10% loss -> consistent warning
1609
- // >= 1% loss -> intermittent warning
1610
- InfoLogLevel level = InfoLogLevel::INFO_LEVEL;
1611
- bool report = true;
1612
- if (lost_portion > 0.2) {
1613
- level = InfoLogLevel::ERROR_LEVEL;
1614
- } else if (lost_portion > 0.1) {
1615
- level = InfoLogLevel::WARN_LEVEL;
1616
- } else if (lost_portion > 0.01) {
1617
- int report_percent = static_cast<int>(lost_portion * 100.0);
1618
- if (Random::GetTLSInstance()->PercentTrue(report_percent)) {
1619
- level = InfoLogLevel::WARN_LEVEL;
1620
- }
1621
- } else {
1622
- // don't report
1623
- report = false;
1624
- }
1625
- if (report) {
1626
- ROCKS_LOG_AT_LEVEL(
1627
- info_log, level,
1628
- "FixedHyperClockCache@%p unable to use estimated %.1f%% capacity "
1629
- "because of full occupancy in %d/%u cache shards "
1630
- "(estimated_entry_charge too high). "
1631
- "Recommend estimated_entry_charge=%zu",
1632
- this, lost_portion * 100.0, over_count, (unsigned)shard_count,
1633
- min_recommendation);
1634
- }
1635
- } else if (average_load_factor < kLowSpecLoadFactor) {
1636
- // Out of spec => Consider reporting load factor too low
1637
- // But cautiously because low is not as big of a problem.
1638
-
1639
- // Only report if highest occupancy shard is also below
1640
- // spec and only if average is substantially out of spec
1641
- if (predicted_load_factors.back() < kLowSpecLoadFactor &&
1642
- average_load_factor < kLowSpecLoadFactor / 1.414) {
1643
- InfoLogLevel level = InfoLogLevel::INFO_LEVEL;
1644
- if (average_load_factor < kLowSpecLoadFactor / 2) {
1645
- level = InfoLogLevel::WARN_LEVEL;
1646
- }
1647
- ROCKS_LOG_AT_LEVEL(
1648
- info_log, level,
1649
- "FixedHyperClockCache@%p table has low occupancy at full capacity. "
1650
- "Higher estimated_entry_charge (about %.1fx) would likely improve "
1651
- "performance. Recommend estimated_entry_charge=%zu",
1652
- this, kMidSpecLoadFactor / average_load_factor, min_recommendation);
1653
- }
1654
- }
1655
- }
1656
-
1657
- // =======================================================================
1658
- // AutoHyperClockCache
1659
- // =======================================================================
1660
-
1661
- // See AutoHyperClockTable::length_info_ etc. for how the linear hashing
1662
- // metadata is encoded. Here are some example values:
1663
- //
1664
- // Used length | min shift | threshold | max shift
1665
- // 2 | 1 | 0 | 1
1666
- // 3 | 1 | 1 | 2
1667
- // 4 | 2 | 0 | 2
1668
- // 5 | 2 | 1 | 3
1669
- // 6 | 2 | 2 | 3
1670
- // 7 | 2 | 3 | 3
1671
- // 8 | 3 | 0 | 3
1672
- // 9 | 3 | 1 | 4
1673
- // ...
1674
- // Note:
1675
- // * min shift = floor(log2(used length))
1676
- // * max shift = ceil(log2(used length))
1677
- // * used length == (1 << shift) + threshold
1678
- // Also, shift=0 is never used in practice, so is reserved for "unset"
1679
-
1680
- namespace {
1681
-
1682
- inline int LengthInfoToMinShift(uint64_t length_info) {
1683
- int mask_shift = BitwiseAnd(length_info, int{255});
1684
- assert(mask_shift <= 63);
1685
- assert(mask_shift > 0);
1686
- return mask_shift;
1687
- }
1688
-
1689
- inline size_t LengthInfoToThreshold(uint64_t length_info) {
1690
- return static_cast<size_t>(length_info >> 8);
1691
- }
1692
-
1693
- inline size_t LengthInfoToUsedLength(uint64_t length_info) {
1694
- size_t threshold = LengthInfoToThreshold(length_info);
1695
- int shift = LengthInfoToMinShift(length_info);
1696
- assert(threshold < (size_t{1} << shift));
1697
- size_t used_length = (size_t{1} << shift) + threshold;
1698
- assert(used_length >= 2);
1699
- return used_length;
1700
- }
1701
-
1702
- inline uint64_t UsedLengthToLengthInfo(size_t used_length) {
1703
- assert(used_length >= 2);
1704
- int shift = FloorLog2(used_length);
1705
- uint64_t threshold = BottomNBits(used_length, shift);
1706
- uint64_t length_info =
1707
- (uint64_t{threshold} << 8) + static_cast<uint64_t>(shift);
1708
- assert(LengthInfoToUsedLength(length_info) == used_length);
1709
- assert(LengthInfoToMinShift(length_info) == shift);
1710
- assert(LengthInfoToThreshold(length_info) == threshold);
1711
- return length_info;
1712
- }
1713
-
1714
- inline size_t GetStartingLength(size_t capacity) {
1715
- if (capacity > port::kPageSize) {
1716
- // Start with one memory page
1717
- return port::kPageSize / sizeof(AutoHyperClockTable::HandleImpl);
1718
- } else {
1719
- // Mostly to make unit tests happy
1720
- return 4;
1721
- }
1722
- }
1723
-
1724
- inline size_t GetHomeIndex(uint64_t hash, int shift) {
1725
- return static_cast<size_t>(BottomNBits(hash, shift));
1726
- }
1727
-
1728
- inline void GetHomeIndexAndShift(uint64_t length_info, uint64_t hash,
1729
- size_t* home, int* shift) {
1730
- int min_shift = LengthInfoToMinShift(length_info);
1731
- size_t threshold = LengthInfoToThreshold(length_info);
1732
- bool extra_shift = GetHomeIndex(hash, min_shift) < threshold;
1733
- *home = GetHomeIndex(hash, min_shift + extra_shift);
1734
- *shift = min_shift + extra_shift;
1735
- assert(*home < LengthInfoToUsedLength(length_info));
1736
- }
1737
-
1738
- inline int GetShiftFromNextWithShift(uint64_t next_with_shift) {
1739
- return BitwiseAnd(next_with_shift,
1740
- AutoHyperClockTable::HandleImpl::kShiftMask);
1741
- }
1742
-
1743
- inline size_t GetNextFromNextWithShift(uint64_t next_with_shift) {
1744
- return static_cast<size_t>(next_with_shift >>
1745
- AutoHyperClockTable::HandleImpl::kNextShift);
1746
- }
1747
-
1748
- inline uint64_t MakeNextWithShift(size_t next, int shift) {
1749
- return (uint64_t{next} << AutoHyperClockTable::HandleImpl::kNextShift) |
1750
- static_cast<uint64_t>(shift);
1751
- }
1752
-
1753
- inline uint64_t MakeNextWithShiftEnd(size_t head, int shift) {
1754
- return AutoHyperClockTable::HandleImpl::kNextEndFlags |
1755
- MakeNextWithShift(head, shift);
1756
- }
1757
-
1758
- // Helper function for Lookup
1759
- inline bool MatchAndRef(const UniqueId64x2* hashed_key, const ClockHandle& h,
1760
- int shift = 0, size_t home = 0,
1761
- bool* full_match_or_unknown = nullptr) {
1762
- // Must be at least something to match
1763
- assert(hashed_key || shift > 0);
1764
-
1765
- uint64_t old_meta;
1766
- // (Optimistically) increment acquire counter.
1767
- old_meta = h.meta.FetchAdd(ClockHandle::kAcquireIncrement);
1768
- // Check if it's a referencable (sharable) entry
1769
- if ((old_meta & (uint64_t{ClockHandle::kStateShareableBit}
1770
- << ClockHandle::kStateShift)) == 0) {
1771
- // For non-sharable states, incrementing the acquire counter has no effect
1772
- // so we don't need to undo it. Furthermore, we cannot safely undo
1773
- // it because we did not acquire a read reference to lock the
1774
- // entry in a Shareable state.
1775
- if (full_match_or_unknown) {
1776
- *full_match_or_unknown = true;
1777
- }
1778
- return false;
1779
- }
1780
- // Else acquired a read reference
1781
- assert(GetRefcount(old_meta + ClockHandle::kAcquireIncrement) > 0);
1782
- if (hashed_key && h.hashed_key == *hashed_key &&
1783
- LIKELY(old_meta & (uint64_t{ClockHandle::kStateVisibleBit}
1784
- << ClockHandle::kStateShift))) {
1785
- // Match on full key, visible
1786
- if (full_match_or_unknown) {
1787
- *full_match_or_unknown = true;
1788
- }
1789
- return true;
1790
- } else if (shift > 0 && home == BottomNBits(h.hashed_key[1], shift)) {
1791
- // NOTE: upper 32 bits of hashed_key[0] is used for sharding
1792
- // Match on home address, possibly invisible
1793
- if (full_match_or_unknown) {
1794
- *full_match_or_unknown = false;
1795
- }
1796
- return true;
1797
- } else {
1798
- // Mismatch. Pretend we never took the reference
1799
- Unref(h);
1800
- if (full_match_or_unknown) {
1801
- *full_match_or_unknown = false;
1802
- }
1803
- return false;
1804
- }
1805
- }
1806
-
1807
- // Assumes a chain rewrite lock prevents concurrent modification of
1808
- // these chain pointers
1809
- void UpgradeShiftsOnRange(AutoHyperClockTable::HandleImpl* arr,
1810
- size_t& frontier, uint64_t stop_before_or_new_tail,
1811
- int old_shift, int new_shift) {
1812
- assert(frontier != SIZE_MAX);
1813
- assert(new_shift == old_shift + 1);
1814
- (void)old_shift;
1815
- (void)new_shift;
1816
- using HandleImpl = AutoHyperClockTable::HandleImpl;
1817
- for (;;) {
1818
- uint64_t next_with_shift = arr[frontier].chain_next_with_shift.Load();
1819
- assert(GetShiftFromNextWithShift(next_with_shift) == old_shift);
1820
- if (next_with_shift == stop_before_or_new_tail) {
1821
- // Stopping at entry with pointer matching "stop before"
1822
- assert(!HandleImpl::IsEnd(next_with_shift));
1823
- return;
1824
- }
1825
- if (HandleImpl::IsEnd(next_with_shift)) {
1826
- // Also update tail to new tail
1827
- assert(HandleImpl::IsEnd(stop_before_or_new_tail));
1828
- arr[frontier].chain_next_with_shift.Store(stop_before_or_new_tail);
1829
- // Mark nothing left to upgrade
1830
- frontier = SIZE_MAX;
1831
- return;
1832
- }
1833
- // Next is another entry to process, so upgrade and advance frontier
1834
- arr[frontier].chain_next_with_shift.FetchAdd(1U);
1835
- assert(GetShiftFromNextWithShift(next_with_shift + 1) == new_shift);
1836
- frontier = GetNextFromNextWithShift(next_with_shift);
1837
- }
1838
- }
1839
-
1840
- size_t CalcOccupancyLimit(size_t used_length) {
1841
- return static_cast<size_t>(used_length * AutoHyperClockTable::kMaxLoadFactor +
1842
- 0.999);
1843
- }
1844
-
1845
- } // namespace
1846
-
1847
- // An RAII wrapper for locking a chain of entries (flag bit on the head)
1848
- // so that there is only one thread allowed to remove entries from the
1849
- // chain, or to rewrite it by splitting for Grow. Without the lock,
1850
- // all lookups and insertions at the head can proceed wait-free.
1851
- // The class also provides functions for safely manipulating the head pointer
1852
- // while holding the lock--or wanting to should it become non-empty.
1853
- //
1854
- // The flag bits on the head are such that the head cannot be locked if it
1855
- // is an empty chain, so that a "blind" FetchOr will try to lock a non-empty
1856
- // chain but have no effect on an empty chain. When a potential rewrite
1857
- // operation see an empty head pointer, there is no need to lock as the
1858
- // operation is a no-op. However, there are some cases such as CAS-update
1859
- // where locking might be required after initially not being needed, if the
1860
- // operation is forced to revisit the head pointer.
1861
- class AutoHyperClockTable::ChainRewriteLock {
1862
- public:
1863
- using HandleImpl = AutoHyperClockTable::HandleImpl;
1864
-
1865
- // Acquire lock if head of h is not an end
1866
- explicit ChainRewriteLock(HandleImpl* h, RelaxedAtomic<uint64_t>& yield_count)
1867
- : head_ptr_(&h->head_next_with_shift) {
1868
- Acquire(yield_count);
1869
- }
1870
-
1871
- // RAII wrap existing lock held (or end)
1872
- explicit ChainRewriteLock(HandleImpl* h,
1873
- RelaxedAtomic<uint64_t>& /*yield_count*/,
1874
- uint64_t already_locked_or_end)
1875
- : head_ptr_(&h->head_next_with_shift) {
1876
- saved_head_ = already_locked_or_end;
1877
- // already locked or end
1878
- assert(saved_head_ & HandleImpl::kHeadLocked);
1879
- }
1880
-
1881
- ~ChainRewriteLock() {
1882
- if (!IsEnd()) {
1883
- // Release lock
1884
- uint64_t old = head_ptr_->FetchAnd(~HandleImpl::kHeadLocked);
1885
- (void)old;
1886
- assert((old & HandleImpl::kNextEndFlags) == HandleImpl::kHeadLocked);
1887
- }
1888
- }
1889
-
1890
- void Reset(HandleImpl* h, RelaxedAtomic<uint64_t>& yield_count) {
1891
- this->~ChainRewriteLock();
1892
- new (this) ChainRewriteLock(h, yield_count);
1893
- }
1894
-
1895
- // Expected current state, assuming no parallel updates.
1896
- uint64_t GetSavedHead() const { return saved_head_; }
1897
-
1898
- bool CasUpdate(uint64_t next_with_shift,
1899
- RelaxedAtomic<uint64_t>& yield_count) {
1900
- uint64_t new_head = next_with_shift | HandleImpl::kHeadLocked;
1901
- uint64_t expected = GetSavedHead();
1902
- bool success = head_ptr_->CasStrong(expected, new_head);
1903
- if (success) {
1904
- // Ensure IsEnd() is kept up-to-date, including for dtor
1905
- saved_head_ = new_head;
1906
- } else {
1907
- // Parallel update to head, such as Insert()
1908
- if (IsEnd()) {
1909
- // Didn't previously hold a lock
1910
- if (HandleImpl::IsEnd(expected)) {
1911
- // Still don't need to
1912
- saved_head_ = expected;
1913
- } else {
1914
- // Need to acquire lock before proceeding
1915
- Acquire(yield_count);
1916
- }
1917
- } else {
1918
- // Parallel update must preserve our lock
1919
- assert((expected & HandleImpl::kNextEndFlags) ==
1920
- HandleImpl::kHeadLocked);
1921
- saved_head_ = expected;
1922
- }
1923
- }
1924
- return success;
1925
- }
1926
-
1927
- bool IsEnd() const { return HandleImpl::IsEnd(saved_head_); }
1928
-
1929
- private:
1930
- void Acquire(RelaxedAtomic<uint64_t>& yield_count) {
1931
- for (;;) {
1932
- // Acquire removal lock on the chain
1933
- uint64_t old_head = head_ptr_->FetchOr(HandleImpl::kHeadLocked);
1934
- if ((old_head & HandleImpl::kNextEndFlags) != HandleImpl::kHeadLocked) {
1935
- // Either acquired the lock or lock not needed (end)
1936
- assert((old_head & HandleImpl::kNextEndFlags) == 0 ||
1937
- (old_head & HandleImpl::kNextEndFlags) ==
1938
- HandleImpl::kNextEndFlags);
1939
-
1940
- saved_head_ = old_head | HandleImpl::kHeadLocked;
1941
- break;
1942
- }
1943
- // NOTE: one of the few yield-wait loops, which is rare enough in practice
1944
- // for its performance to be insignificant. (E.g. using C++20 atomic
1945
- // wait/notify would likely be worse because of wasted notify costs.)
1946
- yield_count.FetchAddRelaxed(1);
1947
- std::this_thread::yield();
1948
- }
1949
- }
1950
-
1951
- AcqRelAtomic<uint64_t>* head_ptr_;
1952
- uint64_t saved_head_;
1953
- };
1954
-
1955
- AutoHyperClockTable::AutoHyperClockTable(
1956
- size_t capacity, CacheMetadataChargePolicy metadata_charge_policy,
1957
- MemoryAllocator* allocator,
1958
- const Cache::EvictionCallback* eviction_callback, const uint32_t* hash_seed,
1959
- const Opts& opts)
1960
- : BaseClockTable(metadata_charge_policy, allocator, eviction_callback,
1961
- hash_seed),
1962
- array_(MemMapping::AllocateLazyZeroed(
1963
- sizeof(HandleImpl) * CalcMaxUsableLength(capacity,
1964
- opts.min_avg_value_size,
1965
- metadata_charge_policy))),
1966
- length_info_(UsedLengthToLengthInfo(GetStartingLength(capacity))),
1967
- occupancy_limit_(
1968
- CalcOccupancyLimit(LengthInfoToUsedLength(length_info_.Load()))),
1969
- grow_frontier_(GetTableSize()),
1970
- clock_pointer_mask_(
1971
- BottomNBits(UINT64_MAX, LengthInfoToMinShift(length_info_.Load()))) {
1972
- if (metadata_charge_policy ==
1973
- CacheMetadataChargePolicy::kFullChargeCacheMetadata) {
1974
- // NOTE: ignoring page boundaries for simplicity
1975
- usage_.FetchAddRelaxed(size_t{GetTableSize()} * sizeof(HandleImpl));
1976
- }
1977
-
1978
- static_assert(sizeof(HandleImpl) == 64U,
1979
- "Expecting size / alignment with common cache line size");
1980
-
1981
- // Populate head pointers
1982
- uint64_t length_info = length_info_.Load();
1983
- int min_shift = LengthInfoToMinShift(length_info);
1984
- int max_shift = min_shift + 1;
1985
- size_t major = uint64_t{1} << min_shift;
1986
- size_t used_length = GetTableSize();
1987
-
1988
- assert(major <= used_length);
1989
- assert(used_length <= major * 2);
1990
-
1991
- // Initialize the initial usable set of slots. This slightly odd iteration
1992
- // order makes it easier to get the correct shift amount on each head.
1993
- for (size_t i = 0; i < major; ++i) {
1994
- #ifndef NDEBUG
1995
- int shift;
1996
- size_t home;
1997
- #endif
1998
- if (major + i < used_length) {
1999
- array_[i].head_next_with_shift.StoreRelaxed(
2000
- MakeNextWithShiftEnd(i, max_shift));
2001
- array_[major + i].head_next_with_shift.StoreRelaxed(
2002
- MakeNextWithShiftEnd(major + i, max_shift));
2003
- #ifndef NDEBUG // Extra invariant checking
2004
- GetHomeIndexAndShift(length_info, i, &home, &shift);
2005
- assert(home == i);
2006
- assert(shift == max_shift);
2007
- GetHomeIndexAndShift(length_info, major + i, &home, &shift);
2008
- assert(home == major + i);
2009
- assert(shift == max_shift);
2010
- #endif
2011
- } else {
2012
- array_[i].head_next_with_shift.StoreRelaxed(
2013
- MakeNextWithShiftEnd(i, min_shift));
2014
- #ifndef NDEBUG // Extra invariant checking
2015
- GetHomeIndexAndShift(length_info, i, &home, &shift);
2016
- assert(home == i);
2017
- assert(shift == min_shift);
2018
- GetHomeIndexAndShift(length_info, major + i, &home, &shift);
2019
- assert(home == i);
2020
- assert(shift == min_shift);
2021
- #endif
2022
- }
2023
- }
2024
- }
2025
-
2026
- AutoHyperClockTable::~AutoHyperClockTable() {
2027
- // As usual, destructor assumes there are no references or active operations
2028
- // on any slot/element in the table.
2029
-
2030
- // It's possible that there were not enough Insert() after final concurrent
2031
- // Grow to ensure length_info_ (published GetTableSize()) is fully up to
2032
- // date. Probe for first unused slot to ensure we see the whole structure.
2033
- size_t used_end = GetTableSize();
2034
- while (used_end < array_.Count() &&
2035
- array_[used_end].head_next_with_shift.LoadRelaxed() !=
2036
- HandleImpl::kUnusedMarker) {
2037
- used_end++;
2038
- }
2039
- #ifndef NDEBUG
2040
- for (size_t i = used_end; i < array_.Count(); i++) {
2041
- assert(array_[i].head_next_with_shift.LoadRelaxed() == 0);
2042
- assert(array_[i].chain_next_with_shift.LoadRelaxed() == 0);
2043
- assert(array_[i].meta.LoadRelaxed() == 0);
2044
- }
2045
- std::vector<bool> was_populated(used_end);
2046
- std::vector<bool> was_pointed_to(used_end);
2047
- #endif
2048
- for (size_t i = 0; i < used_end; i++) {
2049
- HandleImpl& h = array_[i];
2050
- switch (h.meta.LoadRelaxed() >> ClockHandle::kStateShift) {
2051
- case ClockHandle::kStateEmpty:
2052
- // noop
2053
- break;
2054
- case ClockHandle::kStateInvisible: // rare but possible
2055
- case ClockHandle::kStateVisible:
2056
- assert(GetRefcount(h.meta.LoadRelaxed()) == 0);
2057
- h.FreeData(allocator_);
2058
- #ifndef NDEBUG // Extra invariant checking
2059
- usage_.FetchSubRelaxed(h.total_charge);
2060
- occupancy_.FetchSubRelaxed(1U);
2061
- was_populated[i] = true;
2062
- if (!HandleImpl::IsEnd(h.chain_next_with_shift.LoadRelaxed())) {
2063
- assert((h.chain_next_with_shift.LoadRelaxed() &
2064
- HandleImpl::kHeadLocked) == 0);
2065
- size_t next =
2066
- GetNextFromNextWithShift(h.chain_next_with_shift.LoadRelaxed());
2067
- assert(!was_pointed_to[next]);
2068
- was_pointed_to[next] = true;
2069
- }
2070
- #endif
2071
- break;
2072
- // otherwise
2073
- default:
2074
- assert(false);
2075
- break;
2076
- }
2077
- #ifndef NDEBUG // Extra invariant checking
2078
- if (!HandleImpl::IsEnd(h.head_next_with_shift.LoadRelaxed())) {
2079
- size_t next =
2080
- GetNextFromNextWithShift(h.head_next_with_shift.LoadRelaxed());
2081
- assert(!was_pointed_to[next]);
2082
- was_pointed_to[next] = true;
2083
- }
2084
- #endif
2085
- }
2086
- #ifndef NDEBUG // Extra invariant checking
2087
- // This check is not perfect, but should detect most reasonable cases
2088
- // of abandonned or floating entries, etc. (A floating cycle would not
2089
- // be reported as bad.)
2090
- for (size_t i = 0; i < used_end; i++) {
2091
- if (was_populated[i]) {
2092
- assert(was_pointed_to[i]);
2093
- } else {
2094
- assert(!was_pointed_to[i]);
2095
- }
2096
- }
2097
- #endif
2098
-
2099
- // Metadata charging only follows the published table size
2100
- assert(usage_.LoadRelaxed() == 0 ||
2101
- usage_.LoadRelaxed() == GetTableSize() * sizeof(HandleImpl));
2102
- assert(occupancy_.LoadRelaxed() == 0);
2103
- }
2104
-
2105
- size_t AutoHyperClockTable::GetTableSize() const {
2106
- return LengthInfoToUsedLength(length_info_.Load());
2107
- }
2108
-
2109
- size_t AutoHyperClockTable::GetOccupancyLimit() const {
2110
- return occupancy_limit_.LoadRelaxed();
2111
- }
2112
-
2113
- void AutoHyperClockTable::StartInsert(InsertState& state) {
2114
- state.saved_length_info = length_info_.Load();
2115
- }
2116
-
2117
- // Because we have linked lists, bugs or even hardware errors can make it
2118
- // possible to create a cycle, which would lead to infinite loop.
2119
- // Furthermore, when we have retry cases in the code, we want to be sure
2120
- // these are not (and do not become) spin-wait loops. Given the assumption
2121
- // of quality hashing and the infeasibility of consistently recurring
2122
- // concurrent modifications to an entry or chain, we can safely bound the
2123
- // number of loop iterations in feasible operation, whether following chain
2124
- // pointers or retrying with some backtracking. A smaller limit is used for
2125
- // stress testing, to detect potential issues such as cycles or spin-waits,
2126
- // and a larger limit is used to break cycles should they occur in production.
2127
- #define CHECK_TOO_MANY_ITERATIONS(i) \
2128
- { \
2129
- assert(i < 768); \
2130
- if (UNLIKELY(i >= 4096)) { \
2131
- std::terminate(); \
2132
- } \
2133
- }
2134
-
2135
- bool AutoHyperClockTable::GrowIfNeeded(size_t new_occupancy,
2136
- InsertState& state) {
2137
- // new_occupancy has taken into account other threads that are also trying
2138
- // to insert, so as soon as we see sufficient *published* usable size, we
2139
- // can declare success even if we aren't the one that grows the table.
2140
- // However, there's an awkward state where other threads own growing the
2141
- // table to sufficient usable size, but the udpated size is not yet
2142
- // published. If we wait, then that likely slows the ramp-up cache
2143
- // performance. If we unblock ourselves by ensuring we grow by at least one
2144
- // slot, we could technically overshoot required size by number of parallel
2145
- // threads accessing block cache. On balance considering typical cases and
2146
- // the modest consequences of table being slightly too large, the latter
2147
- // seems preferable.
2148
- //
2149
- // So if the published occupancy limit is too small, we unblock ourselves
2150
- // by committing to growing the table by at least one slot. Also note that
2151
- // we might need to grow more than once to actually increase the occupancy
2152
- // limit (due to max load factor < 1.0)
2153
-
2154
- while (UNLIKELY(new_occupancy > occupancy_limit_.LoadRelaxed())) {
2155
- // At this point we commit the thread to growing unless we've reached the
2156
- // limit (returns false).
2157
- if (!Grow(state)) {
2158
- return false;
2159
- }
2160
- }
2161
- // Success (didn't need to grow, or did successfully)
2162
- return true;
2163
- }
2164
-
2165
- bool AutoHyperClockTable::Grow(InsertState& state) {
2166
- // Allocate the next grow slot
2167
- size_t grow_home = grow_frontier_.FetchAddRelaxed(1);
2168
- if (grow_home >= array_.Count()) {
2169
- // Can't grow any more.
2170
- // (Tested by unit test ClockCacheTest/Limits)
2171
- // Make sure we don't overflow grow_frontier_ by reaching here repeatedly
2172
- grow_frontier_.StoreRelaxed(array_.Count());
2173
- return false;
2174
- }
2175
- #ifdef COERCE_CONTEXT_SWITCH
2176
- // This is useful in reproducing concurrency issues in Grow()
2177
- while (Random::GetTLSInstance()->OneIn(2)) {
2178
- std::this_thread::yield();
2179
- }
2180
- #endif
2181
- // Basically, to implement https://en.wikipedia.org/wiki/Linear_hashing
2182
- // entries that belong in a new chain starting at grow_home will be
2183
- // split off from the chain starting at old_home, which is computed here.
2184
- int old_shift = FloorLog2(grow_home);
2185
- size_t old_home = BottomNBits(grow_home, old_shift);
2186
- assert(old_home + (size_t{1} << old_shift) == grow_home);
2187
-
2188
- // Wait here to ensure any Grow operations that would directly feed into
2189
- // this one are finished, though the full waiting actually completes in
2190
- // acquiring the rewrite lock for old_home in SplitForGrow. Here we ensure
2191
- // the expected shift amount has been reached, and there we ensure the
2192
- // chain rewrite lock has been released.
2193
- size_t old_old_home = BottomNBits(grow_home, old_shift - 1);
2194
- for (;;) {
2195
- uint64_t old_old_head = array_[old_old_home].head_next_with_shift.Load();
2196
- if (GetShiftFromNextWithShift(old_old_head) >= old_shift) {
2197
- if ((old_old_head & HandleImpl::kNextEndFlags) !=
2198
- HandleImpl::kHeadLocked) {
2199
- break;
2200
- }
2201
- }
2202
- // NOTE: one of the few yield-wait loops, which is rare enough in practice
2203
- // for its performance to be insignificant.
2204
- yield_count_.FetchAddRelaxed(1);
2205
- std::this_thread::yield();
2206
- }
2207
-
2208
- // Do the dirty work of splitting the chain, including updating heads and
2209
- // chain nexts for new shift amounts.
2210
- SplitForGrow(grow_home, old_home, old_shift);
2211
-
2212
- // length_info_ can be updated any time after the new shift amount is
2213
- // published to both heads, potentially before the end of SplitForGrow.
2214
- // But we also can't update length_info_ until the previous Grow operation
2215
- // (with grow_home := this grow_home - 1) has published the new shift amount
2216
- // to both of its heads. However, we don't want to artificially wait here
2217
- // on that Grow that is otherwise irrelevant.
2218
- //
2219
- // We could have each Grow operation advance length_info_ here as far as it
2220
- // can without waiting, by checking for updated shift on the corresponding
2221
- // old home and also stopping at an empty head value for possible grow_home.
2222
- // However, this could increase CPU cache line sharing and in 1/64 cases
2223
- // bring in an extra page from our mmap.
2224
- //
2225
- // Instead, part of the strategy is delegated to DoInsert():
2226
- // * Here we try to bring length_info_ up to date with this grow_home as
2227
- // much as we can without waiting. It will fall short if a previous Grow
2228
- // is still between reserving the grow slot and making the first big step
2229
- // to publish the new shift amount.
2230
- // * To avoid length_info_ being perpetually out-of-date (for a small number
2231
- // of heads) after our last Grow, we do the same when Insert has to "fall
2232
- // forward" due to length_info_ being out-of-date.
2233
- CatchUpLengthInfoNoWait(grow_home);
2234
-
2235
- // See usage in DoInsert()
2236
- state.likely_empty_slot = grow_home;
2237
-
2238
- // Success
2239
- return true;
2240
- }
2241
-
2242
- // See call in Grow()
2243
- void AutoHyperClockTable::CatchUpLengthInfoNoWait(
2244
- size_t known_usable_grow_home) {
2245
- uint64_t current_length_info = length_info_.Load();
2246
- size_t published_usable_size = LengthInfoToUsedLength(current_length_info);
2247
- while (published_usable_size <= known_usable_grow_home) {
2248
- // For when published_usable_size was grow_home
2249
- size_t next_usable_size = published_usable_size + 1;
2250
- uint64_t next_length_info = UsedLengthToLengthInfo(next_usable_size);
2251
-
2252
- // known_usable_grow_home is known to be ready for Lookup/Insert with
2253
- // the new shift amount, but between that and published usable size, we
2254
- // need to check.
2255
- if (published_usable_size < known_usable_grow_home) {
2256
- int old_shift = FloorLog2(next_usable_size - 1);
2257
- size_t old_home = BottomNBits(published_usable_size, old_shift);
2258
- int shift = GetShiftFromNextWithShift(
2259
- array_[old_home].head_next_with_shift.Load());
2260
- if (shift <= old_shift) {
2261
- // Not ready
2262
- break;
2263
- }
2264
- }
2265
- // CAS update length_info_. This only moves in one direction, so if CAS
2266
- // fails, someone else made progress like we are trying, and we can just
2267
- // pick up the new value and keep going as appropriate.
2268
- if (length_info_.CasStrong(current_length_info, next_length_info)) {
2269
- current_length_info = next_length_info;
2270
- // Update usage_ if metadata charge policy calls for it
2271
- if (metadata_charge_policy_ ==
2272
- CacheMetadataChargePolicy::kFullChargeCacheMetadata) {
2273
- // NOTE: ignoring page boundaries for simplicity
2274
- usage_.FetchAddRelaxed(sizeof(HandleImpl));
2275
- }
2276
- }
2277
- published_usable_size = LengthInfoToUsedLength(current_length_info);
2278
- }
2279
-
2280
- // After updating lengh_info_ we can update occupancy_limit_,
2281
- // allowing for later operations to update it before us.
2282
- // Note: there is no AcqRelAtomic max operation, so we have to use a CAS loop
2283
- size_t old_occupancy_limit = occupancy_limit_.LoadRelaxed();
2284
- size_t new_occupancy_limit = CalcOccupancyLimit(published_usable_size);
2285
- while (old_occupancy_limit < new_occupancy_limit) {
2286
- if (occupancy_limit_.CasWeakRelaxed(old_occupancy_limit,
2287
- new_occupancy_limit)) {
2288
- break;
2289
- }
2290
- }
2291
- }
2292
-
2293
- void AutoHyperClockTable::SplitForGrow(size_t grow_home, size_t old_home,
2294
- int old_shift) {
2295
- int new_shift = old_shift + 1;
2296
- HandleImpl* const arr = array_.Get();
2297
-
2298
- // We implement a somewhat complicated splitting algorithm to ensure that
2299
- // entries are always wait-free visible to Lookup, without Lookup needing
2300
- // to double-check length_info_ to ensure every potentially relevant
2301
- // existing entry is seen. This works step-by-step, carefully sharing
2302
- // unmigrated parts of the chain between the source chain and the new
2303
- // destination chain. This means that Lookup might see a partially migrated
2304
- // chain so has to take that into consideration when checking that it hasn't
2305
- // "jumped off" its intended chain (due to a parallel modification to an
2306
- // "under (de)construction" entry that was found on the chain but has
2307
- // been reassigned).
2308
- //
2309
- // We use a "rewrite lock" on the source and desination chains to exclude
2310
- // removals from those, and we have a prior waiting step that ensures any Grow
2311
- // operations feeding into this one have completed. But this process does have
2312
- // to gracefully handle concurrent insertions to the head of the source chain,
2313
- // and once marked ready, the destination chain.
2314
- //
2315
- // With those considerations, the migration starts with one "big step,"
2316
- // potentially with retries to deal with insertions in parallel. Part of the
2317
- // big step is to mark the two chain heads as updated with the new shift
2318
- // amount, which redirects Lookups to the appropriate new chain.
2319
- //
2320
- // After that big step that updates the heads, the rewrite lock makes it
2321
- // relatively easy to deal with the rest of the migration. Big
2322
- // simplifications come from being able to read the hashed_key of each
2323
- // entry on the chain without needing to hold a read reference, and
2324
- // from never "jumping our to another chain." Concurrent insertions only
2325
- // happen at the chain head, which is outside of what is left to migrate.
2326
- //
2327
- // A series of smaller steps finishes splitting apart the existing chain into
2328
- // two distinct chains, followed by some steps to fully commit the result.
2329
- //
2330
- // Except for trivial cases in which all entries (or remaining entries)
2331
- // on the input chain go to one output chain, there is an important invariant
2332
- // after each step of migration, including after the initial "big step":
2333
- // For each output chain, the "zero chain" (new hash bit is zero) and the
2334
- // "one chain" (new hash bit is one) we have a "frontier" entry marking the
2335
- // boundary between what has been migrated and what has not. One of the
2336
- // frontiers is along the old chain after the other, and all entries between
2337
- // them are for the same target chain as the earlier frontier. Thus, the
2338
- // chains share linked list tails starting at the latter frontier. All
2339
- // pointers from the new head locations to the frontier entries are marked
2340
- // with the new shift amount, while all pointers after the frontiers use the
2341
- // old shift amount.
2342
- //
2343
- // And after each step there is a strengthening step to reach a stronger
2344
- // invariant: the frontier earlier in the original chain is advanced to be
2345
- // immediately before the other frontier.
2346
- //
2347
- // Consider this original input chain,
2348
- //
2349
- // OldHome -Old-> A0 -Old-> B0 -Old-> A1 -Old-> C0 -Old-> OldHome(End)
2350
- // GrowHome (empty)
2351
- //
2352
- // == BIG STEP ==
2353
- // The initial big step finds the first entry that will be on the each
2354
- // output chain (in this case A0 and A1). We use brackets ([]) to mark them
2355
- // as our prospective frontiers.
2356
- //
2357
- // OldHome -Old-> [A0] -Old-> B0 -Old-> [A1] -Old-> C0 -Old-> OldHome(End)
2358
- // GrowHome (empty)
2359
- //
2360
- // Next we speculatively update grow_home head to point to the first entry for
2361
- // the one chain. This will not be used by Lookup until the head at old_home
2362
- // uses the new shift amount.
2363
- //
2364
- // OldHome -Old-> [A0] -Old-> B0 -Old-> [A1] -Old-> C0 -Old-> OldHome(End)
2365
- // GrowHome --------------New------------/
2366
- //
2367
- // Observe that if Lookup were to use the new head at GrowHome, it would be
2368
- // able to find all relevant entries. Finishing the initial big step
2369
- // requires a CAS (compare_exchange) of the OldHome head because there
2370
- // might have been parallel insertions there, in which case we roll back
2371
- // and try again. (We might need to point GrowHome head differently.)
2372
- //
2373
- // OldHome -New-> [A0] -Old-> B0 -Old-> [A1] -Old-> C0 -Old-> OldHome(End)
2374
- // GrowHome --------------New------------/
2375
- //
2376
- // Upgrading the OldHome head pointer with the new shift amount, with a
2377
- // compare_exchange, completes the initial big step, with [A0] as zero
2378
- // chain frontier and [A1] as one chain frontier. Links before the frontiers
2379
- // use the new shift amount and links after use the old shift amount.
2380
- // == END BIG STEP==
2381
- // == STRENGTHENING ==
2382
- // Zero chain frontier is advanced to [B0] (immediately before other
2383
- // frontier) by updating pointers with new shift amounts.
2384
- //
2385
- // OldHome -New-> A0 -New-> [B0] -Old-> [A1] -Old-> C0 -Old-> OldHome(End)
2386
- // GrowHome -------------New-----------/
2387
- //
2388
- // == END STRENGTHENING ==
2389
- // == SMALL STEP #1 ==
2390
- // From the strong invariant state, we need to find the next entry for
2391
- // the new chain with the earlier frontier. In this case, we need to find
2392
- // the next entry for the zero chain that comes after [B0], which in this
2393
- // case is C0. This will be our next zero chain frontier, at least under
2394
- // the weak invariant. To get there, we simply update the link between
2395
- // the current two frontiers to skip over the entries irreleveant to the
2396
- // ealier frontier chain. In this case, the zero chain skips over A1. As a
2397
- // result, he other chain is now the "earlier."
2398
- //
2399
- // OldHome -New-> A0 -New-> B0 -New-> [C0] -Old-> OldHome(End)
2400
- // GrowHome -New-> [A1] ------Old-----/
2401
- //
2402
- // == END SMALL STEP #1 ==
2403
- //
2404
- // Repeating the cycle and end handling is not as interesting.
2405
-
2406
- // Acquire rewrite lock on zero chain (if it's non-empty)
2407
- ChainRewriteLock zero_head_lock(&arr[old_home], yield_count_);
2408
-
2409
- // Used for locking the one chain below
2410
- uint64_t saved_one_head;
2411
- // One head has not been written to
2412
- assert(arr[grow_home].head_next_with_shift.Load() == 0);
2413
-
2414
- // old_home will also the head of the new "zero chain" -- all entries in the
2415
- // "from" chain whose next hash bit is 0. grow_home will be head of the new
2416
- // "one chain".
2417
-
2418
- // For these, SIZE_MAX is like nullptr (unknown)
2419
- size_t zero_chain_frontier = SIZE_MAX;
2420
- size_t one_chain_frontier = SIZE_MAX;
2421
- size_t cur = SIZE_MAX;
2422
-
2423
- // Set to 0 (zero chain frontier earlier), 1 (one chain), or -1 (unknown)
2424
- int chain_frontier_first = -1;
2425
-
2426
- // Might need to retry initial update of heads
2427
- for (int i = 0;; ++i) {
2428
- CHECK_TOO_MANY_ITERATIONS(i);
2429
- assert(zero_chain_frontier == SIZE_MAX);
2430
- assert(one_chain_frontier == SIZE_MAX);
2431
- assert(cur == SIZE_MAX);
2432
- assert(chain_frontier_first == -1);
2433
-
2434
- uint64_t next_with_shift = zero_head_lock.GetSavedHead();
2435
-
2436
- // Find a single representative for each target chain, or scan the whole
2437
- // chain if some target chain has no representative.
2438
- for (;; ++i) {
2439
- CHECK_TOO_MANY_ITERATIONS(i);
2440
-
2441
- // Loop invariants
2442
- assert((chain_frontier_first < 0) == (zero_chain_frontier == SIZE_MAX &&
2443
- one_chain_frontier == SIZE_MAX));
2444
- assert((cur == SIZE_MAX) == (zero_chain_frontier == SIZE_MAX &&
2445
- one_chain_frontier == SIZE_MAX));
2446
-
2447
- assert(GetShiftFromNextWithShift(next_with_shift) == old_shift);
2448
-
2449
- // Check for end of original chain
2450
- if (HandleImpl::IsEnd(next_with_shift)) {
2451
- cur = SIZE_MAX;
2452
- break;
2453
- }
2454
-
2455
- // next_with_shift is not End
2456
- cur = GetNextFromNextWithShift(next_with_shift);
2457
-
2458
- if (BottomNBits(arr[cur].hashed_key[1], new_shift) == old_home) {
2459
- // Entry for zero chain
2460
- if (zero_chain_frontier == SIZE_MAX) {
2461
- zero_chain_frontier = cur;
2462
- if (one_chain_frontier != SIZE_MAX) {
2463
- // Ready to update heads
2464
- break;
2465
- }
2466
- // Nothing yet for one chain
2467
- chain_frontier_first = 0;
2468
- }
2469
- } else {
2470
- assert(BottomNBits(arr[cur].hashed_key[1], new_shift) == grow_home);
2471
- // Entry for one chain
2472
- if (one_chain_frontier == SIZE_MAX) {
2473
- one_chain_frontier = cur;
2474
- if (zero_chain_frontier != SIZE_MAX) {
2475
- // Ready to update heads
2476
- break;
2477
- }
2478
- // Nothing yet for zero chain
2479
- chain_frontier_first = 1;
2480
- }
2481
- }
2482
-
2483
- next_with_shift = arr[cur].chain_next_with_shift.Load();
2484
- }
2485
-
2486
- // Try to update heads for initial migration info
2487
- // We only reached the end of the migrate-from chain already if one of the
2488
- // target chains will be empty.
2489
- assert((cur == SIZE_MAX) ==
2490
- (zero_chain_frontier == SIZE_MAX || one_chain_frontier == SIZE_MAX));
2491
- assert((chain_frontier_first < 0) ==
2492
- (zero_chain_frontier == SIZE_MAX && one_chain_frontier == SIZE_MAX));
2493
-
2494
- // Always update one chain's head first (safe), and mark it as locked
2495
- saved_one_head = HandleImpl::kHeadLocked |
2496
- (one_chain_frontier != SIZE_MAX
2497
- ? MakeNextWithShift(one_chain_frontier, new_shift)
2498
- : MakeNextWithShiftEnd(grow_home, new_shift));
2499
- arr[grow_home].head_next_with_shift.Store(saved_one_head);
2500
-
2501
- // Make sure length_info_ hasn't been updated too early, as we're about
2502
- // to make the change that makes it safe to update (e.g. in DoInsert())
2503
- assert(LengthInfoToUsedLength(length_info_.Load()) <= grow_home);
2504
-
2505
- // Try to set zero's head.
2506
- if (zero_head_lock.CasUpdate(
2507
- zero_chain_frontier != SIZE_MAX
2508
- ? MakeNextWithShift(zero_chain_frontier, new_shift)
2509
- : MakeNextWithShiftEnd(old_home, new_shift),
2510
- yield_count_)) {
2511
- // Both heads successfully updated to new shift
2512
- break;
2513
- } else {
2514
- // Concurrent insertion. This should not happen too many times.
2515
- CHECK_TOO_MANY_ITERATIONS(i);
2516
- // The easiest solution is to restart.
2517
- zero_chain_frontier = SIZE_MAX;
2518
- one_chain_frontier = SIZE_MAX;
2519
- cur = SIZE_MAX;
2520
- chain_frontier_first = -1;
2521
- continue;
2522
- }
2523
- }
2524
-
2525
- // Create an RAII wrapper for the one chain rewrite lock we are already
2526
- // holding (if was not end) and is now "published" after successful CAS on
2527
- // zero chain head.
2528
- ChainRewriteLock one_head_lock(&arr[grow_home], yield_count_, saved_one_head);
2529
-
2530
- // Except for trivial cases, we have something like
2531
- // AHome -New-> [A0] -Old-> [B0] -Old-> [C0] \ |
2532
- // BHome --------------------New------------> [A1] -Old-> ...
2533
- // And we need to upgrade as much as we can on the "first" chain
2534
- // (the one eventually pointing to the other's frontier). This will
2535
- // also finish off any case in which one of the target chains will be empty.
2536
- if (chain_frontier_first >= 0) {
2537
- size_t& first_frontier = chain_frontier_first == 0
2538
- ? /*&*/ zero_chain_frontier
2539
- : /*&*/ one_chain_frontier;
2540
- size_t& other_frontier = chain_frontier_first != 0
2541
- ? /*&*/ zero_chain_frontier
2542
- : /*&*/ one_chain_frontier;
2543
- uint64_t stop_before_or_new_tail =
2544
- other_frontier != SIZE_MAX
2545
- ? /*stop before*/ MakeNextWithShift(other_frontier, old_shift)
2546
- : /*new tail*/ MakeNextWithShiftEnd(
2547
- chain_frontier_first == 0 ? old_home : grow_home, new_shift);
2548
- UpgradeShiftsOnRange(arr, first_frontier, stop_before_or_new_tail,
2549
- old_shift, new_shift);
2550
- }
2551
-
2552
- if (zero_chain_frontier == SIZE_MAX) {
2553
- // Already finished migrating
2554
- assert(one_chain_frontier == SIZE_MAX);
2555
- assert(cur == SIZE_MAX);
2556
- } else {
2557
- // Still need to migrate between two target chains
2558
- for (int i = 0;; ++i) {
2559
- CHECK_TOO_MANY_ITERATIONS(i);
2560
- // Overall loop invariants
2561
- assert(zero_chain_frontier != SIZE_MAX);
2562
- assert(one_chain_frontier != SIZE_MAX);
2563
- assert(cur != SIZE_MAX);
2564
- assert(chain_frontier_first >= 0);
2565
- size_t& first_frontier = chain_frontier_first == 0
2566
- ? /*&*/ zero_chain_frontier
2567
- : /*&*/ one_chain_frontier;
2568
- size_t& other_frontier = chain_frontier_first != 0
2569
- ? /*&*/ zero_chain_frontier
2570
- : /*&*/ one_chain_frontier;
2571
- assert(cur != first_frontier);
2572
- assert(GetNextFromNextWithShift(
2573
- arr[first_frontier].chain_next_with_shift.Load()) ==
2574
- other_frontier);
2575
-
2576
- uint64_t next_with_shift = arr[cur].chain_next_with_shift.Load();
2577
-
2578
- // Check for end of original chain
2579
- if (HandleImpl::IsEnd(next_with_shift)) {
2580
- // Can set upgraded tail on first chain
2581
- uint64_t first_new_tail = MakeNextWithShiftEnd(
2582
- chain_frontier_first == 0 ? old_home : grow_home, new_shift);
2583
- arr[first_frontier].chain_next_with_shift.Store(first_new_tail);
2584
- // And upgrade remainder of other chain
2585
- uint64_t other_new_tail = MakeNextWithShiftEnd(
2586
- chain_frontier_first != 0 ? old_home : grow_home, new_shift);
2587
- UpgradeShiftsOnRange(arr, other_frontier, other_new_tail, old_shift,
2588
- new_shift);
2589
- assert(other_frontier == SIZE_MAX); // Finished
2590
- break;
2591
- }
2592
-
2593
- // next_with_shift is not End
2594
- cur = GetNextFromNextWithShift(next_with_shift);
2595
-
2596
- int target_chain;
2597
- if (BottomNBits(arr[cur].hashed_key[1], new_shift) == old_home) {
2598
- // Entry for zero chain
2599
- target_chain = 0;
2600
- } else {
2601
- assert(BottomNBits(arr[cur].hashed_key[1], new_shift) == grow_home);
2602
- // Entry for one chain
2603
- target_chain = 1;
2604
- }
2605
- if (target_chain == chain_frontier_first) {
2606
- // Found next entry to skip to on the first chain
2607
- uint64_t skip_to = MakeNextWithShift(cur, new_shift);
2608
- arr[first_frontier].chain_next_with_shift.Store(skip_to);
2609
- first_frontier = cur;
2610
- // Upgrade other chain up to entry before that one
2611
- UpgradeShiftsOnRange(arr, other_frontier, next_with_shift, old_shift,
2612
- new_shift);
2613
- // Swap which is marked as first
2614
- chain_frontier_first = 1 - chain_frontier_first;
2615
- } else {
2616
- // Nothing to do yet, as we need to keep old generation pointers in
2617
- // place for lookups
2618
- }
2619
- }
2620
- }
2621
- }
2622
-
2623
- // Variant of PurgeImplLocked: Removes all "under (de) construction" entries
2624
- // from a chain where already holding a rewrite lock
2625
- using PurgeLockedOpData = void;
2626
- // Variant of PurgeImplLocked: Clock-updates all entries in a chain, in
2627
- // addition to functionality of PurgeLocked, where already holding a rewrite
2628
- // lock. (Caller finalizes eviction on entries added to the autovector, in part
2629
- // so that we don't hold the rewrite lock while doing potentially expensive
2630
- // callback and allocator free.)
2631
- using ClockUpdateChainLockedOpData =
2632
- autovector<AutoHyperClockTable::HandleImpl*>;
2633
-
2634
- template <class OpData>
2635
- void AutoHyperClockTable::PurgeImplLocked(OpData* op_data,
2636
- ChainRewriteLock& rewrite_lock,
2637
- size_t home,
2638
- BaseClockTable::EvictionData* data) {
2639
- constexpr bool kIsPurge = std::is_same_v<OpData, PurgeLockedOpData>;
2640
- constexpr bool kIsClockUpdateChain =
2641
- std::is_same_v<OpData, ClockUpdateChainLockedOpData>;
2642
-
2643
- // Exactly one op specified
2644
- static_assert(kIsPurge + kIsClockUpdateChain == 1);
2645
-
2646
- HandleImpl* const arr = array_.Get();
2647
-
2648
- uint64_t next_with_shift = rewrite_lock.GetSavedHead();
2649
- assert(!HandleImpl::IsEnd(next_with_shift));
2650
- int home_shift = GetShiftFromNextWithShift(next_with_shift);
2651
- (void)home;
2652
- (void)home_shift;
2653
- size_t next = GetNextFromNextWithShift(next_with_shift);
2654
- assert(next < array_.Count());
2655
- HandleImpl* h = &arr[next];
2656
- HandleImpl* prev_to_keep = nullptr;
2657
- #ifndef NDEBUG
2658
- uint64_t prev_to_keep_next_with_shift = 0;
2659
- #endif
2660
- // Whether there are entries between h and prev_to_keep that should be
2661
- // purged from the chain.
2662
- bool pending_purge = false;
2663
-
2664
- // Walk the chain, and stitch together any entries that are still
2665
- // "shareable," possibly after clock update. prev_to_keep tells us where
2666
- // the last "stitch back to" location is (nullptr => head).
2667
- for (size_t i = 0;; ++i) {
2668
- CHECK_TOO_MANY_ITERATIONS(i);
2669
-
2670
- bool purgeable = false;
2671
- // In last iteration, h will be nullptr, to stitch together the tail of
2672
- // the chain.
2673
- if (h) {
2674
- // NOTE: holding a rewrite lock on the chain prevents any "under
2675
- // (de)construction" entries in the chain from being marked empty, which
2676
- // allows us to access the hashed_keys without holding a read ref.
2677
- assert(home == BottomNBits(h->hashed_key[1], home_shift));
2678
- if constexpr (kIsClockUpdateChain) {
2679
- // Clock update and/or check for purgeable (under (de)construction)
2680
- if (ClockUpdate(*h, data, &purgeable)) {
2681
- // Remember for finishing eviction
2682
- op_data->push_back(h);
2683
- // Entries for eviction become purgeable
2684
- purgeable = true;
2685
- assert((h->meta.Load() >> ClockHandle::kStateShift) ==
2686
- ClockHandle::kStateConstruction);
2687
- }
2688
- } else {
2689
- (void)op_data;
2690
- (void)data;
2691
- purgeable = ((h->meta.Load() >> ClockHandle::kStateShift) &
2692
- ClockHandle::kStateShareableBit) == 0;
2693
- }
2694
- }
2695
-
2696
- if (purgeable) {
2697
- assert((h->meta.Load() >> ClockHandle::kStateShift) ==
2698
- ClockHandle::kStateConstruction);
2699
- pending_purge = true;
2700
- } else if (pending_purge) {
2701
- if (prev_to_keep) {
2702
- // Update chain next to skip purgeable entries
2703
- assert(prev_to_keep->chain_next_with_shift.Load() ==
2704
- prev_to_keep_next_with_shift);
2705
- prev_to_keep->chain_next_with_shift.Store(next_with_shift);
2706
- } else if (rewrite_lock.CasUpdate(next_with_shift, yield_count_)) {
2707
- // Managed to update head without any parallel insertions
2708
- } else {
2709
- // Parallel insertion must have interfered. Need to do a purge
2710
- // from updated head to here. Since we have no prev_to_keep, there's
2711
- // no risk of duplicate clock updates to entries. Any entries already
2712
- // updated must have been evicted (purgeable) and it's OK to clock
2713
- // update any new entries just inserted in parallel.
2714
- // Can simply restart (GetSavedHead() already updated from CAS failure).
2715
- next_with_shift = rewrite_lock.GetSavedHead();
2716
- assert(!HandleImpl::IsEnd(next_with_shift));
2717
- next = GetNextFromNextWithShift(next_with_shift);
2718
- assert(next < array_.Count());
2719
- h = &arr[next];
2720
- pending_purge = false;
2721
- assert(prev_to_keep == nullptr);
2722
- assert(GetShiftFromNextWithShift(next_with_shift) == home_shift);
2723
- continue;
2724
- }
2725
- pending_purge = false;
2726
- prev_to_keep = h;
2727
- } else {
2728
- prev_to_keep = h;
2729
- }
2730
-
2731
- if (h == nullptr) {
2732
- // Reached end of the chain
2733
- return;
2734
- }
2735
-
2736
- // Read chain pointer
2737
- next_with_shift = h->chain_next_with_shift.Load();
2738
- #ifndef NDEBUG
2739
- if (prev_to_keep == h) {
2740
- prev_to_keep_next_with_shift = next_with_shift;
2741
- }
2742
- #endif
2743
-
2744
- assert(GetShiftFromNextWithShift(next_with_shift) == home_shift);
2745
-
2746
- // Check for end marker
2747
- if (HandleImpl::IsEnd(next_with_shift)) {
2748
- h = nullptr;
2749
- } else {
2750
- next = GetNextFromNextWithShift(next_with_shift);
2751
- assert(next < array_.Count());
2752
- h = &arr[next];
2753
- assert(h != prev_to_keep);
2754
- }
2755
- }
2756
- }
2757
-
2758
- // Variant of PurgeImpl: Removes all "under (de) construction" entries in a
2759
- // chain, such that any entry with the given key must have been purged.
2760
- using PurgeOpData = const UniqueId64x2;
2761
- // Variant of PurgeImpl: Clock-updates all entries in a chain, in addition to
2762
- // purging as appropriate. (Caller finalizes eviction on entries added to the
2763
- // autovector, in part so that we don't hold the rewrite lock while doing
2764
- // potentially expensive callback and allocator free.)
2765
- using ClockUpdateChainOpData = ClockUpdateChainLockedOpData;
2766
-
2767
- template <class OpData>
2768
- void AutoHyperClockTable::PurgeImpl(OpData* op_data, size_t home,
2769
- BaseClockTable::EvictionData* data) {
2770
- // Early efforts to make AutoHCC fully wait-free ran into too many problems
2771
- // that needed obscure and potentially inefficient work-arounds to have a
2772
- // chance at working.
2773
- //
2774
- // The implementation settled on "essentially wait-free" which can be
2775
- // achieved by locking at the level of each probing chain and only for
2776
- // operations that might remove entries from the chain. Because parallel
2777
- // clock updates and Grow operations are ordered, contention is very rare.
2778
- // However, parallel insertions at any chain head have to be accommodated
2779
- // to keep them wait-free.
2780
- //
2781
- // This function implements Purge and ClockUpdateChain functions (see above
2782
- // OpData type definitions) as part of higher-level operations. This function
2783
- // ensures the correct chain is (eventually) covered and handles rewrite
2784
- // locking the chain. PurgeImplLocked has lower level details.
2785
- //
2786
- // In general, these operations and Grow are kept simpler by allowing eager
2787
- // purging of under (de-)construction entries. For example, an Erase
2788
- // operation might find that another thread has purged the entry from the
2789
- // chain by the time its own purge operation acquires the rewrite lock and
2790
- // proceeds. This is OK, and potentially reduces the number of lock/unlock
2791
- // cycles because empty chains are not rewrite-lockable.
2792
-
2793
- constexpr bool kIsPurge = std::is_same_v<OpData, PurgeOpData>;
2794
- constexpr bool kIsClockUpdateChain =
2795
- std::is_same_v<OpData, ClockUpdateChainOpData>;
2796
-
2797
- // Exactly one op specified
2798
- static_assert(kIsPurge + kIsClockUpdateChain == 1);
2799
-
2800
- int home_shift = 0;
2801
- if constexpr (kIsPurge) {
2802
- // Purge callers leave home unspecified, to be determined from key
2803
- assert(home == SIZE_MAX);
2804
- GetHomeIndexAndShift(length_info_.Load(), (*op_data)[1], &home,
2805
- &home_shift);
2806
- assert(home_shift > 0);
2807
- } else {
2808
- assert(kIsClockUpdateChain);
2809
- // Evict callers must specify home
2810
- assert(home < SIZE_MAX);
2811
- }
2812
-
2813
- HandleImpl* const arr = array_.Get();
2814
-
2815
- // Acquire the RAII rewrite lock (if not an empty chain)
2816
- ChainRewriteLock rewrite_lock(&arr[home], yield_count_);
2817
-
2818
- if constexpr (kIsPurge) {
2819
- // Ensure we are at the correct home for the shift in effect for the
2820
- // chain head.
2821
- for (;;) {
2822
- int shift = GetShiftFromNextWithShift(rewrite_lock.GetSavedHead());
2823
-
2824
- if (shift > home_shift) {
2825
- // Found a newer shift at candidate head, which must apply to us.
2826
- // Newer shift might not yet be reflected in length_info_ (an atomicity
2827
- // gap in Grow), so operate as if it is. Note that other insertions
2828
- // could happen using this shift before length_info_ is updated, and
2829
- // it's possible (though unlikely) that multiple generations of Grow
2830
- // have occurred. If shift is more than one generation ahead of
2831
- // home_shift, it's possible that not all descendent homes have
2832
- // reached the `shift` generation. Thus, we need to advance only one
2833
- // shift at a time looking for a home+head with a matching shift
2834
- // amount.
2835
- home_shift++;
2836
- home = GetHomeIndex((*op_data)[1], home_shift);
2837
- rewrite_lock.Reset(&arr[home], yield_count_);
2838
- continue;
2839
- } else {
2840
- assert(shift == home_shift);
2841
- }
2842
- break;
2843
- }
2844
- }
2845
-
2846
- // If the chain is empty, nothing to do
2847
- if (!rewrite_lock.IsEnd()) {
2848
- if constexpr (kIsPurge) {
2849
- PurgeLockedOpData* locked_op_data{};
2850
- PurgeImplLocked(locked_op_data, rewrite_lock, home, data);
2851
- } else {
2852
- PurgeImplLocked(op_data, rewrite_lock, home, data);
2853
- }
2854
- }
2855
- }
2856
-
2857
- AutoHyperClockTable::HandleImpl* AutoHyperClockTable::DoInsert(
2858
- const ClockHandleBasicData& proto, uint64_t initial_countdown,
2859
- bool take_ref, InsertState& state) {
2860
- size_t home;
2861
- int orig_home_shift;
2862
- GetHomeIndexAndShift(state.saved_length_info, proto.hashed_key[1], &home,
2863
- &orig_home_shift);
2864
- HandleImpl* const arr = array_.Get();
2865
-
2866
- // We could go searching through the chain for any duplicate, but that's
2867
- // not typically helpful, except for the REDUNDANT block cache stats.
2868
- // (Inferior duplicates will age out with eviction.) However, we do skip
2869
- // insertion if the home slot (or some other we happen to probe) already
2870
- // has a match (already_matches below). This helps to keep better locality
2871
- // when we can.
2872
- //
2873
- // And we can do that as part of searching for an available slot to
2874
- // insert the new entry, because our preferred location and first slot
2875
- // checked will be the home slot.
2876
- //
2877
- // As the table initially grows to size, few entries will be in the same
2878
- // cache line as the chain head. However, churn in the cache relatively
2879
- // quickly improves the proportion of entries sharing that cache line with
2880
- // the chain head. Data:
2881
- //
2882
- // Initial population only: (cache_bench with -ops_per_thread=1)
2883
- // Entries at home count: 29,202 (out of 129,170 entries in 94,411 chains)
2884
- // Approximate average cache lines read to find an existing entry:
2885
- // 129.2 / 94.4 [without the heads]
2886
- // + (94.4 - 29.2) / 94.4 [the heads not included with entries]
2887
- // = 2.06 cache lines
2888
- //
2889
- // After 10 million ops: (-threads=10 -ops_per_thread=100000)
2890
- // Entries at home count: 67,556 (out of 129,359 entries in 94,756 chains)
2891
- // That's a majority of entries and more than 2/3rds of chains.
2892
- // Approximate average cache lines read to find an existing entry:
2893
- // = 1.65 cache lines
2894
-
2895
- // Even if we aren't saving a ref to this entry (take_ref == false), we need
2896
- // to keep a reference while we are inserting the entry into a chain, so that
2897
- // it is not erased by another thread while trying to insert it on the chain.
2898
- constexpr bool initial_take_ref = true;
2899
-
2900
- size_t used_length = LengthInfoToUsedLength(state.saved_length_info);
2901
- assert(home < used_length);
2902
-
2903
- size_t idx = home;
2904
- bool already_matches = false;
2905
- bool already_matches_ignore = false;
2906
- if (TryInsert(proto, arr[idx], initial_countdown, initial_take_ref,
2907
- &already_matches)) {
2908
- assert(idx == home);
2909
- } else if (already_matches) {
2910
- return nullptr;
2911
- // Here we try to populate newly-opened slots in the table, but not
2912
- // when we can add something to its home slot. This makes the structure
2913
- // more performant more quickly on (initial) growth. We ignore "already
2914
- // matches" in this case because it is unlikely and difficult to
2915
- // incorporate logic for here cleanly and efficiently.
2916
- } else if (UNLIKELY(state.likely_empty_slot > 0) &&
2917
- TryInsert(proto, arr[state.likely_empty_slot], initial_countdown,
2918
- initial_take_ref, &already_matches_ignore)) {
2919
- idx = state.likely_empty_slot;
2920
- } else {
2921
- // We need to search for an available slot outside of the home.
2922
- // Linear hashing provides nice resizing but does typically mean
2923
- // that some heads (home locations) have (in expectation) twice as
2924
- // many entries mapped to them as other heads. For example if the
2925
- // usable length is 80, then heads 16-63 are (in expectation) twice
2926
- // as loaded as heads 0-15 and 64-79, which are using another hash bit.
2927
- //
2928
- // This means that if we just use linear probing (by a small constant)
2929
- // to find an available slot, part of the structure could easily fill up
2930
- // and resort to linear time operations even when the overall load factor
2931
- // is only modestly high, like 70%. Even though each slot has its own CPU
2932
- // cache line, there appears to be a small locality benefit (e.g. TLB and
2933
- // paging) to iterating one by one, as long as we don't afoul of the
2934
- // linear hashing imbalance.
2935
- //
2936
- // In a traditional non-concurrent structure, we could keep a "free list"
2937
- // to ensure immediate access to an available slot, but maintaining such
2938
- // a structure could require more cross-thread coordination to ensure
2939
- // all entries are eventually available to all threads.
2940
- //
2941
- // The way we solve this problem is to use unit-increment linear probing
2942
- // with a small bound, and then fall back on big jumps to have a good
2943
- // chance of finding a slot in an under-populated region quickly if that
2944
- // doesn't work.
2945
- size_t i = 0;
2946
- constexpr size_t kMaxLinearProbe = 4;
2947
- for (; i < kMaxLinearProbe; i++) {
2948
- idx++;
2949
- if (idx >= used_length) {
2950
- idx -= used_length;
2951
- }
2952
- if (TryInsert(proto, arr[idx], initial_countdown, initial_take_ref,
2953
- &already_matches)) {
2954
- break;
2955
- }
2956
- if (already_matches) {
2957
- return nullptr;
2958
- }
2959
- }
2960
- if (i == kMaxLinearProbe) {
2961
- // Keep searching, but change to a search method that should quickly
2962
- // find any under-populated region. Switching to an increment based
2963
- // on the golden ratio helps with that, but we also inject some minor
2964
- // variation (less than 2%, 1 in 2^6) to avoid clustering effects on
2965
- // this larger increment (if it were a fixed value in steady state
2966
- // operation). Here we are primarily using upper bits of hashed_key[1]
2967
- // while home is based on lowest bits.
2968
- uint64_t incr_ratio = 0x9E3779B185EBCA87U + (proto.hashed_key[1] >> 6);
2969
- size_t incr = FastRange64(incr_ratio, used_length);
2970
- assert(incr > 0);
2971
- size_t start = idx;
2972
- for (;; i++) {
2973
- idx += incr;
2974
- if (idx >= used_length) {
2975
- // Wrap around (faster than %)
2976
- idx -= used_length;
2977
- }
2978
- if (idx == start) {
2979
- // We have just completed a cycle that might not have covered all
2980
- // slots. (incr and used_length could have common factors.)
2981
- // Increment for the next cycle, which eventually ensures complete
2982
- // iteration over the set of slots before repeating.
2983
- idx++;
2984
- if (idx >= used_length) {
2985
- idx -= used_length;
2986
- }
2987
- start++;
2988
- if (start >= used_length) {
2989
- start -= used_length;
2990
- }
2991
- if (i >= used_length) {
2992
- used_length = LengthInfoToUsedLength(length_info_.Load());
2993
- if (i >= used_length * 2) {
2994
- // Cycling back should not happen unless there is enough random
2995
- // churn in parallel that we happen to hit each slot at a time
2996
- // that it's occupied, which is really only feasible for small
2997
- // structures, though with linear probing to find empty slots,
2998
- // "small" here might be larger than for double hashing.
2999
- assert(used_length <= 256);
3000
- // Fall back on standalone insert in case something goes awry to
3001
- // cause this
3002
- return nullptr;
3003
- }
3004
- }
3005
- }
3006
- if (TryInsert(proto, arr[idx], initial_countdown, initial_take_ref,
3007
- &already_matches)) {
3008
- break;
3009
- }
3010
- if (already_matches) {
3011
- return nullptr;
3012
- }
3013
- }
3014
- }
3015
- }
3016
-
3017
- // Now insert into chain using head pointer
3018
- uint64_t next_with_shift;
3019
- int home_shift = orig_home_shift;
3020
-
3021
- // Might need to retry
3022
- for (int i = 0;; ++i) {
3023
- CHECK_TOO_MANY_ITERATIONS(i);
3024
- next_with_shift = arr[home].head_next_with_shift.Load();
3025
- int shift = GetShiftFromNextWithShift(next_with_shift);
3026
-
3027
- if (UNLIKELY(shift != home_shift)) {
3028
- // NOTE: shift increases with table growth
3029
- if (shift > home_shift) {
3030
- // Must be grow in progress or completed since reading length_info.
3031
- // Pull out one more hash bit. (See Lookup() for why we can't
3032
- // safely jump to the shift that was read.)
3033
- home_shift++;
3034
- uint64_t hash_bit_mask = uint64_t{1} << (home_shift - 1);
3035
- assert((home & hash_bit_mask) == 0);
3036
- // BEGIN leftover updates to length_info_ for Grow()
3037
- size_t grow_home = home + hash_bit_mask;
3038
- assert(arr[grow_home].head_next_with_shift.Load() !=
3039
- HandleImpl::kUnusedMarker);
3040
- CatchUpLengthInfoNoWait(grow_home);
3041
- // END leftover updates to length_info_ for Grow()
3042
- home += proto.hashed_key[1] & hash_bit_mask;
3043
- continue;
3044
- } else {
3045
- // Should not happen because length_info_ is only updated after both
3046
- // old and new home heads are marked with new shift
3047
- assert(false);
3048
- }
3049
- }
3050
-
3051
- // Values to update to
3052
- uint64_t head_next_with_shift = MakeNextWithShift(idx, home_shift);
3053
- uint64_t chain_next_with_shift = next_with_shift;
3054
-
3055
- // Preserve the locked state in head, without propagating to chain next
3056
- // where it is meaningless (and not allowed)
3057
- if (UNLIKELY((next_with_shift & HandleImpl::kNextEndFlags) ==
3058
- HandleImpl::kHeadLocked)) {
3059
- head_next_with_shift |= HandleImpl::kHeadLocked;
3060
- chain_next_with_shift &= ~HandleImpl::kHeadLocked;
3061
- }
3062
-
3063
- arr[idx].chain_next_with_shift.Store(chain_next_with_shift);
3064
- if (arr[home].head_next_with_shift.CasWeak(next_with_shift,
3065
- head_next_with_shift)) {
3066
- // Success
3067
- if (!take_ref) {
3068
- Unref(arr[idx]);
3069
- }
3070
- return arr + idx;
3071
- }
3072
- }
3073
- }
3074
-
3075
- AutoHyperClockTable::HandleImpl* AutoHyperClockTable::Lookup(
3076
- const UniqueId64x2& hashed_key) {
3077
- // Lookups are wait-free with low occurrence of retries, back-tracking,
3078
- // and fallback. We do not have the benefit of holding a rewrite lock on
3079
- // the chain so must be prepared for many kinds of mayhem, most notably
3080
- // "falling off our chain" where a slot that Lookup has identified but
3081
- // has not read-referenced is removed from one chain and inserted into
3082
- // another. The full algorithm uses the following mitigation strategies to
3083
- // ensure every relevant entry inserted before this Lookup, and not yet
3084
- // evicted, is seen by Lookup, without excessive backtracking etc.:
3085
- // * Keep a known good read ref in the chain for "island hopping." When
3086
- // we observe that a concurrent write takes us off to another chain, we
3087
- // only need to fall back to our last known good read ref (most recent
3088
- // entry on the chain that is not "under construction," which is a transient
3089
- // state). We don't want to compound the CPU toil of a long chain with
3090
- // operations that might need to retry from scratch, with probability
3091
- // in proportion to chain length.
3092
- // * Only detect a chain is potentially incomplete because of a Grow in
3093
- // progress by looking at shift in the next pointer tags (rather than
3094
- // re-checking length_info_).
3095
- // * SplitForGrow, Insert, and PurgeImplLocked ensure that there are no
3096
- // transient states that might cause this full Lookup algorithm to skip over
3097
- // live entries.
3098
-
3099
- // Reading length_info_ is not strictly required for Lookup, if we were
3100
- // to increment shift sizes until we see a shift size match on the
3101
- // relevant head pointer. Thus, reading with relaxed memory order gives
3102
- // us a safe and almost always up-to-date jump into finding the correct
3103
- // home and head.
3104
- size_t home;
3105
- int home_shift;
3106
- GetHomeIndexAndShift(length_info_.LoadRelaxed(), hashed_key[1], &home,
3107
- &home_shift);
3108
- assert(home_shift > 0);
3109
-
3110
- // The full Lookup algorithm however is not great for hot path efficiency,
3111
- // because of the extra careful tracking described above. Overwhelmingly,
3112
- // we can find what we're looking for with a naive linked list traversal
3113
- // of the chain. Even if we "fall off our chain" to another, we don't
3114
- // violate memory safety. We just won't match the key we're looking for.
3115
- // And we would eventually reach an end state, possibly even experiencing a
3116
- // cycle as an entry is freed and reused during our traversal (though at
3117
- // any point in time the structure doesn't have cycles).
3118
- //
3119
- // So for hot path efficiency, we start with a naive Lookup attempt, and
3120
- // then fall back on full Lookup if we don't find the correct entry. To
3121
- // cap how much we invest into the naive Lookup, we simply cap the traversal
3122
- // length before falling back. Also, when we do fall back on full Lookup,
3123
- // we aren't paying much penalty by starting over. Much or most of the cost
3124
- // of Lookup is memory latency in following the chain pointers, and the
3125
- // naive Lookup has warmed the CPU cache for these entries, using as tight
3126
- // of a loop as possible.
3127
-
3128
- HandleImpl* const arr = array_.Get();
3129
- uint64_t next_with_shift = arr[home].head_next_with_shift.LoadRelaxed();
3130
- for (size_t i = 0; !HandleImpl::IsEnd(next_with_shift) && i < 10; ++i) {
3131
- HandleImpl* h = &arr[GetNextFromNextWithShift(next_with_shift)];
3132
- // Attempt cheap key match without acquiring a read ref. This could give a
3133
- // false positive, which is re-checked after acquiring read ref, or false
3134
- // negative, which is re-checked in the full Lookup. Also, this is a
3135
- // technical UB data race according to TSAN, but we don't need to read
3136
- // a "correct" value here for correct overall behavior.
3137
- #ifdef __SANITIZE_THREAD__
3138
- bool probably_equal = Random::GetTLSInstance()->OneIn(2);
3139
- #else
3140
- bool probably_equal = h->hashed_key == hashed_key;
3141
- #endif
3142
- if (probably_equal) {
3143
- // Increment acquire counter for definitive check
3144
- uint64_t old_meta = h->meta.FetchAdd(ClockHandle::kAcquireIncrement);
3145
- // Check if it's a referencable (sharable) entry
3146
- if (LIKELY(old_meta & (uint64_t{ClockHandle::kStateShareableBit}
3147
- << ClockHandle::kStateShift))) {
3148
- assert(GetRefcount(old_meta + ClockHandle::kAcquireIncrement) > 0);
3149
- if (LIKELY(h->hashed_key == hashed_key) &&
3150
- LIKELY(old_meta & (uint64_t{ClockHandle::kStateVisibleBit}
3151
- << ClockHandle::kStateShift))) {
3152
- return h;
3153
- } else {
3154
- Unref(*h);
3155
- }
3156
- } else {
3157
- // For non-sharable states, incrementing the acquire counter has no
3158
- // effect so we don't need to undo it. Furthermore, we cannot safely
3159
- // undo it because we did not acquire a read reference to lock the entry
3160
- // in a Shareable state.
3161
- }
3162
- }
3163
-
3164
- next_with_shift = h->chain_next_with_shift.LoadRelaxed();
3165
- }
3166
-
3167
- // If we get here, falling back on full Lookup algorithm.
3168
- HandleImpl* h = nullptr;
3169
- HandleImpl* read_ref_on_chain = nullptr;
3170
-
3171
- for (size_t i = 0;; ++i) {
3172
- CHECK_TOO_MANY_ITERATIONS(i);
3173
- // Read head or chain pointer
3174
- next_with_shift = h ? h->chain_next_with_shift.Load()
3175
- : arr[home].head_next_with_shift.Load();
3176
- int shift = GetShiftFromNextWithShift(next_with_shift);
3177
-
3178
- // Make sure it's usable
3179
- size_t effective_home = home;
3180
- if (UNLIKELY(shift != home_shift)) {
3181
- // We have potentially gone awry somehow, but it's possible we're just
3182
- // hitting old data that is not yet completed Grow.
3183
- // NOTE: shift bits goes up with table growth.
3184
- if (shift < home_shift) {
3185
- // To avoid waiting on Grow in progress, an old shift amount needs
3186
- // to be processed as if we were still using it and (potentially
3187
- // different or the same) the old home.
3188
- // We can assert it's not too old, because each generation of Grow
3189
- // waits on its ancestor in the previous generation.
3190
- assert(shift + 1 == home_shift);
3191
- effective_home = GetHomeIndex(home, shift);
3192
- } else if (h == read_ref_on_chain) {
3193
- assert(shift > home_shift);
3194
- // At head or coming from an entry on our chain where we're holding
3195
- // a read reference. Thus, we know the newer shift applies to us.
3196
- // Newer shift might not yet be reflected in length_info_ (an atomicity
3197
- // gap in Grow), so operate as if it is. Note that other insertions
3198
- // could happen using this shift before length_info_ is updated, and
3199
- // it's possible (though unlikely) that multiple generations of Grow
3200
- // have occurred. If shift is more than one generation ahead of
3201
- // home_shift, it's possible that not all descendent homes have
3202
- // reached the `shift` generation. Thus, we need to advance only one
3203
- // shift at a time looking for a home+head with a matching shift
3204
- // amount.
3205
- home_shift++;
3206
- // Update home in case it has changed
3207
- home = GetHomeIndex(hashed_key[1], home_shift);
3208
- // This should be rare enough occurrence that it's simplest just
3209
- // to restart (TODO: improve in some cases?)
3210
- h = nullptr;
3211
- if (read_ref_on_chain) {
3212
- Unref(*read_ref_on_chain);
3213
- read_ref_on_chain = nullptr;
3214
- }
3215
- // Didn't make progress & retry
3216
- continue;
3217
- } else {
3218
- assert(shift > home_shift);
3219
- assert(h != nullptr);
3220
- // An "under (de)construction" entry has a new shift amount, which
3221
- // means we have either gotten off our chain or our home shift is out
3222
- // of date. If we revert back to saved ref, we will get updated info.
3223
- h = read_ref_on_chain;
3224
- // Didn't make progress & retry
3225
- continue;
3226
- }
3227
- }
3228
-
3229
- // Check for end marker
3230
- if (HandleImpl::IsEnd(next_with_shift)) {
3231
- // To ensure we didn't miss anything in the chain, the end marker must
3232
- // point back to the correct home.
3233
- if (LIKELY(GetNextFromNextWithShift(next_with_shift) == effective_home)) {
3234
- // Complete, clean iteration of the chain, not found.
3235
- // Clean up.
3236
- if (read_ref_on_chain) {
3237
- Unref(*read_ref_on_chain);
3238
- }
3239
- return nullptr;
3240
- } else {
3241
- // Something went awry. Revert back to a safe point (if we have it)
3242
- h = read_ref_on_chain;
3243
- // Didn't make progress & retry
3244
- continue;
3245
- }
3246
- }
3247
-
3248
- // Follow the next and check for full key match, home match, or neither
3249
- h = &arr[GetNextFromNextWithShift(next_with_shift)];
3250
- bool full_match_or_unknown = false;
3251
- if (MatchAndRef(&hashed_key, *h, shift, effective_home,
3252
- &full_match_or_unknown)) {
3253
- // Got a read ref on next (h).
3254
- //
3255
- // There is a very small chance that between getting the next pointer
3256
- // (now h) and doing MatchAndRef on it, another thread erased/evicted it
3257
- // reinserted it into the same chain, causing us to cycle back in the
3258
- // same chain and potentially see some entries again if we keep walking.
3259
- // Newly-inserted entries are inserted before older ones, so we are at
3260
- // least guaranteed not to miss anything. Here in Lookup, it's just a
3261
- // transient, slight hiccup in performance.
3262
-
3263
- if (full_match_or_unknown) {
3264
- // Full match.
3265
- // Release old read ref on chain if applicable
3266
- if (read_ref_on_chain) {
3267
- // Pretend we never took the reference.
3268
- Unref(*read_ref_on_chain);
3269
- }
3270
- // Update the hit bit
3271
- if (eviction_callback_) {
3272
- h->meta.FetchOrRelaxed(uint64_t{1} << ClockHandle::kHitBitShift);
3273
- }
3274
- // All done.
3275
- return h;
3276
- } else if (UNLIKELY(shift != home_shift) &&
3277
- home != BottomNBits(h->hashed_key[1], home_shift)) {
3278
- // This chain is in a Grow operation and we've landed on an entry
3279
- // that belongs to the wrong destination chain. We can keep going, but
3280
- // there's a chance we'll need to backtrack back *before* this entry,
3281
- // if the Grow finishes before this Lookup. We cannot save this entry
3282
- // for backtracking because it might soon or already be on the wrong
3283
- // chain.
3284
- // NOTE: if we simply backtrack rather than continuing, we would
3285
- // be in a wait loop (not allowed in Lookup!) until the other thread
3286
- // finishes its Grow.
3287
- Unref(*h);
3288
- } else {
3289
- // Correct home location, so we are on the right chain.
3290
- // With new usable read ref, can release old one (if applicable).
3291
- if (read_ref_on_chain) {
3292
- // Pretend we never took the reference.
3293
- Unref(*read_ref_on_chain);
3294
- }
3295
- // And keep the new one.
3296
- read_ref_on_chain = h;
3297
- }
3298
- } else {
3299
- if (full_match_or_unknown) {
3300
- // Must have been an "under construction" entry. Can safely skip it,
3301
- // but there's a chance we'll have to backtrack later
3302
- } else {
3303
- // Home mismatch! Revert back to a safe point (if we have it)
3304
- h = read_ref_on_chain;
3305
- // Didn't make progress & retry
3306
- }
3307
- }
3308
- }
3309
- }
3310
-
3311
- void AutoHyperClockTable::Remove(HandleImpl* h) {
3312
- assert((h->meta.Load() >> ClockHandle::kStateShift) ==
3313
- ClockHandle::kStateConstruction);
3314
-
3315
- const HandleImpl& c_h = *h;
3316
- PurgeImpl(&c_h.hashed_key);
3317
- }
3318
-
3319
- bool AutoHyperClockTable::TryEraseHandle(HandleImpl* h, bool holding_ref,
3320
- bool mark_invisible) {
3321
- uint64_t meta;
3322
- if (mark_invisible) {
3323
- // Set invisible
3324
- meta = h->meta.FetchAnd(
3325
- ~(uint64_t{ClockHandle::kStateVisibleBit} << ClockHandle::kStateShift));
3326
- // To local variable also
3327
- meta &=
3328
- ~(uint64_t{ClockHandle::kStateVisibleBit} << ClockHandle::kStateShift);
3329
- } else {
3330
- meta = h->meta.Load();
3331
- }
3332
-
3333
- // Take ownership if no other refs
3334
- do {
3335
- if (GetRefcount(meta) != uint64_t{holding_ref}) {
3336
- // Not last ref at some point in time during this call
3337
- return false;
3338
- }
3339
- if ((meta & (uint64_t{ClockHandle::kStateShareableBit}
3340
- << ClockHandle::kStateShift)) == 0) {
3341
- // Someone else took ownership
3342
- return false;
3343
- }
3344
- // Note that if !holding_ref, there's a small chance that we release,
3345
- // another thread replaces this entry with another, reaches zero refs, and
3346
- // then we end up erasing that other entry. That's an acceptable risk /
3347
- // imprecision.
3348
- } while (!h->meta.CasWeak(meta, uint64_t{ClockHandle::kStateConstruction}
3349
- << ClockHandle::kStateShift));
3350
- // Took ownership
3351
- // TODO? Delay freeing?
3352
- h->FreeData(allocator_);
3353
- size_t total_charge = h->total_charge;
3354
- if (UNLIKELY(h->IsStandalone())) {
3355
- // Delete detached handle
3356
- delete h;
3357
- standalone_usage_.FetchSubRelaxed(total_charge);
3358
- } else {
3359
- Remove(h);
3360
- MarkEmpty(*h);
3361
- occupancy_.FetchSub(1U);
3362
- }
3363
- usage_.FetchSubRelaxed(total_charge);
3364
- assert(usage_.LoadRelaxed() < SIZE_MAX / 2);
3365
- return true;
3366
- }
3367
-
3368
- bool AutoHyperClockTable::Release(HandleImpl* h, bool useful,
3369
- bool erase_if_last_ref) {
3370
- // In contrast with LRUCache's Release, this function won't delete the handle
3371
- // when the cache is above capacity and the reference is the last one. Space
3372
- // is only freed up by Evict/PurgeImpl (called by Insert when space
3373
- // is needed) and Erase. We do this to avoid an extra atomic read of the
3374
- // variable usage_.
3375
-
3376
- uint64_t old_meta;
3377
- if (useful) {
3378
- // Increment release counter to indicate was used
3379
- old_meta = h->meta.FetchAdd(ClockHandle::kReleaseIncrement);
3380
- // Correct for possible (but rare) overflow
3381
- CorrectNearOverflow(old_meta, h->meta);
3382
- } else {
3383
- // Decrement acquire counter to pretend it never happened
3384
- old_meta = h->meta.FetchSub(ClockHandle::kAcquireIncrement);
3385
- }
3386
-
3387
- assert((old_meta >> ClockHandle::kStateShift) &
3388
- ClockHandle::kStateShareableBit);
3389
- // No underflow
3390
- assert(((old_meta >> ClockHandle::kAcquireCounterShift) &
3391
- ClockHandle::kCounterMask) !=
3392
- ((old_meta >> ClockHandle::kReleaseCounterShift) &
3393
- ClockHandle::kCounterMask));
3394
-
3395
- if ((erase_if_last_ref || UNLIKELY(old_meta >> ClockHandle::kStateShift ==
3396
- ClockHandle::kStateInvisible))) {
3397
- // FIXME: There's a chance here that another thread could replace this
3398
- // entry and we end up erasing the wrong one.
3399
- return TryEraseHandle(h, /*holding_ref=*/false, /*mark_invisible=*/false);
3400
- } else {
3401
- return false;
3402
- }
3403
- }
3404
-
3405
- #ifndef NDEBUG
3406
- void AutoHyperClockTable::TEST_ReleaseN(HandleImpl* h, size_t n) {
3407
- if (n > 0) {
3408
- // Do n-1 simple releases first
3409
- TEST_ReleaseNMinus1(h, n);
3410
-
3411
- // Then the last release might be more involved
3412
- Release(h, /*useful*/ true, /*erase_if_last_ref*/ false);
3413
- }
3414
- }
3415
- #endif
3416
-
3417
- void AutoHyperClockTable::Erase(const UniqueId64x2& hashed_key) {
3418
- // Don't need to be efficient.
3419
- // Might be one match masking another, so loop.
3420
- while (HandleImpl* h = Lookup(hashed_key)) {
3421
- bool gone =
3422
- TryEraseHandle(h, /*holding_ref=*/true, /*mark_invisible=*/true);
3423
- if (!gone) {
3424
- // Only marked invisible, which is ok.
3425
- // Pretend we never took the reference from Lookup.
3426
- Unref(*h);
3427
- }
3428
- }
3429
- }
3430
-
3431
- void AutoHyperClockTable::EraseUnRefEntries() {
3432
- size_t usable_size = GetTableSize();
3433
- for (size_t i = 0; i < usable_size; i++) {
3434
- HandleImpl& h = array_[i];
3435
-
3436
- uint64_t old_meta = h.meta.LoadRelaxed();
3437
- if (old_meta & (uint64_t{ClockHandle::kStateShareableBit}
3438
- << ClockHandle::kStateShift) &&
3439
- GetRefcount(old_meta) == 0 &&
3440
- h.meta.CasStrong(old_meta, uint64_t{ClockHandle::kStateConstruction}
3441
- << ClockHandle::kStateShift)) {
3442
- // Took ownership
3443
- h.FreeData(allocator_);
3444
- usage_.FetchSubRelaxed(h.total_charge);
3445
- // NOTE: could be more efficient with a dedicated variant of
3446
- // PurgeImpl, but this is not a common operation
3447
- Remove(&h);
3448
- MarkEmpty(h);
3449
- occupancy_.FetchSub(1U);
3450
- }
3451
- }
3452
- }
3453
-
3454
- void AutoHyperClockTable::Evict(size_t requested_charge, InsertState& state,
3455
- EvictionData* data,
3456
- uint32_t eviction_effort_cap) {
3457
- // precondition
3458
- assert(requested_charge > 0);
3459
-
3460
- // We need the clock pointer to seemlessly "wrap around" at the end of the
3461
- // table, and to be reasonably stable under Grow operations. This is
3462
- // challenging when the linear hashing progressively opens additional
3463
- // most-significant-hash-bits in determining home locations.
3464
-
3465
- // TODO: make a tuning parameter?
3466
- // Up to 2x this number of homes will be evicted per step. In very rare
3467
- // cases, possibly more, as homes of an out-of-date generation will be
3468
- // resolved to multiple in a newer generation.
3469
- constexpr size_t step_size = 4;
3470
-
3471
- // A clock_pointer_mask_ field separate from length_info_ enables us to use
3472
- // the same mask (way of dividing up the space among evicting threads) for
3473
- // iterating over the whole structure before considering changing the mask
3474
- // at the beginning of each pass. This ensures we do not have a large portion
3475
- // of the space that receives redundant or missed clock updates. However,
3476
- // with two variables, for each update to clock_pointer_mask (< 64 ever in
3477
- // the life of the cache), there will be a brief period where concurrent
3478
- // eviction threads could use the old mask value, possibly causing redundant
3479
- // or missed clock updates for a *small* portion of the table.
3480
- size_t clock_pointer_mask = clock_pointer_mask_.LoadRelaxed();
3481
-
3482
- uint64_t max_clock_pointer = 0; // unset
3483
-
3484
- // TODO: consider updating during a long eviction
3485
- size_t used_length = LengthInfoToUsedLength(state.saved_length_info);
3486
-
3487
- autovector<HandleImpl*> to_finish_eviction;
3488
-
3489
- // Loop until enough freed, or limit reached (see bottom of loop)
3490
- for (;;) {
3491
- // First (concurrent) increment clock pointer
3492
- uint64_t old_clock_pointer = clock_pointer_.FetchAddRelaxed(step_size);
3493
-
3494
- if (UNLIKELY((old_clock_pointer & clock_pointer_mask) == 0)) {
3495
- // Back at the beginning. See if clock_pointer_mask should be updated.
3496
- uint64_t mask = BottomNBits(
3497
- UINT64_MAX, LengthInfoToMinShift(state.saved_length_info));
3498
- if (clock_pointer_mask != mask) {
3499
- clock_pointer_mask = static_cast<size_t>(mask);
3500
- clock_pointer_mask_.StoreRelaxed(clock_pointer_mask);
3501
- }
3502
- }
3503
-
3504
- size_t major_step = clock_pointer_mask + 1;
3505
- assert((major_step & clock_pointer_mask) == 0);
3506
-
3507
- for (size_t base_home = old_clock_pointer & clock_pointer_mask;
3508
- base_home < used_length; base_home += major_step) {
3509
- for (size_t i = 0; i < step_size; i++) {
3510
- size_t home = base_home + i;
3511
- if (home >= used_length) {
3512
- break;
3513
- }
3514
- PurgeImpl(&to_finish_eviction, home, data);
3515
- }
3516
- }
3517
-
3518
- for (HandleImpl* h : to_finish_eviction) {
3519
- TrackAndReleaseEvictedEntry(h);
3520
- // NOTE: setting likely_empty_slot here can cause us to reduce the
3521
- // portion of "at home" entries, probably because an evicted entry
3522
- // is more likely to come back than a random new entry and would be
3523
- // unable to go into its home slot.
3524
- }
3525
- to_finish_eviction.clear();
3526
-
3527
- // Loop exit conditions
3528
- if (data->freed_charge >= requested_charge) {
3529
- return;
3530
- }
3531
-
3532
- if (max_clock_pointer == 0) {
3533
- // Cap the eviction effort at this thread (along with those operating in
3534
- // parallel) circling through the whole structure kMaxCountdown times.
3535
- // In other words, this eviction run must find something/anything that is
3536
- // unreferenced at start of and during the eviction run that isn't
3537
- // reclaimed by a concurrent eviction run.
3538
- // TODO: Does HyperClockCache need kMaxCountdown + 1?
3539
- max_clock_pointer =
3540
- old_clock_pointer +
3541
- (uint64_t{ClockHandle::kMaxCountdown + 1} * major_step);
3542
- }
3543
-
3544
- if (old_clock_pointer + step_size >= max_clock_pointer) {
3545
- return;
3546
- }
3547
-
3548
- if (IsEvictionEffortExceeded(*data, eviction_effort_cap)) {
3549
- eviction_effort_exceeded_count_.FetchAddRelaxed(1);
3550
- return;
3551
- }
3552
- }
3553
- }
3554
-
3555
- size_t AutoHyperClockTable::CalcMaxUsableLength(
3556
- size_t capacity, size_t min_avg_value_size,
3557
- CacheMetadataChargePolicy metadata_charge_policy) {
3558
- double min_avg_slot_charge = min_avg_value_size * kMaxLoadFactor;
3559
- if (metadata_charge_policy == kFullChargeCacheMetadata) {
3560
- min_avg_slot_charge += sizeof(HandleImpl);
3561
- }
3562
- assert(min_avg_slot_charge > 0.0);
3563
- size_t num_slots =
3564
- static_cast<size_t>(capacity / min_avg_slot_charge + 0.999999);
3565
-
3566
- const size_t slots_per_page = port::kPageSize / sizeof(HandleImpl);
3567
-
3568
- // Round up to page size
3569
- return ((num_slots + slots_per_page - 1) / slots_per_page) * slots_per_page;
3570
- }
3571
-
3572
- namespace {
3573
- bool IsHeadNonempty(const AutoHyperClockTable::HandleImpl& h) {
3574
- return !AutoHyperClockTable::HandleImpl::IsEnd(
3575
- h.head_next_with_shift.LoadRelaxed());
3576
- }
3577
- bool IsEntryAtHome(const AutoHyperClockTable::HandleImpl& h, int shift,
3578
- size_t home) {
3579
- if (MatchAndRef(nullptr, h, shift, home)) {
3580
- Unref(h);
3581
- return true;
3582
- } else {
3583
- return false;
3584
- }
3585
- }
3586
- } // namespace
3587
-
3588
- void AutoHyperClockCache::ReportProblems(
3589
- const std::shared_ptr<Logger>& info_log) const {
3590
- BaseHyperClockCache::ReportProblems(info_log);
3591
-
3592
- if (info_log->GetInfoLogLevel() <= InfoLogLevel::DEBUG_LEVEL) {
3593
- LoadVarianceStats head_stats;
3594
- size_t entry_at_home_count = 0;
3595
- uint64_t yield_count = 0;
3596
- this->ForEachShard([&](const Shard* shard) {
3597
- size_t count = shard->GetTableAddressCount();
3598
- uint64_t length_info = UsedLengthToLengthInfo(count);
3599
- for (size_t i = 0; i < count; ++i) {
3600
- const auto& h = *shard->GetTable().HandlePtr(i);
3601
- head_stats.Add(IsHeadNonempty(h));
3602
- int shift;
3603
- size_t home;
3604
- GetHomeIndexAndShift(length_info, i, &home, &shift);
3605
- assert(home == i);
3606
- entry_at_home_count += IsEntryAtHome(h, shift, home);
3607
- }
3608
- yield_count += shard->GetTable().GetYieldCount();
3609
- });
3610
- ROCKS_LOG_AT_LEVEL(info_log, InfoLogLevel::DEBUG_LEVEL,
3611
- "Head occupancy stats: %s", head_stats.Report().c_str());
3612
- ROCKS_LOG_AT_LEVEL(info_log, InfoLogLevel::DEBUG_LEVEL,
3613
- "Entries at home count: %zu", entry_at_home_count);
3614
- ROCKS_LOG_AT_LEVEL(info_log, InfoLogLevel::DEBUG_LEVEL,
3615
- "Yield count: %" PRIu64, yield_count);
3616
- }
3617
- }
3618
-
3619
- } // namespace clock_cache
3620
-
3621
- // DEPRECATED (see public API)
3622
- std::shared_ptr<Cache> NewClockCache(
3623
- size_t capacity, int num_shard_bits, bool strict_capacity_limit,
3624
- CacheMetadataChargePolicy metadata_charge_policy) {
3625
- return NewLRUCache(capacity, num_shard_bits, strict_capacity_limit,
3626
- /* high_pri_pool_ratio */ 0.5, nullptr,
3627
- kDefaultToAdaptiveMutex, metadata_charge_policy,
3628
- /* low_pri_pool_ratio */ 0.0);
3629
- }
3630
-
3631
- std::shared_ptr<Cache> HyperClockCacheOptions::MakeSharedCache() const {
3632
- // For sanitized options
3633
- HyperClockCacheOptions opts = *this;
3634
- if (opts.num_shard_bits >= 20) {
3635
- return nullptr; // The cache cannot be sharded into too many fine pieces.
3636
- }
3637
- if (opts.num_shard_bits < 0) {
3638
- // Use larger shard size to reduce risk of large entries clustering
3639
- // or skewing individual shards.
3640
- constexpr size_t min_shard_size = 32U * 1024U * 1024U;
3641
- opts.num_shard_bits =
3642
- GetDefaultCacheShardBits(opts.capacity, min_shard_size);
3643
- }
3644
- std::shared_ptr<Cache> cache;
3645
- if (opts.estimated_entry_charge == 0) {
3646
- cache = std::make_shared<clock_cache::AutoHyperClockCache>(opts);
3647
- } else {
3648
- cache = std::make_shared<clock_cache::FixedHyperClockCache>(opts);
3649
- }
3650
- if (opts.secondary_cache) {
3651
- cache = std::make_shared<CacheWithSecondaryAdapter>(cache,
3652
- opts.secondary_cache);
3653
- }
3654
- return cache;
3655
- }
3656
-
3657
- } // namespace ROCKSDB_NAMESPACE