Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADBDEV-6573: Fix duplicated settings for LIKE INCLUDING STORAGE with partitioned table #1093

Merged
merged 4 commits into from
Nov 1, 2024

Conversation

silent-observer
Copy link

Fix duplicated settings for LIKE INCLUDING STORAGE with partitioned table

If a partitioned table was created with a LIKE INCLUDING STORAGE clause, the
storage settings for the child partition were applied twice: once from the
parent partition and second time from the LIKE. This caused an error when
trying to use INCLUDING STORAGE with partitioned tables.

To fix it, this patch disables the INCLUDING STORAGE for the child partitions,
removing the duplicate settings.

@BenderArenadata
Copy link

Allure report https://allure.adsw.io/launch/84058

@silent-observer silent-observer marked this pull request as ready for review October 28, 2024 07:05
@BenderArenadata
Copy link

Allure report https://allure.adsw.io/launch/84185

Copy link

@red1452 red1452 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should fillfactor and orientaion inherit by like include storage:

postgres=# CREATE TABLE ctlt4 (a numeric, b timestamp)
WITH (appendoptimized=true, orientation=row, compresstype=zstd, fillfactor=90, autovacuum_enabled=true, user_catalog_table=true, oids=false, compresslevel=2);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
postgres=# CREATE TABLE ctlt4_like1 (LIKE ctlt4)
PARTITION BY RANGE(b) (
  DEFAULT PARTITION extra
);
NOTICE:  table doesn't have 'DISTRIBUTED BY' clause, defaulting to distribution columns from LIKE table
NOTICE:  CREATE TABLE will create partition "ctlt4_like1_1_prt_extra" for table "ctlt4_like1"
CREATE TABLE
postgres=# CREATE TABLE ctlt4_like (LIKE ctlt4 INCLUDING STORAGE)
PARTITION BY RANGE(b) (
  DEFAULT PARTITION extra
);
NOTICE:  table doesn't have 'DISTRIBUTED BY' clause, defaulting to distribution columns from LIKE table
NOTICE:  CREATE TABLE will create partition "ctlt4_like_1_prt_extra" for table "ctlt4_like"
CREATE TABLE
postgres=# \d+ ctlt4
                            Append-Only Table "public.ctlt4"
 Column |            Type             | Modifiers | Storage | Stats target | Description 
--------+-----------------------------+-----------+---------+--------------+-------------
 a      | numeric                     |           | main    |              | 
 b      | timestamp without time zone |           | plain   |              | 
Compression Type: zstd
Compression Level: 2
Block Size: 32768
Checksum: t
Distributed by: (a)
Options: appendonly=true, orientation=row, compresstype=zstd, fillfactor=90, compresslevel=2

postgres=# \d+ ctlt4_like
                          Append-Only Table "public.ctlt4_like"
 Column |            Type             | Modifiers | Storage | Stats target | Description 
--------+-----------------------------+-----------+---------+--------------+-------------
 a      | numeric                     |           | main    |              | 
 b      | timestamp without time zone |           | plain   |              | 
Compression Type: zstd
Compression Level: 2
Block Size: 32768
Checksum: t
Child tables: ctlt4_like_1_prt_extra
Distributed by: (a)
Partition by: (b)
Options: appendonly=true, checksum=true, compresslevel=2, compresstype=zstd

@silent-observer
Copy link
Author

orientation=row seems to be the default value and is not copied. Repeating the same with orientation=column does copy it. fillfactor seems to not be copied at all. However, this matches the existing behavior of LIKE INCLUDING STORAGE without partitioned tables involved.

In general behavior of this option is kind of questionable, considering that GPDB 7 it only copies attstorage and nothing else and there is no way to copy table-level options like appendonly or orientation at all.

@BenderArenadata
Copy link

Allure report https://allure.adsw.io/launch/84241

@Stolb27 Stolb27 enabled auto-merge (squash) November 1, 2024 09:16
@BenderArenadata
Copy link

Allure report https://allure.adsw.io/launch/84659

@Stolb27 Stolb27 merged commit 3069a80 into adb-6.x-dev Nov 1, 2024
5 checks passed
@Stolb27 Stolb27 deleted the ADBDEV-6573 branch November 1, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants