Summary:
LibPqTestBase::BumpCatalogVersion has a Sleep(2s) that is intended to
wait for the recently bumped catalog version to propagate. Whether it
intends for the catalog version to propagate to all tservers or just to
the connection conn, I do not know, because tests have varying
expectations. For example, PgLibPqTest.StaleMasterReads does not seem
care at all whether it propagated because it only checks master's
catalog version. And PgLibPqTest.CatalogCacheMemoryLeak already has a
sleep call after calling this function. So it looks like no tests
actually care about the catalog version propagating.
It turns out, the 2s sleep is not sufficient when writing a test that
does care about the catalog version propagating, at least to conn. It
fails 1/100 times on TSAN, and reducing it to 1.5s makes it fail 3/50
times. To make the wait more reliable, have wait on conn's local
catalog version directly. This function can then be used more reliably
in cases where conn needs to have up-to-date catalog version.
Jira: DB-14156
Test Plan:
./yb_build.sh fastdebug --gcc11 --sj --cxx-test pg_backends-test
./yb_build.sh fastdebug --gcc11 --sj --cxx-test pg_libpq-test
Close: #25015
Depends on D40110
Reviewers: myang
Reviewed By: myang
Subscribers: yql
Differential Revision: https://phorge.dev.yugabyte.com/D40115