Re: pg_receivexlog add synchronous mode - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: pg_receivexlog add synchronous mode
Date
Msg-id CAHGQGwEhSdAF2gMmTqVWnnDFRtT40eaSHvbMTcTp29VKr5ej=Q@mail.gmail.com
Whole thread Raw
In response to Re: pg_receivexlog add synchronous mode  (<furuyao@pm.nttdata.co.jp>)
Responses Re: pg_receivexlog add synchronous mode  (<furuyao@pm.nttdata.co.jp>)
List pgsql-hackers
On Thu, Jun 26, 2014 at 7:01 PM,  <furuyao@pm.nttdata.co.jp> wrote:
>> The patch looks somewhat complicated and bugs can be easily introduced
>> because it tries to not only add new feature but also reorganize the main
>> loop in HandleCopyStream at the same time. To keep the patch simple, I'm
>> thinking to firstly apply the attached patch which just refactors the
>> main loop. Then we can apply the main patch, i.e., add new feature.
>> Thought?
> Thank you for the refactoring patch.
> I did a review of the patch.
> As a result, I found the calculation of sleeptime when the --status-intarvall is set to 1 was incorrect.
>
> --status-intarvall 1 -->  sleeptime 1.9999 !?
> --status-intarvall 2 -->  sleeptime 1.9999 OK
> --status-intarvall 3 -->  sleeptime 2.9999 OK

Thanks for the review!

+            if (secs <= 0)
+                secs = 1;    /* Always sleep at least 1 sec */
+
+            sleeptime = secs * 1000 + usecs / 1000;

The above is the code which caused that problem. 'usecs' should have been
reset to zero when 'secs' are rounded up to 1 second. But not. Attached is
the updated version of the patch.

Regards,

--
Fujii Masao

Attachment

pgsql-hackers by date:

Previous
From: Dilip kumar
Date:
Subject: Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]
Next
From: Andres Freund
Date:
Subject: Re: pg_receivexlog add synchronous mode