-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[YSQL] #5232: Provide follower reads through YSQL
Summary: Currently we support consistent prefix reads (read from followers) for both YCQL and YEDIS, but not for YSQL. This diff adds new session variable to specify if read from followers should be enabled. The value for this variable is being sent as part of the execution parameters. When read from followers is enabled, this is translated to CONSISTENT_PREFIX consistency level which is sent to the tablet RPC layer. In this layer, if CONSISTENT_PREFIX consistency is specified, the closest replica that can serve the read is selected regardless of whether or not it it's the leader for such tablet. This diff also adds new metrics to count how the number of CONSISTENT_PREFIX requests, and also the number of YSQL rows read as part of a consistent prefix request. Test Plan: Set the `yb_read_from_followers`, execute a select statement and verify that in the rpc layer, the read has consistent_prefix consistency. New unit tests Also for the compatibility with isolation levels: ```ysqlsh (11.2-YB-2.3.3.0-b0) Type "help" for help. yugabyte=# SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL REPEATABLE READ; SET yugabyte=# SET yb_read_from_followers = true; ERROR: cannot enable yb_read_from_followers with the current transaction isolation mode HINT: Use READ UNCOMMITTED or READ COMMITTED to enable yb_read_from_followers. yugabyte=# SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED; SET yugabyte=# SET yb_read_from_followers = true; SET yugabyte=# SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL REPEATABLE READ; ERROR: cannot use this transaction isolation level with yb_read_from_followers enabled HINT: Disable yb_read_from_followers to use REPEATABLE READ or SERIALIZABLE. ``` Reviewers: bogdan, amitanand, mihnea, zyu Reviewed By: mihnea, zyu Subscribers: bogdan, zyu, ybase Differential Revision: https://phabricator.dev.yugabyte.com/D9205
- Loading branch information
Showing
34 changed files
with
428 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.