On 01/06/2015 03:22 PM, Andres Freund wrote:
On 2015-01-05 18:45:22 +0200, Heikki Linnakangas wrote:
On 01/03/2015 08:59 PM, Andres Freund wrote:
Did you perhaps intend to use XLogFileInit(use_existing = true)
instead of XLogFileOpen()? That works for me.

Hmm, that doesn't sound right either. XLogFileInit is used when you switch
to a new segment, not to open an old segment for writing. It happens to
work, because with use_existing = true it will in fact always open the old
segment, instead of creating a new one, but I don't think that's in the
spirit of how that function's intended to be used.

Well, its docs say "Create a new XLOG file segment, or open a
pre-existing one.", so it's not that mismatched. We really don't know
whether the EndOfLog's segment already exist in this scenario.  Also,
doesn't XLogWrite() essentially use it in the same way?

XLogWrite() is smarter. It uses XLogFileInit() when switching to a new segment, and XLogFileOpen when writing to the middle of a segment.

Committed the fix to not open the segment at all.

- Heikki



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to