Re: [Proposal] Global temporary tables

曾文旌 (义从) <wenjing.zwj@alibaba-inc.com>

From: 曾文旌 <wenjing.zwj@alibaba-inc.com>
To: Prabhat Sahu <prabhat.sahu@enterprisedb.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, tushar <tushar.ahuja@enterprisedb.com>, Robert Haas <robertmhaas@gmail.com>, Tomas Vondra <tomas.vondra@2ndquadrant.com>, Konstantin Knizhnik <k.knizhnik@postgrespro.ru>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, "蔡松露(子嘉)" <zijia@taobao.com>, "Cai, Le" <le.cai@alibaba-inc.com>
Date: 2020-04-27T09:45:28Z
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 →
  1. PageAddItemExtended(): Add LP_UNUSED assertion.

  2. Remove temporary files after backend crash

  3. Fix comment in indexing.c

  4. Fix failure to ignore leftover temp tables after a server crash.


> 2020年4月24日 下午12:55,Prabhat Sahu <prabhat.sahu@enterprisedb.com> 写道:
> 
> Hi Wenjing,
> 
> Please check, the server getting crash with the below scenario(CLUSTER gtt using INDEX).
> 
> -- Session1:
> postgres=# create global temporary table gtt (c1 integer) on commit preserve rows;
> CREATE TABLE
> postgres=# create index idx1 on gtt (c1);
> CREATE INDEX
> 
> -- Session2:
> postgres=# create index idx2 on gtt (c1);
> CREATE INDEX
> 
> -- Session1:
> postgres=# cluster gtt using idx1;
> server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.
Thanks for review, I fixed In v31.


Wenjing



> !?>
> 
> -- Below is the stacktrace:
> [edb@localhost bin]$ gdb -q -c data/core.95690 postgres 
> Reading symbols from /home/edb/PG/PGsrcNew/postgresql/inst/bin/postgres...done.
> [New LWP 95690]
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> Core was generated by `postgres: edb postgres [local] CLUSTER                    '.
> Program terminated with signal 6, Aborted.
> #0  0x00007f9c574ee337 in raise () from /lib64/libc.so.6
> Missing separate debuginfos, use: debuginfo-install glibc-2.17-292.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-37.el7_7.2.x86_64 libcom_err-1.42.9-16.el7.x86_64 libgcc-4.8.5-39.el7.x86_64 libselinux-2.5-14.1.el7.x86_64 openssl-libs-1.0.2k-19.el7.x86_64 pcre-8.32-17.el7.x86_64 zlib-1.2.7-18.el7.x86_64
> (gdb) bt
> #0  0x00007f9c574ee337 in raise () from /lib64/libc.so.6
> #1  0x00007f9c574efa28 in abort () from /lib64/libc.so.6
> #2  0x0000000000ab3a3c in ExceptionalCondition (conditionName=0xb5e2e8 "!ReindexIsProcessingIndex(indexOid)", errorType=0xb5d365 "FailedAssertion", 
>     fileName=0xb5d4e9 "index.c", lineNumber=3825) at assert.c:67
> #3  0x00000000005b0412 in reindex_relation (relid=16384, flags=2, options=0) at index.c:3825
> #4  0x000000000065e36d in finish_heap_swap (OIDOldHeap=16384, OIDNewHeap=16389, is_system_catalog=false, swap_toast_by_content=false, 
>     check_constraints=false, is_internal=true, frozenXid=491, cutoffMulti=1, newrelpersistence=103 'g') at cluster.c:1448
> #5  0x000000000065ccef in rebuild_relation (OldHeap=0x7f9c589adef0, indexOid=16387, verbose=false) at cluster.c:602
> #6  0x000000000065c757 in cluster_rel (tableOid=16384, indexOid=16387, options=0) at cluster.c:418
> #7  0x000000000065c2cf in cluster (stmt=0x2cd1600, isTopLevel=true) at cluster.c:180
> #8  0x000000000093b213 in standard_ProcessUtility (pstmt=0x2cd16c8, queryString=0x2cd0b30 "cluster gtt using idx1;", context=PROCESS_UTILITY_TOPLEVEL, 
>     params=0x0, queryEnv=0x0, dest=0x2cd19a8, qc=0x7ffcd32604b0) at utility.c:819
> #9  0x000000000093aa50 in ProcessUtility (pstmt=0x2cd16c8, queryString=0x2cd0b30 "cluster gtt using idx1;", context=PROCESS_UTILITY_TOPLEVEL, params=0x0, 
>     queryEnv=0x0, dest=0x2cd19a8, qc=0x7ffcd32604b0) at utility.c:522
> #10 0x00000000009398c2 in PortalRunUtility (portal=0x2d36ba0, pstmt=0x2cd16c8, isTopLevel=true, setHoldSnapshot=false, dest=0x2cd19a8, qc=0x7ffcd32604b0)
>     at pquery.c:1157
> #11 0x0000000000939ad8 in PortalRunMulti (portal=0x2d36ba0, isTopLevel=true, setHoldSnapshot=false, dest=0x2cd19a8, altdest=0x2cd19a8, qc=0x7ffcd32604b0)
>     at pquery.c:1303
> #12 0x0000000000938ff6 in PortalRun (portal=0x2d36ba0, count=9223372036854775807, isTopLevel=true, run_once=true, dest=0x2cd19a8, altdest=0x2cd19a8, 
>     qc=0x7ffcd32604b0) at pquery.c:779
> #13 0x00000000009331b0 in exec_simple_query (query_string=0x2cd0b30 "cluster gtt using idx1;") at postgres.c:1239
> #14 0x00000000009371bc in PostgresMain (argc=1, argv=0x2cfab80, dbname=0x2cfaa78 "postgres", username=0x2cfaa58 "edb") at postgres.c:4315
> #15 0x00000000008872a9 in BackendRun (port=0x2cf2b50) at postmaster.c:4510
> #16 0x0000000000886a9e in BackendStartup (port=0x2cf2b50) at postmaster.c:4202
> #17 0x000000000088301c in ServerLoop () at postmaster.c:1727
> #18 0x00000000008828f3 in PostmasterMain (argc=3, argv=0x2ccb460) at postmaster.c:1400
> #19 0x0000000000789c54 in main (argc=3, argv=0x2ccb460) at main.c:210
> (gdb) 
> 
> -- 
> With Regards,
> Prabhat Kumar Sahu
> EnterpriseDB: http://www.enterprisedb.com <http://www.enterprisedb.com/>