Re: pgsql: pg_rewind: Fetch small files according to new size. - Mailing list pgsql-committers

From Alvaro Herrera
Subject Re: pgsql: pg_rewind: Fetch small files according to new size.
Date
Msg-id 202204060844.l7zjinlqcwoq@alvherre.pgsql
Whole thread Raw
In response to Re: pgsql: pg_rewind: Fetch small files according to new size.  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-committers
On 2022-Apr-05, Daniel Gustafsson wrote:

> local_source.c:118:15: error: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka
'unsignedint') [-Werror,-Wformat]
 
>                                  srcpath, len, written_len);
>                                  ~~~~~~~~~^~~~~~~~~~~~~~~~~
> 
> I'm running a fixup with casting to int and printing with %d (like how
> pg_rewind.c:digestControlFile already does it for printing a size_t) through CI
> just to be sure and will push once it's had a green run:
> 
> -               pg_fatal("size of source file \"%s\" changed concurrently: " UINT64_FORMAT " bytes expected, "
UINT64_FORMAT" copied",
 
> -                                srcpath, len, written_len);
> +               pg_fatal("size of source file \"%s\" changed concurrently: %d bytes expected, %d copied",
> +                                srcpath, (int) len, (int) written_len);

Hmm, it is typical to cast file sizes to long long and print with %lld.
See d914eb347fcd for a recent example.

.. oh, I see you pushed already.  Not sure this is worth fixing, since
the original commit message claimed to involve only "small files".

I suppose having a non-relation-file in the datadir that's bigger than
4GB is not expected?

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
Essentially, you're proposing Kevlar shoes as a solution for the problem
that you want to walk around carrying a loaded gun aimed at your foot.
(Tom Lane)



pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Fix unsigned output format in SLRU error reporting
Next
From: Daniel Gustafsson
Date:
Subject: Re: pgsql: pg_rewind: Fetch small files according to new size.