Re: [Proposal] Global temporary tables
Wenjing Zeng <wjzeng2012@gmail.com>
From: wenjing <wjzeng2012@gmail.com>
To: Andrew Bille <andrewbille@gmail.com>
Cc: wenjing <wenjing@gmail.com>, Pavel Stehule <pavel.stehule@gmail.com>, Tony Zhu <tony.zhu@ww-it.cn>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-10-09T07:41:26Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
PageAddItemExtended(): Add LP_UNUSED assertion.
- 30aaab26e521 14.0 cited
-
Remove temporary files after backend crash
- cd91de0d1795 14.0 cited
-
Fix comment in indexing.c
- 9fd2952cf492 14.0 cited
-
Fix failure to ignore leftover temp tables after a server crash.
- 6919b7e32947 9.3.0 cited
Attachments
- 0004-gtt-v55-regress.patch (application/octet-stream) patch v55-0004
- 0003-gtt-v55-implementation.patch (application/octet-stream) patch v55-0003
- 0001-gtt-v55-reademe.patch (application/octet-stream) patch v55-0001
- 0002-gtt-v55-doc.patch (application/octet-stream) patch v55-0002
Andrew Bille <andrewbille@gmail.com> 于2021年10月7日周四 上午12:30写道: > On master with the v54 patches applied the following script leads to crash: > Thank you for pointing it out. This is a bug that occurs during transaction rollback and process exit, I fixed it, please confirm it. Wenjing export > ASAN_OPTIONS=detect_leaks=0:abort_on_error=1:disable_coredump=0:strict_string_checks=1:check_initialization_order=1:strict_init_order=1 > initdb -D data > pg_ctl -w -t 5 -D data -l server.log start > psql -c "create global temp table tmp_table_test_statistics(a int); insert > into temp_table_test_statistics values(generate_series(1,1000000000));" & > sleep 1 > pg_ctl -w -t 5 -D data -l server.log stop > > and i got error > ================================================================= > ==1022892==ERROR: AddressSanitizer: heap-use-after-free on address > 0x62500004c640 at pc 0x562435348750 bp 0x7ffee8487e60 sp 0x7ffee8487e50 > READ of size 8 at 0x62500004c640 thread T0 > --- > > with backtrace: > > Core was generated by `postgres: andrew regression [local] INSERT > '. > Program terminated with signal SIGABRT, Aborted. > #0 __GI_raise (sig=sig@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@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 > #1 0x00007fa8fd008859 in __GI_abort () at abort.c:79 > #2 0x000056243471eae2 in __sanitizer::Abort() () > #3 0x000056243472968c in __sanitizer::Die() () > #4 0x000056243470ad1c in > __asan::ScopedInErrorReport::~ScopedInErrorReport() () > #5 0x000056243470a793 in __asan::ReportGenericError(unsigned long, > unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned > int, bool) () > #6 0x000056243470b5db in __asan_report_load8 () > #7 0x0000562435348750 in DropRelFileNodesAllBuffers > (smgr_reln=smgr_reln@entry=0x62500004c640, nnodes=nnodes@entry=1) at > bufmgr.c:3211 > #8 0x00005624353ec8a8 in smgrdounlinkall (rels=rels@entry=0x62500004c640, > nrels=nrels@entry=1, isRedo=isRedo@entry=false) at smgr.c:397 > #9 0x0000562434aa76e1 in gtt_storage_removeall (code=<optimized out>, > arg=<optimized out>) at storage_gtt.c:726 > #10 0x0000562435371962 in shmem_exit (code=code@entry=1) at ipc.c:236 > #11 0x0000562435371d4f in proc_exit_prepare (code=code@entry=1) at > ipc.c:194 > #12 0x0000562435371f74 in proc_exit (code=code@entry=1) at ipc.c:107 > #13 0x000056243581e35c in errfinish (filename=<optimized out>, > filename@entry=0x562435b800e0 "postgres.c", lineno=lineno@entry=3191, > funcname=funcname@entry=0x562435b836a0 <__func__.26025> > "ProcessInterrupts") at elog.c:666 > #14 0x00005624353f5f86 in ProcessInterrupts () at postgres.c:3191 > #15 0x0000562434eb26d6 in ExecProjectSet (pstate=0x62500003f150) at > nodeProjectSet.c:51 > #16 0x0000562434eaae8e in ExecProcNode (node=0x62500003f150) at > ../../../src/include/executor/executor.h:257 > #17 ExecModifyTable (pstate=0x62500003ec98) at nodeModifyTable.c:2429 > #18 0x0000562434df5755 in ExecProcNodeFirst (node=0x62500003ec98) at > execProcnode.c:463 > #19 0x0000562434dd678a in ExecProcNode (node=0x62500003ec98) at > ../../../src/include/executor/executor.h:257 > #20 ExecutePlan (estate=estate@entry=0x62500003ea20, > planstate=0x62500003ec98, use_parallel_mode=<optimized out>, > use_parallel_mode@entry=false, operation=operation@entry=CMD_INSERT, > sendTuples=false, numberTuples=numberTuples@entry=0, > direction=ForwardScanDirection, > dest=0x625000045550, execute_once=true) at execMain.c:1555 > #21 0x0000562434dd9867 in standard_ExecutorRun (queryDesc=0x6190000015a0, > direction=ForwardScanDirection, count=0, execute_once=execute_once@entry=true) > at execMain.c:361 > #22 0x0000562434dd9a83 in ExecutorRun (queryDesc=queryDesc@entry=0x6190000015a0, > direction=direction@entry=ForwardScanDirection, count=count@entry=0, > execute_once=execute_once@entry=true) at execMain.c:305 > #23 0x0000562435401be6 in ProcessQuery (plan=plan@entry=0x625000045480, > sourceText=0x625000005220 "insert into temp_table_test_statistics > values(generate_series(1,1000000000));", params=0x0, queryEnv=0x0, > dest=dest@entry=0x625000045550, qc=qc@entry=0x7ffee84886d0) > at pquery.c:160 > #24 0x0000562435404a32 in PortalRunMulti (portal=portal@entry=0x625000020a20, > isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=false, > dest=dest@entry=0x625000045550, altdest=altdest@entry=0x625000045550, > qc=qc@entry=0x7ffee84886d0) > at pquery.c:1274 > #25 0x000056243540598d in PortalRun (portal=portal@entry=0x625000020a20, > count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, > run_once=run_once@entry=true, dest=dest@entry=0x625000045550, > altdest=altdest@entry=0x625000045550, qc=<optimized out>) > at pquery.c:788 > #26 0x00005624353fa917 in exec_simple_query > (query_string=query_string@entry=0x625000005220 "insert into > temp_table_test_statistics values(generate_series(1,1000000000));") at > postgres.c:1214 > #27 0x00005624353ff61d in PostgresMain (dbname=dbname@entry=0x629000011278 > "regression", username=username@entry=0x629000011258 "andrew") at > postgres.c:4497 > #28 0x00005624351f65c7 in BackendRun (port=port@entry=0x615000002d80) at > postmaster.c:4560 > #29 0x00005624351ff1c5 in BackendStartup (port=port@entry=0x615000002d80) > at postmaster.c:4288 > #30 0x00005624351ff970 in ServerLoop () at postmaster.c:1801 > #31 0x0000562435201da4 in PostmasterMain (argc=3, argv=<optimized out>) at > postmaster.c:1473 > #32 0x0000562434f3ab2d in main (argc=3, argv=0x603000000280) at main.c:198 > --- > > I've built the server with sanitizers using gcc 9 as following: > CPPFLAGS="-Og -fsanitize=address -fsanitize=undefined > -fno-sanitize=nonnull-attribute -fno-sanitize-recover > -fno-sanitize=alignment -fstack-protector" LDFLAGS='-fsanitize=address > -fsanitize=undefined -static-libasan' ./configure --enable-tap-tests > --enable-debug > >