summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2015-07-07 13:13:15 +0200
committerAndres Freund <andres@anarazel.de>2015-07-07 13:13:15 +0200
commitcf051c4f9d4e990e5fce0a00bacb47b4e64261d6 (patch)
tree591d6e3e3fde00b01fa38e4827e0db990ddef8e9
parent8022b0a35f7c4e71908a878c8c412b5c2ae8536c (diff)
Fix logical decoding bug leading to inefficient reopening of files.
When spilling transaction data to disk a simple typo caused the output file to be closed and reopened for every serialized change. That happens to not have a huge impact on linux, which is why it probably wasn't noticed so far, but on windows that appears to trigger actual disk writes after every change. Not fun. The bug fortunately does not have any impact besides speed. A change could end up being in the wrong segment (last instead of next), but since we read all files to the end, that's just ugly, not really problematic. It's not a problem to upgrade, since transaction spill files do not persist across restarts. Bug: #13484 Reported-By: Olivier Gosseaume Discussion: 20150703090217.1190.63940@wrigleys.postgresql.org Backpatch to 9.4, where logical decoding was added.
-rw-r--r--src/backend/replication/logical/reorderbuffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index fa98580302a..478c3e874af 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -2009,7 +2009,7 @@ ReorderBufferSerializeTXN(ReorderBuffer *rb, ReorderBufferTXN *txn)
* store in segment in which it belongs by start lsn, don't split over
* multiple segments tho
*/
- if (fd == -1 || XLByteInSeg(change->lsn, curOpenSegNo))
+ if (fd == -1 || !XLByteInSeg(change->lsn, curOpenSegNo))
{
XLogRecPtr recptr;