Re: pg_receivexlog and feedback message - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: pg_receivexlog and feedback message
Date
Msg-id CAHGQGwGhd=XXhtze4fmBNE5-RKS7c0-u6ck7RUwcMHVPpCWXEw@mail.gmail.com
Whole thread Raw
In response to Re: pg_receivexlog and feedback message  (Magnus Hagander <magnus@hagander.net>)
Responses Re: pg_receivexlog and feedback message
List pgsql-hackers
On Sun, Jun 10, 2012 at 7:55 PM, Magnus Hagander <magnus@hagander.net> wrote:
> How about this?

+                /*
+                 * Set flushed position to the last byte in the previous
+                 * file. Per above we know that xrecoff%XLOG_SEG_SIZE=0
+                 */
+                flushedpos = blockpos;
+                if (flushedpos.xrecoff == 0)
+                {
+                    flushedpos.xlogid--;
+                    flushedpos.xrecoff = XLogFileSize-1;
+                }
+                else
+                    flushedpos.xrecoff--;

flushedpos.xrecoff doesn't need to be decremented by one.
If xrecoff % XLOG_SEG_SIZE = 0, the position should be the last
byte of previous (i.e., flushed) WAL file.

Regards,

-- 
Fujii Masao


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: log_newpage header comment
Next
From: "Kevin Grittner"
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Add ERROR msg for GLOBAL/LOCAL TEMP is not yet implemented