Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data

Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>

From: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>
To: Andrey Borodin <x4mmm@yandex-team.ru>
Cc: Andres Freund <andres@anarazel.de>, Noah Misch <noah@leadboat.com>, CM Team <cm@enterprisedb.com>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>, Michael Paquier <michael@paquier.xyz>, Tom Lane <tgl@sss.pgh.pa.us>, Peter Geoghegan <pg@bowt.ie>, Semab Tariq <semab.tariq@enterprisedb.com>
Date: 2021-11-01T13:33:26Z
Lists: pgsql-bugs
On Mon, Nov 1, 2021 at 6:48 PM Andrey Borodin <x4mmm@yandex-team.ru> wrote:

>
>
> > 1 нояб. 2021 г., в 18:10, Sandeep Thakkar <
> sandeep.thakkar@enterprisedb.com> написал(а):
> >
> >
> >
> > On Mon, Nov 1, 2021 at 12:48 AM Andres Freund <andres@anarazel.de>
> wrote:
> > Hi,
> >
> > On 2021-10-31 13:01:00 +0530, Sandeep Thakkar wrote:
> > > > #1  0x40000000003fdc00:0 in equalTupleDescs
> (tupdesc1=0x60000000001f65e0,
> > > >
> > > >     tupdesc2=0x60000000001fba08)
> >
> > Could you print out *tupdesc1, *tupdesc2? And best also
> > p tupdesc1->attrs[0]
> > p tupdesc1->attrs[1]
> > p tupdesc1->attrs[2]
> > p tupdesc2->attrs[0]
> > p tupdesc2->attrs[1]
> > p tupdesc2->attrs[2]
> >
> > you mean make the changes in the .c files to print these values and
> rerun the build? Can you please share the files where this needs to be done
> or give me a patch?
>
> You can paste these commands into gdb. Just as you did with bt. It will
> print values.
>
> Here you go (and with full bt):

(gdb) bt

#0  0x3fffffffff3fdbf0 in <unknown_procedure> ()

#1  0x40000000003fdc00:0 in equalTupleDescs (tupdesc1=0x60000000001f65e0,

    tupdesc2=0x60000000001fba08)

#2  0x40000000017f9660:0 in RelationClearRelation (

    relation=0x60000000001f3730, rebuild=true)

#3  0x40000000017fa730:0 in RelationFlushRelation
(relation=0x60000000001f3730)

#4  0x40000000017fabb0:0 in RelationCacheInvalidateEntry (relationId=27272)

#5  0x40000000017c8f20:0 in LocalExecuteInvalidationMessage (

    msg=0x60000000001a46b8)

#6  0x40000000017c84e0:0 in ProcessInvalidationMessages (

    group=0x60000000001a43e4, func=0x87ffffffef7b7250)

#7  0x40000000017cb420:0 in CommandEndInvalidationMessages ()

#8  0x40000000006b1c50:0 in AtCCI_LocalCache ()

#9  0x40000000006b0910:0 in CommandCounterIncrement ()

#10 0x4000000000807130:0 in create_toast_table (rel=0x60000000001f3730,

    toastOid=0, toastIndexOid=0, reloptions=0, lockmode=8, check=true,

    OIDOldToast=0)

#11 0x4000000000805ac0:0 in CheckAndCreateToastTable (relOid=27272,

    reloptions=0, lockmode=8, check=true, OIDOldToast=0) at toasting.c:88

#12 0x4000000000805850:0 in AlterTableCreateToastTable (relOid=27272,

    reloptions=0, lockmode=8) at toasting.c:62

#13 0x4000000000aa9a30:0 in ATRewriteCatalogs (wqueue=0x87ffffffffffc3b0,

    lockmode=8, context=0x87ffffffffffc590)

---Type <return> to continue, or q <return> to quit---

#14 0x4000000000aa6fc0:0 in ATController (parsetree=0x60000000000e04e0,

    rel=0x60000000001f3730, cmds=0x60000000000e0488, recurse=true,
lockmode=8,

    context=0x87ffffffffffc590)

