f622ca2c7c
Summary: Add savepoint support when the current transaction has flushed unprepared batches. Rolling back to savepoint is similar to rolling back a transaction. It requires the set of keys that have changed since the savepoint, re-reading the keys at the snapshot at that savepoint, and the restoring the old keys by writing out another unprepared batch. For this strategy to work though, we must be capable of reading keys at a savepoint. This does not work if keys were written out using the same sequence number before and after a savepoint. Therefore, when we flush out unprepared batches, we must split the batch by savepoint if any savepoints exist. eg. If we have the following: ``` Put(A) Put(B) Put(C) SetSavePoint() Put(D) Put(E) SetSavePoint() Put(F) ``` Then we will write out 3 separate unprepared batches: ``` Put(A) 1 Put(B) 1 Put(C) 1 Put(D) 2 Put(E) 2 Put(F) 3 ``` This is so that when we rollback to eg. the first savepoint, we can just read keys at snapshot_seq = 1. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5627 Differential Revision: D16584130 Pulled By: lth fbshipit-source-id: 6d100dd548fb20c4b76661bd0f8a2647e64477fa |
||
---|---|---|
.. | ||
optimistic_transaction_db_impl.cc | ||
optimistic_transaction_db_impl.h | ||
optimistic_transaction_test.cc | ||
optimistic_transaction.cc | ||
optimistic_transaction.h | ||
pessimistic_transaction_db.cc | ||
pessimistic_transaction_db.h | ||
pessimistic_transaction.cc | ||
pessimistic_transaction.h | ||
snapshot_checker.cc | ||
transaction_base.cc | ||
transaction_base.h | ||
transaction_db_mutex_impl.cc | ||
transaction_db_mutex_impl.h | ||
transaction_lock_mgr.cc | ||
transaction_lock_mgr.h | ||
transaction_test.cc | ||
transaction_test.h | ||
transaction_util.cc | ||
transaction_util.h | ||
write_prepared_transaction_test.cc | ||
write_prepared_txn_db.cc | ||
write_prepared_txn_db.h | ||
write_prepared_txn.cc | ||
write_prepared_txn.h | ||
write_unprepared_transaction_test.cc | ||
write_unprepared_txn_db.cc | ||
write_unprepared_txn_db.h | ||
write_unprepared_txn.cc | ||
write_unprepared_txn.h |