Make both WAL SMGR function arguments symmetric

Only the read took the segment size while both writing and reading
actually needs it. Either both or neither should take it as an argument.
pull/238/head
Andreas Karlsson 2 months ago committed by Andreas Karlsson
parent d9403cbb49
commit 3d43051138
  1. 6
      contrib/pg_tde/src/access/pg_tde_xlog_smgr.c
  2. 4
      src/backend/access/transam/xlog.c
  3. 2
      src/backend/replication/walreceiver.c
  4. 4
      src/include/access/xlog_smgr.h
  5. 2
      src/include/pg_config_manual.h

@ -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); TimeLineID tli, XLogSegNo segno, int segSize);
static ssize_t tdeheap_xlog_seg_write(int fd, const void *buf, size_t count, static ssize_t tdeheap_xlog_seg_write(int fd, const void *buf, size_t count,
off_t offset, TimeLineID tli, off_t offset, TimeLineID tli,
XLogSegNo segno); XLogSegNo segno, int segSize);
static const XLogSmgr tde_xlog_smgr = { static const XLogSmgr tde_xlog_smgr = {
.seg_read = tdeheap_xlog_seg_read, .seg_read = tdeheap_xlog_seg_read,
@ -217,7 +217,7 @@ TDEXLogSmgrInitWrite(bool encrypt_xlog)
static ssize_t static ssize_t
tdeheap_xlog_seg_write(int fd, const void *buf, size_t count, off_t offset, 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 #ifndef FRONTEND
@ -231,7 +231,7 @@ tdeheap_xlog_seg_write(int fd, const void *buf, size_t count, off_t offset,
{ {
XLogRecPtr lsn; 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); pg_tde_wal_last_key_set_lsn(lsn, EncryptionState->db_map_path);
EncryptionKey.start_lsn = lsn; EncryptionKey.start_lsn = lsn;

@ -2446,7 +2446,7 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible)
INSTR_TIME_SET_ZERO(start); INSTR_TIME_SET_ZERO(start);
pgstat_report_wait_start(WAIT_EVENT_WAL_WRITE); 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(); pgstat_report_wait_end();
/* /*
@ -3491,7 +3491,7 @@ XLogFileCopy(TimeLineID destTLI, XLogSegNo destsegno,
} }
errno = 0; errno = 0;
pgstat_report_wait_start(WAIT_EVENT_WAL_COPY_WRITE); 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; int save_errno = errno;

@ -944,7 +944,7 @@ XLogWalRcvWrite(char *buf, Size nbytes, XLogRecPtr recptr, TimeLineID tli)
byteswritten = xlog_smgr->seg_write(recvFile, buf, segbytes, byteswritten = xlog_smgr->seg_write(recvFile, buf, segbytes,
(off_t) startoff, recvFileTLI, (off_t) startoff, recvFileTLI,
recvSegNo); recvSegNo, wal_segment_size);
if (byteswritten <= 0) if (byteswritten <= 0)
{ {
char xlogfname[MAXFNAMELEN]; char xlogfname[MAXFNAMELEN];

@ -12,12 +12,12 @@ typedef struct XLogSmgr
TimeLineID tli, XLogSegNo segno, int segSize); TimeLineID tli, XLogSegNo segno, int segSize);
ssize_t (*seg_write) (int fd, const void *buf, size_t count, off_t offset, 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; } XLogSmgr;
static inline ssize_t static inline ssize_t
default_seg_write(int fd, const void *buf, size_t count, off_t offset, 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); return pg_pwrite(fd, buf, count, offset);
} }

@ -384,4 +384,4 @@
*/ */
/* #define TRACE_SYNCSCAN */ /* #define TRACE_SYNCSCAN */
#define PERCONA_API_VERSION 1 #define PERCONA_API_VERSION 2

Loading…
Cancel
Save