@nxtedition/rocksdb 13.1.4 → 13.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/binding.cc +43 -16
  2. package/deps/rocksdb/rocksdb/{TARGETS → BUCK} +27 -0
  3. package/deps/rocksdb/rocksdb/CMakeLists.txt +3 -1
  4. package/deps/rocksdb/rocksdb/Makefile +2 -2
  5. package/deps/rocksdb/rocksdb/cache/cache.cc +3 -1
  6. package/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.h +2 -0
  7. package/deps/rocksdb/rocksdb/db/attribute_group_iterator_impl.h +34 -9
  8. package/deps/rocksdb/rocksdb/db/blob/blob_source.cc +7 -6
  9. package/deps/rocksdb/rocksdb/db/blob/blob_source.h +5 -1
  10. package/deps/rocksdb/rocksdb/db/blob/blob_source_test.cc +22 -14
  11. package/deps/rocksdb/rocksdb/db/blob/db_blob_basic_test.cc +149 -0
  12. package/deps/rocksdb/rocksdb/db/builder.cc +13 -24
  13. package/deps/rocksdb/rocksdb/db/coalescing_iterator.h +35 -10
  14. package/deps/rocksdb/rocksdb/db/column_family.cc +21 -10
  15. package/deps/rocksdb/rocksdb/db/column_family.h +15 -8
  16. package/deps/rocksdb/rocksdb/db/column_family_test.cc +98 -7
  17. package/deps/rocksdb/rocksdb/db/compaction/compaction.cc +126 -16
  18. package/deps/rocksdb/rocksdb/db/compaction/compaction.h +51 -5
  19. package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.cc +2 -2
  20. package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.h +2 -8
  21. package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator_test.cc +24 -0
  22. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.cc +52 -22
  23. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.h +9 -7
  24. package/deps/rocksdb/rocksdb/db/compaction/compaction_job_test.cc +36 -9
  25. package/deps/rocksdb/rocksdb/db/compaction/compaction_outputs.h +6 -0
  26. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker.cc +30 -17
  27. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker.h +26 -23
  28. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_fifo.cc +43 -33
  29. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_fifo.h +6 -5
  30. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_level.cc +19 -9
  31. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_level.h +6 -5
  32. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_test.cc +632 -411
  33. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_universal.cc +171 -51
  34. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_universal.h +7 -5
  35. package/deps/rocksdb/rocksdb/db/compaction/compaction_service_job.cc +37 -10
  36. package/deps/rocksdb/rocksdb/db/compaction/compaction_service_test.cc +51 -11
  37. package/deps/rocksdb/rocksdb/db/compaction/subcompaction_state.cc +10 -3
  38. package/deps/rocksdb/rocksdb/db/compaction/tiered_compaction_test.cc +350 -154
  39. package/deps/rocksdb/rocksdb/db/convenience.cc +1 -1
  40. package/deps/rocksdb/rocksdb/db/db_block_cache_test.cc +62 -27
  41. package/deps/rocksdb/rocksdb/db/db_bloom_filter_test.cc +68 -1
  42. package/deps/rocksdb/rocksdb/db/db_compaction_test.cc +91 -0
  43. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.cc +134 -70
  44. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +71 -23
  45. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_compaction_flush.cc +43 -16
  46. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_debug.cc +47 -33
  47. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_files.cc +27 -19
  48. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +38 -25
  49. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_readonly.cc +3 -3
  50. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.cc +7 -4
  51. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_write.cc +258 -42
  52. package/deps/rocksdb/rocksdb/db/db_io_failure_test.cc +161 -9
  53. package/deps/rocksdb/rocksdb/db/db_iter.cc +118 -86
  54. package/deps/rocksdb/rocksdb/db/db_iter.h +44 -17
  55. package/deps/rocksdb/rocksdb/db/db_options_test.cc +27 -6
  56. package/deps/rocksdb/rocksdb/db/db_test.cc +48 -16
  57. package/deps/rocksdb/rocksdb/db/db_test2.cc +60 -15
  58. package/deps/rocksdb/rocksdb/db/db_test_util.cc +97 -44
  59. package/deps/rocksdb/rocksdb/db/db_test_util.h +7 -1
  60. package/deps/rocksdb/rocksdb/db/dbformat.cc +15 -5
  61. package/deps/rocksdb/rocksdb/db/dbformat.h +137 -55
  62. package/deps/rocksdb/rocksdb/db/event_helpers.cc +1 -0
  63. package/deps/rocksdb/rocksdb/db/experimental.cc +54 -0
  64. package/deps/rocksdb/rocksdb/db/external_sst_file_basic_test.cc +663 -8
  65. package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.cc +152 -91
  66. package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.h +134 -11
  67. package/deps/rocksdb/rocksdb/db/external_sst_file_test.cc +55 -9
  68. package/deps/rocksdb/rocksdb/db/flush_job.cc +52 -29
  69. package/deps/rocksdb/rocksdb/db/flush_job.h +5 -3
  70. package/deps/rocksdb/rocksdb/db/flush_job_test.cc +18 -12
  71. package/deps/rocksdb/rocksdb/db/forward_iterator.cc +23 -29
  72. package/deps/rocksdb/rocksdb/db/import_column_family_job.cc +3 -2
  73. package/deps/rocksdb/rocksdb/db/import_column_family_test.cc +2 -0
  74. package/deps/rocksdb/rocksdb/db/internal_stats.cc +9 -6
  75. package/deps/rocksdb/rocksdb/db/internal_stats.h +54 -0
  76. package/deps/rocksdb/rocksdb/db/job_context.h +1 -1
  77. package/deps/rocksdb/rocksdb/db/log_reader.cc +6 -7
  78. package/deps/rocksdb/rocksdb/db/manifest_ops.cc +47 -0
  79. package/deps/rocksdb/rocksdb/db/manifest_ops.h +20 -0
  80. package/deps/rocksdb/rocksdb/db/memtable.cc +165 -64
  81. package/deps/rocksdb/rocksdb/db/memtable.h +422 -243
  82. package/deps/rocksdb/rocksdb/db/memtable_list.cc +99 -68
  83. package/deps/rocksdb/rocksdb/db/memtable_list.h +63 -38
  84. package/deps/rocksdb/rocksdb/db/memtable_list_test.cc +28 -25
  85. package/deps/rocksdb/rocksdb/db/multi_cf_iterator_impl.h +118 -60
  86. package/deps/rocksdb/rocksdb/db/multi_cf_iterator_test.cc +344 -89
  87. package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter.h +2 -3
  88. package/deps/rocksdb/rocksdb/db/repair.cc +15 -14
  89. package/deps/rocksdb/rocksdb/db/repair_test.cc +0 -13
  90. package/deps/rocksdb/rocksdb/db/snapshot_checker.h +7 -0
  91. package/deps/rocksdb/rocksdb/db/table_cache.cc +62 -65
  92. package/deps/rocksdb/rocksdb/db/table_cache.h +70 -76
  93. package/deps/rocksdb/rocksdb/db/table_cache_sync_and_async.h +5 -6
  94. package/deps/rocksdb/rocksdb/db/table_properties_collector_test.cc +1 -1
  95. package/deps/rocksdb/rocksdb/db/transaction_log_impl.cc +8 -7
  96. package/deps/rocksdb/rocksdb/db/version_builder.cc +17 -19
  97. package/deps/rocksdb/rocksdb/db/version_builder.h +13 -12
  98. package/deps/rocksdb/rocksdb/db/version_edit.h +30 -0
  99. package/deps/rocksdb/rocksdb/db/version_edit_handler.cc +3 -5
  100. package/deps/rocksdb/rocksdb/db/version_set.cc +89 -129
  101. package/deps/rocksdb/rocksdb/db/version_set.h +12 -4
  102. package/deps/rocksdb/rocksdb/db/version_set_sync_and_async.h +1 -2
  103. package/deps/rocksdb/rocksdb/db/version_set_test.cc +12 -8
  104. package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization.cc +0 -15
  105. package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization.h +0 -2
  106. package/deps/rocksdb/rocksdb/db/wide/wide_column_serialization_test.cc +9 -7
  107. package/deps/rocksdb/rocksdb/db/wide/wide_columns_helper.cc +0 -8
  108. package/deps/rocksdb/rocksdb/db/wide/wide_columns_helper.h +28 -2
  109. package/deps/rocksdb/rocksdb/db/write_batch.cc +32 -10
  110. package/deps/rocksdb/rocksdb/db/write_batch_internal.h +9 -0
  111. package/deps/rocksdb/rocksdb/db/write_batch_test.cc +2 -1
  112. package/deps/rocksdb/rocksdb/db/write_thread.cc +3 -1
  113. package/deps/rocksdb/rocksdb/db/write_thread.h +6 -2
  114. package/deps/rocksdb/rocksdb/db_stress_tool/batched_ops_stress.cc +15 -0
  115. package/deps/rocksdb/rocksdb/db_stress_tool/cf_consistency_stress.cc +7 -0
  116. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.h +4 -0
  117. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_gflags.cc +18 -2
  118. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.cc +100 -22
  119. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.h +15 -4
  120. package/deps/rocksdb/rocksdb/db_stress_tool/multi_ops_txns_stress.cc +34 -8
  121. package/deps/rocksdb/rocksdb/db_stress_tool/no_batched_ops_stress.cc +223 -78
  122. package/deps/rocksdb/rocksdb/env/file_system.cc +6 -1
  123. package/deps/rocksdb/rocksdb/env/fs_posix.cc +53 -0
  124. package/deps/rocksdb/rocksdb/env/io_posix.cc +63 -17
  125. package/deps/rocksdb/rocksdb/env/io_posix.h +30 -1
  126. package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.cc +132 -48
  127. package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.h +92 -24
  128. package/deps/rocksdb/rocksdb/file/prefetch_test.cc +727 -109
  129. package/deps/rocksdb/rocksdb/file/random_access_file_reader.cc +3 -4
  130. package/deps/rocksdb/rocksdb/file/random_access_file_reader.h +1 -1
  131. package/deps/rocksdb/rocksdb/file/writable_file_writer.cc +8 -0
  132. package/deps/rocksdb/rocksdb/include/rocksdb/attribute_groups.h +20 -1
  133. package/deps/rocksdb/rocksdb/include/rocksdb/compaction_job_stats.h +9 -0
  134. package/deps/rocksdb/rocksdb/include/rocksdb/configurable.h +9 -5
  135. package/deps/rocksdb/rocksdb/include/rocksdb/convenience.h +2 -0
  136. package/deps/rocksdb/rocksdb/include/rocksdb/db.h +10 -2
  137. package/deps/rocksdb/rocksdb/include/rocksdb/env.h +1 -0
  138. package/deps/rocksdb/rocksdb/include/rocksdb/experimental.h +7 -0
  139. package/deps/rocksdb/rocksdb/include/rocksdb/file_system.h +34 -37
  140. package/deps/rocksdb/rocksdb/include/rocksdb/iterator_base.h +21 -0
  141. package/deps/rocksdb/rocksdb/include/rocksdb/options.h +56 -28
  142. package/deps/rocksdb/rocksdb/include/rocksdb/sst_file_writer.h +3 -0
  143. package/deps/rocksdb/rocksdb/include/rocksdb/table.h +36 -28
  144. package/deps/rocksdb/rocksdb/include/rocksdb/table_properties.h +11 -0
  145. package/deps/rocksdb/rocksdb/include/rocksdb/thread_status.h +1 -0
  146. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/options_type.h +84 -60
  147. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/secondary_index.h +102 -0
  148. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/table_properties_collectors.h +89 -2
  149. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/transaction.h +32 -0
  150. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/transaction_db.h +30 -1
  151. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/write_batch_with_index.h +23 -2
  152. package/deps/rocksdb/rocksdb/include/rocksdb/version.h +2 -2
  153. package/deps/rocksdb/rocksdb/include/rocksdb/write_batch.h +2 -0
  154. package/deps/rocksdb/rocksdb/memtable/inlineskiplist.h +79 -21
  155. package/deps/rocksdb/rocksdb/memtable/skiplist.h +41 -18
  156. package/deps/rocksdb/rocksdb/memtable/skiplistrep.cc +1 -5
  157. package/deps/rocksdb/rocksdb/memtable/wbwi_memtable.cc +169 -0
  158. package/deps/rocksdb/rocksdb/memtable/wbwi_memtable.h +400 -0
  159. package/deps/rocksdb/rocksdb/monitoring/thread_status_util_debug.cc +2 -0
  160. package/deps/rocksdb/rocksdb/options/cf_options.cc +137 -82
  161. package/deps/rocksdb/rocksdb/options/cf_options.h +18 -6
  162. package/deps/rocksdb/rocksdb/options/configurable.cc +31 -17
  163. package/deps/rocksdb/rocksdb/options/configurable_helper.h +7 -6
  164. package/deps/rocksdb/rocksdb/options/options_helper.cc +10 -8
  165. package/deps/rocksdb/rocksdb/options/options_parser.cc +74 -54
  166. package/deps/rocksdb/rocksdb/options/options_settable_test.cc +89 -0
  167. package/deps/rocksdb/rocksdb/options/options_test.cc +112 -26
  168. package/deps/rocksdb/rocksdb/port/port.h +5 -9
  169. package/deps/rocksdb/rocksdb/src.mk +8 -0
  170. package/deps/rocksdb/rocksdb/table/adaptive/adaptive_table_factory.h +4 -0
  171. package/deps/rocksdb/rocksdb/table/block_based/block.h +1 -7
  172. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_builder.cc +2 -0
  173. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_factory.cc +62 -80
  174. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_factory.h +13 -3
  175. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.cc +16 -5
  176. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.h +38 -7
  177. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.cc +12 -4
  178. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.h +4 -1
  179. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +4 -1
  180. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_test.cc +204 -1
  181. package/deps/rocksdb/rocksdb/table/block_based/data_block_hash_index_test.cc +3 -3
  182. package/deps/rocksdb/rocksdb/table/block_fetcher_test.cc +2 -1
  183. package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_factory.h +4 -0
  184. package/deps/rocksdb/rocksdb/table/format.cc +3 -3
  185. package/deps/rocksdb/rocksdb/table/meta_blocks.cc +4 -1
  186. package/deps/rocksdb/rocksdb/table/mock_table.cc +0 -50
  187. package/deps/rocksdb/rocksdb/table/mock_table.h +53 -0
  188. package/deps/rocksdb/rocksdb/table/plain/plain_table_factory.h +4 -0
  189. package/deps/rocksdb/rocksdb/table/sst_file_dumper.cc +1 -1
  190. package/deps/rocksdb/rocksdb/table/sst_file_writer.cc +10 -5
  191. package/deps/rocksdb/rocksdb/table/table_builder.h +3 -1
  192. package/deps/rocksdb/rocksdb/table/table_properties.cc +181 -0
  193. package/deps/rocksdb/rocksdb/table/table_reader_bench.cc +5 -5
  194. package/deps/rocksdb/rocksdb/table/table_test.cc +71 -64
  195. package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_pysim.py +45 -45
  196. package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_pysim_test.py +35 -35
  197. package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer_plot.py +43 -43
  198. package/deps/rocksdb/rocksdb/tools/db_bench_tool.cc +41 -4
  199. package/deps/rocksdb/rocksdb/tools/ldb_cmd.cc +1 -0
  200. package/deps/rocksdb/rocksdb/tools/sst_dump_test.cc +1 -1
  201. package/deps/rocksdb/rocksdb/unreleased_history/add.sh +13 -0
  202. package/deps/rocksdb/rocksdb/util/aligned_buffer.h +24 -5
  203. package/deps/rocksdb/rocksdb/util/compaction_job_stats_impl.cc +7 -0
  204. package/deps/rocksdb/rocksdb/util/file_checksum_helper.cc +0 -52
  205. package/deps/rocksdb/rocksdb/util/file_checksum_helper.h +1 -10
  206. package/deps/rocksdb/rocksdb/util/file_reader_writer_test.cc +92 -0
  207. package/deps/rocksdb/rocksdb/util/thread_operation.h +1 -0
  208. package/deps/rocksdb/rocksdb/util/udt_util.cc +50 -4
  209. package/deps/rocksdb/rocksdb/util/udt_util.h +24 -11
  210. package/deps/rocksdb/rocksdb/util/udt_util_test.cc +26 -13
  211. package/deps/rocksdb/rocksdb/utilities/memory/memory_test.cc +1 -16
  212. package/deps/rocksdb/rocksdb/utilities/options/options_util_test.cc +2 -0
  213. package/deps/rocksdb/rocksdb/utilities/secondary_index/faiss_ivf_index.cc +214 -0
  214. package/deps/rocksdb/rocksdb/utilities/secondary_index/faiss_ivf_index.h +60 -0
  215. package/deps/rocksdb/rocksdb/utilities/secondary_index/faiss_ivf_index_test.cc +124 -0
  216. package/deps/rocksdb/rocksdb/utilities/secondary_index/secondary_index_mixin.h +441 -0
  217. package/deps/rocksdb/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector.cc +34 -3
  218. package/deps/rocksdb/rocksdb/utilities/table_properties_collectors/compact_for_tiering_collector.h +7 -2
  219. package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction_test.cc +437 -0
  220. package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction.cc +34 -11
  221. package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction.h +14 -7
  222. package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction_db.cc +7 -1
  223. package/deps/rocksdb/rocksdb/utilities/transactions/snapshot_checker.cc +17 -0
  224. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_base.cc +69 -0
  225. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_base.h +20 -0
  226. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.cc +1290 -0
  227. package/deps/rocksdb/rocksdb/utilities/transactions/write_committed_transaction_ts_test.cc +324 -0
  228. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn.cc +18 -1
  229. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn.h +8 -1
  230. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +57 -12
  231. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.cc +32 -3
  232. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.h +33 -2
  233. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_test.cc +721 -9
  234. package/deps/rocksdb/rocksdb.gyp +2 -0
  235. package/package.json +1 -1
  236. package/prebuilds/darwin-arm64/@nxtedition+rocksdb.node +0 -0
  237. package/prebuilds/linux-x64/@nxtedition+rocksdb.node +0 -0
