Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#22821] YSQL: Preserve local limit in a multi-page read
Summary: ### Issue We set the read time explicitly in pg_op.cc for subsequent pages. This sets the read time on consistent read point. Consistent read point thinks this is a new read point and clears out all the local limit values stored. This will cause the local limit to advance, leading to read restart errors. ### Fix Clear out paging read time field before passing the response back to the pg layer from tserver's pg client session. Except for catalog sessions since they do not follow used_read_time logic. ### History 1c2e37d was introduced to use the same read time across all pages of a read. This was done as follows: docdb sets a read_time in the paging state and passes back to Pg. Pg would then copy paste the same paging state in the next RPC to docdb. Docdb would then pick the read time from the paging state to ensure that the same snapshot is used. b97a881 was a follow-up fix after 1c2e37d. After this fix, PG, sets the read time in the subsequent rpc requests using the read time from the paging state, instead of relying on docdb to use the read time from the copy pasted paging state. Currently, we do not need the paging state read time (sans upgrade reasons) for 1. Plain sessions have used_read_time logic that sets the read time of subsequent RPCs. 2. DDL sessions use distributed transactions from the start and the used_read_time for that is also handled. Catalog sessions require paging read time at the moment. We do not clear paging read time for catalog requests when sending back the response to pggate. **Upgrade/Rollback safety:** The used read time logic is present in local proxy. Since the local proxy is upgraded along with the Pg layer, no upgrade issues are expected. Jira: DB-11718 Test Plan: Jenkins ``` ./yb_build.sh --cxx-test pg_read_visibility-test --gtest-filter MultiPageScan ./yb_build.sh --cxx-test pgwrapper_pg_single_tserver-test --gtest_filter PgSingleTServerTest.TestPagingInSerializableIsolation ./yb_build.sh --gtest_filter PgLibPqTest.PagingReadRestart ``` Reviewers: pjain, sergei, dmitry Reviewed By: pjain, sergei, dmitry Subscribers: svc_phabricator, yql, ybase Differential Revision: https://phorge.dev.yugabyte.com/D35750
- Loading branch information