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-25T12:13:01Z
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年10月23日周六 下午9:22写道:

> Thanks, the vacuum is fixed
>
> But I found another crash (on v57 patches), reproduced with:
>
> psql -t -c "create global temp table t (a integer); insert into t values
> (1); select count(*) from t group by t;"
> server closed the connection unexpectedly
>         This probably means the server terminated abnormally
>         before or while processing the request.
> connection to server was lost
>
> I missed whole row and system column. It has been fixed in v58.
Please review the new code(v58) again


Wenjing

with trace:
>
> [New LWP 2580215]
> [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] SELECT
>                            '.
> 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  0x00007f258d482859 in __GI_abort () at abort.c:79
> #2  0x000055ad0be8878f in ExceptionalCondition
> (conditionName=conditionName@entry=0x55ad0bf19743
> "gtt_rnode->att_stat_tups[i]", errorType=errorType@entry=0x55ad0bee500b
> "FailedAssertion", fileName=fileName@entry=0x55ad0bf1966b
> "storage_gtt.c", lineNumber=lineNumber@entry=902) at assert.c:69
> #3  0x000055ad0ba9379f in get_gtt_att_statistic (reloid=<optimized out>,
> attnum=0, inh=<optimized out>) at storage_gtt.c:902
> #4  0x000055ad0be35625 in examine_simple_variable (root=root@entry=0x55ad0c498748,
> var=var@entry=0x55ad0c498c68, vardata=vardata@entry=0x7fff06c9ebf0) at
> selfuncs.c:5391
> #5  0x000055ad0be36a89 in examine_variable (root=root@entry=0x55ad0c498748,
> node=node@entry=0x55ad0c498c68, varRelid=varRelid@entry=0,
> vardata=vardata@entry=0x7fff06c9ebf0) at selfuncs.c:4990
> #6  0x000055ad0be3ad64 in estimate_num_groups (root=root@entry=0x55ad0c498748,
> groupExprs=<optimized out>, input_rows=input_rows@entry=255,
> pgset=pgset@entry=0x0, estinfo=estinfo@entry=0x0) at selfuncs.c:3455
> #7  0x000055ad0bc50835 in get_number_of_groups (root=root@entry=0x55ad0c498748,
> path_rows=255, gd=gd@entry=0x0, target_list=0x55ad0c498bb8) at
> planner.c:3241
> #8  0x000055ad0bc5576f in create_ordinary_grouping_paths (root=root@entry=0x55ad0c498748,
> input_rel=input_rel@entry=0x55ad0c3ce148, grouped_rel=grouped_rel@entry=0x55ad0c4983f0,
> agg_costs=agg_costs@entry=0x7fff06c9edb0, gd=gd@entry=0x0,
> extra=extra@entry=0x7fff06c9ede0, partially_grouped_rel_p=0x7fff06c9eda8)
>     at planner.c:3628
> #9  0x000055ad0bc55a72 in create_grouping_paths (root=root@entry=0x55ad0c498748,
> input_rel=input_rel@entry=0x55ad0c3ce148, target=target@entry=0x55ad0c4c95d8,
> target_parallel_safe=target_parallel_safe@entry=true, gd=gd@entry=0x0) at
> planner.c:3377
> #10 0x000055ad0bc5686d in grouping_planner (root=root@entry=0x55ad0c498748,
> tuple_fraction=<optimized out>, tuple_fraction@entry=0) at planner.c:1592
> #11 0x000055ad0bc57910 in subquery_planner (glob=glob@entry=0x55ad0c497880,
> parse=parse@entry=0x55ad0c3cdbb8, parent_root=parent_root@entry=0x0,
> hasRecursion=hasRecursion@entry=false, tuple_fraction=tuple_fraction@entry=0)
> at planner.c:1025
> #12 0x000055ad0bc57f36 in standard_planner (parse=0x55ad0c3cdbb8,
> query_string=<optimized out>, cursorOptions=2048, boundParams=0x0) at
> planner.c:406
> #13 0x000055ad0bc584d4 in planner (parse=parse@entry=0x55ad0c3cdbb8,
> query_string=query_string@entry=0x55ad0c3cc470 "create global temp table
> t (a integer); insert into t values (1); select count(*) from t group by
> t;", cursorOptions=cursorOptions@entry=2048, boundParams=boundParams@entry=0x0)
> at planner.c:277
> #14 0x000055ad0bd4855f in pg_plan_query (querytree=querytree@entry=0x55ad0c3cdbb8,
> query_string=query_string@entry=0x55ad0c3cc470 "create global temp table
> t (a integer); insert into t values (1); select count(*) from t group by
> t;", cursorOptions=cursorOptions@entry=2048, boundParams=boundParams@entry
> =0x0)
>     at postgres.c:847
> #15 0x000055ad0bd4863b in pg_plan_queries (querytrees=0x55ad0c4986f0,
> query_string=query_string@entry=0x55ad0c3cc470 "create global temp table
> t (a integer); insert into t values (1); select count(*) from t group by
> t;", cursorOptions=cursorOptions@entry=2048, boundParams=boundParams@entry=0x0)
> at postgres.c:939
> #16 0x000055ad0bd48b20 in exec_simple_query
> (query_string=query_string@entry=0x55ad0c3cc470 "create global temp table
> t (a integer); insert into t values (1); select count(*) from t group by
> t;") at postgres.c:1133
> #17 0x000055ad0bd4aaf3 in PostgresMain (dbname=<optimized out>,
> username=<optimized out>) at postgres.c:4497
> #18 0x000055ad0bca3f91 in BackendRun (port=port@entry=0x55ad0c3f1020) at
> postmaster.c:4560
> #19 0x000055ad0bca7115 in BackendStartup (port=port@entry=0x55ad0c3f1020)
> at postmaster.c:4288
> #20 0x000055ad0bca735c in ServerLoop () at postmaster.c:1801
> #21 0x000055ad0bca893e in PostmasterMain (argc=3, argv=<optimized out>) at
> postmaster.c:1473
> #22 0x000055ad0bbe8e31 in main (argc=3, argv=0x55ad0c3c6660) at main.c:198
>
> On Thu, Oct 21, 2021 at 4:25 PM wenjing <wjzeng2012@gmail.com> wrote:
>
>>
>>
>> Andrew Bille <andrewbille@gmail.com> 于2021年10月20日周三 上午2:59写道:
>>
>>> Another thanks for the fix. It works for me.
>>>
>>> But I found another crash!
>>>
>> This is a check code that was added this year, but it did find a problem
>> and I fixed it.
>> Please review the new code(v57) again.
>>
>>
>>