@nxtedition/rocksdb 6.0.2 → 7.0.0-alpha.2

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 (259) hide show
  1. package/BUILDING.md +12 -4
  2. package/binding.cc +589 -128
  3. package/chained-batch.js +6 -6
  4. package/deps/rocksdb/rocksdb/CMakeLists.txt +9 -0
  5. package/deps/rocksdb/rocksdb/Makefile +16 -5
  6. package/deps/rocksdb/rocksdb/TARGETS +23 -2
  7. package/deps/rocksdb/rocksdb/cmake/modules/CxxFlags.cmake +7 -0
  8. package/deps/rocksdb/rocksdb/cmake/modules/FindJeMalloc.cmake +29 -0
  9. package/deps/rocksdb/rocksdb/cmake/modules/FindNUMA.cmake +29 -0
  10. package/deps/rocksdb/rocksdb/cmake/modules/FindSnappy.cmake +29 -0
  11. package/deps/rocksdb/rocksdb/cmake/modules/FindTBB.cmake +33 -0
  12. package/deps/rocksdb/rocksdb/cmake/modules/Findgflags.cmake +29 -0
  13. package/deps/rocksdb/rocksdb/cmake/modules/Findlz4.cmake +29 -0
  14. package/deps/rocksdb/rocksdb/cmake/modules/Finduring.cmake +26 -0
  15. package/deps/rocksdb/rocksdb/cmake/modules/Findzstd.cmake +29 -0
  16. package/deps/rocksdb/rocksdb/cmake/modules/ReadVersion.cmake +10 -0
  17. package/deps/rocksdb/rocksdb/db/builder.cc +12 -4
  18. package/deps/rocksdb/rocksdb/db/c.cc +26 -0
  19. package/deps/rocksdb/rocksdb/db/c_test.c +3 -0
  20. package/deps/rocksdb/rocksdb/db/column_family.cc +8 -2
  21. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.cc +29 -6
  22. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.h +8 -2
  23. package/deps/rocksdb/rocksdb/db/compaction/compaction_job_test.cc +16 -4
  24. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_test.cc +2 -1
  25. package/deps/rocksdb/rocksdb/db/compaction/compaction_service_test.cc +16 -0
  26. package/deps/rocksdb/rocksdb/db/db_basic_test.cc +402 -30
  27. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.cc +2 -12
  28. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +14 -0
  29. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_compaction_flush.cc +7 -5
  30. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_experimental.cc +1 -1
  31. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +33 -7
  32. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_readonly.cc +54 -23
  33. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_readonly.h +3 -0
  34. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.cc +8 -1
  35. package/deps/rocksdb/rocksdb/db/db_options_test.cc +16 -0
  36. package/deps/rocksdb/rocksdb/db/db_rate_limiter_test.cc +14 -15
  37. package/deps/rocksdb/rocksdb/db/db_readonly_with_timestamp_test.cc +331 -0
  38. package/deps/rocksdb/rocksdb/db/db_secondary_test.cc +5 -0
  39. package/deps/rocksdb/rocksdb/db/db_test.cc +16 -0
  40. package/deps/rocksdb/rocksdb/db/db_test2.cc +221 -92
  41. package/deps/rocksdb/rocksdb/db/db_test_util.cc +6 -2
  42. package/deps/rocksdb/rocksdb/db/db_test_util.h +4 -2
  43. package/deps/rocksdb/rocksdb/db/db_with_timestamp_basic_test.cc +1 -171
  44. package/deps/rocksdb/rocksdb/db/db_with_timestamp_test_util.cc +96 -0
  45. package/deps/rocksdb/rocksdb/db/db_with_timestamp_test_util.h +126 -0
  46. package/deps/rocksdb/rocksdb/db/experimental.cc +1 -1
  47. package/deps/rocksdb/rocksdb/db/external_sst_file_basic_test.cc +57 -0
  48. package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.cc +13 -2
  49. package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.h +2 -0
  50. package/deps/rocksdb/rocksdb/db/flush_job.cc +10 -11
  51. package/deps/rocksdb/rocksdb/db/import_column_family_job.cc +11 -1
  52. package/deps/rocksdb/rocksdb/db/import_column_family_test.cc +6 -0
  53. package/deps/rocksdb/rocksdb/db/repair.cc +12 -1
  54. package/deps/rocksdb/rocksdb/db/repair_test.cc +32 -10
  55. package/deps/rocksdb/rocksdb/db/snapshot_impl.h +3 -1
  56. package/deps/rocksdb/rocksdb/db/table_cache.cc +19 -127
  57. package/deps/rocksdb/rocksdb/db/table_cache.h +3 -2
  58. package/deps/rocksdb/rocksdb/db/table_cache_sync_and_async.h +140 -0
  59. package/deps/rocksdb/rocksdb/db/version_builder_test.cc +130 -128
  60. package/deps/rocksdb/rocksdb/db/version_edit.cc +20 -0
  61. package/deps/rocksdb/rocksdb/db/version_edit.h +13 -4
  62. package/deps/rocksdb/rocksdb/db/version_edit_test.cc +14 -14
  63. package/deps/rocksdb/rocksdb/db/version_set.cc +205 -212
  64. package/deps/rocksdb/rocksdb/db/version_set.h +11 -0
  65. package/deps/rocksdb/rocksdb/db/version_set_sync_and_async.h +154 -0
  66. package/deps/rocksdb/rocksdb/db/version_set_test.cc +10 -9
  67. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.h +2 -0
  68. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_gflags.cc +13 -0
  69. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.cc +15 -0
  70. package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.cc +159 -65
  71. package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.h +43 -21
  72. package/deps/rocksdb/rocksdb/file/prefetch_test.cc +142 -17
  73. package/deps/rocksdb/rocksdb/file/writable_file_writer.cc +23 -27
  74. package/deps/rocksdb/rocksdb/file/writable_file_writer.h +2 -3
  75. package/deps/rocksdb/rocksdb/include/rocksdb/advanced_options.h +23 -5
  76. package/deps/rocksdb/rocksdb/include/rocksdb/c.h +14 -1
  77. package/deps/rocksdb/rocksdb/include/rocksdb/file_system.h +2 -0
  78. package/deps/rocksdb/rocksdb/include/rocksdb/options.h +17 -0
  79. package/deps/rocksdb/rocksdb/include/rocksdb/perf_context.h +2 -0
  80. package/deps/rocksdb/rocksdb/include/rocksdb/snapshot.h +4 -1
  81. package/deps/rocksdb/rocksdb/include/rocksdb/statistics.h +3 -0
  82. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/options_type.h +189 -0
  83. package/deps/rocksdb/rocksdb/include/rocksdb/version.h +1 -1
  84. package/deps/rocksdb/rocksdb/monitoring/perf_context.cc +5 -0
  85. package/deps/rocksdb/rocksdb/monitoring/statistics.cc +1 -1
  86. package/deps/rocksdb/rocksdb/options/cf_options.cc +13 -0
  87. package/deps/rocksdb/rocksdb/options/db_options.cc +8 -0
  88. package/deps/rocksdb/rocksdb/options/db_options.h +1 -0
  89. package/deps/rocksdb/rocksdb/options/options.cc +7 -0
  90. package/deps/rocksdb/rocksdb/options/options_helper.cc +4 -0
  91. package/deps/rocksdb/rocksdb/options/options_settable_test.cc +6 -4
  92. package/deps/rocksdb/rocksdb/options/options_test.cc +107 -9
  93. package/deps/rocksdb/rocksdb/src.mk +4 -1
  94. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_builder.cc +9 -4
  95. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.cc +80 -6
  96. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.h +8 -2
  97. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.cc +81 -757
  98. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.h +21 -15
  99. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_impl.h +9 -3
  100. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +754 -0
  101. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_test.cc +2 -1
  102. package/deps/rocksdb/rocksdb/table/block_based/block_prefetcher.cc +8 -0
  103. package/deps/rocksdb/rocksdb/table/block_based/filter_block.h +1 -10
  104. package/deps/rocksdb/rocksdb/table/block_based/filter_block_reader_common.cc +59 -1
  105. package/deps/rocksdb/rocksdb/table/block_based/filter_block_reader_common.h +18 -0
  106. package/deps/rocksdb/rocksdb/table/block_based/full_filter_block.cc +0 -61
  107. package/deps/rocksdb/rocksdb/table/block_based/full_filter_block.h +0 -13
  108. package/deps/rocksdb/rocksdb/table/block_based/index_reader_common.cc +1 -1
  109. package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block.cc +3 -2
  110. package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_iterator.cc +2 -2
  111. package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_reader.cc +2 -1
  112. package/deps/rocksdb/rocksdb/table/block_based/uncompression_dict_reader.cc +2 -1
  113. package/deps/rocksdb/rocksdb/table/block_fetcher.cc +60 -2
  114. package/deps/rocksdb/rocksdb/table/block_fetcher.h +2 -0
  115. package/deps/rocksdb/rocksdb/table/merging_iterator.cc +39 -0
  116. package/deps/rocksdb/rocksdb/table/multiget_context.h +46 -2
  117. package/deps/rocksdb/rocksdb/table/sst_file_dumper.cc +2 -1
  118. package/deps/rocksdb/rocksdb/table/sst_file_dumper.h +1 -1
  119. package/deps/rocksdb/rocksdb/table/table_reader.h +13 -0
  120. package/deps/rocksdb/rocksdb/table/unique_id.cc +27 -0
  121. package/deps/rocksdb/rocksdb/table/unique_id_impl.h +3 -0
  122. package/deps/rocksdb/rocksdb/test_util/testutil.cc +2 -0
  123. package/deps/rocksdb/rocksdb/tools/db_bench_tool.cc +23 -7
  124. package/deps/rocksdb/rocksdb/tools/sst_dump_tool.cc +9 -1
  125. package/deps/rocksdb/rocksdb/util/async_file_reader.cc +72 -0
  126. package/deps/rocksdb/rocksdb/util/async_file_reader.h +144 -0
  127. package/deps/rocksdb/rocksdb/util/compression.h +49 -0
  128. package/deps/rocksdb/rocksdb/util/coro_utils.h +111 -0
  129. package/deps/rocksdb/rocksdb/util/single_thread_executor.h +55 -0
  130. package/deps/rocksdb/rocksdb.gyp +16 -15
  131. package/index.js +186 -3
  132. package/iterator.js +1 -0
  133. package/package-lock.json +23687 -0
  134. package/package.json +2 -30
  135. package/prebuilds/darwin-arm64/node.napi.node +0 -0
  136. package/deps/liburing/liburing/README +0 -46
  137. package/deps/liburing/liburing/test/232c93d07b74-test.c +0 -305
  138. package/deps/liburing/liburing/test/35fa71a030ca-test.c +0 -329
  139. package/deps/liburing/liburing/test/500f9fbadef8-test.c +0 -89
  140. package/deps/liburing/liburing/test/7ad0e4b2f83c-test.c +0 -93
  141. package/deps/liburing/liburing/test/8a9973408177-test.c +0 -106
  142. package/deps/liburing/liburing/test/917257daa0fe-test.c +0 -53
  143. package/deps/liburing/liburing/test/Makefile +0 -312
  144. package/deps/liburing/liburing/test/a0908ae19763-test.c +0 -58
  145. package/deps/liburing/liburing/test/a4c0b3decb33-test.c +0 -180
  146. package/deps/liburing/liburing/test/accept-link.c +0 -251
  147. package/deps/liburing/liburing/test/accept-reuse.c +0 -164
  148. package/deps/liburing/liburing/test/accept-test.c +0 -79
  149. package/deps/liburing/liburing/test/accept.c +0 -476
  150. package/deps/liburing/liburing/test/across-fork.c +0 -283
  151. package/deps/liburing/liburing/test/b19062a56726-test.c +0 -53
  152. package/deps/liburing/liburing/test/b5837bd5311d-test.c +0 -77
  153. package/deps/liburing/liburing/test/ce593a6c480a-test.c +0 -135
  154. package/deps/liburing/liburing/test/close-opath.c +0 -122
  155. package/deps/liburing/liburing/test/config +0 -10
  156. package/deps/liburing/liburing/test/connect.c +0 -398
  157. package/deps/liburing/liburing/test/cq-full.c +0 -96
  158. package/deps/liburing/liburing/test/cq-overflow.c +0 -294
  159. package/deps/liburing/liburing/test/cq-peek-batch.c +0 -102
  160. package/deps/liburing/liburing/test/cq-ready.c +0 -94
  161. package/deps/liburing/liburing/test/cq-size.c +0 -58
  162. package/deps/liburing/liburing/test/d4ae271dfaae-test.c +0 -96
  163. package/deps/liburing/liburing/test/d77a67ed5f27-test.c +0 -65
  164. package/deps/liburing/liburing/test/defer.c +0 -307
  165. package/deps/liburing/liburing/test/double-poll-crash.c +0 -186
  166. package/deps/liburing/liburing/test/eeed8b54e0df-test.c +0 -114
  167. package/deps/liburing/liburing/test/empty-eownerdead.c +0 -42
  168. package/deps/liburing/liburing/test/eventfd-disable.c +0 -151
  169. package/deps/liburing/liburing/test/eventfd-ring.c +0 -97
  170. package/deps/liburing/liburing/test/eventfd.c +0 -112
  171. package/deps/liburing/liburing/test/fadvise.c +0 -202
  172. package/deps/liburing/liburing/test/fallocate.c +0 -249
  173. package/deps/liburing/liburing/test/fc2a85cb02ef-test.c +0 -138
  174. package/deps/liburing/liburing/test/file-register.c +0 -843
  175. package/deps/liburing/liburing/test/file-update.c +0 -173
  176. package/deps/liburing/liburing/test/files-exit-hang-poll.c +0 -128
  177. package/deps/liburing/liburing/test/files-exit-hang-timeout.c +0 -134
  178. package/deps/liburing/liburing/test/fixed-link.c +0 -90
  179. package/deps/liburing/liburing/test/fsync.c +0 -224
  180. package/deps/liburing/liburing/test/hardlink.c +0 -136
  181. package/deps/liburing/liburing/test/helpers.c +0 -135
  182. package/deps/liburing/liburing/test/helpers.h +0 -67
  183. package/deps/liburing/liburing/test/io-cancel.c +0 -537
  184. package/deps/liburing/liburing/test/io_uring_enter.c +0 -296
  185. package/deps/liburing/liburing/test/io_uring_register.c +0 -664
  186. package/deps/liburing/liburing/test/io_uring_setup.c +0 -192
  187. package/deps/liburing/liburing/test/iopoll.c +0 -366
  188. package/deps/liburing/liburing/test/lfs-openat-write.c +0 -117
  189. package/deps/liburing/liburing/test/lfs-openat.c +0 -273
  190. package/deps/liburing/liburing/test/link-timeout.c +0 -1107
  191. package/deps/liburing/liburing/test/link.c +0 -496
  192. package/deps/liburing/liburing/test/link_drain.c +0 -229
  193. package/deps/liburing/liburing/test/madvise.c +0 -195
  194. package/deps/liburing/liburing/test/mkdir.c +0 -108
  195. package/deps/liburing/liburing/test/multicqes_drain.c +0 -383
  196. package/deps/liburing/liburing/test/nop-all-sizes.c +0 -107
  197. package/deps/liburing/liburing/test/nop.c +0 -115
  198. package/deps/liburing/liburing/test/open-close.c +0 -146
  199. package/deps/liburing/liburing/test/openat2.c +0 -240
  200. package/deps/liburing/liburing/test/personality.c +0 -204
  201. package/deps/liburing/liburing/test/pipe-eof.c +0 -81
  202. package/deps/liburing/liburing/test/pipe-reuse.c +0 -105
  203. package/deps/liburing/liburing/test/poll-cancel-ton.c +0 -139
  204. package/deps/liburing/liburing/test/poll-cancel.c +0 -135
  205. package/deps/liburing/liburing/test/poll-link.c +0 -227
  206. package/deps/liburing/liburing/test/poll-many.c +0 -208
  207. package/deps/liburing/liburing/test/poll-mshot-update.c +0 -273
  208. package/deps/liburing/liburing/test/poll-ring.c +0 -48
  209. package/deps/liburing/liburing/test/poll-v-poll.c +0 -353
  210. package/deps/liburing/liburing/test/poll.c +0 -109
  211. package/deps/liburing/liburing/test/probe.c +0 -137
  212. package/deps/liburing/liburing/test/read-write.c +0 -876
  213. package/deps/liburing/liburing/test/register-restrictions.c +0 -633
  214. package/deps/liburing/liburing/test/rename.c +0 -134
  215. package/deps/liburing/liburing/test/ring-leak.c +0 -173
  216. package/deps/liburing/liburing/test/ring-leak2.c +0 -249
  217. package/deps/liburing/liburing/test/rsrc_tags.c +0 -449
  218. package/deps/liburing/liburing/test/runtests-loop.sh +0 -16
  219. package/deps/liburing/liburing/test/runtests.sh +0 -170
  220. package/deps/liburing/liburing/test/rw_merge_test.c +0 -97
  221. package/deps/liburing/liburing/test/self.c +0 -91
  222. package/deps/liburing/liburing/test/send_recv.c +0 -291
  223. package/deps/liburing/liburing/test/send_recvmsg.c +0 -345
  224. package/deps/liburing/liburing/test/sendmsg_fs_cve.c +0 -198
  225. package/deps/liburing/liburing/test/shared-wq.c +0 -84
  226. package/deps/liburing/liburing/test/short-read.c +0 -75
  227. package/deps/liburing/liburing/test/shutdown.c +0 -163
  228. package/deps/liburing/liburing/test/sigfd-deadlock.c +0 -74
  229. package/deps/liburing/liburing/test/socket-rw-eagain.c +0 -156
  230. package/deps/liburing/liburing/test/socket-rw.c +0 -147
  231. package/deps/liburing/liburing/test/splice.c +0 -511
  232. package/deps/liburing/liburing/test/sq-full-cpp.cc +0 -45
  233. package/deps/liburing/liburing/test/sq-full.c +0 -45
  234. package/deps/liburing/liburing/test/sq-poll-dup.c +0 -200
  235. package/deps/liburing/liburing/test/sq-poll-kthread.c +0 -168
  236. package/deps/liburing/liburing/test/sq-poll-share.c +0 -137
  237. package/deps/liburing/liburing/test/sq-space_left.c +0 -159
  238. package/deps/liburing/liburing/test/sqpoll-cancel-hang.c +0 -159
  239. package/deps/liburing/liburing/test/sqpoll-disable-exit.c +0 -195
  240. package/deps/liburing/liburing/test/sqpoll-exit-hang.c +0 -77
  241. package/deps/liburing/liburing/test/sqpoll-sleep.c +0 -68
  242. package/deps/liburing/liburing/test/statx.c +0 -172
  243. package/deps/liburing/liburing/test/stdout.c +0 -232
  244. package/deps/liburing/liburing/test/submit-link-fail.c +0 -154
  245. package/deps/liburing/liburing/test/submit-reuse.c +0 -239
  246. package/deps/liburing/liburing/test/symlink.c +0 -116
  247. package/deps/liburing/liburing/test/teardowns.c +0 -58
  248. package/deps/liburing/liburing/test/thread-exit.c +0 -131
  249. package/deps/liburing/liburing/test/timeout-new.c +0 -246
  250. package/deps/liburing/liburing/test/timeout-overflow.c +0 -204
  251. package/deps/liburing/liburing/test/timeout.c +0 -1354
  252. package/deps/liburing/liburing/test/unlink.c +0 -111
  253. package/deps/liburing/liburing/test/wakeup-hang.c +0 -162
  254. package/deps/rocksdb/rocksdb/README.md +0 -32
  255. package/deps/rocksdb/rocksdb/microbench/README.md +0 -60
  256. package/deps/rocksdb/rocksdb/plugin/README.md +0 -43
  257. package/deps/rocksdb/rocksdb/port/README +0 -10
  258. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/README +0 -13
  259. package/prebuilds/linux-x64/node.napi.node +0 -0
