rocksdb/utilities/transactions
Yanqin Jin d6e1e6f37a Add commit_timestamp and read_timestamp to Pessimistic transaction (#9537)
Summary:
Pull Request resolved: https://github.com/facebook/rocksdb/pull/9537

Add `Transaction::SetReadTimestampForValidation()` and
`Transaction::SetCommitTimestamp()` APIs with default implementation
returning `Status::NotSupported()`. Currently, calling these two APIs do not
have any effect.

Also add checks to `PessimisticTransactionDB`
to enforce that column families in the same db either
- disable user-defined timestamp
- enable 64-bit timestamp

Just to clarify, a `PessimisticTransactionDB` can have some column families without
timestamps as well as column families that enable timestamp.

Each `PessimisticTransaction` can have two optional timestamps, `read_timestamp_`
used for additional validation and `commit_timestamp_` which denotes when the transaction commits.
For now, we are going to support `WriteCommittedTxn` (in a series of subsequent PRs)

Once set, we do not allow decreasing `read_timestamp_`. The `commit_timestamp_` must be
 greater than `read_timestamp_` for each transaction and must be set before commit, unless
the transaction does not involve any column family that enables user-defined timestamp.

TransactionDB builds on top of RocksDB core `DB` layer. Though `DB` layer assumes
that user-defined timestamps are byte arrays, `TransactionDB` uses uint64_t to store
timestamps. When they are passed down, they are still interpreted as
byte-arrays by `DB`.

Reviewed By: ltamasi

Differential Revision: D31567959

fbshipit-source-id: b0b6b69acab5d8e340cf174f33e8b09f1c3d3502
2022-02-11 20:19:15 -08:00
..
lock Range Locking: add support for escalation barriers (#9290) 2022-01-14 12:46:09 -08:00
optimistic_transaction_db_impl.cc Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
optimistic_transaction_db_impl.h Revise APIs related to user-defined timestamp (#8946) 2022-02-01 22:19:01 -08:00
optimistic_transaction_test.cc MemTableList::TrimHistory now use allocated bytes (#9020) 2021-12-02 11:45:39 -08:00
optimistic_transaction.cc Add further tests to ASSERT_STATUS_CHECKED (2) (#7698) 2020-12-09 21:21:16 -08:00
optimistic_transaction.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
pessimistic_transaction_db.cc Add commit_timestamp and read_timestamp to Pessimistic transaction (#9537) 2022-02-11 20:19:15 -08:00
pessimistic_transaction_db.h Range Locking: Allow different LockManagers, add Range Lock definitions (#7443) 2020-12-07 20:18:07 -08:00
pessimistic_transaction.cc Add commit_timestamp and read_timestamp to Pessimistic transaction (#9537) 2022-02-11 20:19:15 -08:00
pessimistic_transaction.h Add commit_timestamp and read_timestamp to Pessimistic transaction (#9537) 2022-02-11 20:19:15 -08:00
snapshot_checker.cc Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
transaction_base.cc Add commit marker with timestamp (#9266) 2021-12-10 11:05:35 -08:00
transaction_base.h Fix small issues (#5896) 2021-11-08 12:32:38 -08:00
transaction_db_mutex_impl.cc Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
transaction_db_mutex_impl.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
transaction_test.cc Add commit_timestamp and read_timestamp to Pessimistic transaction (#9537) 2022-02-11 20:19:15 -08:00
transaction_test.h Add commit_timestamp and read_timestamp to Pessimistic transaction (#9537) 2022-02-11 20:19:15 -08:00
transaction_util.cc Update TransactionUtil::CheckKeyForConflict to also use timestamps (#9162) 2021-11-15 12:52:18 -08:00
transaction_util.h Update TransactionUtil::CheckKeyForConflict to also use timestamps (#9162) 2021-11-15 12:52:18 -08:00
write_prepared_transaction_test.cc Make TwoWriteQueues/SnapshotConcurrentAccessTest.SnapshotConcurrentAcces less flaky (#9281) 2021-12-10 12:52:33 -08:00
write_prepared_txn_db.cc Revise APIs related to user-defined timestamp (#8946) 2022-02-01 22:19:01 -08:00
write_prepared_txn_db.h Cleanup includes in dbformat.h (#8930) 2021-09-29 04:04:40 -07:00
write_prepared_txn.cc Update TransactionUtil::CheckKeyForConflict to also use timestamps (#9162) 2021-11-15 12:52:18 -08:00
write_prepared_txn.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
write_unprepared_transaction_test.cc Move slow valgrind tests behind -DROCKSDB_FULL_VALGRIND_RUN (#8475) 2021-07-07 11:14:05 -07:00
write_unprepared_txn_db.cc Add further tests to ASSERT_STATUS_CHECKED (2) (#7698) 2020-12-09 21:21:16 -08:00
write_unprepared_txn_db.h WriteUnPrepared: Pass in correct subbatch count during rollback (#6463) 2020-02-28 11:19:32 -08:00
write_unprepared_txn.cc Update TransactionUtil::CheckKeyForConflict to also use timestamps (#9162) 2021-11-15 12:52:18 -08:00
write_unprepared_txn.h Replace tracked_keys with a new LockTracker interface in TransactionDB (#7013) 2020-08-06 12:38:00 -07:00