pgsql: Refactor WAL segment copying code. - Mailing list pgsql-committers

From Fujii Masao
Subject pgsql: Refactor WAL segment copying code.
Date
Msg-id E1Z21Oz-0001ir-Vk@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Refactor WAL segment copying code.

* Remove unused argument "dstfname" and related code from XLogFileCopy().

* Previously XLogFileCopy() returned a pstrdup'd string so that
InstallXLogFileSegment() used it later. Since the pstrdup'd string was never
free'd, there could be a risk of memory leak. It was almost harmless because
the startup process exited just after calling XLogFileCopy(), it existed.
This commit changes XLogFileCopy() so that it directly calls
InstallXLogFileSegment() and doesn't call pstrdup() at all. Which fixes that
memory leak problem.

* Extend InstallXLogFileSegment() so that the caller can specify the log level.
Which allows us to emit an error when InstallXLogFileSegment() fails a disk
file access like link() and rename(). Previously it was always logged with
LOG level and additionally needed to be logged with ERROR when we wanted
to treat it as an error.

Michael Paquier

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7abc68597436da1475b4d9b08f4fa9f3c5ed6185

Modified Files
--------------
src/backend/access/transam/xlog.c |   54 ++++++++++++-------------------------
1 file changed, 17 insertions(+), 37 deletions(-)


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: Allow HotStandbyActiveInReplay() to be called in single user mod
Next
From: Alvaro Herrera
Date:
Subject: pgsql: Fix typos