[YSQL] DDL changes may not be visible on other connections for up to one heartbeat period #1506
Labels
area/ysql
Yugabyte SQL (YSQL)
kind/enhancement
This is an enhancement of an existing feature
priority/medium
Medium priority issue
Projects
Jira Link: DB-2093
Summary: If
SELECT *
statements are made on one node while anALTER TABLE
is being performed on another (and not before), then until the next tserver heartbeat, the selects will continue to be processed using the old schema without error.Probable Cause: When the first select is performed, the YB client (from pggate) must go to the master to get the metadata for the table. Since the alter has finished internally (in DocDB), the YB client gets the new schema version from the master, which now matches the version known by docdb. When following selects are performed (until the next heartbeat updates the
ysql_catalog_version_
) both the schema version (from YB client cache and DocDB) and ysql catalog versions (from YSQL cache and DocDB) are matching (and so no error is generated) despite the fact that the ysql catalog version is actually behind the schema version.Test Case:
Example Output:
Expected Output: It is expected that after the insert completes, and select should either return both columns, or a "Catalog Version Mismatch" error, but instead there is a period (until the next t-server heartbeat) where the table can be read using the out-of-date catalog.
Note: This issue is most prevalent when the second statement is created from the thread in which it is used. If the second statement is created from the main thread, the issue can still be seen, however it is less frequent (likely due to some locking done internally by JDBC).
The text was updated successfully, but these errors were encountered: