Re: [HACKERS] Memory leak with XLogFileCopy since de768844 (WAL file with .partial)

2015-06-30 Thread Michael Paquier
On Wed, Jul 1, 2015 at 10:58 AM, Fujii Masao wrote: > On Tue, Jun 9, 2015 at 10:09 AM, Michael Paquier wrote: >> That's a valid concern. What about the attached then? I think that it >> is still good to keep upto to copy only data up to the switch point at >> recovery exit. InstallXLogFileSegment()

Re: [HACKERS] Memory leak with XLogFileCopy since de768844 (WAL file with .partial)

2015-06-30 Thread Fujii Masao
On Tue, Jun 9, 2015 at 10:09 AM, Michael Paquier wrote: > On Tue, Jun 9, 2015 at 6:25 AM, Heikki Linnakangas wrote: >> I'm still not sure if I should've just reverted that refactoring, to make >> XLogFileCopy() look the same in master and back-branches, which makes >> back-patching easier, or keep

Re: [HACKERS] Memory leak with XLogFileCopy since de768844 (WAL file with .partial)

2015-06-08 Thread Fujii Masao
On Tue, Jun 9, 2015 at 6:25 AM, Heikki Linnakangas wrote: > On 06/08/2015 09:04 PM, Fujii Masao wrote: >> >> On Mon, Jun 8, 2015 at 11:52 AM, Michael Paquier >> wrote: >>> >>> On Fri, Jun 5, 2015 at 10:45 PM, Fujii Masao wrote: Why don't we call InstallXLogFileSegment() at the end of XL

Re: [HACKERS] Memory leak with XLogFileCopy since de768844 (WAL file with .partial)

2015-06-08 Thread Michael Paquier
On Tue, Jun 9, 2015 at 6:25 AM, Heikki Linnakangas wrote: > I'm still not sure if I should've just reverted that refactoring, to make > XLogFileCopy() look the same in master and back-branches, which makes > back-patching easier, or keep the refactoring, because it makes the code > slightly nicer.

Re: [HACKERS] Memory leak with XLogFileCopy since de768844 (WAL file with .partial)

2015-06-08 Thread Heikki Linnakangas
On 06/08/2015 09:04 PM, Fujii Masao wrote: On Mon, Jun 8, 2015 at 11:52 AM, Michael Paquier wrote: On Fri, Jun 5, 2015 at 10:45 PM, Fujii Masao wrote: Why don't we call InstallXLogFileSegment() at the end of XLogFileCopy()? If we do that, the risk of memory leak you're worried will disappear a

Re: [HACKERS] Memory leak with XLogFileCopy since de768844 (WAL file with .partial)

2015-06-08 Thread Fujii Masao
On Mon, Jun 8, 2015 at 11:52 AM, Michael Paquier wrote: > On Fri, Jun 5, 2015 at 10:45 PM, Fujii Masao wrote: >> Why don't we call InstallXLogFileSegment() at the end of XLogFileCopy()? >> If we do that, the risk of memory leak you're worried will disappear at all. > > Yes, that looks fine, XLogFi

Re: [HACKERS] Memory leak with XLogFileCopy since de768844 (WAL file with .partial)

2015-06-07 Thread Michael Paquier
On Fri, Jun 5, 2015 at 10:45 PM, Fujii Masao wrote: > Why don't we call InstallXLogFileSegment() at the end of XLogFileCopy()? > If we do that, the risk of memory leak you're worried will disappear at all. Yes, that looks fine, XLogFileCopy() would copy to a temporary file, then install it definit

Re: [HACKERS] Memory leak with XLogFileCopy since de768844 (WAL file with .partial)

2015-06-05 Thread Fujii Masao
On Fri, Jun 5, 2015 at 12:39 PM, Michael Paquier wrote: > > > On Thu, Jun 4, 2015 at 10:40 PM, Fujii Masao wrote: >> >> On Mon, Jun 1, 2015 at 4:24 PM, Michael Paquier >> wrote: >> > On Thu, May 28, 2015 at 9:09 PM, Michael Paquier >> > wrote: >> >> Since commit de768844, XLogFileCopy of xlog.c

Re: [HACKERS] Memory leak with XLogFileCopy since de768844 (WAL file with .partial)

2015-06-04 Thread Michael Paquier
On Thu, Jun 4, 2015 at 10:40 PM, Fujii Masao wrote: > On Mon, Jun 1, 2015 at 4:24 PM, Michael Paquier > wrote: > > On Thu, May 28, 2015 at 9:09 PM, Michael Paquier > > wrote: > >> Since commit de768844, XLogFileCopy of xlog.c returns to caller a > >> pstrdup'd string that can be used afterwards

Re: [HACKERS] Memory leak with XLogFileCopy since de768844 (WAL file with .partial)

2015-06-04 Thread Fujii Masao
On Mon, Jun 1, 2015 at 4:24 PM, Michael Paquier wrote: > On Thu, May 28, 2015 at 9:09 PM, Michael Paquier > wrote: >> Since commit de768844, XLogFileCopy of xlog.c returns to caller a >> pstrdup'd string that can be used afterwards for other things. >> XLogFileCopy is used in only one place, and

Re: [HACKERS] Memory leak with XLogFileCopy since de768844 (WAL file with .partial)

2015-06-01 Thread Michael Paquier
On Thu, May 28, 2015 at 9:09 PM, Michael Paquier wrote: > Since commit de768844, XLogFileCopy of xlog.c returns to caller a > pstrdup'd string that can be used afterwards for other things. > XLogFileCopy is used in only one place, and it happens that the result > string is never freed at all, leak

[HACKERS] Memory leak with XLogFileCopy since de768844 (WAL file with .partial)

2015-05-28 Thread Michael Paquier
Hi all, Since commit de768844, XLogFileCopy of xlog.c returns to caller a pstrdup'd string that can be used afterwards for other things. XLogFileCopy is used in only one place, and it happens that the result string is never freed at all, leaking memory. Attached is a patch to fix the problem. Rega