-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#23163] YSQL: pg_partman: Make partition creation idempotent
Summary: Currently transactional DDL is not supported in YugabyteDB . Due to which if any procedure or function which are performing multiple DDLs in a transactional context can lead to issue of DDLs getting executed and committed even if stored procedure failed due to some exception while running stored procedure or ungraceful Postgres backend process or tserver process kill. pg_partman extension uses `create_parent` function as main function to create child partitions of a partitioned table. `create_parent` itself calls other pg_partman functions that performs DDLs to create and attach partitioned tables and add some other objects like indexes, constraints and adding privileges. Hence it required to make complete workflow of `create_parent` idempotent. create_parent.sql - Base function called for creating child partitions for a partitioned table. - Changes done - Make default table creation idempotent with not-exist addition - Check before attaching default table if it is already attached create_partition_time/id.sql - Functions called by create_parent and run_maintenance. Creation and attaching of child tables except for the default child table occurs here. the default child is handled at create_parent only. - Changes done - Get list of child tables attached to parent table into v_child_tables - Loop over the partition names for which want to create and attach new partition, name it is partition_name - If partition_name is present in v_child_tables, then continue - If partition_name is not attached but created, then skip creation -> have to test this -> made changes. Jira: DB-12101 Test Plan: jenkins: compile only Reviewers: skumar, hsunder, jason Reviewed By: jason Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D36428
- Loading branch information
Devansh Saxena
committed
Jul 23, 2024
1 parent
2248dcd
commit 7b32d05
Showing
3 changed files
with
91 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters