diff --git a/contrib/pg_tde/src/access/pg_tde_xlog_smgr.c b/contrib/pg_tde/src/access/pg_tde_xlog_smgr.c index 86723fdf4e5..e351b218cf8 100644 --- a/contrib/pg_tde/src/access/pg_tde_xlog_smgr.c +++ b/contrib/pg_tde/src/access/pg_tde_xlog_smgr.c @@ -32,7 +32,7 @@ static ssize_t tdeheap_xlog_seg_read(int fd, void *buf, size_t count, off_t offs TimeLineID tli, XLogSegNo segno, int segSize); static ssize_t tdeheap_xlog_seg_write(int fd, const void *buf, size_t count, off_t offset, TimeLineID tli, - XLogSegNo segno); + XLogSegNo segno, int segSize); static const XLogSmgr tde_xlog_smgr = { .seg_read = tdeheap_xlog_seg_read, @@ -217,7 +217,7 @@ TDEXLogSmgrInitWrite(bool encrypt_xlog) static ssize_t tdeheap_xlog_seg_write(int fd, const void *buf, size_t count, off_t offset, - TimeLineID tli, XLogSegNo segno) + TimeLineID tli, XLogSegNo segno, int segSize) { #ifndef FRONTEND @@ -231,7 +231,7 @@ tdeheap_xlog_seg_write(int fd, const void *buf, size_t count, off_t offset, { XLogRecPtr lsn; - XLogSegNoOffsetToRecPtr(segno, offset, wal_segment_size, lsn); + XLogSegNoOffsetToRecPtr(segno, offset, segSize, lsn); pg_tde_wal_last_key_set_lsn(lsn, EncryptionState->db_map_path); EncryptionKey.start_lsn = lsn; diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index c1d7988066f..e0e8d2daf00 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2446,7 +2446,7 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) INSTR_TIME_SET_ZERO(start); pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); - written = xlog_smgr->seg_write(openLogFile, from, nleft, startoffset, tli, openLogSegNo); + written = xlog_smgr->seg_write(openLogFile, from, nleft, startoffset, tli, openLogSegNo, wal_segment_size); pgstat_report_wait_end(); /* @@ -3491,7 +3491,7 @@ XLogFileCopy(TimeLineID destTLI, XLogSegNo destsegno, } errno = 0; pgstat_report_wait_start(WAIT_EVENT_WAL_COPY_WRITE); - if ((int) xlog_smgr->seg_write(fd, buffer.data, sizeof(buffer), offset, destTLI, destsegno) != (int) sizeof(buffer)) + if ((int) xlog_smgr->seg_write(fd, buffer.data, sizeof(buffer), offset, destTLI, destsegno, wal_segment_size) != (int) sizeof(buffer)) { int save_errno = errno; diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c index 973ef75f138..7cdfe1a6487 100644 --- a/src/backend/replication/walreceiver.c +++ b/src/backend/replication/walreceiver.c @@ -944,7 +944,7 @@ XLogWalRcvWrite(char *buf, Size nbytes, XLogRecPtr recptr, TimeLineID tli) byteswritten = xlog_smgr->seg_write(recvFile, buf, segbytes, (off_t) startoff, recvFileTLI, - recvSegNo); + recvSegNo, wal_segment_size); if (byteswritten <= 0) { char xlogfname[MAXFNAMELEN]; diff --git a/src/include/access/xlog_smgr.h b/src/include/access/xlog_smgr.h index 808a07f502f..b1f7c4c425f 100644 --- a/src/include/access/xlog_smgr.h +++ b/src/include/access/xlog_smgr.h @@ -12,12 +12,12 @@ typedef struct XLogSmgr TimeLineID tli, XLogSegNo segno, int segSize); ssize_t (*seg_write) (int fd, const void *buf, size_t count, off_t offset, - TimeLineID tli, XLogSegNo segno); + TimeLineID tli, XLogSegNo segno, int segSize); } XLogSmgr; static inline ssize_t default_seg_write(int fd, const void *buf, size_t count, off_t offset, - TimeLineID tli, XLogSegNo segno) + TimeLineID tli, XLogSegNo segno, int segSize) { return pg_pwrite(fd, buf, count, offset); } diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h index 78353b03d70..588d6e987cd 100644 --- a/src/include/pg_config_manual.h +++ b/src/include/pg_config_manual.h @@ -384,4 +384,4 @@ */ /* #define TRACE_SYNCSCAN */ -#define PERCONA_API_VERSION 1 +#define PERCONA_API_VERSION 2