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
segfault with create index statement (btree paritial jsonb column) #9022
Comments
i cannot reproduce on empty table with 6.1. it might be related to some of your table data. can you help to identify the data to trigger the issue and share them? |
I guess this could be data related, having some trouble reproducing it with consistency or a small test case. I'm still trying narrow it down some, unsure if this will help. create table dataset_13_13.test_core (myid uuid, jdoc jsonb) WITH (
I don't really understand why an analyze would affect if this gets a panic. |
yeah I don't fully understand why this is intermittent. but this just some json data I found on the internet that I can reproduce with.
|
Are you still able to reproduce the issue? If yes is it possible for you to upload the coredump? You could use the packcore utility to collect the core and related libraries. |
i'll go see about getting a core. |
I've uploaded the cores to the commercial support side now that I have access again. |
I did some debugging on the core file, and was able to track this down to how we build the list columns that need to be scanned in IndexBuildAppendOnlyColScan(). It doesn't take into account columns that are used in the WHERE clause, so if there is a column that's only used in the WHERE clause, it's not fetched. In this particular case, that lead to a crash because the corresponding field in the "slot" to hold each row was left uninitialized. The first time an index is created on an AOCO table, it always scans all columns to build the so-called "AO block directory", but on subsequent indexes on the same table, the bug arises. Here's a simpler repro:
It doesn't lead to a crash, at least on my laptop on a debugging build with compiler optimizations disabled, but the SELECT returns incorrect result. It should return the one row in the table, but it returns 0 rows. Thanks for the report, I'll open a PR to fix this soon. |
Hi Heikki,
thank you for taking a look at this and finding the cause.
…-Mark
On Thu, Nov 21, 2019 at 11:34 AM Heikki Linnakangas < ***@***.***> wrote:
I did some debugging on the core file, and was able to track this down to
how we build the list columns that need to be scanned in
IndexBuildAppendOnlyColScan(). It doesn't take into account columns that
are used in the WHERE clause, so if there is a column that's only used in
the WHERE clause, it's not fetched. In this particular case, that lead to a
crash because the corresponding field in the "slot" to hold each row was
left uninitialized. The first time an index is created on an AOCO table, it
always scans all columns to build the so-called "AO block directory", but
on subsequent indexes on the same table, the bug arises.
Here's a simpler repro:
create table aocol (id int4, t text) with (appendonly=true, orientation=column);
insert into aocol values (1, 'foobar');
-- Create an index on the table. This is the first index on the table, so it
-- creates the ao block directory, and scans all columns.
create index on aocol (id);
-- Create another index. This index needs to scan both columns, because both
-- columns are used by the index; one as the index column, and the other in
-- the expression.
create index myidx on aocol (id) WHERE t like 'foo%';
-- Check that the row is found using the partial index.
set optimizer=off;
set enable_seqscan=off;
select * from aocol where t like 'foo%';
It doesn't lead to a crash, at least on my laptop on a debugging build
with compiler optimizations disabled, but the SELECT returns incorrect
result. It should return the one row in the table, but it returns 0 rows.
Thanks for the report, I'll open a PR to fix this soon.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#9022?email_source=notifications&email_token=AFJXWOMDSSBTKMFRMUX6WLLQU3ICTA5CNFSM4JK7R5JKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEE3G5VA#issuecomment-557215444>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFJXWOMZB7LTYE6XGMSZT6LQU3ICTANCNFSM4JK7R5JA>
.
|
Fixes github issue #9022 Reviewed-by: Asim R P <apraveen@pivotal.io>
Fixes github issue #9022 Reviewed-by: Asim R P <apraveen@pivotal.io>
Fixes github issue #9022 Reviewed-by: Asim R P <apraveen@pivotal.io>
Fixed master, 6X_STABLE and 5X_STABLE. Thanks for the report! |
Greenplum version or build
6.1.0
OS version and uname -a
Linux gpdb-sn.openstacklocal 3.10.0-957.27.2.el7.x86_64 #1 SMP Mon Jul 29 17:46:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
autoconf options used ( config.status --config )
N/A
Installation information ( pg_config )
N/A
Expected behavior
create index statement should NOT cause a panic.
Actual behavior
segfault
segment log.
Step to reproduce the behavior
create table with a jsonb column. create a btree index on that table for a column and filter where the jsonb is being type cast.
The text was updated successfully, but these errors were encountered: