rocksdb/utilities/transactions
Reid Horuff a657ee9a9c [rocksdb] Recovery path sequence miscount fix
Summary:
Consider the following WAL with 4 batch entries prefixed with their sequence at time of memtable insert.
[1: BEGIN_PREPARE, PUT, PUT, PUT, PUT, END_PREPARE(a)]
[1: BEGIN_PREPARE, PUT, PUT, PUT, PUT, END_PREPARE(b)]
[4: COMMIT(a)]
[7: COMMIT(b)]

The first two batches do not consume any sequence numbers so are both prefixed with seq=1.
For 2pc commit, memtable insertion takes place before COMMIT batch is written to WAL.
We can see that sequence number consumption takes place between WAL entries giving us the seemingly sparse sequence prefix for WAL entries.
This is a valid WAL.

Because with 2PC markers one WriteBatch points to another batch containing its inserts a writebatch can consume more or less sequence numbers than the number of sequence consuming entries that it contains.

We can see that, given the entries in the WAL, 6 sequence ids were consumed. Yet on recovery the maximum sequence consumed would be 7 + 3 (the number of sequence numbers consumed by COMMIT(b))

So, now upon recovery we must track the actual consumption of sequence numbers.
In the provided scenario there will be no sequence gaps, but it is possible to produce a sequence gap. This should not be a problem though. correct?

Test Plan: provided test.

Reviewers: sdong

Subscribers: andrewkr, leveldb, dhruba, hermanlee4

Differential Revision: https://reviews.facebook.net/D57645
2016-05-10 14:06:07 -07:00
..
optimistic_transaction_db_impl.cc optimistic transactions support for reinitialization 2016-03-07 19:03:09 -08:00
optimistic_transaction_db_impl.h optimistic transactions support for reinitialization 2016-03-07 19:03:09 -08:00
optimistic_transaction_impl.cc [rocksdb] Two Phase Transaction 2016-05-10 14:06:07 -07:00
optimistic_transaction_impl.h [rocksdb] Two Phase Transaction 2016-05-10 14:06:07 -07:00
optimistic_transaction_test.cc Fix AppVeyor build error 2016-03-15 10:57:33 -07:00
transaction_base.cc [rocksdb] Two Phase Transaction 2016-05-10 14:06:07 -07:00
transaction_base.h [rocksdb] Two Phase Transaction 2016-05-10 14:06:07 -07:00
transaction_db_impl.cc [rocksdb] Two Phase Transaction 2016-05-10 14:06:07 -07:00
transaction_db_impl.h [rocksdb] Two Phase Transaction 2016-05-10 14:06:07 -07:00
transaction_db_mutex_impl.cc Fix transaction locking 2016-02-16 17:15:05 -08:00
transaction_db_mutex_impl.h Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
transaction_impl.cc [rocksdb] Two Phase Transaction 2016-05-10 14:06:07 -07:00
transaction_impl.h [rocksdb] Two Phase Transaction 2016-05-10 14:06:07 -07:00
transaction_lock_mgr.cc Merge pull request #1101 from flyd1005/wip-fix-typo 2016-04-28 02:30:44 -07:00
transaction_lock_mgr.h Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
transaction_test.cc [rocksdb] Recovery path sequence miscount fix 2016-05-10 14:06:07 -07:00
transaction_util.cc Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
transaction_util.h Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00