[Bug] gp_distribution_policy reports randomly distributed and replicated tables as misplaced
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 74/100
Hướng nghiên cứu
Start by reading gpcontrib/gp_distribution_policy and trace gp_distribution_policy_table_check() alongside the SQL declarations in gp_distribution_policy--1.0.sql. Reproduce the reported results for hash, random, and replicated tables, then check behavior against the policy type. Done means the check handles non-hash policies as intended, with coverage for the reported cases.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Apache Cloudberry version
Reproduced on:
REL_2_STABLEat 91582af9baf (PostgreSQL 14.12, 2.2.0-incubating build dev)mainat eb9bf338855 (PostgreSQL 16.9, 3.0.0-devel)
What happened
gp_table_distribution_check() from gpcontrib/gp_distribution_policy returns false for most
segments of a randomly distributed table and of a replicated table, although the data is placed
correctly. For a hash-distributed table it returns true on every segment, as expected.
gp_distribution_policy_table_check() hashes the distribution key columns of each row and compares
the target segment with the current segment. It does not look at the policy type. A randomly
distributed or replicated table has no distribution key columns (policy->nattrs = 0), so every row
hashes to the same target segment, and the function reports every other segment that holds rows as
wrong. In the run below that target is segment 0.
What you think should happen instead
For a randomly distributed table, any placement is valid, so the function should return true. For
a replicated table, every segment holds a full copy, so it should return true, or check that the
copies are complete. Alternatively, the function should reject tables that are not hash-distributed
with a clear error.
How to reproduce
CREATE EXTENSION gp_distribution_policy;
CREATE TABLE dhash (a int) DISTRIBUTED BY (a); INSERT INTO dhash SELECT generate_series(1, 100);
CREATE TABLE drand (a int) DISTRIBUTED RANDOMLY; INSERT INTO drand SELECT generate_series(1, 100);
CREATE TABLE drep (a int) DISTRIBUTED REPLICATED; INSERT INTO drep SELECT generate_series(1, 100);
SELECT 'hash' AS t, * FROM gp_table_distribution_check('dhash')
UNION ALL SELECT 'random', * FROM gp_table_distribution_check('drand')
UNION ALL SELECT 'replicated', * FROM gp_table_distribution_check('drep')
ORDER BY 1, 2;
Output on a 3-segment demo cluster (identical on both branches):
t | gp_segment_id | is_distribution_correct
------------+---------------+-------------------------
hash | 0 | t
hash | 1 | t
hash | 2 | t
random | 0 | t
random | 1 | f
random | 2 | f
replicated | 0 | t
replicated | 1 | f
replicated | 2 | f
Operating System
Rocky Linux 9.7 (apache/incubator-cloudberry:cbdb-build-rocky9-latest), built with devops/build/automation/cloudberry/scripts.
Anything else
gp_distribution_policy_table_check(regclass) is declared IMMUTABLE in
gp_distribution_policy--1.0.sql (provolatile = 'i'), although it reads table data. It should be
VOLATILE, which is also what the comment in the C file says. We did not observe a wrong result
caused by this.
Bug found by Claude Code. Please review it again.
- Ngôn ngữ chính
- C
- Star
- 1.5k
- Fork
- 280
- Merge trung bình
- 4 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 122
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/cloudberry
-
type: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/cloudberry#2459 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
psql tab completion broken for storage servers, tags, profiles and resource groups (pre-PG15 query format)Có thể đã có người làm @allenvox đã nhận 18 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/cloudberry#2316 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
gpexpand first stage fails: 'SyncPackages' object has no attribute 'ret' (extension sync never runs; regression)Có thể đã có người làm @talmacschen-arch đã nhận 166 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
apache/cloudberry#1825 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug] ORCA returns wrong system column values through a partially pruned CTE consumerCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởtype: Bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
apache/cloudberry#2458 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug] Window Sort above ROLLUP gets a larger memory quota and runs slower after "Reserve memory for one partition at a time"Có thể đã có người làm @Alena0704 đã nhận 1 ngày trước. Đang mởtype: Bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
apache/cloudberry#2446 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của apache/cloudberry
Issue tương tự
-
HXsetdir strdup leakĐang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
ly05010419/MacNativeGames#2459 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
2024.2 Backport Required 2025.2 Backport Required 2026.1 Backport Required 2026.2 Backport Required area/build-framework kind/enhancement priority/medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
yugabyte/yugabyte-db#39930 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
RecompLauncher supportĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
shinyquagsire23/OpenJKDF2#540 ·
Maintainer thường phản hồi trong vòng 12 ngày
-
Prison work hall: laundry and kitchen stations stand at bare walls, the hatch has no counter or signĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Life-Framework/Life-Framework#5939 ·
Maintainer thường phản hồi trong vòng 1 ngày