[Bug] gp_distribution_policy reports randomly distributed and replicated tables as misplaced
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 74/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C
- スター
- 1.5k
- フォーク
- 280
- 平均マージ
- 4日 21時間
- マージ済み PR(30日)
- 122
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/cloudberry のほかの issue
-
type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/cloudberry#2459 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
psql tab completion broken for storage servers, tags, profiles and resource groups (pre-PG15 query format)対応中かも @allenvox が 18 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/cloudberry#2316 ·
メンテナーはふだん 2 日以内に返信
-
gpexpand first stage fails: 'SyncPackages' object has no attribute 'ret' (extension sync never runs; regression)対応中かも @talmacschen-arch が 166 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
apache/cloudberry#1825 ·
メンテナーはふだん 2 日以内に返信
-
[Bug] ORCA returns wrong system column values through a partially pruned CTE consumer対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンtype: Bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
apache/cloudberry#2458 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
[Bug] Window Sort above ROLLUP gets a larger memory quota and runs slower after "Reserve memory for one partition at a time"対応中かも @Alena0704 が 1 日前に担当しました。 オープンtype: Bug
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
apache/cloudberry#2446 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
apache/cloudberry の issue をすべて見る
似ている issue
-
HXsetdir strdup leakオープン
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
ly05010419/MacNativeGames#2459 ·
メンテナーはふだん 1 日以内に返信
-
2024.2 Backport Required 2025.2 Backport Required 2026.1 Backport Required 2026.2 Backport Required area/build-framework kind/enhancement priority/medium
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
yugabyte/yugabyte-db#39930 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
shinyquagsire23/OpenJKDF2#540 ·
メンテナーはふだん 12 日以内に返信
-
Prison work hall: laundry and kitchen stations stand at bare walls, the hatch has no counter or signオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Life-Framework/Life-Framework#5939 ·
メンテナーはふだん 1 日以内に返信