]> granicus.if.org Git - postgresql/blobdiff - src/backend/replication/logical/reorderbuffer.c
Change extension of spilled ReorderBufferChange data to ".tmp".
[postgresql] / src / backend / replication / logical / reorderbuffer.c
index 9b55b94227b09686281e347ada53cf9f78563b6d..0d72ac1c791f50a289a06ca432476fda365662a1 100644 (file)
@@ -2421,6 +2421,7 @@ ReorderBufferSerializeChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
 
        ondisk->size = sz;
 
+       errno = 0;
        pgstat_report_wait_start(WAIT_EVENT_REORDER_BUFFER_WRITE);
        if (write(fd, rb->outbuf, ondisk->size) != ondisk->size)
        {
@@ -2764,7 +2765,7 @@ ReorderBufferCleanupSerializedTXNs(const char *slotname)
                        if (unlink(path) != 0)
                                ereport(ERROR,
                                                (errcode_for_file_access(),
-                                                errmsg("could not remove file \"%s\" during removal of pg_replslot/%s/*.xid: %m",
+                                                errmsg("could not remove file \"%s\" during removal of pg_replslot/%s/xid*: %m",
                                                                path, slotname)));
                }
        }
@@ -2784,7 +2785,7 @@ ReorderBufferSerializedPath(char *path, ReplicationSlot *slot, TransactionId xid
 
        XLogSegNoOffsetToRecPtr(segno, 0, wal_segment_size, recptr);
 
-       snprintf(path, MAXPGPATH, "pg_replslot/%s/xid-%u-lsn-%X-%X.snap",
+       snprintf(path, MAXPGPATH, "pg_replslot/%s/xid-%u-lsn-%X-%X.tmp",
                         NameStr(MyReplicationSlot->data.name),
                         xid,
                         (uint32) (recptr >> 32), (uint32) recptr);
@@ -3277,11 +3278,13 @@ ApplyLogicalMappingFile(HTAB *tuplecid_data, Oid relid, const char *fname)
                        new_ent->combocid = ent->combocid;
                }
        }
+
+       CloseTransientFile(fd);
 }
 
 
 /*
- * Check whether the TransactionOId 'xid' is in the pre-sorted array 'xip'.
+ * Check whether the TransactionOid 'xid' is in the pre-sorted array 'xip'.
  */
 static bool
 TransactionIdInArray(TransactionId xid, TransactionId *xip, Size num)