rocksdb/utilities/transactions
Jay Huh 586d78b31e Remove wait_unscheduled from waitForCompact internal API (#11443)
Summary:
Context:

In pull request https://github.com/facebook/rocksdb/issues/11436, we are introducing a new public API `waitForCompact(const WaitForCompactOptions& wait_for_compact_options)`. This API invokes the internal implementation `waitForCompact(bool wait_unscheduled=false)`. The unscheduled parameter indicates the compactions that are not yet scheduled but are required to process items in the queue.

In certain cases, we are unable to wait for compactions, such as during a shutdown or when background jobs are paused. It is important to return the appropriate status in these scenarios. For all other cases, we should wait for all compaction and flush jobs, including the unscheduled ones. The primary purpose of this new API is to wait until the system has resolved its compaction debt. Currently, the usage of `wait_unscheduled` is limited to test code.

This pull request eliminates the usage of wait_unscheduled. The internal `waitForCompact()` API now waits for unscheduled compactions unless the db is undergoing a shutdown. In the event of a shutdown, the API returns `Status::ShutdownInProgress()`.

Additionally, a new parameter, `abort_on_pause`, has been introduced with a default value of `false`. This parameter addresses the possibility of waiting indefinitely for unscheduled jobs if `PauseBackgroundWork()` was called before `waitForCompact()` is invoked. By setting `abort_on_pause` to `true`, the API will immediately return `Status::Aborted`.

Furthermore, all tests that previously called `waitForCompact(true)` have been fixed.

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

Test Plan:
Existing tests that involve a shutdown in progress:

- DBCompactionTest::CompactRangeShutdownWhileDelayed
- DBTestWithParam::PreShutdownMultipleCompaction
- DBTestWithParam::PreShutdownCompactionMiddle

Reviewed By: pdillinger

Differential Revision: D45923426

Pulled By: jaykorean

fbshipit-source-id: 7dc93fe6a6841a7d9d2d72866fa647090dba8eae
2023-05-17 18:13:50 -07:00
..
lock Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
optimistic_transaction.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
optimistic_transaction.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
optimistic_transaction_db_impl.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
optimistic_transaction_db_impl.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
optimistic_transaction_test.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
pessimistic_transaction.cc Group rocksdb.sst.read.micros stat by IOActivity flush and compaction (#11288) 2023-04-21 09:07:18 -07:00
pessimistic_transaction.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
pessimistic_transaction_db.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
pessimistic_transaction_db.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
snapshot_checker.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
timestamped_snapshot_test.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
transaction_base.cc Group rocksdb.sst.read.micros stat by IOActivity flush and compaction (#11288) 2023-04-21 09:07:18 -07:00
transaction_base.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
transaction_db_mutex_impl.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
transaction_db_mutex_impl.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
transaction_test.cc Remove wait_unscheduled from waitForCompact internal API (#11443) 2023-05-17 18:13:50 -07:00
transaction_test.h Replace member variable lambda with methods (#10924) 2022-11-07 12:31:48 -08:00
transaction_util.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
transaction_util.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
write_committed_transaction_ts_test.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
write_prepared_transaction_test.cc Remove wait_unscheduled from waitForCompact internal API (#11443) 2023-05-17 18:13:50 -07:00
write_prepared_txn.cc Group rocksdb.sst.read.micros stat by IOActivity flush and compaction (#11288) 2023-04-21 09:07:18 -07:00
write_prepared_txn.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
write_prepared_txn_db.cc Group rocksdb.sst.read.micros stat by IOActivity flush and compaction (#11288) 2023-04-21 09:07:18 -07:00
write_prepared_txn_db.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
write_unprepared_transaction_test.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
write_unprepared_txn.cc Group rocksdb.sst.read.micros stat by IOActivity flush and compaction (#11288) 2023-04-21 09:07:18 -07:00
write_unprepared_txn.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
write_unprepared_txn_db.cc Group rocksdb.sst.read.micros stat by IOActivity flush and compaction (#11288) 2023-04-21 09:07:18 -07:00
write_unprepared_txn_db.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00