yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
9.02k stars 1.08k forks source link

[YSQL][Pg partman] Insufficient Sub-Partitions Created for Specified Premake Value in create_sub_parent Function #24991

Open shishir2001-yb opened 2 days ago

shishir2001-yb commented 2 days ago

Jira Link: DB-14133

Description

Version: 2024.2.0.0-b122 Logs: Added in Jira comments

When executing run_maintenance, the expected number of sub-partitions are not being created, even when a high premake value is passed. This behavior seems to persist regardless of the specified premake value. While it might align with native Partman behavior, it appears to be an issue that warrants attention.

db_timestamp_0=# \d
                               List of relations
 Schema |                  Name                  |       Type        |  Owner   
--------+----------------------------------------+-------------------+----------
 public | custom_time_partitions                 | table             | yugabyte
 public | mv_tb_0_db_timestamp_0                 | materialized view | postgres
 public | part_config                            | table             | yugabyte
 public | part_config_sub                        | table             | yugabyte
 public | table_privs                            | view              | yugabyte
 public | tb_0                                   | table             | postgres
 public | tb_0_p2024_11_19_1900                  | table             | yugabyte
 public | tb_0_p2024_11_19_1900_p2024_11_19_1900 | table             | yugabyte
 public | tb_0_p2024_11_19_1900_p2024_11_19_1905 | table             | yugabyte
 public | tb_0_p2024_11_19_1900_p2024_11_19_1910 | table             | yugabyte
 public | tb_0_p2024_11_19_1915                  | table             | yugabyte
 public | tb_0_p2024_11_19_1915_p2024_11_19_1915 | table             | yugabyte
 public | tb_0_p2024_11_19_1915_p2024_11_19_1920 | table             | yugabyte
 public | tb_0_p2024_11_19_1915_p2024_11_19_1925 | table             | yugabyte
 public | tb_0_p2024_11_19_1930                  | table             | yugabyte
 public | tb_0_p2024_11_19_1930_p2024_11_19_1930 | table             | yugabyte
 public | tb_0_p2024_11_19_1930_p2024_11_19_1935 | table             | yugabyte
 public | tb_0_p2024_11_19_1930_p2024_11_19_1940 | table             | yugabyte
 public | tb_0_p2024_11_19_1945                  | table             | yugabyte
 public | tb_0_p2024_11_19_1945_p2024_11_19_1945 | table             | yugabyte
 public | tb_0_p2024_11_19_1945_p2024_11_19_1950 | table             | yugabyte
 public | tb_0_p2024_11_19_1945_p2024_11_19_1955 | table             | yugabyte
 public | tb_0_p2024_11_19_2000                  | table             | yugabyte
 public | tb_0_p2024_11_19_2000_p2024_11_19_2000 | table             | yugabyte 
 public | tb_0_p2024_11_19_2000_p2024_11_19_2005 | table             | yugabyte
 public | tb_0_p2024_11_19_2000_p2024_11_19_2010 | table             | yugabyte
 public | tb_0_p2024_11_19_2015                  | table             | yugabyte
 public | tb_0_p2024_11_19_2015_p2024_11_19_2015 | table             | yugabyte -------------> Only 1 sub-partition is created 
 public | tb_0_p2024_11_19_2030                  | table             | yugabyte
 public | tb_0_p2024_11_19_2030_p2024_11_19_2030 | table             | yugabyte -------------> Only 1 sub-partition is created 
 public | tb_0_p2024_11_19_2045                  | table             | yugabyte

Note: We have already SET infinite_time_partitions=true

For parent partition we pass pre_make as 10 and interval as 15 mins

SELECT create_parent('public.tb_0', 'created_at', 'native', 'quarter-hour', NULL::text[], 10, 'on', '2024-11-19 19:25:52', true, 'none', '', NULL::text[], true, NULL::text, true, NULL::text);

For sub-partition we pass pre_make as 10 and interval as 5 mins

SELECT create_sub_parent('public.tb_0', 'created_at', 'native', '5 minutes', 'yes', NULL::text[], 10, NULL::text, true, 'none', '', true, true, NULL::text);

Issue Type

kind/bug

Warning: Please confirm that this issue does not contain any sensitive information