@@ -1296,6 +1296,7 @@ TEST_F(DBTest2, PresetCompressionDict) {
1296
1296
  enum DictionaryTypes : int {
1297
1297
  kWithoutDict,
1298
1298
  kWithDict,
1299
+ kWithZSTDfinalizeDict,
1299
1300
  kWithZSTDTrainedDict,
1300
1301
  kDictEnd,
1301
1302
  };
@@ -1304,6 +1305,7 @@ TEST_F(DBTest2, PresetCompressionDict) {
1304
1305
  options.compression = compression_type;
1305
1306
  size_t bytes_without_dict = 0;
1306
1307
  size_t bytes_with_dict = 0;
1308
+ size_t bytes_with_zstd_finalize_dict = 0;
1307
1309
  size_t bytes_with_zstd_trained_dict = 0;
1308
1310
  for (int i = kWithoutDict; i < kDictEnd; i++) {
1309
1311
  // First iteration: compress without preset dictionary
@@ -1323,12 +1325,21 @@ TEST_F(DBTest2, PresetCompressionDict) {
1323
1325
  options.compression_opts.max_dict_bytes = kBlockSizeBytes;
1324
1326
  options.compression_opts.zstd_max_train_bytes = 0;
1325
1327
  break;
1328
+ case kWithZSTDfinalizeDict:
1329
+ if (compression_type != kZSTD) {
1330
+ continue;
1331
+ }
1332
+ options.compression_opts.max_dict_bytes = kBlockSizeBytes;
1333
+ options.compression_opts.zstd_max_train_bytes = kL0FileBytes;
1334
+ options.compression_opts.use_zstd_dict_trainer = false;
1335
+ break;
1326
1336
  case kWithZSTDTrainedDict:
1327
1337
  if (compression_type != kZSTD) {
1328
1338
  continue;
1329
1339
  }
1330
1340
  options.compression_opts.max_dict_bytes = kBlockSizeBytes;
1331
1341
  options.compression_opts.zstd_max_train_bytes = kL0FileBytes;
1342
+ options.compression_opts.use_zstd_dict_trainer = true;
1332
1343
  break;
1333
1344
  default:
1334
1345
  assert(false);
@@ -1365,6 +1376,8 @@ TEST_F(DBTest2, PresetCompressionDict) {
1365
1376
  bytes_without_dict = total_sst_bytes;
1366
1377
  } else if (i == kWithDict) {
1367
1378
  bytes_with_dict = total_sst_bytes;
1379
+ } else if (i == kWithZSTDfinalizeDict) {
1380
+ bytes_with_zstd_finalize_dict = total_sst_bytes;
1368
1381
  } else if (i == kWithZSTDTrainedDict) {
1369
1382
  bytes_with_zstd_trained_dict = total_sst_bytes;
1370
1383
  }
@@ -1375,6 +1388,13 @@ TEST_F(DBTest2, PresetCompressionDict) {
1375
1388
  }
1376
1389
  if (i == kWithDict) {
1377
1390
  ASSERT_GT(bytes_without_dict, bytes_with_dict);
1391
+ } else if (i == kWithZSTDTrainedDict) {
1392
+ // In zstd compression, it is sometimes possible that using a finalized
1393
+ // dictionary does not get as good a compression ratio as raw content
1394
+ // dictionary. But using a dictionary should always get better
1395
+ // compression ratio than not using one.
1396
+ ASSERT_TRUE(bytes_with_dict > bytes_with_zstd_finalize_dict ||
1397
+ bytes_without_dict > bytes_with_zstd_finalize_dict);
1378
1398
  } else if (i == kWithZSTDTrainedDict) {
1379
1399
  // In zstd compression, it is sometimes possible that using a trained
1380
1400
  // dictionary does not get as good a compression ratio as without
@@ -6309,115 +6329,118 @@ TEST_F(DBTest2, BlockBasedTablePrefixGetIndexNotFound) {
6309
6329
 
6310
6330
  #ifndef ROCKSDB_LITE
6311
6331
  TEST_F(DBTest2, AutoPrefixMode1) {
6312
- // create a DB with block prefix index
6313
- BlockBasedTableOptions table_options;
6314
- Options options = CurrentOptions();
6315
- table_options.filter_policy.reset(NewBloomFilterPolicy(10, false));
6316
- options.table_factory.reset(NewBlockBasedTableFactory(table_options));
6317
- options.prefix_extractor.reset(NewFixedPrefixTransform(1));
6318
- options.statistics = CreateDBStatistics();
6319
-
6320
- Reopen(options);
6321
-
6322
- Random rnd(301);
6323
- std::string large_value = rnd.RandomString(500);
6324
-
6325
- ASSERT_OK(Put("a1", large_value));
6326
- ASSERT_OK(Put("x1", large_value));
6327
- ASSERT_OK(Put("y1", large_value));
6328
- ASSERT_OK(Flush());
6329
-
6330
- ReadOptions ro;
6331
- ro.total_order_seek = false;
6332
- ro.auto_prefix_mode = true;
6333
- {
6334
- std::unique_ptr<Iterator> iterator(db_->NewIterator(ro));
6335
- iterator->Seek("b1");
6336
- ASSERT_TRUE(iterator->Valid());
6337
- ASSERT_EQ("x1", iterator->key().ToString());
6338
- ASSERT_EQ(0, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6339
- ASSERT_OK(iterator->status());
6340
- }
6332
+ do {
6333
+ // create a DB with block prefix index
6334
+ Options options = CurrentOptions();
6335
+ BlockBasedTableOptions table_options =
6336
+ *options.table_factory->GetOptions<BlockBasedTableOptions>();
6337
+ table_options.filter_policy.reset(NewBloomFilterPolicy(10, false));
6338
+ options.table_factory.reset(NewBlockBasedTableFactory(table_options));
6339
+ options.prefix_extractor.reset(NewFixedPrefixTransform(1));
6340
+ options.statistics = CreateDBStatistics();
6341
6341
 
6342
- std::string ub_str = "b9";
6343
- Slice ub(ub_str);
6344
- ro.iterate_upper_bound = &ub;
6342
+ Reopen(options);
6345
6343
 
6346
- {
6347
- std::unique_ptr<Iterator> iterator(db_->NewIterator(ro));
6348
- iterator->Seek("b1");
6349
- ASSERT_FALSE(iterator->Valid());
6350
- ASSERT_EQ(1, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6351
- ASSERT_OK(iterator->status());
6352
- }
6344
+ Random rnd(301);
6345
+ std::string large_value = rnd.RandomString(500);
6353
6346
 
6354
- ub_str = "z";
6355
- ub = Slice(ub_str);
6356
- {
6357
- std::unique_ptr<Iterator> iterator(db_->NewIterator(ro));
6358
- iterator->Seek("b1");
6359
- ASSERT_TRUE(iterator->Valid());
6360
- ASSERT_EQ("x1", iterator->key().ToString());
6361
- ASSERT_EQ(1, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6362
- ASSERT_OK(iterator->status());
6363
- }
6347
+ ASSERT_OK(Put("a1", large_value));
6348
+ ASSERT_OK(Put("x1", large_value));
6349
+ ASSERT_OK(Put("y1", large_value));
6350
+ ASSERT_OK(Flush());
6364
6351
 
6365
- ub_str = "c";
6366
- ub = Slice(ub_str);
6367
- {
6368
- std::unique_ptr<Iterator> iterator(db_->NewIterator(ro));
6369
- iterator->Seek("b1");
6370
- ASSERT_FALSE(iterator->Valid());
6371
- ASSERT_EQ(2, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6372
- ASSERT_OK(iterator->status());
6373
- }
6352
+ ReadOptions ro;
6353
+ ro.total_order_seek = false;
6354
+ ro.auto_prefix_mode = true;
6355
+ {
6356
+ std::unique_ptr<Iterator> iterator(db_->NewIterator(ro));
6357
+ iterator->Seek("b1");
6358
+ ASSERT_TRUE(iterator->Valid());
6359
+ ASSERT_EQ("x1", iterator->key().ToString());
6360
+ ASSERT_EQ(0, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6361
+ ASSERT_OK(iterator->status());
6362
+ }
6374
6363
 
6375
- // The same queries without recreating iterator
6376
- {
6377
- ub_str = "b9";
6378
- ub = Slice(ub_str);
6364
+ std::string ub_str = "b9";
6365
+ Slice ub(ub_str);
6379
6366
  ro.iterate_upper_bound = &ub;
6380
6367
 
6381
- std::unique_ptr<Iterator> iterator(db_->NewIterator(ro));
6382
- iterator->Seek("b1");
6383
- ASSERT_FALSE(iterator->Valid());
6384
- ASSERT_EQ(3, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6385
- ASSERT_OK(iterator->status());
6368
+ {
6369
+ std::unique_ptr<Iterator> iterator(db_->NewIterator(ro));
6370
+ iterator->Seek("b1");
6371
+ ASSERT_FALSE(iterator->Valid());
6372
+ ASSERT_EQ(1, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6373
+ ASSERT_OK(iterator->status());
6374
+ }
6386
6375
 
6387
6376
  ub_str = "z";
6388
6377
  ub = Slice(ub_str);
6389
-
6390
- iterator->Seek("b1");
6391
- ASSERT_TRUE(iterator->Valid());
6392
- ASSERT_EQ("x1", iterator->key().ToString());
6393
- ASSERT_EQ(3, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6378
+ {
6379
+ std::unique_ptr<Iterator> iterator(db_->NewIterator(ro));
6380
+ iterator->Seek("b1");
6381
+ ASSERT_TRUE(iterator->Valid());
6382
+ ASSERT_EQ("x1", iterator->key().ToString());
6383
+ ASSERT_EQ(1, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6384
+ ASSERT_OK(iterator->status());
6385
+ }
6394
6386
 
6395
6387
  ub_str = "c";
6396
6388
  ub = Slice(ub_str);
6389
+ {
6390
+ std::unique_ptr<Iterator> iterator(db_->NewIterator(ro));
6391
+ iterator->Seek("b1");
6392
+ ASSERT_FALSE(iterator->Valid());
6393
+ ASSERT_EQ(2, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6394
+ ASSERT_OK(iterator->status());
6395
+ }
6397
6396
 
6398
- iterator->Seek("b1");
6399
- ASSERT_FALSE(iterator->Valid());
6400
- ASSERT_EQ(4, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6397
+ // The same queries without recreating iterator
6398
+ {
6399
+ ub_str = "b9";
6400
+ ub = Slice(ub_str);
6401
+ ro.iterate_upper_bound = &ub;
6401
6402
 
6402
- ub_str = "b9";
6403
- ub = Slice(ub_str);
6404
- ro.iterate_upper_bound = &ub;
6405
- iterator->SeekForPrev("b1");
6406
- ASSERT_TRUE(iterator->Valid());
6407
- ASSERT_EQ("a1", iterator->key().ToString());
6408
- ASSERT_EQ(4, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6403
+ std::unique_ptr<Iterator> iterator(db_->NewIterator(ro));
6404
+ iterator->Seek("b1");
6405
+ ASSERT_FALSE(iterator->Valid());
6406
+ ASSERT_EQ(3, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6407
+ ASSERT_OK(iterator->status());
6409
6408
 
6410
- ub_str = "zz";
6411
- ub = Slice(ub_str);
6412
- ro.iterate_upper_bound = &ub;
6413
- iterator->SeekToLast();
6414
- ASSERT_TRUE(iterator->Valid());
6415
- ASSERT_EQ("y1", iterator->key().ToString());
6409
+ ub_str = "z";
6410
+ ub = Slice(ub_str);
6416
6411
 
6417
- iterator->SeekToFirst();
6418
- ASSERT_TRUE(iterator->Valid());
6419
- ASSERT_EQ("a1", iterator->key().ToString());
6420
- }
6412
+ iterator->Seek("b1");
6413
+ ASSERT_TRUE(iterator->Valid());
6414
+ ASSERT_EQ("x1", iterator->key().ToString());
6415
+ ASSERT_EQ(3, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6416
+
6417
+ ub_str = "c";
6418
+ ub = Slice(ub_str);
6419
+
6420
+ iterator->Seek("b1");
6421
+ ASSERT_FALSE(iterator->Valid());
6422
+ ASSERT_EQ(4, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6423
+
6424
+ ub_str = "b9";
6425
+ ub = Slice(ub_str);
6426
+ ro.iterate_upper_bound = &ub;
6427
+ iterator->SeekForPrev("b1");
6428
+ ASSERT_TRUE(iterator->Valid());
6429
+ ASSERT_EQ("a1", iterator->key().ToString());
6430
+ ASSERT_EQ(4, TestGetTickerCount(options, BLOOM_FILTER_PREFIX_CHECKED));
6431
+
6432
+ ub_str = "zz";
6433
+ ub = Slice(ub_str);
6434
+ ro.iterate_upper_bound = &ub;
6435
+ iterator->SeekToLast();
6436
+ ASSERT_TRUE(iterator->Valid());
6437
+ ASSERT_EQ("y1", iterator->key().ToString());
6438
+
6439
+ iterator->SeekToFirst();
6440
+ ASSERT_TRUE(iterator->Valid());
6441
+ ASSERT_EQ("a1", iterator->key().ToString());
6442
+ }
6443
+ } while (ChangeOptions(kSkipPlainTable));
6421
6444
  }
6422
6445
 
6423
6446
  class RenameCurrentTest : public DBTestBase,
@@ -7149,6 +7172,112 @@ TEST_F(DBTest2, RenameDirectory) {
7149
7172
  dbname_ = old_dbname;
7150
7173
  }
7151
7174
 
7175
+ TEST_F(DBTest2, SstUniqueIdVerifyBackwardCompatible) {
7176
+ const int kNumSst = 3;
7177
+ const int kLevel0Trigger = 4;
7178
+ auto options = CurrentOptions();
7179
+ options.level0_file_num_compaction_trigger = kLevel0Trigger;
7180
+ options.statistics = CreateDBStatistics();
7181
+
7182
+ // Existing manifest doesn't have unique id
7183
+ SyncPoint::GetInstance()->SetCallBack(
7184
+ "VersionEdit::EncodeTo:UniqueId", [&](void* arg) {
7185
+ auto unique_id = static_cast<UniqueId64x2*>(arg);
7186
+ // remove id before writing it to manifest
7187
+ (*unique_id)[0] = 0;
7188
+ (*unique_id)[1] = 0;
7189
+ });
7190
+ std::atomic_int skipped = 0;
7191
+ SyncPoint::GetInstance()->SetCallBack("Version::VerifySstUniqueIds::Skipped",
7192
+ [&](void* /*arg*/) { skipped++; });
7193
+ SyncPoint::GetInstance()->EnableProcessing();
7194
+
7195
+ // generate a few SSTs
7196
+ for (int i = 0; i < kNumSst; i++) {
7197
+ for (int j = 0; j < 100; j++) {
7198
+ ASSERT_OK(Put(Key(i * 10 + j), "value"));
7199
+ }
7200
+ ASSERT_OK(Flush());
7201
+ }
7202
+
7203
+ // Reopen without verification
7204
+ Reopen(options);
7205
+
7206
+ // Reopen with verification, but it's skipped because manifest doesn't have id
7207
+ options.verify_sst_unique_id_in_manifest = true;
7208
+ Reopen(options);
7209
+ ASSERT_EQ(skipped, kNumSst);
7210
+
7211
+ // test compaction generated Sst
7212
+ for (int i = kNumSst; i < kLevel0Trigger; i++) {
7213
+ for (int j = 0; j < 100; j++) {
7214
+ ASSERT_OK(Put(Key(i * 10 + j), "value"));
7215
+ }
7216
+ ASSERT_OK(Flush());
7217
+ }
7218
+ ASSERT_OK(dbfull()->TEST_WaitForCompact());
7219
+
7220
+ #ifndef ROCKSDB_LITE
7221
+ ASSERT_EQ("0,1", FilesPerLevel(0));
7222
+ #endif // ROCKSDB_LITE
7223
+
7224
+ // Reopen with verification should fail
7225
+ options.verify_sst_unique_id_in_manifest = true;
7226
+ skipped = 0;
7227
+ Reopen(options);
7228
+ ASSERT_EQ(skipped, 1);
7229
+ }
7230
+
7231
+ TEST_F(DBTest2, SstUniqueIdVerify) {
7232
+ const int kNumSst = 3;
7233
+ const int kLevel0Trigger = 4;
7234
+ auto options = CurrentOptions();
7235
+ options.level0_file_num_compaction_trigger = kLevel0Trigger;
7236
+
7237
+ SyncPoint::GetInstance()->SetCallBack(
7238
+ "PropertyBlockBuilder::AddTableProperty:Start", [&](void* props_vs) {
7239
+ auto props = static_cast<TableProperties*>(props_vs);
7240
+ // update table property session_id to a different one
7241
+ props->db_session_id = DBImpl::GenerateDbSessionId(nullptr);
7242
+ });
7243
+ SyncPoint::GetInstance()->EnableProcessing();
7244
+
7245
+ // generate a few SSTs
7246
+ for (int i = 0; i < kNumSst; i++) {
7247
+ for (int j = 0; j < 100; j++) {
7248
+ ASSERT_OK(Put(Key(i * 10 + j), "value"));
7249
+ }
7250
+ ASSERT_OK(Flush());
7251
+ }
7252
+
7253
+ // Reopen with verification should report corruption
7254
+ options.verify_sst_unique_id_in_manifest = true;
7255
+ auto s = TryReopen(options);
7256
+ ASSERT_TRUE(s.IsCorruption());
7257
+
7258
+ // Reopen without verification should be fine
7259
+ options.verify_sst_unique_id_in_manifest = false;
7260
+ Reopen(options);
7261
+
7262
+ // test compaction generated Sst
7263
+ for (int i = kNumSst; i < kLevel0Trigger; i++) {
7264
+ for (int j = 0; j < 100; j++) {
7265
+ ASSERT_OK(Put(Key(i * 10 + j), "value"));
7266
+ }
7267
+ ASSERT_OK(Flush());
7268
+ }
7269
+ ASSERT_OK(dbfull()->TEST_WaitForCompact());
7270
+
7271
+ #ifndef ROCKSDB_LITE
7272
+ ASSERT_EQ("0,1", FilesPerLevel(0));
7273
+ #endif // ROCKSDB_LITE
7274
+
7275
+ // Reopen with verification should fail
7276
+ options.verify_sst_unique_id_in_manifest = true;
7277
+ s = TryReopen(options);
7278
+ ASSERT_TRUE(s.IsCorruption());
7279
+ }
7280
+
7152
7281
  #ifndef ROCKSDB_LITE
7153
7282
  TEST_F(DBTest2, GetLatestSeqAndTsForKey) {
7154
7283
  Destroy(last_options_);
@@ -830,10 +830,12 @@ std::string DBTestBase::Get(int cf, const std::string& k,
830
830
  std::vector<std::string> DBTestBase::MultiGet(std::vector<int> cfs,
831
831
  const std::vector<std::string>& k,
832
832
  const Snapshot* snapshot,
833
- const bool batched) {
833
+ const bool batched,
834
+ const bool async) {
834
835
  ReadOptions options;
835
836
  options.verify_checksums = true;
836
837
  options.snapshot = snapshot;
838
+ options.async_io = async;
837
839
  std::vector<ColumnFamilyHandle*> handles;
838
840
  std::vector<Slice> keys;
839
841
  std::vector<std::string> result;
@@ -875,10 +877,12 @@ std::vector<std::string> DBTestBase::MultiGet(std::vector<int> cfs,
875
877
  }
876
878
 
877
879
  std::vector<std::string> DBTestBase::MultiGet(const std::vector<std::string>& k,
878
- const Snapshot* snapshot) {
880
+ const Snapshot* snapshot,
881
+ const bool async) {
879
882
  ReadOptions options;
880
883
  options.verify_checksums = true;
881
884
  options.snapshot = snapshot;
885
+ options.async_io = async;
882
886
  std::vector<Slice> keys;
883
887
  std::vector<std::string> result(k.size());
884
888
  std::vector<Status> statuses(k.size());
@@ -1199,10 +1199,12 @@ class DBTestBase : public testing::Test {
1199
1199
  std::vector<std::string> MultiGet(std::vector<int> cfs,
1200
1200
  const std::vector<std::string>& k,
1201
1201
  const Snapshot* snapshot,
1202
- const bool batched);
1202
+ const bool batched,
1203
+ const bool async = false);
1203
1204
 
1204
1205
  std::vector<std::string> MultiGet(const std::vector<std::string>& k,
1205
- const Snapshot* snapshot = nullptr);
1206
+ const Snapshot* snapshot = nullptr,
1207
+ const bool async = false);
1206
1208
 
1207
1209
  uint64_t GetNumSnapshots();
1208
1210
 
@@ -7,7 +7,7 @@
7
7
  // Use of this source code is governed by a BSD-style license that can be
8
8
  // found in the LICENSE file. See the AUTHORS file for names of contributors.
9
9
 
10
- #include "db/db_test_util.h"
10
+ #include "db/db_with_timestamp_test_util.h"
11
11
  #include "port/stack_trace.h"
12
12
  #include "rocksdb/perf_context.h"
13
13
  #include "rocksdb/utilities/debug.h"
@@ -20,176 +20,6 @@
20
20
  #include "utilities/fault_injection_env.h"
21
21
 
22
22
  namespace ROCKSDB_NAMESPACE {
23
- class DBBasicTestWithTimestampBase : public DBTestBase {
24
- public:
25
- explicit DBBasicTestWithTimestampBase(const std::string& dbname)
26
- : DBTestBase(dbname, /*env_do_fsync=*/true) {}
27
-
28
- protected:
29
- static std::string Key1(uint64_t k) {
30
- std::string ret;
31
- PutFixed64(&ret, k);
32
- std::reverse(ret.begin(), ret.end());
33
- return ret;
34
- }
35
-
36
- static std::string KeyWithPrefix(std::string prefix, uint64_t k) {
37
- std::string ret;
38
- PutFixed64(&ret, k);
39
- std::reverse(ret.begin(), ret.end());
40
- return prefix + ret;
41
- }
42
-
43
- static std::vector<Slice> ConvertStrToSlice(
44
- std::vector<std::string>& strings) {
45
- std::vector<Slice> ret;
46
- for (const auto& s : strings) {
47
- ret.emplace_back(s);
48
- }
49
- return ret;
50
- }
51
-
52
- class TestComparator : public Comparator {
53
- private:
54
- const Comparator* cmp_without_ts_;
55
-
56
- public:
57
- explicit TestComparator(size_t ts_sz)
58
- : Comparator(ts_sz), cmp_without_ts_(nullptr) {
59
- cmp_without_ts_ = BytewiseComparator();
60
- }
61
-
62
- const char* Name() const override { return "TestComparator"; }
63
-
64
- void FindShortSuccessor(std::string*) const override {}
65
-
66
- void FindShortestSeparator(std::string*, const Slice&) const override {}
67
-
68
- int Compare(const Slice& a, const Slice& b) const override {
69
- int r = CompareWithoutTimestamp(a, b);
70
- if (r != 0 || 0 == timestamp_size()) {
71
- return r;
72
- }
73
- return -CompareTimestamp(
74
- Slice(a.data() + a.size() - timestamp_size(), timestamp_size()),
75
- Slice(b.data() + b.size() - timestamp_size(), timestamp_size()));
76
- }
77
-
78
- using Comparator::CompareWithoutTimestamp;
79
- int CompareWithoutTimestamp(const Slice& a, bool a_has_ts, const Slice& b,
80
- bool b_has_ts) const override {
81
- if (a_has_ts) {
82
- assert(a.size() >= timestamp_size());
83
- }
84
- if (b_has_ts) {
85
- assert(b.size() >= timestamp_size());
86
- }
87
- Slice lhs = a_has_ts ? StripTimestampFromUserKey(a, timestamp_size()) : a;
88
- Slice rhs = b_has_ts ? StripTimestampFromUserKey(b, timestamp_size()) : b;
89
- return cmp_without_ts_->Compare(lhs, rhs);
90
- }
91
-
92
- int CompareTimestamp(const Slice& ts1, const Slice& ts2) const override {
93
- if (!ts1.data() && !ts2.data()) {
94
- return 0;
95
- } else if (ts1.data() && !ts2.data()) {
96
- return 1;
97
- } else if (!ts1.data() && ts2.data()) {
98
- return -1;
99
- }
100
- assert(ts1.size() == ts2.size());
101
- uint64_t low1 = 0;
102
- uint64_t low2 = 0;
103
- uint64_t high1 = 0;
104
- uint64_t high2 = 0;
105
- const size_t kSize = ts1.size();
106
- std::unique_ptr<char[]> ts1_buf(new char[kSize]);
107
- memcpy(ts1_buf.get(), ts1.data(), ts1.size());
108
- std::unique_ptr<char[]> ts2_buf(new char[kSize]);
109
- memcpy(ts2_buf.get(), ts2.data(), ts2.size());
110
- Slice ts1_copy = Slice(ts1_buf.get(), kSize);
111
- Slice ts2_copy = Slice(ts2_buf.get(), kSize);
112
- auto* ptr1 = const_cast<Slice*>(&ts1_copy);
113
- auto* ptr2 = const_cast<Slice*>(&ts2_copy);
114
- if (!GetFixed64(ptr1, &low1) || !GetFixed64(ptr1, &high1) ||
115
- !GetFixed64(ptr2, &low2) || !GetFixed64(ptr2, &high2)) {
116
- assert(false);
117
- }
118
- if (high1 < high2) {
119
- return -1;
120
- } else if (high1 > high2) {
121
- return 1;
122
- }
123
- if (low1 < low2) {
124
- return -1;
125
- } else if (low1 > low2) {
126
- return 1;
127
- }
128
- return 0;
129
- }
130
- };
131
-
132
- std::string Timestamp(uint64_t low, uint64_t high) {
133
- std::string ts;
134
- PutFixed64(&ts, low);
135
- PutFixed64(&ts, high);
136
- return ts;
137
- }
138
-
139
- void CheckIterUserEntry(const Iterator* it, const Slice& expected_key,
140
- ValueType expected_value_type,
141
- const Slice& expected_value,
142
- const Slice& expected_ts) const {
143
- ASSERT_TRUE(it->Valid());
144
- ASSERT_OK(it->status());
145
- ASSERT_EQ(expected_key, it->key());
146
- if (kTypeValue == expected_value_type) {
147
- ASSERT_EQ(expected_value, it->value());
148
- }
149
- ASSERT_EQ(expected_ts, it->timestamp());
150
- }
151
-
152
- void CheckIterEntry(const Iterator* it, const Slice& expected_ukey,
153
- SequenceNumber expected_seq, ValueType expected_val_type,
154
- const Slice& expected_value, const Slice& expected_ts) {
155
- ASSERT_TRUE(it->Valid());
156
- ASSERT_OK(it->status());
157
- std::string ukey_and_ts;
158
- ukey_and_ts.assign(expected_ukey.data(), expected_ukey.size());
159
- ukey_and_ts.append(expected_ts.data(), expected_ts.size());
160
- ParsedInternalKey parsed_ikey;
161
- ASSERT_OK(
162
- ParseInternalKey(it->key(), &parsed_ikey, true /* log_err_key */));
163
- ASSERT_EQ(ukey_and_ts, parsed_ikey.user_key);
164
- ASSERT_EQ(expected_val_type, parsed_ikey.type);
165
- ASSERT_EQ(expected_seq, parsed_ikey.sequence);
166
- if (expected_val_type == kTypeValue) {
167
- ASSERT_EQ(expected_value, it->value());
168
- }
169
- ASSERT_EQ(expected_ts, it->timestamp());
170
- }
171
-
172
- void CheckIterEntry(const Iterator* it, const Slice& expected_ukey,
173
- ValueType expected_val_type, const Slice& expected_value,
174
- const Slice& expected_ts) {
175
- ASSERT_TRUE(it->Valid());
176
- ASSERT_OK(it->status());
177
- std::string ukey_and_ts;
178
- ukey_and_ts.assign(expected_ukey.data(), expected_ukey.size());
179
- ukey_and_ts.append(expected_ts.data(), expected_ts.size());
180
-
181
- ParsedInternalKey parsed_ikey;
182
- ASSERT_OK(
183
- ParseInternalKey(it->key(), &parsed_ikey, true /* log_err_key */));
184
- ASSERT_EQ(expected_val_type, parsed_ikey.type);
185
- ASSERT_EQ(Slice(ukey_and_ts), parsed_ikey.user_key);
186
- if (expected_val_type == kTypeValue) {
187
- ASSERT_EQ(expected_value, it->value());
188
- }
189
- ASSERT_EQ(expected_ts, it->timestamp());
190
- }
191
- };
192
-
193
23
  class DBBasicTestWithTimestamp : public DBBasicTestWithTimestampBase {
194
24
  public:
195
25
  DBBasicTestWithTimestamp()