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

explain analyze with sort will cause segment crash #8804

Closed
compasses opened this issue Oct 11, 2019 · 0 comments · Fixed by #8868
Closed

explain analyze with sort will cause segment crash #8804

compasses opened this issue Oct 11, 2019 · 0 comments · Fixed by #8868
Assignees

Comments

@compasses
Copy link

@compasses compasses commented Oct 11, 2019

Greenplum version or build

6X_STABLE

OS version and uname -a

Linux 4.18.0-25-generic #26-Ubuntu SMP Mon Jun 24 09:32:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

autoconf options used ( config.status --config )

Installation information ( pg_config )

Expected behavior

Actual behavior

Step to reproduce the behavior

create table test (a , b ,c);
create table test (a int, b int ,c int);
insert into test values(generate_series(1,100000),generate_series(1,100000),generate_series(1,100000));
create index a_ind on test(a,b,c);

run this explain analyze on segment directly:
explain analyze select * from test order by c; 
then the segment will crash.

The problem code is :

static void
show_sort_info(SortState *sortstate, ExplainState *es)
{
	CdbExplain_NodeSummary *ns;
	int			i;

	if (!es->analyze)
		return;
       // ns is NULL here
	ns = ((PlanState *) sortstate)->instrument->cdbNodeSummary;
	...

@gaos1 gaos1 self-assigned this Oct 14, 2019
ashwinstar added a commit to ashwinstar/gpdb that referenced this issue Oct 18, 2019
show_sort_info() crashes if `((PlanState *)
sortstate)->instrument->cdbNodeSummary` is
NULL. cdbexplain_localExecStats() should be called for utility mode
connections or DISPATCH mode on master. Hence, modifying the check to
avoid crash.

In general, utility mode doesn't have much such usecase but definitely
crashing is not good, hence avoid the same.

Fixes greenplum-db#8804 github issue.
ashwinstar added a commit that referenced this issue Oct 21, 2019
show_sort_info() crashes if `((PlanState *)
sortstate)->instrument->cdbNodeSummary` is
NULL. cdbexplain_localExecStats() should be called for utility mode
connections or DISPATCH mode on master. Hence, modifying the check to
avoid crash.

In general, utility mode doesn't have much such usecase but definitely
crashing is not good, hence avoid the same.

Fixes #8804 github issue.

(cherry picked from commit 91cdc61)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.