Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit fe546f3

Browse files
committed
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.
1 parent cf714c8 commit fe546f3

File tree

1 file changed

+2
-1
lines changed
  • src/backend/access/transam

1 file changed

+2
-1
lines changed

src/backend/access/transam/xact.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,8 @@ RecordTransactionCommit(void)
11681168
* Note that at this stage we have marked clog, but still show as running
11691169
* in the procarray and continue to hold locks.
11701170
*/
1171-
SyncRepWaitForLSN(XactLastRecEnd);
1171+
if (wrote_xlog)
1172+
SyncRepWaitForLSN(XactLastRecEnd);
11721173

11731174
/* Reset XactLastRecEnd until the next transaction writes something */
11741175
XactLastRecEnd.xrecoff = 0;

0 commit comments

Comments
 (0)