Re: Assorted fixes related to WAL files (was: Use XLogFromFileName() in pg_resetwal to parse position from WAL file)

2022-10-04 Thread Michael Paquier
On Tue, Oct 04, 2022 at 06:24:18PM +0530, Bharath Rupireddy wrote: > I'm fine with doing either of these things. Let's hear from others. > > I've added a CF entry - https://commitfest.postgresql.org/40/3927/ About 0002, I am not sure that it is worth bothering. Sure, this wastes a few bytes, but

Re: Assorted fixes related to WAL files (was: Use XLogFromFileName() in pg_resetwal to parse position from WAL file)

2022-10-04 Thread Bharath Rupireddy
On Tue, Oct 4, 2022 at 2:01 PM Kyotaro Horiguchi wrote: > > > 1. 0001 replaces explicit WAL file parsing code with > > Looks good to me. > > > 2. 0002 replaces MAXPGPATH with MAXFNAMELEN for WAL file names. > > Looks reasonable, too. I don't find other instances of the same mistake. Thanks for r

Re: Assorted fixes related to WAL files (was: Use XLogFromFileName() in pg_resetwal to parse position from WAL file)

2022-10-04 Thread Kyotaro Horiguchi
At Tue, 4 Oct 2022 13:20:54 +0530, Bharath Rupireddy wrote in > On Tue, Oct 4, 2022 at 12:11 PM Kyotaro Horiguchi > wrote: > > > > > > > > > static uint32 minXlogTli = 0; > > > > I have found other three instances of this in xlog.c and > > pg_receivewal.c. Do they worth fixing? > > > > (pg_upg

Assorted fixes related to WAL files (was: Use XLogFromFileName() in pg_resetwal to parse position from WAL file)

2022-10-04 Thread Bharath Rupireddy
On Tue, Oct 4, 2022 at 12:11 PM Kyotaro Horiguchi wrote: > > > > > > static uint32 minXlogTli = 0; > > I have found other three instances of this in xlog.c and > pg_receivewal.c. Do they worth fixing? > > (pg_upgarade.c has "uint32 tli/logid/segno but I'm not sure they need > to be "fixed". At l

Re: Use XLogFromFileName() in pg_resetwal to parse position from WAL file

2022-10-03 Thread Kyotaro Horiguchi
At Tue, 04 Oct 2022 15:23:48 +0900 (JST), Kyotaro Horiguchi wrote in > This is not directly related to this patch, pg_resetwal.c has the > following line.. > > > static uint32 minXlogTli = 0; I have found other three instances of this in xlog.c and pg_receivewal.c. Do they worth fixing? (pg_

Re: Use XLogFromFileName() in pg_resetwal to parse position from WAL file

2022-10-03 Thread Michael Paquier
On Tue, Oct 04, 2022 at 03:17:06PM +0900, Kyotaro Horiguchi wrote: > Nice finding. I found a few '%08X%08X's but they don't seem to fit > similar fix. Nice cleanup. > Couldn't we use XLByteToSeg() here? > > Other than that, it looks good to me. Yep. It looks that you're right here. -- Michael

Re: Use XLogFromFileName() in pg_resetwal to parse position from WAL file

2022-10-03 Thread Kyotaro Horiguchi
At Tue, 04 Oct 2022 15:17:06 +0900 (JST), Kyotaro Horiguchi wrote in > Other than that, it looks good to me. Sorry I have another comment. > - unsigned int tli, > - log, > - seg; > +

Re: Use XLogFromFileName() in pg_resetwal to parse position from WAL file

2022-10-03 Thread Bharath Rupireddy
On Tue, Oct 4, 2022 at 11:47 AM Kyotaro Horiguchi wrote: > > > - segs_per_xlogid = (UINT64CONST(0x0001) / > > ControlFile.xlog_seg_size); > > newXlogSegNo = ControlFile.checkPointCopy.redo / > > ControlFile.xlog_seg_size; > > Couldn't we use XLByteToSeg() here? Yes, we cou

Re: Use XLogFromFileName() in pg_resetwal to parse position from WAL file

2022-10-03 Thread Kyotaro Horiguchi
At Tue, 4 Oct 2022 11:06:15 +0530, Bharath Rupireddy wrote in > It looks like there's an opportunity to replace explicit WAL file > parsing code with XLogFromFileName() in pg_resetwal.c. This was not > done then (in PG 10) because the XLogFromFileName() wasn't accepting > file size as an input p

Use XLogFromFileName() in pg_resetwal to parse position from WAL file

2022-10-03 Thread Bharath Rupireddy
Hi, It looks like there's an opportunity to replace explicit WAL file parsing code with XLogFromFileName() in pg_resetwal.c. This was not done then (in PG 10) because the XLogFromFileName() wasn't accepting file size as an input parameter (see [1]) and pg_resetwal needed to use WAL file size from