[Bug] GPORCA crashes the coordinator with dependencies extended statistics
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C
- Star
- 1.4k
- Fork
- 262
- Merge trung bình
- 4 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 54
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
-
[Bug] Expand fails to recognize user-defined tablespacesCó thể đã có người làm @nix-oss đã nhận 59 ngày trước. Đang mởtype: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
apache/cloudberry#1885 · 2 reaction ·
Maintainer thường phản hồi trong vòng 3 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 120 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 3 ngày
-
type: Bug
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 58/100
apache/cloudberry#2137 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
type: Proposal
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
apache/cloudberry#2136 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[Bug] REINDEX DATABASE CONCURRENTLY breaks temporary PAX tables created with ON COMMIT DELETE ROWSĐang mởtype: Bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
apache/cloudberry#2134 ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của apache/cloudberry
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày
-
base-files: 82_config_generate: regenerate /etc/board.json if 0-bytes / truncated after power cutĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
openwrt/openwrt#25940 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
FujiNetWIFI/fujinet-lib#186 ·
Maintainer thường phản hồi trong vòng 1 ngày