rocksdb/utilities/transactions
Yu Zhang fc59d8f9c6 Add public API `WriteWithCallback` to support custom callbacks (#12603)
Summary:
This PR adds a `DB::WriteWithCallback` API that does the same things as `DB::Write` while takes an argument `UserWriteCallback` to execute custom callback functions during the write.

We currently support two types of callback functions: `OnWriteEnqueued` and `OnWalWriteFinish`. The former is invoked   after the write is enqueued, and the later is invoked after WAL write finishes when applicable.

These callback functions are intended for users to use to improve synchronization between concurrent writes, their execution is on the write's critical path so it will impact the write's latency if not used properly. The documentation for the callback interface mentioned this and suggest user to keep these callback functions' implementation minimum.

Although transaction interfaces' writes doesn't yet allow user to specify such a user write callback argument, the `DBImpl::Write*` type of APIs do not differentiate between regular DB writes or writes coming from the transaction layer when it comes to supporting this `UserWriteCallback`. These callbacks works for all the write modes including: default write mode, Options.two_write_queues, Options.unordered_write, Options.enable_pipelined_write

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

Test Plan: Added unit test in ./write_callback_test

Reviewed By: anand1976

Differential Revision: D58044638

Pulled By: jowlyzhang

fbshipit-source-id: 87a84a0221df8f589ec8fc4d74597e72ce97e4cd
2024-05-31 19:30:19 -07:00
..
lock Fix deprecated use of 0/NULL in internal_repo_rocksdb/repo/util/xxhash.h + 5 2024-04-01 21:20:51 -07:00
optimistic_transaction.cc Run internal cpp modernizer on RocksDB repo (#12398) 2024-03-04 10:08:32 -08:00
optimistic_transaction.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
optimistic_transaction_db_impl.cc Run internal cpp modernizer on RocksDB repo (#12398) 2024-03-04 10:08:32 -08:00
optimistic_transaction_db_impl.h Remove 'virtual' when implied by 'override' (#12319) 2024-01-31 13:14:42 -08:00
optimistic_transaction_test.cc Add GetEntityForUpdate to optimistic and WriteCommitted pessimistic transactions (#12668) 2024-05-20 10:43:05 -07:00
pessimistic_transaction.cc Add public API `WriteWithCallback` to support custom callbacks (#12603) 2024-05-31 19:30:19 -07:00
pessimistic_transaction.h Add GetEntityForUpdate to optimistic and WriteCommitted pessimistic transactions (#12668) 2024-05-20 10:43:05 -07:00
pessimistic_transaction_db.cc Add PutEntity support for optimistic and WritePrepared pessimistic transactions (#12606) 2024-05-06 14:41:00 -07:00
pessimistic_transaction_db.h Add PutEntity support for optimistic and WritePrepared pessimistic transactions (#12606) 2024-05-06 14:41:00 -07:00
snapshot_checker.cc Remove extra semi colon from internal_repo_rocksdb/repo/tools/ldb_cmd.cc 2024-03-18 18:51:50 -07:00
timestamped_snapshot_test.cc Run internal cpp modernizer on RocksDB repo (#12398) 2024-03-04 10:08:32 -08:00
transaction_base.cc Add GetEntityForUpdate to optimistic and WriteCommitted pessimistic transactions (#12668) 2024-05-20 10:43:05 -07:00
transaction_base.h Add GetEntityForUpdate to optimistic and WriteCommitted pessimistic transactions (#12668) 2024-05-20 10:43:05 -07:00
transaction_db_mutex_impl.cc Run internal cpp modernizer on RocksDB repo (#12398) 2024-03-04 10:08:32 -08:00
transaction_db_mutex_impl.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
transaction_test.cc Fix rebuilding transactions containing PutEntity (#12681) 2024-05-21 17:22:20 -07:00
transaction_test.h Rename, deprecate `LogFile` and `VectorLogPtr` (#12695) 2024-05-28 09:24:49 -07: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 Add GetEntityForUpdate to optimistic and WriteCommitted pessimistic transactions (#12668) 2024-05-20 10:43:05 -07:00
write_prepared_transaction_test.cc Run internal cpp modernizer on RocksDB repo (#12398) 2024-03-04 10:08:32 -08:00
write_prepared_txn.cc Add public API `WriteWithCallback` to support custom callbacks (#12603) 2024-05-31 19:30:19 -07:00
write_prepared_txn.h Remove 'virtual' when implied by 'override' (#12319) 2024-01-31 13:14:42 -08:00
write_prepared_txn_db.cc Add public API `WriteWithCallback` to support custom callbacks (#12603) 2024-05-31 19:30:19 -07:00
write_prepared_txn_db.h Deprecate some variants of Get and MultiGet (#12327) 2024-02-16 09:21:06 -08:00
write_unprepared_transaction_test.cc Refactor WriteUnpreparedStressTest to be a unit test (#11424) 2023-05-22 12:31:52 -07:00
write_unprepared_txn.cc Add public API `WriteWithCallback` to support custom callbacks (#12603) 2024-05-31 19:30:19 -07:00
write_unprepared_txn.h Remove 'virtual' when implied by 'override' (#12319) 2024-01-31 13:14:42 -08:00
write_unprepared_txn_db.cc Add public API `WriteWithCallback` to support custom callbacks (#12603) 2024-05-31 19:30:19 -07:00
write_unprepared_txn_db.h Remove 'virtual' when implied by 'override' (#12319) 2024-01-31 13:14:42 -08:00