@@ -544,6 +544,11 @@ Status MultiOpsTxnsStressTest::TestCustomOperations(
544
544
  // Should never reach here.
545
545
  assert(false);
546
546
  }
547
+ if (!s.ok()) {
548
+ fprintf(stderr, "Transaction failed %s\n", s.ToString().c_str());
549
+ fflush(stderr);
550
+ thread->shared->SafeTerminate();
551
+ }
547
552
 
548
553
  return s;
549
554
  }
@@ -579,7 +584,7 @@ Status MultiOpsTxnsStressTest::PrimaryKeyUpdateTxn(ThreadState* thread,
579
584
  std::string new_pk = Record::EncodePrimaryKey(new_a);
580
585
  std::unique_ptr<Transaction> txn;
581
586
  WriteOptions wopts;
582
- Status s = NewTxn(wopts, &txn);
587
+ Status s = NewTxn(wopts, thread, &txn);
583
588
  if (!s.ok()) {
584
589
  assert(!txn);
585
590
  thread->stats.AddErrors(1);
@@ -611,7 +616,12 @@ Status MultiOpsTxnsStressTest::PrimaryKeyUpdateTxn(ThreadState* thread,
611
616
  }
612
617
  auto& key_gen = key_gen_for_a_[thread->tid];
613
618
  key_gen->UndoAllocation(new_a);
614
- txn->Rollback().PermitUncheckedError();
619
+ s = txn->Rollback();
620
+ if (!s.ok()) {
621
+ fprintf(stderr, "Transaction rollback failed %s\n", s.ToString().c_str());
622
+ fflush(stderr);
623
+ assert(false);
624
+ }
615
625
  });
