> 2020年2月5日 下午10:15,Robert Haas <robertmhaas@gmail.com> 写道:
>
> On Wed, Feb 5, 2020 at 8:21 AM 曾文旌(义从) <wenjing.zwj@alibaba-inc.com> wrote:
>> What do you mean by "catalog buffer"?
>> Yes, cleanup of local temp table requires deletion of correspondent entry from catalog and GTT should not do it.
>> But I am speaking only about cleanup of data files of temp relations. It is done in the same way for local and
globaltemp tables.
>>
>> For native pg, the data file of temp table will not be cleaned up direct after oom happen.
>> Because the orphan local temp table(include catalog, local buffer, datafile) will be cleaned up by deleting the
orphantemp schame in autovacuum.
>> So for GTT ,we cannot do the same with just deleting data files. This is why I dealt with it specifically.
>
> After a crash restart, all temporary relfilenodes (e.g t12345_67890)
> are removed. I think GTTs should use relfilenodes of this general
> form, and then they'll be cleaned up by the existing code. For a
> regular temporary table, there is also the problem of removing the
> catalog entries, but GTTs shouldn't have this problem, because a GTT
> doesn't have any catalog entries for individual sessions, just for the
> main object, which isn't going away just because the system restarted.
> Right?
Wenjing wrote:
I have implemented its processing in global_temporary_table_v10-pg13.patch
When oom happen, all backend will be killed.
Then, I choose to clean up these files(all like t12345_67890) in startup process.
Wenjing
>
>> In my patch autovacuum is prohibited for GTT.
>>
>> But vacuum GTT is not prohibited.
>
> That sounds right to me.
Wenjing wrote:
Also implemented in global_temporary_table_v10-pg13.patch
Wenjing
>
> This thread is getting very hard to follow because neither Konstantin
> nor Wenjing seem to be using the standard method of quoting. When I
> reply, I get the whole thing quoted with "> " but can't easily tell
> the difference between what Wenjing wrote and what Konstantin wrote,
> because both of your mailers are quoting using indentation rather than
> "> " and it gets wiped out by my mailer. Please see if you can get
> your mailer to do what is normally done on this mailing list.
>
> Thanks,
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company