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

[YSQL] pg_partman: unknown transaction, could be recently aborted #13597

Open
averyshum62 opened this issue Aug 11, 2022 · 0 comments
Open

[YSQL] pg_partman: unknown transaction, could be recently aborted #13597

averyshum62 opened this issue Aug 11, 2022 · 0 comments
Labels
area/ysql Yugabyte SQL (YSQL) kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue

Comments

@averyshum62
Copy link
Contributor

averyshum62 commented Aug 11, 2022

Jira Link: DB-3172

Description

Ran into the following error while importing tests for pg_partman extension. The error appeared while porting over test-id-native.sql in pg_partman/test/test_native (after removing CREATE UNLOGGED TABLE and ALTER TABLE ... ADD PRIMARY KEY calls as they aren't supported).

ERROR:  Operation failed. Try again: Unknown transaction, could be recently aborted: a0399c51-d7ab-4c9b-ad55-5d407fa93a82
CONTEXT: SQL statement "SELECT control, partition_type, datetime_string, epoch 
                                                                     FROM partman.part_config WHERE parent_table = v_parent_table"
PL/pgSQL function show_partition_info(text,text,text) line 53 at SQL statement
SQL statement "SELECT child_start_id                     FROM partman.show_partition_info(v_row.partition_schemaname||'.'||v_row.partition_tablename
        , v_partition_interval::text
        , p_parent_table)"
PL/pgSQL function partman.drop_partition_id(text,bigint,boolean,boolean,text) line 174 at SQL statement
DETAIL: 
HINT: 
CONTEXT:  PL/pgSQL function partman.drop_partition_id(text,bigint,boolean,boolean,text) line 337 at RAISE

I believe the cause of the error is the DDL ALTER TABLE ... ATTACH PARTITION, which causes DMLs following it to fail. It is called in partman.create_partition_id, called by partman.create_parent to attach partitions to the parent.

The following SQL code reproduces the error. In order to run, the pg_partman extension must be loaded, with the like clause enabled.

create schema partman;
create extension pg_partman schema partman;

CREATE SCHEMA partman_test;

begin;

CREATE TABLE partman_test.id_taptest_table (
    col1 bigint 
    , col2 text not null default 'stuff'
    , col3 timestamptz DEFAULT now()
    , col4 text) PARTITION BY RANGE (col1);
 CREATE INDEX ON partman_test.id_taptest_table (col3);

SELECT partman.create_parent('partman_test.id_taptest_table', 'col1', 'native', '5', p_jobmon := false, p_start_partition := '3000000000');
INSERT INTO partman_test.id_taptest_table (col1, col4) VALUES (generate_series(3000000001,3000000009), 'stuff'||generate_series(3000000001,3000000009));

SELECT partman.drop_partition_id('partman_test.id_taptest_table', '2', p_keep_table := false);

 commit;

Note: the error may be slightly different from run to run (i.e. the DML that fails may change)

@averyshum62 averyshum62 added area/ysql Yugabyte SQL (YSQL) status/awaiting-triage Issue awaiting triage labels Aug 11, 2022
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue and removed status/awaiting-triage Issue awaiting triage labels Aug 11, 2022
@yugabyte-ci yugabyte-ci added kind/enhancement This is an enhancement of an existing feature and removed kind/bug This issue is a bug labels Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

2 participants