616
626
 
617
627
  ReadOptions ropts;
@@ -699,7 +709,7 @@ Status MultiOpsTxnsStressTest::SecondaryKeyUpdateTxn(ThreadState* thread,
699
709
  uint32_t new_c) {
700
710
  std::unique_ptr<Transaction> txn;
701
711
  WriteOptions wopts;
702
- Status s = NewTxn(wopts, &txn);
712
+ Status s = NewTxn(wopts, thread, &txn);
703
713
  if (!s.ok()) {
704
714
  assert(!txn);
705
715
  thread->stats.AddErrors(1);
@@ -735,7 +745,12 @@ Status MultiOpsTxnsStressTest::SecondaryKeyUpdateTxn(ThreadState* thread,
735
745
  }
736
746
  auto& key_gen = key_gen_for_c_[thread->tid];
737
747
  key_gen->UndoAllocation(new_c);
738
- txn->Rollback().PermitUncheckedError();
748
+ s = txn->Rollback();
749
+ if (!s.ok()) {
750
+ fprintf(stderr, "Transaction rollback failed %s\n", s.ToString().c_str());
751
+ fflush(stderr);
752
+ assert(false);
753
+ }
739
754
  });
740
755
 
741
756
  // TODO (yanqin) try SetSnapshotOnNextOperation(). We currently need to take
