[RFC] Should smgrtruncate() avoid sending sinval message for temp relations

From: "MauMau" <maumau307(at)gmail(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: [RFC] Should smgrtruncate() avoid sending sinval message for temp relations
Date: 2014-07-23 14:42:26
Message-ID: 5CF4ABBA67674088B3941894E22A0D25@maumau
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

I'm investigating a mysterious hang problem on PostgreSQL 9.2.8. If many
sessions use temporary tables whose rows are deleted on commit, the hang
occurs. I'd like to show you the stack trace, but I'm trying to figure out
how to reproduce the problem. IIRC, the stack trace was as follows. The
standby server was running normally.

...
SyncRepWaitForLSN
CommitTransaction
CommitTransactionCommand
ProcessCatchupEvent
HandleCatchupInterrupt
procsignal_sigusr1_handler
<SIGUSR1 received>
recv
...
ReadCommand
PostgresMain
...

Looking at smgrtruncate(), the sinval message is sent even when the
truncated relation is a temporary relation. However, I think the sinval
message is not necessary for temp relations, because each session doesn't
see the temp relations of other sessions. So, the following code seems
better. This avoids sinval queue overflow which leads to SIGUSR1. Is this
correct?

if (SmgrIsTemp(reln))
/* Do his on behalf of sinval message handler */
smgrclosenode(reln->smgr_rnode);
else
CacheInvalidateSmgr(reln->smgr_rnode);

Regards
MauMau

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-07-23 14:55:05 Re: PDF builds broken again
Previous Message Michael Paquier 2014-07-23 14:26:58 Re: Inconsistencies of service failure handling on Windows