diff options
Diffstat (limited to 'src/backend/replication/logical/message.c')
-rw-r--r-- | src/backend/replication/logical/message.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/backend/replication/logical/message.c b/src/backend/replication/logical/message.c index c5de14afc65..b5d29382f54 100644 --- a/src/backend/replication/logical/message.c +++ b/src/backend/replication/logical/message.c @@ -44,9 +44,10 @@ */ XLogRecPtr LogLogicalMessage(const char *prefix, const char *message, size_t size, - bool transactional) + bool transactional, bool flush) { xl_logical_message xlrec; + XLogRecPtr lsn; /* * Force xid to be allocated if we're emitting a transactional message. @@ -71,7 +72,15 @@ LogLogicalMessage(const char *prefix, const char *message, size_t size, /* allow origin filtering */ XLogSetRecordFlags(XLOG_INCLUDE_ORIGIN); - return XLogInsert(RM_LOGICALMSG_ID, XLOG_LOGICAL_MESSAGE); + lsn = XLogInsert(RM_LOGICALMSG_ID, XLOG_LOGICAL_MESSAGE); + + /* + * Make sure that the message hits disk before leaving if emitting a + * non-transactional message when flush is requested. + */ + if (!transactional && flush) + XLogFlush(lsn); + return lsn; } /* |