Summary:
D45024 introduced the flakiness. The likely cause is -
- We get the list of current running backends at the start of pg_stat_get_activity
- For each row, we also call yb_pg_stat_get_backend_pss_mem_bytes (PG function), which in turns call YbPgGetCurRssPssMemUsage (C function)
- The modified YbPgGetCurRssPssMemUsage might be slower. so when it's time of the background worker to be added to pg_stat_activity, it's no longer there and we get NULL as backend_type
Test fix is to update the test query to filter out NULLs
Jira: DB-17574
Test Plan: ./yb_build.sh --cxx-test pg_ash-test --gtest_filter PgBgWorkersTest.ValidateBgWorkers
Reviewers: ishan.chhangani
Reviewed By: ishan.chhangani
Subscribers: yql
Differential Revision: https://phorge.dev.yugabyte.com/D45390