Fix async_io regression in scans (#10939)

Summary:
Fix async_io regression in scans due to incorrect check which was causing the valid data in buffer to be cleared during seek.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10939

Test Plan:
- stress tests  export CRASH_TEST_EXT_ARGS="--async_io=1"
    make crash_test -j32
- Ran db_bench command which was caught the regression:
./db_bench --db=/rocksdb_async_io_testing/prefix_scan --disable_wal=1 --use_existing_db=true --benchmarks="seekrandom" -key_size=32 -value_size=512 -num=50000000 -use_direct_reads=false -seek_nexts=963 -duration=30 -ops_between_duration_checks=1 --async_io=true --compaction_readahead_size=4194304 --log_readahead_size=0 --blob_compaction_readahead_size=0 --initial_auto_readahead_size=65536 --num_file_reads_for_auto_readahead=0 --max_auto_readahead_size=524288

seekrandom   :    3777.415 micros/op 264 ops/sec 30.000 seconds 7942 operations;  132.3 MB/s (7942 of 7942 found)

Reviewed By: anand1976

Differential Revision: D41173899

Pulled By: akankshamahajan15

fbshipit-source-id: 2d75b06457d65b1851c92382565d9c3fac329dfe
main
akankshamahajan 2 years ago committed by Facebook GitHub Bot
parent dbc4101b89
commit d1aca4a5ae
  1. 1
      HISTORY.md
  2. 2
      file/file_prefetch_buffer.cc

@ -8,6 +8,7 @@
* Fix memory corruption error in scans if async_io is enabled. Memory corruption happened if there is IOError while reading the data leading to empty buffer and other buffer already in progress of async read goes again for reading. * Fix memory corruption error in scans if async_io is enabled. Memory corruption happened if there is IOError while reading the data leading to empty buffer and other buffer already in progress of async read goes again for reading.
* Fix failed memtable flush retry bug that could cause wrongly ordered updates, which would surface to writers as `Status::Corruption` in case of `force_consistency_checks=true` (default). It affects use cases that enable both parallel flush (`max_background_flushes > 1` or `max_background_jobs >= 8`) and non-default memtable count (`max_write_buffer_number > 2`). * Fix failed memtable flush retry bug that could cause wrongly ordered updates, which would surface to writers as `Status::Corruption` in case of `force_consistency_checks=true` (default). It affects use cases that enable both parallel flush (`max_background_flushes > 1` or `max_background_jobs >= 8`) and non-default memtable count (`max_write_buffer_number > 2`).
* Fixed an issue where the `READ_NUM_MERGE_OPERANDS` ticker was not updated when the base key-value or tombstone was read from an SST file. * Fixed an issue where the `READ_NUM_MERGE_OPERANDS` ticker was not updated when the base key-value or tombstone was read from an SST file.
* Fixed a regression in scan for async_io. During seek, valid buffers were getting cleared causing a regression.
### New Features ### New Features
* Add basic support for user-defined timestamp to Merge (#10819). * Add basic support for user-defined timestamp to Merge (#10819).

@ -664,7 +664,7 @@ bool FilePrefetchBuffer::TryReadFromCacheAsync(
// submitted in PrefetchAsync should match with this request. Otherwise // submitted in PrefetchAsync should match with this request. Otherwise
// buffers will be outdated. // buffers will be outdated.
// Random offset called. So abort the IOs. // Random offset called. So abort the IOs.
if (bufs_[curr_].offset_ != offset) { if (prev_offset_ != offset) {
AbortAllIOs(); AbortAllIOs();
bufs_[curr_].buffer_.Clear(); bufs_[curr_].buffer_.Clear();
bufs_[curr_ ^ 1].buffer_.Clear(); bufs_[curr_ ^ 1].buffer_.Clear();

Loading…
Cancel
Save