Re: [Proposal] Global temporary tables

From: wenjing <wjzeng2012(at)gmail(dot)com>
To: Andrew Bille <andrewbille(at)gmail(dot)com>
Cc: wenjing <wenjing(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tony Zhu <tony(dot)zhu(at)ww-it(dot)cn>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [Proposal] Global temporary tables
Date: 2021-10-18 12:00:05
Message-ID: CA+B_3VkLysCq6BHsRpVmURo8sGxewoGS6w=Ak5xqbq_P4cqDMA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Bille <andrewbille(at)gmail(dot)com> 于2021年10月15日周五 下午3:44写道:

> On master with the v55 patches applied the following script leads to crash:
> initdb -D data
> pg_ctl -w -t 5 -D data -l server.log start
>
> psql -t -c "begin; create global temp table gtt_with_index(a int primary
> key, b text); commit; select pg_sleep(5);" >psql1.log &
> psql -t -c "select pg_sleep(1); create index idx_b on gtt_with_index(b);"
> >psql2.log &
> for i in `seq 40`; do (psql -t -c "select pg_sleep(1); insert into
> gtt_with_index values(1,'test');" &); done
>
> sleep 10
>
>
> and I got crash
> INSERT 0 1
> ...
> INSERT 0 1
> server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
> connection to server was lost
> WARNING: terminating connection because of crash of another server process
> DETAIL: The postmaster has commanded this server process to roll back the
> current transaction and exit, because another server process exited
> abnormally and possibly corrupted shared memory.
> HINT: In a moment you should be able to reconnect to the database and
> repeat your command.
> server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
> connection to server was lost
>
> and some coredumps with the following stack:
>
> [New LWP 1821493]
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> Core was generated by `postgres: andrew regression [local] INSERT
> '.
> Program terminated with signal SIGABRT, Aborted.
> #0 __GI_raise (sig=sig(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
> 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
> (gdb) bt
> #0 __GI_raise (sig=sig(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1 0x00007f021d809859 in __GI_abort () at abort.c:79
> #2 0x0000564dc1bd22e8 in ExceptionalCondition
> (conditionName=conditionName(at)entry=0x564dc1c5c957
> "index->rd_index->indisvalid", errorType=errorType(at)entry=0x564dc1c2a00b
> "FailedAssertion", fileName=fileName(at)entry=0x564dc1c5c854
> "storage_gtt.c",
> lineNumber=lineNumber(at)entry=1381) at assert.c:69
> #3 0x0000564dc185778b in init_gtt_storage (operation=operation(at)entry=CMD_INSERT,
> resultRelInfo=resultRelInfo(at)entry=0x564dc306f6c0) at storage_gtt.c:1381
> #4 0x0000564dc194c888 in ExecInsert (mtstate=0x564dc306f4a8,
> resultRelInfo=0x564dc306f6c0, slot=0x564dc30706d0, planSlot=0x564dc306fca0,
> estate=0x564dc306f230, canSetTag=<optimized out>) at nodeModifyTable.c:638
> #5 0x0000564dc194d945 in ExecModifyTable (pstate=<optimized out>) at
> nodeModifyTable.c:2565
> #6 0x0000564dc191ca83 in ExecProcNode (node=0x564dc306f4a8) at
> ../../../src/include/executor/executor.h:257
> #7 ExecutePlan (execute_once=<optimized out>, dest=0x564dc310ed80,
> direction=<optimized out>, numberTuples=0, sendTuples=<optimized out>,
> operation=CMD_INSERT, use_parallel_mode=<optimized out>,
> planstate=0x564dc306f4a8, estate=0x564dc306f230) at execMain.c:1555
> #8 standard_ExecutorRun (queryDesc=0x564dc306bce0, direction=<optimized
> out>, count=0, execute_once=<optimized out>) at execMain.c:361
> #9 0x0000564dc1ab47a0 in ProcessQuery (plan=<optimized out>,
> sourceText=0x564dc3049a30 "select pg_sleep(1); insert into gtt_with_index
> values(1,'test');", params=0x0, queryEnv=0x0, dest=0x564dc310ed80,
> qc=0x7ffd3a6cf2e0) at pquery.c:160
> #10 0x0000564dc1ab52e2 in PortalRunMulti (portal=portal(at)entry=0x564dc30acd80,
> isTopLevel=isTopLevel(at)entry=true, setHoldSnapshot=setHoldSnapshot(at)entry=false,
> dest=dest(at)entry=0x564dc310ed80, altdest=altdest(at)entry=0x564dc310ed80,
> qc=qc(at)entry=0x7ffd3a6cf2e0)
> at pquery.c:1274
> #11 0x0000564dc1ab5861 in PortalRun (portal=portal(at)entry=0x564dc30acd80,
> count=count(at)entry=9223372036854775807, isTopLevel=isTopLevel(at)entry=true,
> run_once=run_once(at)entry=true, dest=dest(at)entry=0x564dc310ed80,
> altdest=altdest(at)entry=0x564dc310ed80, qc=0x7ffd3a6cf2e0)
> at pquery.c:788
> #12 0x0000564dc1ab1522 in exec_simple_query (query_string=0x564dc3049a30
> "select pg_sleep(1); insert into gtt_with_index values(1,'test');") at
> postgres.c:1214
> #13 0x0000564dc1ab327a in PostgresMain (dbname=<optimized out>,
> username=<optimized out>) at postgres.c:4497
> #14 0x0000564dc1a1f539 in BackendRun (port=<optimized out>,
> port=<optimized out>) at postmaster.c:4560
> #15 BackendStartup (port=<optimized out>) at postmaster.c:4288
> #16 ServerLoop () at postmaster.c:1801
> #17 0x0000564dc1a2053c in PostmasterMain (argc=<optimized out>,
> argv=0x564dc3043fc0) at postmaster.c:1473
> #18 0x0000564dc1750180 in main (argc=3, argv=0x564dc3043fc0) at main.c:198
> (gdb) q
>
>
> I've built the server using gcc 9 as following:
> ./configure --enable-debug --enable-cassert
>
> Thanks to Alexander Lakhin for simplifying the repro.
>
> On Thu, Oct 14, 2021 at 3:29 PM wenjing zeng <wjzeng2012(at)gmail(dot)com> wrote:
>
>>
>> Be deeply grateful.
>> Perhaps you can give the stack of problems so that you can start
>> analyzing them as soon as possible.
>>
>> Wenjing
>>
>>
Hi Andrew
I fixed the problem, please confirm again.
Thanks

Wenjing

Attachment Content-Type Size
0004-gtt-v56-regress.patch application/octet-stream 79.1 KB
0002-gtt-v56-doc.patch application/octet-stream 7.5 KB
0003-gtt-v56-implementation.patch application/octet-stream 164.6 KB
0001-gtt-v56-reademe.patch application/octet-stream 7.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2021-10-18 12:15:15 Re: Polyphase merge is obsolete
Previous Message Heikki Linnakangas 2021-10-18 11:17:30 Re: ResourceOwner refactoring