Re: [Proposal] Global temporary tables

Wenjing Zeng <wjzeng2012@gmail.com>

From: wenjing <wjzeng2012@gmail.com>
To: Andrew Bille <andrewbille@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, Tony Zhu <Tony.zhu@ww-it.cn>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, wenjing <wenjing@gmail.com>
Date: 2021-12-23T12:36:37Z
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.

Attachments

Andrew Bille <andrewbille@gmail.com> 于2021年12月21日周二 14:00写道:

> Hi!
> Thanks for new patches.
> Yet another crash reproduced on master with v63 patches:
>
> CREATE TABLESPACE ts LOCATION '/tmp/ts';
> CREATE GLOBAL TEMP TABLE tbl (num1 bigint);
> INSERT INTO tbl (num1) values (1);
> CREATE INDEX tbl_idx ON tbl (num1);
> REINDEX (TABLESPACE ts) TABLE tbl;
>
This is a feature made in PG14 that supports reindex change tablespaces.
Thank you for pointing that out and I fixed it in v64.
Waiting for your feedback.

regards

Wenjing


>
> Got error:
> CREATE TABLESPACE
> CREATE TABLE
> INSERT 0 1
> CREATE INDEX
> WARNING:  AbortTransaction while in COMMIT state
> ERROR:  gtt relfilenode 16388 not found in rel 16388
> PANIC:  cannot abort transaction 726, it was already committed
> server closed the connection unexpectedly
>     This probably means the server terminated abnormally
>     before or while processing the request.
> connection to server was lost
>
> in log:
> 2021-12-21 12:54:08.273 +07 [208725] ERROR:  gtt relfilenode 16388 not
> found in rel 16388
> 2021-12-21 12:54:08.273 +07 [208725] STATEMENT:  REINDEX (TABLESPACE ts)
> TABLE tbl;
> 2021-12-21 12:54:08.273 +07 [208725] WARNING:  AbortTransaction while in
> COMMIT state
> 2021-12-21 12:54:08.273 +07 [208725] PANIC:  cannot abort transaction 726,
> it was already committed
> 2021-12-21 12:54:08.775 +07 [208716] LOG:  server process (PID 208725) was
> terminated by signal 6: Аварийный останов
> 2021-12-21 12:54:08.775 +07 [208716] DETAIL:  Failed process was running:
> REINDEX (TABLESPACE ts) TABLE tbl;
> 2021-12-21 12:54:08.775 +07 [208716] LOG:  terminating any other active
> server processes
> 2021-12-21 12:54:08.775 +07 [208716] LOG:  all server processes
> terminated; reinitializing
>
> with dump:
> [New LWP 208725]
> [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 postgres [local] REINDEX
>    '.
> 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: Нет такого файла или каталога.
> (gdb) bt
> #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1  0x00007feadfac7859 in __GI_abort () at abort.c:79
> #2  0x000055e36b6d9ec7 in errfinish (filename=0x55e36b786e20 "xact.c",
> lineno=1729, funcname=0x55e36b788660 <__func__.29619>
> "RecordTransactionAbort") at elog.c:680
> #3  0x000055e36b0d6e37 in RecordTransactionAbort (isSubXact=false) at
> xact.c:1729
> #4  0x000055e36b0d7f64 in AbortTransaction () at xact.c:2787
> #5  0x000055e36b0d88fa in AbortCurrentTransaction () at xact.c:3315
> #6  0x000055e36b524f33 in PostgresMain (dbname=0x55e36d4d97b8 "postgres",
> username=0x55e36d4d9798 "andrew") at postgres.c:4252
> #7  0x000055e36b44d1e0 in BackendRun (port=0x55e36d4d1020) at
> postmaster.c:4594
> #8  0x000055e36b44cac5 in BackendStartup (port=0x55e36d4d1020) at
> postmaster.c:4322
> #9  0x000055e36b448bad in ServerLoop () at postmaster.c:1802
> #10 0x000055e36b448346 in PostmasterMain (argc=3, argv=0x55e36d4a84d0) at
> postmaster.c:1474
> #11 0x000055e36b33b5ca in main (argc=3, argv=0x55e36d4a84d0) at main.c:198
>
> Regards!
>
> On Mon, Dec 20, 2021 at 7:42 PM wenjing zeng <wjzeng2012@gmail.com> wrote:
>
>> Post GTT v63 to fixed conflicts with the latest code.
>>
>>
>>
>> Hi Andrew
>>
>> Have you found any new bugs recently?
>>
>>
>>
>> Wenjing
>>
>>
>>
>>
>> 2021年11月20日 01:31,wenjing <wjzeng2012@gmail.com> 写道:
>>
>>
>>
>> Andrew Bille <andrewbille@gmail.com> 于2021年11月15日周一 下午6:34写道:
>>
>>> Thanks for the patches. The feature has become much more stable.
>>> However, there is another simple case that generates an error:
>>> Master with v61 patches
>>>
>>> CREATE GLOBAL TEMPORARY TABLE t AS SELECT 1 AS a;
>>> ERROR:  could not open file "base/13560/t3_16384": No such file or
>>> directory
>>>
>> Thank you for pointing out that this part is not reasonable enough.
>> This issue has been fixed in v62.
>> Looking forward to your reply.
>>
>>
>> Wenjing
>>
>>
>>
>>> Andrew
>>>
>>> On Thu, Nov 11, 2021 at 3:15 PM wenjing <wjzeng2012@gmail.com> wrote:
>>>
>>>> Fixed a bug in function pg_gtt_attached_pid.
>>>> Looking forward to your reply.
>>>>
>>>>
>>>> Wenjing
>>>>
>>>>
>>
>>
>> <0001-gtt-v62-reademe.patch><0004-gtt-v62-regress.patch>
>> <0002-gtt-v62-doc.patch><0003-gtt-v62-implementation.patch>
>>
>>
>>
>>
>>