Summary:
This diff made the following changes:
(1) When calling one of the new builtin functions
function yb_increment_db_catalog_version_with_inval_messages
function yb_increment_all_db_catalog_versions_with_inval_messages
If there is a corruption in `pg_yb_catalog_version` such that `MyDatabaseId`
does not have a row in it, both functions will return PG null value. Current the
code did not check for the PG null value, I added code to detect that and set
the `new_version` to 0 (YB_CATCACHE_VERSION_UNINITIALIZED which isn't a valid
catalog version number). We could do elog(ERROR) to raise an exception when a PG
null is returned but that will cause some unit test to fail due to behavior
change in case of converting from per-database catalog version mode back to
global catalog version mode.
(2) Added new function `YbIsInvalidationMessageEnabled` to consolidate how
invalidation message is enabled at PG side.
(3) Moved the call of `YbResetNewCatalogVersion` to the beginning of
`YbIncrementMasterCatalogVersionTableEntry` so that we have a better assertion
that `yb_new_catalog_version` is properly initialized each time we attempt to
increment the catalog version.
(4) Added new function `YbCheckNewLocalCatalogVersionOptimization` to perform
the local catalog version bump optimization, which becomes more involved when
`YbIsInvalidationMessageEnabled` is true.
(5) Fixed formatting misalignment when I changed `sender_pid` to `yb_sender_pid`.
(6) Removed an unneeded
```
DECLARE_bool(ysql_yb_enable_invalidation_messages);
```
Test Plan: ./yb_build.sh --cxx-test pg_catalog_version-test
Reviewers: kfranz, sanketh, mihnea
Reviewed By: kfranz
Subscribers: jason, yql
Differential Revision: https://phorge.dev.yugabyte.com/D42693