Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgresql is crashing when selecting from citus columnar table #7647

Closed
vnoreika opened this issue Jul 9, 2024 · 6 comments · Fixed by #7703
Closed

postgresql is crashing when selecting from citus columnar table #7647

vnoreika opened this issue Jul 9, 2024 · 6 comments · Fixed by #7703

Comments

@vnoreika
Copy link

vnoreika commented Jul 9, 2024

Hello,

we have a problem that postgresql is crashing when we left join citus table on heap tables.
OS Redhat 8.9 , Postgresql 16.3 , Citus 12.1.4

How to reproduce:

create extension citus;
create table test1 (a integer);
create table test2 (a integer);
create table test3 (b integer) using columnar;

SELECT *
   FROM test1 a1
     LEFT JOIN test2 a2 ON a1.a = a2.a
     LEFT JOIN test3 b  ON a2.a = b.b
;

server closed the connection unexpectedly

From logs:
<2024-07-09 10:00:21.484 EEST%2048391%668cdfda.1f4187%%%> DETAIL: Failed process was running: select *
FROM test1 a1
LEFT JOIN test2 a2 ON a1.a = a2.a
left JOIN test3 b ON a2.a = b.b
;
<2024-07-09 10:00:21.484 EEST%2048391%668cdfda.1f4187%%%> LOG: terminating any other active server processes
<2024-07-09 10:00:21.489 EEST%2048570%668ce005.1f423a%[unknown]%[local]%[unknown]> LOG: connection received: host=[local]
<2024-07-09 10:00:21.489 EEST%2048570%668ce005.1f423a%postgres%[local]%test> FATAL: the database system is in recovery mode
<2024-07-09 10:00:21.492 EEST%2048391%668cdfda.1f4187%%%> LOG: all server processes terminated; reinitializing

@copetol
Copy link
Contributor

copetol commented Jul 24, 2024

Hello,

as a workaround for this you can set columnar.enable_custom_scan to false

@Fenoman
Copy link

Fenoman commented Sep 18, 2024

Absolutely the same problem! It would be great to fix this bug as soon as possible...

@OlgaSergeyevaB
Copy link

OlgaSergeyevaB commented Oct 14, 2024

Hello,
It is enough to exclude outer_join_rels from candidateRelids in columnar_customscan.c FindCandidateRelids and it will work:


#if PG_VERSION_NUM >= PG_VERSION_16
	candidateRelids = bms_del_members(candidateRelids, root->outer_join_rels);	
#endif

OlgaSergeyevaB pushed a commit to OlgaSergeyevaB/citus that referenced this issue Oct 14, 2024
@Naralas
Copy link

Naralas commented Dec 5, 2024

Hi, we seem to be facing a similar issue, getting a Segmentation fault using multiple left join on columnar tables. What is the status of the issue, could it be integrated into a next release?

@OlgaSergeyevaB
Copy link

Hi, @Naralas
Created #7703
We use a fork https://github.com/OlgaSergeyevaB/citus

OlgaSergeyevaB pushed a commit to OlgaSergeyevaB/citus that referenced this issue Jan 22, 2025
OlgaSergeyevaB pushed a commit to OlgaSergeyevaB/citus that referenced this issue Feb 14, 2025
OlgaSergeyevaB pushed a commit to OlgaSergeyevaB/citus that referenced this issue Feb 14, 2025
OlgaSergeyevaB pushed a commit to OlgaSergeyevaB/citus that referenced this issue Feb 15, 2025
OlgaSergeyevaB pushed a commit to OlgaSergeyevaB/citus that referenced this issue Feb 17, 2025
OlgaSergeyevaB pushed a commit to OlgaSergeyevaB/citus that referenced this issue Feb 17, 2025
OlgaSergeyevaB pushed a commit to OlgaSergeyevaB/citus that referenced this issue Feb 18, 2025
OlgaSergeyevaB pushed a commit to OlgaSergeyevaB/citus that referenced this issue Feb 18, 2025
…s from CandidateRelids

For the relevant PG16 commit requiring this addition:
* postgres/postgres@2489d76

Add test from https://github.com/hydradatabase/hydra/pull/279/files
add order by for test and add explain
colm-mchugh pushed a commit that referenced this issue Feb 18, 2025
…ids (#7703)

DESCRIPTION: Fixes a crash in columnar custom scan that happens when a
columnar table is used in a join. Fixes issue #7647.

Co-authored-by: Ольга Сергеева <[email protected]>
@colm-mchugh
Copy link
Contributor

Fixed by #7703 (commit 459c283) - thanks @OlgaSergeyevaB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants