Re: pg_receivexlog --status-interval add fsync feedback - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: pg_receivexlog --status-interval add fsync feedback
Date
Msg-id 20141112190545.GZ1791@alvin.alvh.no-ip.org
Whole thread Raw
In response to Re: pg_receivexlog --status-interval add fsync feedback  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: pg_receivexlog --status-interval add fsync feedback
List pgsql-hackers
Fujii Masao wrote:

> --- 127,152 ----
>            When this option is used, <application>pg_receivexlog</> will report
>            a flush position to the server, indicating when each segment has been
>            synchronized to disk so that the server can remove that segment if it
> !          is not otherwise needed. <literal>--synchronous</literal> option must
> !         be specified when making <application>pg_receivexlog</> run as
> !         synchronous standby by using replication slot. Otherwise WAL data
> !         cannot be flushed frequently enough for this to work correctly.
>           </para>
>         </listitem>
>        </varlistentry>

Whitespace damage here.

> +     printf(_("      --synchronous      flush transaction log in real time\n"));

"in real time" sounds odd.  How about "flush transaction log
immediately after writing", or maybe "have transaction log writes be
synchronous".

> --- 781,791 ----
>           now = feGetCurrentTimestamp();
>   
>           /*
> !          * Issue sync command as soon as there are WAL data which
> !          * has not been flushed yet if synchronous option is true.
>            */
>           if (lastFlushPosition < blockpos &&
> !             walfile != -1 && synchronous)

I'd put the "synchronous" condition first in the if(), and start the
comment with it rather than putting it at the end.  Both seem weird.

> --- 793,807 ----
>                           progname, current_walfile_name, strerror(errno));
>                   goto error;
>               }
>               lastFlushPosition = blockpos;
> ! 
> !             /*
> !              * Send feedback so that the server sees the latest WAL locations
> !              * immediately if synchronous option is true.
> !              */
> !             if (!sendFeedback(conn, blockpos, now, false))
> !                 goto error;
> !             last_status = now;

I'm not clear about this comment .. why does it say "if synchronous
option is true" when it's not checking the condition?

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: recovery_target_time and standby_mode
Next
From: Robert Haas
Date:
Subject: Re: group locking: incomplete patch, just for discussion