Please sign in to comment.
[#2125] Avoid picking read time for the serializable transactions
Summary: For backward compatibility, we have a list of capabilities, supported by tserver. Right after master restart, while it did not receive heartbeats from tservers it does not know their capabilities. So, when meta cache is updated tserver with empty capabilities could be stored in it. Also, we have a feature that read time for the transaction with snapshot isolation is picked at tablet server, while processing the first request from this transaction. But, when iterating with tablet server that does not support picking read time, we set transaction read time at the proxy layer (i.e. YCQL or YSQL proxy). This particular code contained a bug and also set read time for the transaction with serializable isolation. Read time for the transaction with serializable isolation should not be set, since if it would be set transaction with serializable isolation could miss writes made by committed transactions. The scenario that happened in #2125: 1) All masters are turned off. 2) Meta cache is invalidated and right after master restarted client fetches tablet server information with empty capabilities. 3) When the client tries to send the next transaction request, the buggy code is executed and read time is picked for the transaction with serializable isolation (it is T2 transaction in #2125). 4) Operation executed for this transaction missed values that were recently committed by other transactions. Following by incorrect state. So actually it is not just serializable violation but could cause more serious consistency bugs. Fixed by avoid setting read time for the transaction with serializable isolation. Extended PgLibPqTest.OnConflict test: 1) Add reads to transaction 2) Find order cycles Added PgLibPqTest.OnConlictWithKillMaster. Test Plan: ybd --gtest_filter PgLibPqTest.OnConflict -n 100 Reviewers: mikhail Reviewed By: mikhail Subscribers: ybase Differential Revision: https://phabricator.dev.yugabyte.com/D7108
- Loading branch information...
Showing with 271 additions and 35 deletions.
Oops, something went wrong.