#15 0x4000000000aa6410:0 in AlterTable (stmt=0x60000000000e04e0, lockmode=8,


    context=0x87ffffffffffc590)

#16 0x40000000012f9a50:0 in ProcessUtilitySlow (pstate=0x6000000000117210,

    pstmt=0x60000000000e0830,

    queryString=0x60000000000df7f0 "ALTER TABLE attmp ADD COLUMN c text;",

    context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0,

    dest=0x60000000000e0920, qc=0x87ffffffffffd838)

#17 0x40000000012f8890:0 in standard_ProcessUtility
(pstmt=0x60000000000e0830,

    queryString=0x60000000000df7f0 "ALTER TABLE attmp ADD COLUMN c text;",

    readOnlyTree=false, context=PROCESS_UTILITY_TOPLEVEL, params=0x0,

    queryEnv=0x0, dest=0x60000000000e0920, qc=0x87ffffffffffd838)

#18 0x40000000012f6150:0 in ProcessUtility (pstmt=0x60000000000e0830,

    queryString=0x60000000000df7f0 "ALTER TABLE attmp ADD COLUMN c text;",

    readOnlyTree=false, context=PROCESS_UTILITY_TOPLEVEL, params=0x0,

    queryEnv=0x0, dest=0x60000000000e0920, qc=0x87ffffffffffd838)

#19 0x40000000012f24c0:0 in PortalRunUtility (portal=0x600000000015baf0,

    pstmt=0x60000000000e0830, isTopLevel=true, setHoldSnapshot=false,

    dest=0x60000000000e0920, qc=0x87ffffffffffd838)

#20 0x40000000012f2c90:0 in PortalRunMulti (portal=0x600000000015baf0,

    isTopLevel=true, setHoldSnapshot=false, dest=0x60000000000e0920,

---Type <return> to continue, or q <return> to quit---

    altdest=0x60000000000e0920, qc=0x87ffffffffffd838)

#21 0x40000000012f08d0:0 in PortalRun (portal=0x600000000015baf0,

    count=9223372036854775807, isTopLevel=true, run_once=true,

    dest=0x60000000000e0920, altdest=0x60000000000e0920,
qc=0x87ffffffffffd838)

#22 0x40000000012dcf70:0 in exec_simple_query (

    query_string=0x60000000000df7f0 "ALTER TABLE attmp ADD COLUMN c text;")

#23 0x40000000012eaaf0:0 in PostgresMain (

    dbname=0x60000000000aaa78 "regression",

    username=0x60000000000a8ff8 "pgbfarm")

#24 0x40000000010751b0:0 in BackendRun (port=0x60000000001168e0)

#25 0x4000000001074040:0 in BackendStartup (port=0x60000000001168e0)

#26 0x4000000001068e60:0 in ServerLoop ()

#27 0x40000000010679b0:0 in PostmasterMain (argc=8, argv=0x87ffffffffffe610)

#28 0x4000000000d45660:0 in main (argc=8, argv=0x87ffffffffffe610)

    at main.c:146

(gdb) p tupdesc1->attrs[1]

No symbol "tupdesc1" in current context.

(gdb) p tupdesc1->attrs[2]

No symbol "tupdesc1" in current context.

(gdb) p tupdesc2->attrs[0]

No symbol "tupdesc2" in current context.

(gdb) p tupdesc2->attrs[1]

No symbol "tupdesc2" in current context.

> (gdb)



>

Thank you!
>
> Best regards, Andrey Borodin.



-- 
Sandeep Thakkar

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Improve contrib/amcheck's tests for CREATE INDEX CONCURRENTLY.

  2. Fix minor memory leaks in pg_dump.

  3. Avoid race in RelationBuildDesc() affecting CREATE INDEX CONCURRENTLY.

  4. Fix CREATE INDEX CONCURRENTLY for the newest prepared transactions.

  5. Add -w back to the flags for pg_ctl (re)start in PostgresNode

  6. Fix CREATE INDEX CONCURRENTLY for simultaneous prepared transactions.