RelationCreateStorage can orphan files

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: RelationCreateStorage can orphan files
Date: 2010-09-15 22:36:56
Message-ID: AANLkTim5KEU2j0aes75N9PW2Un9J_eHikiA2_gxnoUg+@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I notice that RelationCreateStorage() creates the main fork on disk
before writing (let alone flushing) WAL. So if PG gets killed at that
point, we end up with an orphaned file on disk. I think that we could
even extend the relation a few times before WAL gets written, so I
don't even think it's necessarily a zero-size file. We could perhaps
avoid this by writing and flushing a WAL record that includes the
creating XID before touching the disk; when we replay the record, we
create the file but then delete it if the XID fails to commit before
recovery ends. But I guess maybe our feeling is that it's just not
worth taking a performance hit for this?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Erik Rijkers 2010-09-15 23:12:46 Re: Synchronous replication - patch status inquiry
Previous Message Alvaro Herrera 2010-09-15 22:21:36 Re: autonomous transactions (was Re: TODO note)