Overview
This article explains how to address the DDL Atomicity failure alert indicating discrepancies between table metadata in DocDB and Postgres layers.
These discrepancies can manifest as:
-
Orphaned Tables: Tables that exist in DocDB but cannot be referenced in Postgres.
-
Mismatched Table Names: Tables that exist in both layers but have inconsistent names.
These issues can occur due to operations like creation or deletion of tables followed by ALTERs in DDL like ALTER column, ADD PRIMARY KEY etc which are simultaneous and fail.
Common Scenarios and Examples
Orphaned Tables
Example Alert:
Table test with oid 30936 and uuid 000071c20000300080000000000078d8 does not exist in database tas - ORPHANED TABLE NEEDS TO BE DROPPED
-
-
Resolution: Verify and drop the orphaned table using
yb-admin
.
-
Steps to Resolve Orphaned Tables
-
-
Verify the Table Existence in Postgres
Use theysql
command to check if the table exists in the Postgres layer.
Example:SELECT * FROM pg_class WHERE oid = 30936;
If the table does not exist, proceed to the next step.
-
Drop the Orphaned Table Using
yb-admin
Use thedelete_table_by_id
command inyb-admin
to remove the orphaned table from DocDB.
Example:yb-admin -master_addresses <master-addresses> delete_table_by_id 000071c20000300080000000000078d8
Replace
<master-addresses>
with the appropriate master addresses and the UUID with the one from the alert.
-
Mismatched Table Names
Example Alert:
Table test_temp_old with oid 19843 and uuid 00004008000030008000000000004d83 exists in tas but has a mismatched table name: table name in YSQL metadata is test - TABLE NAME NEEDS TO BE FIXED
-
-
Cause: The table name in DocDB does not match the name in Postgres.
-
Resolution: Rename the table in Postgres to match the name in DocDB. For the resolution steps please refer here.
-
Related Commands
-
yb-admin delete_table_by_id <uuid>
: Drops a table by its UUID in DocDB. -
ALTER TABLE <table_name> RENAME TO <new_name>
: Renames a table in Postgres.
For further assistance, contact your database administrator or refer to the official YugabyteDB documentation.
Comments
0 comments
Please sign in to leave a comment.