Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#22243] YSQL: Fix incorrect log message when a column is dropped suc…
…cessfully Summary: To reproduce the bug: ``` yugabyte=# create table foo(id int); CREATE TABLE yugabyte=# alter table foo drop column id; ALTER TABLE ``` Note that the ALTER TABLE statement completed successfully. Look at yb-master.INFO, saw: ``` I0502 19:26:37.713428 27752 ysql_ddl_handler.cc:396] Sending Alter Table request as part of rollback for table foo ``` The log says `rollback` which suggests the DDL operation failed. But in this case `roll forward` is more appropriate. We first mark the column id to be dropped in DocDB metadata for table `foo`, then drop the column from PG catalog metadata for table `foo`. Once the PG side has successfully committed, we then roll forward the DocDB metadata change by dropping the column. This completes the entire DDL operation. I made a fix to log `roll forward` if the PG side commits successfully, and `rollback` if the PG side aborts. Also made some small test code cleanup for DDL atomicity because --ysql_yb_ddl_rollback_enabled is true by default now. Jira: DB-11161 Test Plan: (1) Manually do the test described in the summary, saw the new log: ``` I0502 20:12:33.628252 4412 ysql_ddl_handler.cc:399] Sending Alter Table request as part of roll forward for table foo ``` (2) ./yb_build.sh release --java-test 'org.yb.pgsql.TestPgUniqueConstraint' (3) YB_ENABLE_YSQL_CONN_MGR_IN_TESTS=true ./yb_build.sh release --java-test 'org.yb.pgsql.TestPgUniqueConstraint' Reviewers: fizaa Reviewed By: fizaa Subscribers: yql, ybase Differential Revision: https://phorge.dev.yugabyte.com/D34704
- Loading branch information