Re: pg_receivexlog add synchronous mode

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: furuyao(at)pm(dot)nttdata(dot)co(dot)jp
Cc: Andres Freund <andres(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_receivexlog add synchronous mode
Date: 2014-06-27 11:10:35
Message-ID: CAHGQGwEhSdAF2gMmTqVWnnDFRtT40eaSHvbMTcTp29VKr5ej=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 26, 2014 at 7:01 PM, <furuyao(at)pm(dot)nttdata(dot)co(dot)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 Content-Type Size
refactor_receivelog_v2.patch text/x-diff 6.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-06-27 11:22:25 Re: pg_receivexlog add synchronous mode
Previous Message Dilip kumar 2014-06-27 11:10:00 Re: TODO : Allow parallel cores to be used by vacuumdb [ WIP ]