[Bug] GPORCA crashes the coordinator with dependencies extended statistics
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 30/100
調査の方向性
Start by running the reproduction SQL with optimizer = on to confirm the SIGSEGV and capture a backtrace. The payload points to CExtendedStatsProcessor.cpp, where colid_to_attno_mapping->Find(&colid) is dereferenced without a null check around lines 279 and 355/365, while the check near line 431 does test for null. Done means the query returns one row (NULL | NULL | f) with optimizer on and the crash no longer occurs, with a regression test added.
索引モデルが issue の本文から書いたものです。
説明
Apache Cloudberry version
No response
What happened
Reproduce:
CREATE TABLE t1 (c0 name, c1 numeric, c2 boolean) DISTRIBUTED BY (c2);
INSERT INTO t1 VALUES ('a', 0.9, false), (NULL, NULL, false), ('', 0.1, false), ('1', 0.7, true), ('b', 0.5, NULL), ('', NULL, NULL), ('c', NULL, NULL);
CREATE STATISTICS s1 ON c0, c2 FROM t1;
CREATE STATISTICS s2 ON c1, c2 FROM t1;
ANALYZE t1;
SET optimizer = on;
SELECT * FROM (SELECT c0 AS a, c1 AS b, c2 AS c FROM t1 WHERE c2 IS FALSE) AS r WHERE r.a IS NULL AND r.b IS NULL AND r.c = FALSE;
-- server closed the connection unexpectedly
Expected: one row, NULL | NULL | f. That's what you get with optimizer = off, or with optimizer = on after dropping s1 and s2.
Actual: the coordinator backend crashes, and all other sessions are reset while the cluster recovers:
PANIC: Unexpected internal error: Master process received signal SIGSEGV
server process (PID ...) was terminated by signal 11: Segmentation fault
Stack (top frames):
gpnaucrates::CFilterStatsProcessor::MakeHistHashMapConjFilter
gpnaucrates::CFilterStatsProcessor::MakeStatsFilter
gpnaucrates::CFilterStatsProcessor::MakeStatsFilterForScalarExpr
gpopt::CLogicalSelect::PstatsDerive
gpopt::CExpressionHandle::DeriveRootStats
...
gpopt::CEngine::FinalizeExploration
Possible cause: MakeHistHashMapConjFilter calls CExtendedStatsProcessor::ApplyCorrelatedStatsToScaleFactorFilterCalculation. In that function, the result of colid_to_attno_mapping->Find(&colid) is dereferenced
without a null check (CExtendedStatsProcessor.cpp, around lines 279 and 355/365), while another call site (around line 431) does check for null. The filter here sits above a subquery and spans columns from two
different dependency statistics objects, which may produce a column ID with no mapping. I haven't confirmed this in a debugger.
What you think should happen instead
No response
How to reproduce
CREATE TABLE t1 (c0 name, c1 numeric, c2 boolean) DISTRIBUTED BY (c2);
INSERT INTO t1 VALUES ('a', 0.9, false), (NULL, NULL, false), ('', 0.1, false), ('1', 0.7, true), ('b', 0.5, NULL), ('', NULL, NULL), ('c', NULL, NULL);
CREATE STATISTICS s1 ON c0, c2 FROM t1;
CREATE STATISTICS s2 ON c1, c2 FROM t1;
ANALYZE t1;
SET optimizer = on;
SELECT * FROM (SELECT c0 AS a, c1 AS b, c2 AS c FROM t1 WHERE c2 IS FALSE) AS r WHERE r.a IS NULL AND r.b IS NULL AND r.c = FALSE;
-- server closed the connection unexpectedly
Operating System
any
Anything else
No response
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
- フォーク
- 262
- 平均マージ
- 4日 20時間
- マージ済み PR(30日)
- 57
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/cloudberry のほかの issue
-
[Bug] Expand fails to recognize user-defined tablespaces対応中かも @nix-oss が 60 日前に担当しました。 オープンtype: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
apache/cloudberry#1885 · リアクション 2 件 ·
メンテナーはふだん 3 日以内に返信
-
gpexpand first stage fails: 'SyncPackages' object has no attribute 'ret' (extension sync never runs; regression)対応中かも @talmacschen-arch が 121 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
apache/cloudberry#1825 ·
メンテナーはふだん 3 日以内に返信
-
Lance support: contrib/lance_fdw and the MCP server's Lance tools対応中かも @MisterRaindrop が 1 日前に担当しました。 オープン
apache/cloudberry#2139 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
-
type: Bug
難易度 3/5 半日 初心者へのやさしさ 58/100
apache/cloudberry#2137 ·
メンテナーはふだん 3 日以内に返信
-
type: Proposal
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
apache/cloudberry#2136 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
apache/cloudberry の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
AFLplusplus/AFLplusplus#2903 ·
-
category:port-update
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
colbymchenry/codegraph#2634 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 8 日以内に返信