@@ -901,7 +916,7 @@ Status MultiOpsTxnsStressTest::UpdatePrimaryIndexValueTxn(ThreadState* thread,
901
916
  std::string pk_str = Record::EncodePrimaryKey(a);
902
917
  std::unique_ptr<Transaction> txn;
903
918
  WriteOptions wopts;
904
- Status s = NewTxn(wopts, &txn);
919
+ Status s = NewTxn(wopts, thread, &txn);
905
920
  if (!s.ok()) {
906
921
  assert(!txn);
907
922
  thread->stats.AddErrors(1);
@@ -927,7 +942,12 @@ Status MultiOpsTxnsStressTest::UpdatePrimaryIndexValueTxn(ThreadState* thread,
927
942
  } else {
928
943
  thread->stats.AddErrors(1);
929
944
  }
930
- txn->Rollback().PermitUncheckedError();
945
+ s = txn->Rollback();
946
+ if (!s.ok()) {
947
+ fprintf(stderr, "Transaction rollback failed %s\n", s.ToString().c_str());
948
+ fflush(stderr);
949
+ assert(false);
950
+ }
931
951
  });
932
952
  ReadOptions ropts;
933
953
  ropts.rate_limiter_priority =
@@ -982,7 +1002,7 @@ Status MultiOpsTxnsStressTest::PointLookupTxn(ThreadState* thread,
982
1002
 
983
1003
  std::unique_ptr<Transaction> txn;
984
1004
  WriteOptions wopts;
985
- Status s = NewTxn(wopts, &txn);
1005
+ Status s = NewTxn(wopts, thread, &txn);
986
1006
  if (!s.ok()) {
987
1007
  assert(!txn);
988
1008
  thread->stats.AddErrors(1);
@@ -1026,7 +1046,7 @@ Status MultiOpsTxnsStressTest::RangeScanTxn(ThreadState* thread,
1026
1046
 
1027
1047
  std::unique_ptr<Transaction> txn;
1028
1048
  WriteOptions wopts;
1029
- Status s = NewTxn(wopts, &txn);
1049
+ Status s = NewTxn(wopts, thread, &txn);
1030
1050
  if (!s.ok()) {
1031
1051
  assert(!txn);
1032
1052
  thread->stats.AddErrors(1);
@@ -1384,6 +1404,12 @@ Status MultiOpsTxnsStressTest::CommitAndCreateTimestampedSnapshotIfNeeded(
1384
1404
  } else {
1385
1405
  s = txn.Commit();
1386
1406
  }
1407
+ if (!s.ok()) {
1408
+ fprintf(stderr, "Txn %s commit failed with %s\n", txn.GetName().c_str(),
1409
+ s.ToString().c_str());
1410
+ fflush(stderr);
1411
+ }
1412
+
1387
1413
  assert(txn_db_);
1388
1414
  if (FLAGS_create_timestamped_snapshot_one_in > 0 &&
1389
1415
  thread->rand.OneInOpt(50000)) {
@@ -568,9 +568,11 @@ class NonBatchedOpsStressTest : public StressTest {
568
568
  post_read_expected_value)) {
569
569
  thread->shared->SetVerificationFailure();
570
570
  fprintf(stderr,
571
- "error : inconsistent values for key %s: Get returns %s, "
571
+ "error : inconsistent values for key %s (%" PRIi64
572
+ "): Get returns %s, "
572
573
  "but expected state is \"deleted\".\n",
573
- key.ToString(true).c_str(), StringToHex(from_db).c_str());
574
+ key.ToString(true).c_str(), rand_keys[0],
575
+ StringToHex(from_db).c_str());
574
576
  }
575
577
  Slice from_db_slice(from_db);
576
578
  uint32_t value_base_from_db = GetValueBase(from_db_slice);
@@ -579,11 +581,12 @@ class NonBatchedOpsStressTest : public StressTest {
579
581
  post_read_expected_value)) {
580
582
  thread->shared->SetVerificationFailure();
581
583
  fprintf(stderr,
582
- "error : inconsistent values for key %s: Get returns %s with "
584
+ "error : inconsistent values for key %s (%" PRIi64
585
+ "): Get returns %s with "
583
586
  "value base %d that falls out of expected state's value base "
584
587
  "range.\n",
585
- key.ToString(true).c_str(), StringToHex(from_db).c_str(),
586
- value_base_from_db);
588
+ key.ToString(true).c_str(), rand_keys[0],
589
+ StringToHex(from_db).c_str(), value_base_from_db);
587
590
  }
588
591
  }
589
592
  } else if (s.IsNotFound()) {
@@ -594,15 +597,16 @@ class NonBatchedOpsStressTest : public StressTest {
594
597
  post_read_expected_value)) {
595
598
  thread->shared->SetVerificationFailure();
596
599
  fprintf(stderr,
597
- "error : inconsistent values for key %s: expected state has "
600
+ "error : inconsistent values for key %s (%" PRIi64
601
+ "): expected state has "
598
602
  "the key, Get() returns NotFound.\n",
599
- key.ToString(true).c_str());
603
+ key.ToString(true).c_str(), rand_keys[0]);
600
604
  }
601
605
  }
602
606
  } else if (injected_error_count == 0 || !IsErrorInjectedAndRetryable(s)) {
603
607
  thread->shared->SetVerificationFailure();
604
- fprintf(stderr, "error : Get() returns %s for key: %s.\n",
605
- s.ToString().c_str(), key.ToString(true).c_str());
608
+ fprintf(stderr, "error : Get() returns %s for key: %s (%" PRIi64 ").\n",
609
+ s.ToString().c_str(), key.ToString(true).c_str(), rand_keys[0]);
606
610
  }
607
611
  return s;
