aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2012-04-17 16:28:31 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2012-04-17 16:36:59 +0300
commit10fcfada235af6186c9474230483ab0fe5c9610d (patch)
tree20cb0dc6b97c5fb19dbd6c17772c5a88337b80d3 /src
parent79853989c577cc90754d7562363bf802157864ae (diff)
downloadpostgresql-10fcfada235af6186c9474230483ab0fe5c9610d.tar.gz
postgresql-10fcfada235af6186c9474230483ab0fe5c9610d.zip
Don't wait for the commit record to be replicated if we wrote no WAL.
When using synchronous replication, we waited for the commit record to be replicated, but if we our transaction didn't write any other WAL records, that's not required because we don't even flush the WAL locally to disk in that case. This lead to long waits when committing a transaction that only modified a temporary table. Bug spotted by Thom Brown.
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xact.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 7bdf38636b5..901fff059a1 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -1141,7 +1141,8 @@ RecordTransactionCommit(void)
* Note that at this stage we have marked clog, but still show as running
* in the procarray and continue to hold locks.
*/
- SyncRepWaitForLSN(XactLastRecEnd);
+ if (wrote_xlog)
+ SyncRepWaitForLSN(XactLastRecEnd);
/* Reset XactLastRecEnd until the next transaction writes something */
XactLastRecEnd.xrecoff = 0;