Re: pg_receivexlog and feedback message

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_receivexlog and feedback message
Date: 2012-06-11 13:04:42
Message-ID: CABUevEybb_XOrzxffQU3F57pLkCA=sKjBYjQsYhu6b9hktbR0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jun 10, 2012 at 4:02 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> 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.

Hmm. I thikn I confused myself with "last byte written" vs "current
position". And we're dealing with current position here...

So it should just be flushedpos = blockpos and be done with it, right?

Though before I commit anything with this, we need to decide what to
wrt syncrep on that, per the other thread.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2012-06-11 13:19:12 Re: pg_basebackup blocking all queries with horrible performance
Previous Message Magnus Hagander 2012-06-11 13:01:52 Re: pg_basebackup --xlog compatibility break