608
612
  }
@@ -662,7 +666,7 @@ class NonBatchedOpsStressTest : public StressTest {
662
666
  if (FLAGS_rate_limit_auto_wal_flush) {
663
667
  wo.rate_limiter_priority = Env::IO_USER;
664
668
  }
665
- Status s = NewTxn(wo, &txn);
669
+ Status s = NewTxn(wo, thread, &txn);
666
670
  if (!s.ok()) {
667
671
  fprintf(stderr, "NewTxn error: %s\n", s.ToString().c_str());
668
672
  shared->SafeTerminate();
@@ -1031,17 +1035,18 @@ class NonBatchedOpsStressTest : public StressTest {
1031
1035
  shared->SetVerificationFailure();
1032
1036
  fprintf(stderr,
1033
1037
  "error : inconsistent columns returned by GetEntity for key "
1034
- "%s: %s\n",
1035
- StringToHex(key_str).c_str(),
1038
+ "%s (%" PRIi64 "): %s\n",
1039
+ StringToHex(key_str).c_str(), rand_keys[0],
1036
1040
  WideColumnsToHex(columns).c_str());
1037
1041
  } else if (ExpectedValueHelper::MustHaveNotExisted(
1038
1042
  pre_read_expected_value, post_read_expected_value)) {
1039
1043
  shared->SetVerificationFailure();
1040
- fprintf(
1041
- stderr,
1042
- "error : inconsistent values for key %s: GetEntity returns %s, "
1043
- "expected state does not have the key.\n",
1044
- StringToHex(key_str).c_str(), WideColumnsToHex(columns).c_str());
1044
+ fprintf(stderr,
1045
+ "error : inconsistent values for key %s (%" PRIi64
1046
+ "): GetEntity returns %s, "
1047
+ "expected state does not have the key.\n",
1048
+ StringToHex(key_str).c_str(), rand_keys[0],
1049
+ WideColumnsToHex(columns).c_str());
1045
1050
  } else {
1046
1051
  const uint32_t value_base_from_db =
1047
1052
  GetValueBase(WideColumnsHelper::GetDefaultColumn(columns));
@@ -1051,11 +1056,12 @@ class NonBatchedOpsStressTest : public StressTest {
1051
1056
  shared->SetVerificationFailure();
1052
1057
  fprintf(
1053
1058
  stderr,
1054
- "error : inconsistent values for key %s: GetEntity returns %s "
1059
+ "error : inconsistent values for key %s (%" PRIi64
1060
+ "): GetEntity returns %s "
1055
1061
  "with value base %d that falls out of expected state's value "
1056
1062
  "base range.\n",
1057
- StringToHex(key_str).c_str(), WideColumnsToHex(columns).c_str(),
1058
- value_base_from_db);
1063
+ StringToHex(key_str).c_str(), rand_keys[0],
1064
+ WideColumnsToHex(columns).c_str(), value_base_from_db);
1059
1065
  }
1060
1066
  }
1061
1067
  }
@@ -1067,14 +1073,16 @@ class NonBatchedOpsStressTest : public StressTest {
1067
1073
  post_read_expected_value)) {
1068
1074
  shared->SetVerificationFailure();
1069
1075
  fprintf(stderr,
1070
- "error : inconsistent values for key %s: expected state has "
1076
+ "error : inconsistent values for key %s (%" PRIi64
1077
+ "): expected state has "
1071
1078
  "the key, GetEntity returns NotFound.\n",
1072
- StringToHex(key_str).c_str());
1079
+ StringToHex(key_str).c_str(), rand_keys[0]);
1073
1080
  }
1074
1081
  }
1075
1082
  } else if (injected_error_count == 0 || !IsErrorInjectedAndRetryable(s)) {
1076
- fprintf(stderr, "error : GetEntity() returns %s for key: %s.\n",
1077
- s.ToString().c_str(), StringToHex(key_str).c_str());
1083
+ fprintf(stderr,
1084
+ "error : GetEntity() returns %s for key: %s (%" PRIi64 ").\n",
1085
+ s.ToString().c_str(), StringToHex(key_str).c_str(), rand_keys[0]);
1078
1086
  thread->shared->SetVerificationFailure();
1079
1087
  }
1080
1088
  }
@@ -1119,7 +1127,7 @@ class NonBatchedOpsStressTest : public StressTest {
1119
1127
  write_options.rate_limiter_priority = Env::IO_USER;
1120
1128
  }
1121
1129
 
