Re: [Proposal] Global temporary tables

From: 曾文旌 <wenjing(dot)zwj(at)alibaba-inc(dot)com>
To: Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>
Cc: tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, "蔡松露(子嘉)" <zijia(at)taobao(dot)com>, "Cai, Le" <le(dot)cai(at)alibaba-inc(dot)com>, "萧少聪(铁庵)" <shaocong(dot)xsc(at)alibaba-inc(dot)com>
Subject: Re: [Proposal] Global temporary tables
Date: 2020-04-20 09:29:11
Message-ID: 88124F96-7519-4CD4-9011-3CDAADEB7FFA@alibaba-inc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 2020年4月17日 下午8:59,Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com> 写道:
>
> Hi Wenjing,
>
> Please check below scenario, we are getting a server crash with "ALTER TABLE" add column with default value as sequence:
>
> -- Create gtt, exit and re-connect the psql prompt, create sequence, alter table add a column with sequence.
> postgres=# create global temporary table gtt1 (c1 int);
> CREATE TABLE
> postgres=# \q
> [edb(at)localhost bin]$ ./psql postgres
> psql (13devel)
> Type "help" for help.
>
> postgres=# create sequence seq;
> CREATE SEQUENCE
> postgres=# alter table gtt1 add c2 int default nextval('seq');
> 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.
> !?> \q
Please check my new patch.

Wenjing

>
>
> -- Stack trace:
> [edb(at)localhost bin]$ gdb -q -c data/core.70358 postgres
> Reading symbols from /home/edb/PG/PGsrcNew/postgresql/inst/bin/postgres...done.
> [New LWP 70358]
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> Core was generated by `postgres: edb postgres [local] ALTER TABLE '.
> Program terminated with signal 6, Aborted.
> #0 0x00007f150223b337 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 0x00007f150223b337 in raise () from /lib64/libc.so.6
> #1 0x00007f150223ca28 in abort () from /lib64/libc.so.6
> #2 0x0000000000ab2cdd in ExceptionalCondition (conditionName=0xc03ab8 "OidIsValid(relfilenode1) && OidIsValid(relfilenode2)",
> errorType=0xc0371f "FailedAssertion", fileName=0xc03492 "cluster.c", lineNumber=1637) at assert.c:67
> #3 0x000000000065e200 in gtt_swap_relation_files (r1=16384, r2=16390, target_is_pg_class=false, swap_toast_by_content=false, is_internal=true,
> frozenXid=490, cutoffMulti=1, mapped_tables=0x7ffd841f7ee0) at cluster.c:1637
> #4 0x000000000065dcd9 in finish_heap_swap (OIDOldHeap=16384, OIDNewHeap=16390, is_system_catalog=false, swap_toast_by_content=false,
> check_constraints=true, is_internal=true, frozenXid=490, cutoffMulti=1, newrelpersistence=103 'g') at cluster.c:1395
> #5 0x00000000006bca18 in ATRewriteTables (parsetree=0x1deab80, wqueue=0x7ffd841f80c8, lockmode=8, context=0x7ffd841f8260) at tablecmds.c:4991
> #6 0x00000000006ba890 in ATController (parsetree=0x1deab80, rel=0x7f150378f330, cmds=0x1deab28, recurse=true, lockmode=8, context=0x7ffd841f8260)
> at tablecmds.c:3991
> #7 0x00000000006ba4f8 in AlterTable (stmt=0x1deab80, lockmode=8, context=0x7ffd841f8260) at tablecmds.c:3644
> #8 0x000000000093b62a in ProcessUtilitySlow (pstate=0x1e0d6d0, pstmt=0x1deac48,
> queryString=0x1de9b30 "alter table gtt1 add c2 int default nextval('seq');", context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x1deaf28,
> qc=0x7ffd841f8830) at utility.c:1267
> #9 0x000000000093b141 in standard_ProcessUtility (pstmt=0x1deac48, queryString=0x1de9b30 "alter table gtt1 add c2 int default nextval('seq');",
> context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x1deaf28, qc=0x7ffd841f8830) at utility.c:1067
> #10 0x000000000093a22b in ProcessUtility (pstmt=0x1deac48, queryString=0x1de9b30 "alter table gtt1 add c2 int default nextval('seq');",
> context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x1deaf28, qc=0x7ffd841f8830) at utility.c:522
> #11 0x000000000093909d in PortalRunUtility (portal=0x1e4fba0, pstmt=0x1deac48, isTopLevel=true, setHoldSnapshot=false, dest=0x1deaf28, qc=0x7ffd841f8830)
> at pquery.c:1157
> #12 0x00000000009392b3 in PortalRunMulti (portal=0x1e4fba0, isTopLevel=true, setHoldSnapshot=false, dest=0x1deaf28, altdest=0x1deaf28, qc=0x7ffd841f8830)
> at pquery.c:1303
> #13 0x00000000009387d1 in PortalRun (portal=0x1e4fba0, count=9223372036854775807, isTopLevel=true, run_once=true, dest=0x1deaf28, altdest=0x1deaf28,
> qc=0x7ffd841f8830) at pquery.c:779
> #14 0x000000000093298b in exec_simple_query (query_string=0x1de9b30 "alter table gtt1 add c2 int default nextval('seq');") at postgres.c:1239
> #15 0x0000000000936997 in PostgresMain (argc=1, argv=0x1e13b80, dbname=0x1e13a78 "postgres", username=0x1e13a58 "edb") at postgres.c:4315
> #16 0x00000000008868b3 in BackendRun (port=0x1e0bb50) at postmaster.c:4510
> #17 0x00000000008860a8 in BackendStartup (port=0x1e0bb50) at postmaster.c:4202
> #18 0x0000000000882626 in ServerLoop () at postmaster.c:1727
> #19 0x0000000000881efd in PostmasterMain (argc=3, argv=0x1de4460) at postmaster.c:1400
> #20 0x0000000000789288 in main (argc=3, argv=0x1de4460) at main.c:210
> (gdb)
>
> --
> With Regards,
> Prabhat Kumar Sahu
> EnterpriseDB: http://www.enterprisedb.com <http://www.enterprisedb.com/>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message 曾文旌 2020-04-20 09:31:43 Re: [Proposal] Global temporary tables
Previous Message 曾文旌 2020-04-20 09:09:24 Re: [Proposal] Global temporary tables