Re: Strange debug message of walreciver?

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Strange debug message of walreciver?
Date: 2015-03-08 03:29:16
Message-ID: CAFcNs+o5px=e9k4aWCJORwYP4-CXpwiE2bVq1p5tw7udJ1pEOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Mar 7, 2015 at 10:18 PM, Tatsuo Ishii <ishii(at)postgresql(dot)org> wrote:
>
> When I set log_min_messages to debug5 and looked into walreciver log,
> I saw this:
>
> 3600 2015-03-08 09:47:38 JST DEBUG: sendtime 2015-03-08
09:47:38.31493+09 receipttime 2015-03-08 09:47:38.315027+09 replication
apply delay -1945478837 ms tran sfer latency 0 ms
>
> The "replication apply delay -1945478837 ms" part looks strange
> because the delay is below 0. The number is formatted as %d in elog
> call, and I suspect this is kind of integer overflow.
>

Looking at GetReplicationApplyDelay() in walreceiverfuncs.c I noticed that
the integer overflow occurs because sometimes the return of the
GetCurrentChunkReplayStartTime() is 0 (zero).

I added an elog into GetReplicationApplyDelay to check this info:

DEBUG: GetReplicationApplyDelay 479099832 seconds, 352 milliseconds,
(0.000000, 479099832352083.000000)
DEBUG: sendtime 2015-03-08 00:17:12.351987-03 receipttime 2015-03-08
00:17:12.352043-03 replication apply delay -1936504800 ms transfer latency
0 ms
DEBUG: GetReplicationApplyDelay 479099841 seconds, 450 milliseconds,
(0.000000, 479099841450320.000000)
DEBUG: sendtime 2015-03-08 00:17:21.45018-03 receipttime 2015-03-08
00:17:21.450294-03 replication apply delay -1936495702 ms transfer latency
0 ms

Maybe we should check before and return zero from GetReplicationApplyDelay.
The attached patch implement it.

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello

Attachment Content-Type Size
fix_strange_debug_message_in_walreceiver_v1.patch text/x-diff 822 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Karlsson 2015-03-08 04:44:36 Re: BRIN range operator class
Previous Message Sawada Masahiko 2015-03-08 03:19:58 Wrong error message in REINDEX command