1122
- const Status s = NewTxn(write_options, &txn);
1130
+ const Status s = NewTxn(write_options, thread, &txn);
1123
1131
  if (!s.ok()) {
1124
1132
  fprintf(stderr, "NewTxn error: %s\n", s.ToString().c_str());
1125
1133
  thread->shared->SafeTerminate();
@@ -1450,8 +1458,10 @@ class NonBatchedOpsStressTest : public StressTest {
1450
1458
  Slice ub_slice;
1451
1459
  ReadOptions ro_copy = read_opts;
1452
1460
 
1453
- // Get the next prefix first and then see if we want to set upper bound.
1454
- // We'll use the next prefix in an assertion later on
1461
+ // Randomly test with `iterate_upper_bound` and `prefix_same_as_start`
1462
+ //
1463
+ // Get the next prefix first and then see if we want to set it to be the
1464
+ // upper bound. We'll use the next prefix in an assertion later on
1455
1465
  if (GetNextPrefix(prefix, &upper_bound) && thread->rand.OneIn(2)) {
1456
1466
  // For half of the time, set the upper bound to the next prefix
1457
1467
  ub_slice = Slice(upper_bound);
@@ -1460,6 +1470,8 @@ class NonBatchedOpsStressTest : public StressTest {
1460
1470
  ro_copy.table_filter =
1461
1471
  sqfc_factory_->GetTableFilterForRangeQuery(prefix, ub_slice);
1462
1472
  }
1473
+ } else if (options_.prefix_extractor && thread->rand.OneIn(2)) {
1474
+ ro_copy.prefix_same_as_start = true;
1463
1475
  }
1464
1476
 
1465
1477
  std::string read_ts_str;
@@ -1480,8 +1492,16 @@ class NonBatchedOpsStressTest : public StressTest {
1480
1492
  uint64_t count = 0;
1481
1493
  Status s;
1482
1494
 
1483
- for (iter->Seek(prefix); iter->Valid() && iter->key().starts_with(prefix);
1484
- iter->Next()) {
1495
+ for (iter->Seek(prefix); iter->Valid(); iter->Next()) {
1496
+ // If upper or prefix bounds is specified, only keys of the target
1497
+ // prefix should show up. Otherwise, we need to manual exit the loop when
1498
+ // we see the first key that is not in the target prefix show up.
1499
+ if (ro_copy.iterate_upper_bound != nullptr ||
1500
+ ro_copy.prefix_same_as_start) {
1501
+ assert(iter->key().starts_with(prefix));
1502
+ } else if (!iter->key().starts_with(prefix)) {
1503
+ break;
1504
+ }
1485
1505
  ++count;
1486
1506
 
1487
1507
  // When iter_start_ts is set, iterator exposes internal keys, including
@@ -1495,6 +1515,13 @@ class NonBatchedOpsStressTest : public StressTest {
1495
1515
  }
1496
1516
  }
1497
1517
 
1518
+ if (ro_copy.allow_unprepared_value) {
1519
+ if (!iter->PrepareValue()) {
1520
+ s = iter->status();
1521
+ break;
1522
+ }
1523
+ }
1524
+
1498
1525
  if (!VerifyWideColumns(iter->value(), iter->columns())) {
1499
1526
  s = Status::Corruption("Value and columns inconsistent",
1500
1527
  DebugString(iter->value(), iter->columns()));
@@ -1535,7 +1562,14 @@ class NonBatchedOpsStressTest : public StressTest {
1535
1562
  if (s.ok()) {
1536
1563
  thread->stats.AddPrefixes(1, count);
1537
1564
  } else if (injected_error_count == 0 || !IsErrorInjectedAndRetryable(s)) {
1538
- fprintf(stderr, "TestPrefixScan error: %s\n", s.ToString().c_str());
1565
+ fprintf(stderr,
1566
+ "TestPrefixScan error: %s with ReadOptions::iterate_upper_bound: "
1567
+ "%s, prefix_same_as_start: %s \n",
1568
+ s.ToString().c_str(),
1569
+ ro_copy.iterate_upper_bound
1570
+ ? ro_copy.iterate_upper_bound->ToString(true).c_str()
1571
+ : "nullptr",
1572
+ ro_copy.prefix_same_as_start ? "true" : "false");
1539
1573
  thread->shared->SetVerificationFailure();
1540
1574
  }
1541
1575
 
@@ -1618,6 +1652,7 @@ class NonBatchedOpsStressTest : public StressTest {
1618
1652
  // To track whether WAL write may have succeeded during the initial failed
1619
1653
  // write
1620
1654
  bool initial_wal_write_may_succeed = true;
1655
+ bool commit_bypass_memtable = false;
1621
1656
 
1622
1657
  PendingExpectedValue pending_expected_value =
1623
1658
  shared->PreparePut(rand_column_family, rand_key);
@@ -1679,9 +1714,10 @@ class NonBatchedOpsStressTest : public StressTest {
1679
1714
  s = db_->Put(write_opts, cfh, k, write_ts, v);
1680
1715
  }
1681
1716
  } else {
1682
- s = ExecuteTransaction(write_opts, thread, [&](Transaction& txn) {
1683
- return txn.Put(cfh, k, v);
1684
- });
1717
+ s = ExecuteTransaction(
1718
+ write_opts, thread,
1719
+ [&](Transaction& txn) { return txn.Put(cfh, k, v); },
1720
+ &commit_bypass_memtable);
1685
1721
  }
1686
1722
  }
1687
1723
  UpdateIfInitialWriteFails(db_stress_env, s, &initial_write_s,
@@ -1745,6 +1781,7 @@ class NonBatchedOpsStressTest : public StressTest {
1745
1781
  // To track whether WAL write may have succeeded during the initial failed
1746
1782
  // write
1747
1783
  bool initial_wal_write_may_succeed = true;
1784
+ bool commit_bypass_memtable = false;
1748
1785
 
1749
1786
  // Use delete if the key may be overwritten and a single deletion
1750
1787
  // otherwise.
@@ -1769,13 +1806,14 @@ class NonBatchedOpsStressTest : public StressTest {
1769
1806
  s = db_->Delete(write_opts, cfh, key, write_ts);
1770
1807
  }
1771
1808
  } else {
1772
- s = ExecuteTransaction(write_opts, thread, [&](Transaction& txn) {
1773
- return txn.Delete(cfh, key);
1774
- });
1809
+ s = ExecuteTransaction(
1810
+ write_opts, thread,
1811
+ [&](Transaction& txn) { return txn.Delete(cfh, key); },
1812
+ &commit_bypass_memtable);
1775
1813
  }
1776
- UpdateIfInitialWriteFails(db_stress_env, s, &initial_write_s,
1777
- &initial_wal_write_may_succeed,
1778
- &wait_for_recover_start_time);
1814
+ UpdateIfInitialWriteFails(
1815
+ db_stress_env, s, &initial_write_s, &initial_wal_write_may_succeed,
1816
+ &wait_for_recover_start_time, commit_bypass_memtable);
1779
1817
  } while (!s.ok() && IsErrorInjectedAndRetryable(s) &&
1780
1818
  initial_wal_write_may_succeed);
1781
1819
 
@@ -1825,13 +1863,14 @@ class NonBatchedOpsStressTest : public StressTest {
1825
1863
  s = db_->SingleDelete(write_opts, cfh, key, write_ts);
1826
1864
  }
1827
1865
  } else {
1828
- s = ExecuteTransaction(write_opts, thread, [&](Transaction& txn) {
1829
- return txn.SingleDelete(cfh, key);
1830
- });
1866
+ s = ExecuteTransaction(
1867
+ write_opts, thread,
1868
+ [&](Transaction& txn) { return txn.SingleDelete(cfh, key); },
1869
+ &commit_bypass_memtable);
1831
1870
  }
1832
- UpdateIfInitialWriteFails(db_stress_env, s, &initial_write_s,
1833
- &initial_wal_write_may_succeed,
1834
- &wait_for_recover_start_time);
1871
+ UpdateIfInitialWriteFails(
1872
+ db_stress_env, s, &initial_write_s, &initial_wal_write_may_succeed,
1873
+ &wait_for_recover_start_time, commit_bypass_memtable);
1835
1874
  } while (!s.ok() && IsErrorInjectedAndRetryable(s) &&
1836
1875
  initial_wal_write_may_succeed);
1837
1876
 
@@ -1963,8 +2002,23 @@ class NonBatchedOpsStressTest : public StressTest {
1963
2002
  void TestIngestExternalFile(ThreadState* thread,
1964
2003
  const std::vector<int>& rand_column_families,
1965
2004
  const std::vector<int64_t>& rand_keys) override {
2005
+ // When true, we create two sst files, the first one with regular puts for
2006
+ // a continuous range of keys, the second one with a standalone range
2007
+ // deletion for all the keys. This is to exercise the standalone range
2008
+ // deletion file's compaction input optimization.
2009
+ bool test_standalone_range_deletion = thread->rand.OneInOpt(
2010
+ FLAGS_test_ingest_standalone_range_deletion_one_in);
2011
+ std::vector<std::string> external_files;
1966
2012
  const std::string sst_filename =
1967
2013
  FLAGS_db + "/." + std::to_string(thread->tid) + ".sst";
2014
+ external_files.push_back(sst_filename);
2015
+ std::string standalone_rangedel_filename;
2016
+ if (test_standalone_range_deletion) {
2017
+ standalone_rangedel_filename = FLAGS_db + "/." +
2018
+ std::to_string(thread->tid) +
2019
+ "_standalone_rangedel.sst";
2020
+ external_files.push_back(standalone_rangedel_filename);
2021
+ }
1968
2022
  Status s;
1969
2023
  std::ostringstream ingest_options_oss;
1970
2024
 
@@ -1976,10 +2030,15 @@ class NonBatchedOpsStressTest : public StressTest {
1976
2030
  FaultInjectionIOType::kMetadataWrite);
1977
2031
  }
1978
2032
 
1979
- if (db_stress_env->FileExists(sst_filename).ok()) {
1980
- // Maybe we terminated abnormally before, so cleanup to give this file
1981
- // ingestion a clean slate
1982
- s = db_stress_env->DeleteFile(sst_filename);
2033
+ for (const auto& filename : external_files) {
2034
+ if (db_stress_env->FileExists(filename).ok()) {
2035
+ // Maybe we terminated abnormally before, so cleanup to give this file
2036
+ // ingestion a clean slate
2037
+ s = db_stress_env->DeleteFile(filename);
2038
+ }
2039
+ if (!s.ok()) {
2040
+ return;
2041
+ }
1983
2042
  }
1984
2043
 
1985
2044
  if (fault_fs_guard) {
@@ -1990,9 +2049,19 @@ class NonBatchedOpsStressTest : public StressTest {
1990
2049
  }
1991
2050
 
1992
2051
  SstFileWriter sst_file_writer(EnvOptions(options_), options_);
2052
+ SstFileWriter standalone_rangedel_sst_file_writer(EnvOptions(options_),
2053
+ options_);
1993
2054
  if (s.ok()) {
1994
2055
  s = sst_file_writer.Open(sst_filename);
1995
2056
  }
2057
+ if (s.ok() && test_standalone_range_deletion) {
2058
+ s = standalone_rangedel_sst_file_writer.Open(
2059
+ standalone_rangedel_filename);
2060
+ }
2061
+ if (!s.ok()) {
2062
+ return;
2063
+ }
2064
+
1996
2065
  int64_t key_base = rand_keys[0];
1997
2066
  int column_family = rand_column_families[0];
1998
2067
  std::vector<std::unique_ptr<MutexLock>> range_locks;
@@ -2005,51 +2074,93 @@ class NonBatchedOpsStressTest : public StressTest {
2005
2074
  pending_expected_values.reserve(FLAGS_ingest_external_file_width);
2006
2075
  SharedState* shared = thread->shared;
2007
2076
 
2077
+ // Grab locks, add keys
2008
2078
  assert(FLAGS_nooverwritepercent < 100);
2009
- // Grab locks, set pending state on expected values, and add keys
2010
2079
  for (int64_t key = key_base;
2011
- s.ok() && key < shared->GetMaxKey() &&
2012
- static_cast<int32_t>(keys.size()) < FLAGS_ingest_external_file_width;
2080
+ key < shared->GetMaxKey() &&
2081
+ key < key_base + FLAGS_ingest_external_file_width;
2013
2082
  ++key) {
2014
2083
  if (key == key_base ||
2015
2084
  (key & ((1 << FLAGS_log2_keys_per_lock) - 1)) == 0) {
2016
2085
  range_locks.emplace_back(
2017
2086
  new MutexLock(shared->GetMutexForKey(column_family, key)));
2018
2087
  }
2019
- if (!shared->AllowsOverwrite(key)) {
2020
- // We could alternatively include `key` that is deleted.
2021
- continue;
2088
+ if (test_standalone_range_deletion) {
2089
+ // Testing standalone range deletion needs a continuous range of keys.
2090
+ if (shared->AllowsOverwrite(key)) {
2091
+ if (keys.empty() || (!keys.empty() && keys.back() == key - 1)) {
2092
+ keys.push_back(key);
2093
+ } else {
2094
+ keys.clear();
2095
+ keys.push_back(key);
2096
+ }
2097
+ } else {
2098
+ if (keys.size() > 0) {
2099
+ break;
2100
+ } else {
2101
+ continue;
2102
+ }
2103
+ }
2104
+ } else {
2105
+ if (!shared->AllowsOverwrite(key)) {
2106
+ // We could alternatively include `key` that is deleted.
2107
+ continue;
2108
+ }
2109
+ keys.push_back(key);
2022
2110
  }
2023
- keys.push_back(key);
2024
-
2025
- PendingExpectedValue pending_expected_value =
2026
- shared->PreparePut(column_family, key);
2111
+ }
2027
2112
 
2028
- const uint32_t value_base = pending_expected_value.GetFinalValueBase();
2029
- values.push_back(value_base);
2030
- pending_expected_values.push_back(pending_expected_value);
2113
+ if (s.ok() && keys.empty()) {
2114
+ return;
2115
+ }
2031
2116
 
2117
+ // set pending state on expected values, create and ingest files.
2118
+ size_t total_keys = keys.size();
2119
+ for (size_t i = 0; s.ok() && i < total_keys; i++) {
2120
+ int64_t key = keys.at(i);
2032
2121
  char value[100];
2033
2122
  auto key_str = Key(key);
2034
- const size_t value_len = GenerateValue(value_base, value, sizeof(value));
2035
2123
  const Slice k(key_str);
2036
- const Slice v(value, value_len);
2037
-
2038
- if (FLAGS_use_put_entity_one_in > 0 &&
2039
- (value_base % FLAGS_use_put_entity_one_in) == 0) {
2040
- WideColumns columns = GenerateWideColumns(value_base, v);
2041
- s = sst_file_writer.PutEntity(k, columns);
2042
- } else {
2124
+ Slice v;
2125
+ if (test_standalone_range_deletion) {
2126
+ assert(i == 0 || keys.at(i - 1) == key - 1);
2043
2127
  s = sst_file_writer.Put(k, v);
2128
+ } else {
2129
+ PendingExpectedValue pending_expected_value =
2130
+ shared->PreparePut(column_family, key);
2131
+ const uint32_t value_base = pending_expected_value.GetFinalValueBase();
2132
+ const size_t value_len =
2133
+ GenerateValue(value_base, value, sizeof(value));
2134
+ v = Slice(value, value_len);
2135
+ values.push_back(value_base);
2136
+ pending_expected_values.push_back(pending_expected_value);
2137
+ if (FLAGS_use_put_entity_one_in > 0 &&
2138
+ (value_base % FLAGS_use_put_entity_one_in) == 0) {
2139
+ WideColumns columns = GenerateWideColumns(values.back(), v);
2140
+ s = sst_file_writer.PutEntity(k, columns);
2141
+ } else {
2142
+ s = sst_file_writer.Put(k, v);
2143
+ }
2044
2144
  }
2045
2145
  }
2046
-
2047
- if (s.ok() && keys.empty()) {
2048
- return;
2146
+ if (s.ok() && !keys.empty()) {
2147
+ s = sst_file_writer.Finish();
2049
2148
  }
2050
2149
 
2051
- if (s.ok()) {
2052
- s = sst_file_writer.Finish();
2150
+ if (s.ok() && total_keys != 0 && test_standalone_range_deletion) {
2151
+ int64_t start_key = keys.at(0);
2152
+ int64_t end_key = keys.back() + 1;
2153
+ pending_expected_values =
2154
+ shared->PrepareDeleteRange(column_family, start_key, end_key);
2155
+ auto start_key_str = Key(start_key);
2156
+ const Slice start_key_slice(start_key_str);
2157
+ auto end_key_str = Key(end_key);
2158
+ const Slice end_key_slice(end_key_str);
2159
+ s = standalone_rangedel_sst_file_writer.DeleteRange(start_key_slice,
2160
+ end_key_slice);
2161
+ if (s.ok()) {
2162
+ s = standalone_rangedel_sst_file_writer.Finish();
2163
+ }
2053
2164
  }
2054
2165
  if (s.ok()) {
2055
2166
  IngestExternalFileOptions ingest_options;
@@ -2057,13 +2168,17 @@ class NonBatchedOpsStressTest : public StressTest {
2057
2168
  ingest_options.verify_checksums_before_ingest = thread->rand.OneInOpt(2);
2058
2169
  ingest_options.verify_checksums_readahead_size =
2059
2170
  thread->rand.OneInOpt(2) ? 1024 * 1024 : 0;
2171
+ ingest_options.fill_cache = thread->rand.OneInOpt(4);
2060
2172
  ingest_options_oss << "move_files: " << ingest_options.move_files
2061
2173
  << ", verify_checksums_before_ingest: "
2062
2174
  << ingest_options.verify_checksums_before_ingest
2063
2175
  << ", verify_checksums_readahead_size: "
2064
- << ingest_options.verify_checksums_readahead_size;
2176
+ << ingest_options.verify_checksums_readahead_size
2177
+ << ", fill_cache: " << ingest_options.fill_cache
2178
+ << ", test_standalone_range_deletion: "
2179
+ << test_standalone_range_deletion;
2065
2180
  s = db_->IngestExternalFile(column_families_[column_family],
2066
- {sst_filename}, ingest_options);
2181
+ external_files, ingest_options);
2067
2182
  }
2068
2183
  if (!s.ok()) {
2069
2184
  for (PendingExpectedValue& pending_expected_value :
@@ -2258,6 +2373,16 @@ class NonBatchedOpsStressTest : public StressTest {
2258
2373
  uint64_t curr = 0;
2259
2374
  while (true) {
2260
2375
  assert(last_key < ub);
2376
+
2377
+ if (iter->Valid() && ro.allow_unprepared_value) {
2378
+ op_logs += "*";
2379
+
2380
+ if (!iter->PrepareValue()) {
2381
+ assert(!iter->Valid());
2382
+ assert(!iter->status().ok());
2383
+ }
2384
+ }
2385
+
2261
2386
  if (!iter->Valid()) {
2262
2387
  if (!iter->status().ok()) {
2263
2388
  if (IsErrorInjectedAndRetryable(iter->status())) {
@@ -2320,6 +2445,16 @@ class NonBatchedOpsStressTest : public StressTest {
2320
2445
  last_key = ub;
2321
2446
  while (true) {
2322
2447
  assert(lb < last_key);
2448
+
2449
+ if (iter->Valid() && ro.allow_unprepared_value) {
2450
+ op_logs += "*";
2451
+
2452
+ if (!iter->PrepareValue()) {
2453
+ assert(!iter->Valid());
2454
+ assert(!iter->status().ok());
2455
+ }
2456
+ }
2457
+
2323
2458
  if (!iter->Valid()) {
2324
2459
  if (!iter->status().ok()) {
2325
2460
  if (IsErrorInjectedAndRetryable(iter->status())) {
@@ -2458,6 +2593,16 @@ class NonBatchedOpsStressTest : public StressTest {
2458
2593
  }
2459
2594
 
2460
2595
  for (int64_t i = 0; i < num_iter && iter->Valid(); ++i) {
2596
+ if (ro.allow_unprepared_value) {
2597
+ op_logs += "*";
2598
+
2599
+ if (!iter->PrepareValue()) {
2600
+ assert(!iter->Valid());
2601
+ assert(!iter->status().ok());
2602
+ break;
2603
+ }
2604
+ }
2605
+
2461
2606
  if (!check_columns()) {
2462
2607
  return Status::OK();
2463
2608
  }
@@ -2735,7 +2880,7 @@ class NonBatchedOpsStressTest : public StressTest {
2735
2880
  const size_t sz = GenerateValue(value_base, value, sizeof(value));
2736
2881
  const Slice v(value, sz);
2737
2882
 
2738
- if (op == Op::PutOrPutEntity) {
2883
+ if (op == Op::PutOrPutEntity || !FLAGS_use_merge) {
2739
2884
  if (FLAGS_use_put_entity_one_in > 0 &&
2740
2885
  (value_base % FLAGS_use_put_entity_one_in) == 0) {
2741
2886
  s = txn->PutEntity(cfh, k, GenerateWideColumns(value_base, v));
@@ -200,6 +200,11 @@ IOStatus WriteStringToFile(FileSystem* fs, const Slice& data,
200
200
 
201
201
  IOStatus ReadFileToString(FileSystem* fs, const std::string& fname,
202
202
  std::string* data) {
203
+ return ReadFileToString(fs, fname, IOOptions(), data);
204
+ }
205
+
206
+ IOStatus ReadFileToString(FileSystem* fs, const std::string& fname,
207
+ const IOOptions& opts, std::string* data) {
203
208
  FileOptions soptions;
204
209
  data->clear();
205
210
  std::unique_ptr<FSSequentialFile> file;
@@ -212,7 +217,7 @@ IOStatus ReadFileToString(FileSystem* fs, const std::string& fname,
212
217
  char* space = new char[kBufferSize];
213
218
  while (true) {
214
219
  Slice fragment;
215
- s = file->Read(kBufferSize, IOOptions(), &fragment, space, nullptr);
220
+ s = file->Read(kBufferSize, opts, &fragment, space, nullptr);
216
221
  if (!s.ok()) {
217
222
  break;
218
223
  }