public inbox for [email protected]  
help / color / mirror / Atom feed
From: Drouvot, Bertrand <[email protected]>
To: Kyotaro Horiguchi <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Subject: Re: more descriptive message for process termination due to max_slot_wal_keep_size
Date: Wed, 7 Sep 2022 12:16:29 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

Hi,

On 9/7/22 4:20 AM, Kyotaro Horiguchi wrote:
> (I noticed I sent a wrong version..)
>
> At Tue, 6 Sep 2022 10:54:35 +0200, "Drouvot, Bertrand"<[email protected]>  wrote in
>> Thanks for the new patch version!. I did not realized (sorry about
>> that) that we'd need to expose byte_size_pretty(). Now I wonder if we
> I didn't think we need the units larger than MB, but I used
> pretty_print to prevent small number from rounding to exactly zero.

Yeah makes sense.

Also, rounding to zero wouldn't occur with "just" displaying "oldestLSN 
- restart_lsn" (as proposed upthread).

> On
> the other hand, in typical cases it is longer than 6 digits in bytes,
> which is a bit hard to read a glance.

Yeah right, but that's already the case in some part of the code, like 
for example in arrayfuncs.c:

                 ereport(ERROR,
                         (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
                          errmsg("array size exceeds the maximum allowed 
(%d)",
                                 (int) MaxAllocSize)));

>> LOG:  terminating process 16034 to release replication slot "rep1" because its restart_lsn 0/3158000 exceeds the limit by 15368192 bytes
>> should not simply report the number of bytes (like I can see it is
>> done in many places). So something like:
> ..
>> + (errmsg("terminating process %d to release replication slot \"%s\"
>> because its restart_lsn %X/%X exceeds the limit by %lu bytes",
> ..
>> and then forget about exposing/using byte_size_pretty() (that would be
>> more consistent with the same kind of reporting in the existing code).
>>
>> What do you think?
> An alterntive would be rounding up to the whole MB, or a sub-MB.
>
>>         ereport(LOG,
>>             (errmsg("terminating process %d to release replication slot \"%s\" because its restart_lsn %X/%X exceeds the limit by %.1lf MB",
>>                 active_pid, NameStr(slotname),
>>                 LSN_FORMAT_ARGS(restart_lsn),
>>                 /* round-up at sub-MB */
>>                 ceil((double) (oldestLSN - restart_lsn) / 1024 / 102.4) / 10),

typo "/ 102.4" ?

>> LOG:  terminating process 49539 to release replication slot "rep1" because its restart_lsn 0/3038000 exceeds the limit by 15.8 MB
> If the distance were 1 byte, it is shown as "0.1 MB".

Right and I'm -1 on it, I think we should stick to the "pretty" or the 
"bytes only" approach (my preference being the bytes only one).

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services:https://aws.amazon.com


view thread (26+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: more descriptive message for process termination due to max_slot_wal_keep_size
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox