[Bug] Parallel dedup semi-join planning takes an exclusive lock on gp_segment_configuration
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 53/100
調査の方向性
Start with the parallel semi-join regression fixture in src/test/regress/sql/cbdb_parallel.sql and trace the two planner paths in src/backend/cdb/cdbpath.c to cdbcomponent_get_maxdbid() in src/backend/cdb/cdbutil.c. Check how the catalog is opened and closed, and identify a read-only lookup that preserves locking for topology-changing callers. Verify with EXPLAIN and the fixture that planning no longer holds an AccessExclusiveLock while topology changes retain their required locking.
索引モデルが issue の本文から書いたものです。
説明
Apache Cloudberry version
Apache Cloudberry 2.2.0-incubating, build 13d3c58eaa0 (PostgreSQL 14.10)
What happened
While diagnosing intermittent connection delays on a multi-segment cluster, we observed ordinary read-only SELECTs holding a granted AccessExclusiveLock on pg_catalog.gp_segment_configuration. New connections were waiting for AccessShareLock on the same shared catalog. pg_blocking_pids() identified the SELECT backend as the blocker, including in a different database on the same coordinator.
On a separate three-segment development cluster running the same build, EXPLAIN without ANALYZE alone acquired the lock. In the on/off comparison below, the final plan was Parallel Hash Semi Join in both cases. The lock can therefore come from evaluating a candidate that is never executed.
What you think should happen instead
Planning a read-only query should not hold a transaction-duration AccessExclusiveLock on the shared topology catalog. The planner only needs to read the maximum segment DBID. Please preserve the locking semantics required by topology-changing callers.
How to reproduce
On the affected build in a development environment, use the parallel semi-join regression fixture as a starting point. We compared EXPLAIN (without ANALYZE) on an equivalent EXISTS query joining two distributed tables, with optimizer=off, enable_parallel=on, and two workers per gather.
| Planner settings | Current backend’s lock on gp_segment_configuration after EXPLAIN |
|---|---|
| Both parallel dedup semi-join options enabled | Granted AccessExclusiveLock |
enable_parallel_dedup_semi_join=off and enable_parallel_dedup_semi_reverse_join=off |
No lock observed |
We inspected pg_locks in each read-only test transaction and rolled back immediately after taking the sample.
Operating System
Enterprise Linux 9, x86_64
Anything else
The two parallel join paths in cdbpath.c call cdbcomponent_get_maxdbid() when the deduplicated input uses multiple parallel workers. The catalog implementation opens the relation with AccessExclusiveLock and closes it with NoLock, keeping the lock until transaction end.
A possible fix is to give the planner a separate read-only lookup with appropriately scoped locking. Turning off both dedup options at session scope avoided this path on the tested build while leaving ordinary parallel semi-joins available. We verified the behavior on 2.2.0 only.
Are you willing to submit PR?
- Yes, I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct.
- 主要言語
- C
- スター
- 1.4k
- フォーク
- 273
- 平均マージ
- 4日 6時間
- マージ済み PR(30日)
- 105
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/cloudberry のほかの issue
-
isolation2 lockmodes fails on cassert builds: extra AccessShareLock on partition root対応中かも @tuhaihe が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/cloudberry#2356 ·
メンテナーはふだん 2 日以内に返信
-
psql tab completion broken for storage servers, tags, profiles and resource groups (pre-PG15 query format)対応中かも @allenvox が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/cloudberry#2316 ·
メンテナーはふだん 2 日以内に返信
-
[Bug] Expand fails to recognize user-defined tablespaces対応中かも @nix-oss が 92 日前に担当しました。 オープンtype: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
apache/cloudberry#1885 · リアクション 2 件 ·
メンテナーはふだん 2 日以内に返信
-
gpexpand first stage fails: 'SyncPackages' object has no attribute 'ret' (extension sync never runs; regression)対応中かも @talmacschen-arch が 153 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
apache/cloudberry#1825 ·
メンテナーはふだん 2 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
apache/cloudberry#2348 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
apache/cloudberry の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
windows-artifacts: the win-arm64 job uses a Visual Studio generator missing from windows-11-armオープン
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
-
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
crosspoint-reader/crosspoint-reader#4535 ·
メンテナーはふだん 1 日以内に返信
-
[core] Clients never advertise RNS_UD_CS_SUPPORT_ERRINFO_PDU, so a conforming server can't send them Set Error Info対応中かも @akallabeth が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
FreeRDP/FreeRDP#14230 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Wrong release linkedオープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
Genymobile/scrcpy#7178 ·
メンテナーはふだん 3 日以内に返信