Simon Riggs <simon(at)2ndquadrant(dot)com> writes:
> LWLockAcquire(WALInsertLock, LW_EXCLUSIVE)
> Reserve space to write into.
> LSN = current Insert pointer
> Move pointer forward by length of data to be inserted, acquiring
> WALWriteLock if required to ensure space is available.
I think you've handwaved over how you'll avoid self-deadlock
in the case where the WAL record exceeds the size of wal_buffers.
Assuming that that can be fixed without too much ugliness,
it seems worth trying.
regards, tom lane