One of the reasons for last years Rmgr plugin patch was the idea of a
signalling interface between Primary and Standby nodes. Such a feature
would help in producing further programmatic tests for Hot Standby.
Proposal is to use up the last rmgr id, slot 7: RM_INFO_ID.
Functions would be provided on primary side to send a user-defined
binary message into WAL stream, with a single message type
XLOG_INFO_MSG. (Superuser only, though can be wrapped and given to
trusted users).
On Standby side, we would provide a plugin interface to allow the
message to be read and handled by user-written code. This would then
allow a simple value or notification to be passed to a waiting (polling)
connection on standby. If new LISTEN/NOTIFY gets into 8.5 then this
would be an obvious fit, but I have no need for message passing, just
info passing, so no need to wait for that; something much simpler.
We could do this by adding stuff into Streaming Rep patch, but seems
best to provide a generic interface that lives in the WAL stream itself,
rather than being at a meta level and divorced from the WAL.
This would allow the writing of a test suite that can create certain
conditions on the primary, then send notification of the event to the
standby. Standby would then halt recovery in a precise state while a
user runs an appropriate test.
-- Simon Riggs www.2ndQuadrant.com