Skip to content

2.27.0.0-b76

@myang2021 myang2021 tagged this 07 May 19:50
Summary:
YSQL has an optimization that detects if a DDL statement has made any write or
not. If a DDL statement has made any write, then it is assumed that some catalog
table is written and the catalog has changed. That means we need to increment
the catalog version to trigger catalog cache refreshes. However, it was found
that it is possible that a DDL statement does not write to any catalog table,
but as part of a DDL event trigger function that writes to a user table, the DDL
statement is detected to have writes and the catalog version is incremented. We
can refine this optimization so that only when a DDL statement has made writes
to a catalog table, we need to increment catalog version. If a DDL statement
only writes to a user table as part of a DDL even trigger function, then there
is no need to increment catalog version because catalog does not change so all
the catalog caches remain valid.

This diff makes the change as described. One of the new unit tests added
PgCatalogVersionHasCatalogWriteTest/PgCatalogVersionHasCatalogWriteTest.WriteUserTableInsideDdlEventTrigger/0
would fail before this diff.
Jira: DB-16567

Test Plan: ./yb_build.sh release --cxx-test pg_catalog_version-test --gtest_filter PgCatalogVersionHasCatalogWriteTest/PgCatalogVersionHasCatalogWriteTest.WriteUserTableInsideDdlEventTrigger/*

Reviewers: kfranz, sanketh, mihnea

Reviewed By: sanketh

Subscribers: pjain, yql

Differential Revision: https://phorge.dev.yugabyte.com/D43780
Assets 2
Loading