1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

Make walsender more responsive.

Per testing by Andres Freund, this improves replication performance
and reduces replication latency and latency jitter.  I was a bit
concerned about moving more work into XLogInsert, but testing seems
to show that it's not a problem in practice.

Along the way, improve comments for WaitLatchOrSocket.

Andres Freund.  Review and stylistic cleanup by me.
This commit is contained in:
Robert Haas
2012-07-02 09:36:34 -04:00
parent 9ad45c18b6
commit f83b59997d
7 changed files with 59 additions and 36 deletions

View File

@@ -1042,13 +1042,6 @@ EndPrepare(GlobalTransaction gxact)
/* If we crash now, we have prepared: WAL replay will fix things */
/*
* Wake up all walsenders to send WAL up to the PREPARE record immediately
* if replication is enabled
*/
if (max_wal_senders > 0)
WalSndWakeup();
/* write correct CRC and close file */
if ((write(fd, &statefile_crc, sizeof(pg_crc32))) != sizeof(pg_crc32))
{
@@ -2045,13 +2038,6 @@ RecordTransactionCommitPrepared(TransactionId xid,
/* Flush XLOG to disk */
XLogFlush(recptr);
/*
* Wake up all walsenders to send WAL up to the COMMIT PREPARED record
* immediately if replication is enabled
*/
if (max_wal_senders > 0)
WalSndWakeup();
/* Mark the transaction committed in pg_clog */
TransactionIdCommitTree(xid, nchildren, children);
@@ -2132,13 +2118,6 @@ RecordTransactionAbortPrepared(TransactionId xid,
/* Always flush, since we're about to remove the 2PC state file */
XLogFlush(recptr);
/*
* Wake up all walsenders to send WAL up to the ABORT PREPARED record
* immediately if replication is enabled
*/
if (max_wal_senders > 0)
WalSndWakeup();
/*
* Mark the transaction aborted in clog. This is not absolutely necessary
* but we may as well do it while we are here.