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

Restrict COPY to intermediate partition tables #979

Merged
merged 9 commits into from
Jul 12, 2024
Merged

Conversation

red1452
Copy link

@red1452 red1452 commented Jun 28, 2024

Restrict COPY to intermediate partition tables

Copy to a mid-level partition led to insert into such partition instead of leaf
partition. This patch adds check, which does not allow copy to a mid-level
partition. Correct copy should be into root partition or leaf partition.

Copy to a mid-level partition led to insert into such partition instead of leaf
partition. This patch adds check, which does not allow copy to a mid-level
partition. Correct copy should be into root partition or leaf partition.
@BenderArenadata
Copy link

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

Copy link

@KnightMurloc KnightMurloc left a comment

Choose a reason for hiding this comment

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

It seems to me that we are testing the insertion into the intermediate partition and into the root twice. Is there any difference between these tests?

Restrict COPY TO intermediate partition tables

It seems to me that it is necessary to say more clearly which command we are talking about. Something like:
Restrict COPY FROM on intermediate partition tables.

src/backend/commands/copy.c Outdated Show resolved Hide resolved
src/backend/commands/copy.c Outdated Show resolved Hide resolved
src/test/regress/input/gpcopy.source Outdated Show resolved Hide resolved
@BenderArenadata
Copy link

Failed job Build for ppc64le: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1586353

@BenderArenadata
Copy link

@BenderArenadata
Copy link

Failed job Build for ppc64le: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1586404

@BenderArenadata
Copy link

@BenderArenadata
Copy link

Copy link

@KnightMurloc KnightMurloc left a comment

Choose a reason for hiding this comment

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

It looks like two cases are tested twice is it necessary?

src/test/regress/input/gpcopy.source Show resolved Hide resolved
src/test/regress/input/gpcopy.source Show resolved Hide resolved
@BenderArenadata
Copy link

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

@BenderArenadata
Copy link

Failed job Behave tests on x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1596715

@BenderArenadata
Copy link

Failed job Regression tests with ORCA on x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1596711

Copy link

@KnightMurloc KnightMurloc left a comment

Choose a reason for hiding this comment

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

Without a patch, only the following diff appears:

 COPY tmp_table TO '/tmp/table_data';
 -- Copy to the mid-level partition should fail
 COPY part_table_1_prt_2 FROM '/tmp/table_data';
-ERROR:  cannot copy to intermediate part of a partitioned table
-HINT:  consider using COPY to either the root or a leaf partition instead.
+WARNING:  skipping "part_table_1_prt_2" --- cannot analyze a mid-level partition. Please run ANALYZE on the root partition table.
 -- Copy to the leaf partition should use check constraint and fail
 COPY part_table_1_prt_2_2_prt_part_a FROM '/tmp/table_data';
 ERROR:  new row for relation "part_table_1_prt_2_2_prt_part_a" violates check constraint "part_table_1_prt_2_2_prt_part_a_check"
@@ -1399,8 +1439,7 @@
 COPY tmp_table TO '/tmp/table_data';
 -- Copy to a mid-level partition should fail
 COPY part_table_1_prt_2 FROM '/tmp/table_data';
-ERROR:  cannot copy to intermediate part of a partitioned table
-HINT:  consider using COPY to either the root or a leaf partition instead.
+WARNING:  skipping "part_table_1_prt_2" --- cannot analyze a mid-level partition. Please run ANALYZE on the root partition table.
 -- Copy to a leaf partition should use check constraint and be success
 COPY part_table_1_prt_2_2_prt_part_a FROM '/tmp/table_data';
 analyze part_table;

Are some the tests redundant? We are testing something that is not related to the patch.

src/test/regress/input/gpcopy.source Outdated Show resolved Hide resolved
@red1452
Copy link
Author

red1452 commented Jul 4, 2024

Are some the tests redundant? We are testing something that is not related to the patch.

Patch restricts copy to intermediate partitions, but test checks, that copy to the other type of partitions works correctly after this fix. To check only copy to intermediate partition is not full test.

@BenderArenadata
Copy link

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

@BenderArenadata
Copy link

Failed job Regression tests with Postgres on x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1602749

@BenderArenadata
Copy link

Failed job Regression tests with ORCA on x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1602752

@BenderArenadata
Copy link

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

@BenderArenadata
Copy link

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

@BenderArenadata
Copy link

Failed job Behave tests on x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1607066

@BenderArenadata
Copy link

Failed job Regression tests with Postgres on x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1607059

@BenderArenadata
Copy link

Failed job Regression tests with ORCA on x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1607061

@BenderArenadata
Copy link

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

@BenderArenadata
Copy link

Failed job Behave tests on ppc64le: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1613617

@BenderArenadata
Copy link

Failed job Behave tests on ppc64le: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1614954

@BenderArenadata
Copy link

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

@BenderArenadata
Copy link

Failed job Regression tests with ORCA on x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1635814

@BenderArenadata
Copy link

Failed job Regression tests with Postgres on x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1635812

@BenderArenadata
Copy link

Failed job Regression tests with Postgres on x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1637397

@BenderArenadata
Copy link

Failed job Regression tests with ORCA on x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1637396

@andr-sokolov andr-sokolov merged commit 1101c25 into adb-6.x-dev Jul 12, 2024
5 checks passed
@andr-sokolov andr-sokolov deleted the ADBDEV-5809 branch July 12, 2024 08:19
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.

None yet

5 participants