Re: pg_receivexlog and feedback message

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_receivexlog and feedback message
Date: 2012-06-10 14:02:16
Message-ID: CAHGQGwGhd=XXhtze4fmBNE5-RKS7c0-u6ck7RUwcMHVPpCWXEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jun 10, 2012 at 7:55 PM, Magnus Hagander <magnus(at)hagander(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2012-06-10 14:08:58 Re: pg_basebackup blocking all queries with horrible performance
Previous Message Robert Haas 2012-06-10 13:55:07 Re: log_newpage header comment