You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
The function `TabletServer::GetTserverCatalogMessageLists` is used to serve a PG
backend's local tserver request to get the invalidation messages associated with
a consecutive sequence of catalog versions. For example, if a PG backend has
current local catalog version 3, and the shared memory catalog version is 5, it
will ask its local tserver for the invalidation messages associated with catalog
version 4 and 5. For each database, a tserver maintains a queue of `(catalog
version, message_list)` pairs. The maximum queue length is determined by
`--ysql_max_invalidation_message_queue_size` (default value 1024). Right now
`GetTserverCatalogMessageLists` performs a linear scan to find out the first
catalog version that is asked for (4 in the previous example). For a full length
queue, when a PG backend is not lagging far behind, it means that we need to
scan from the beginning of the queue to nearly the end to find out the first
catalog version. Consider that the queue is sorted by catalog version, a linear
scan is not efficient. We should use `std::lower_bound` to locate the first
catalog version more quickly.
This diff replaces the linear scan with `std::lower_bound`, also made some
change to use SCHECK, and improved logging when no match can be found.
Jira: DB-16821
Test Plan: ./yb_build.sh --cxx-test pg_catalog_version-test
Reviewers: kfranz, sanketh, mihnea
Reviewed By: sanketh
Subscribers: yql
Differential Revision: https://phorge.dev.yugabyte.com/D44152
0 commit comments