From: Nathan Bossart <nathandbossart@gmail.com>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Peter Eisentraut <peter@eisentraut.org>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: add timing information to pg_upgrade
Date: Wed, 2 Aug 2023 10:39:39 -0700
Message-ID: <20230802173939.GA1142777@nathanxps13> (raw)
In-Reply-To: <20230802160914.GA1025261@nathanxps13>
References: <20230728184735.GC3661419@nathanxps13>
<CALj2ACVVvk1cYLtWVxHv=Z1Ubq=UES9fhKbUU4c9k4W+fEDnbw@mail.gmail.com>
<20230729211418.GA189222@nathanxps13>
<CALj2ACUEkFmk8x8XTuN=ZgEMtQ6zuZP2jDy4Ri-woaL0i1ABfg@mail.gmail.com>
<20230731183702.GA537853@nathanxps13>
<d92952c7-e97d-933e-2558-ebe3708336e8@eisentraut.org>
<20230801154554.GA723589@nathanxps13>
<68c0092c-2d81-68a4-04c5-920bc428feac@eisentraut.org>
<CALj2ACXNN5_pqiHd7CNmsRfT+0duL=tgNiZCqYwALiWiB=YUew@mail.gmail.com>
<20230802160914.GA1025261@nathanxps13>
On Wed, Aug 02, 2023 at 09:09:14AM -0700, Nathan Bossart wrote:
> On Wed, Aug 02, 2023 at 01:02:53PM +0530, Bharath Rupireddy wrote:
>> On Wed, Aug 2, 2023 at 12:45 PM Peter Eisentraut <peter@eisentraut.org> wrote:
>>> I think we should change the output format to be more like initdb, like
>>>
>>> Doing something ... ok
>>>
>>> without horizontally aligning all the "ok"s.
>>
>> While this looks simple, we might end up with a lot of diff and
>> changes after removing MESSAGE_WIDTH. There's a significant part of
>> pg_upgrade code that deals with MESSAGE_WIDTH. I don't think it's
>> worth the effort. Therefore, I'd prefer the simplest possible fix -
>> change the message to '"Checking for \"aclitem\" data type in user
>> tables". It may be an overkill, but we can consider adding
>> Assert(sizeof(message) < MESSAGE_WIDTH) in progress report functions
>> to not encourage new messages to end up in the same formatting issue.
>
> I don't think it's that difficult. ІMO the bigger question is whether we
> want to back-patch such a change to v16 at this point.
Here is a work-in-progress patch that seems to get things pretty close to
what Peter is suggesting.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.comAttachments:0001-work-in-progress-fix-pg_upgrade-output.patch (text/x-diff, 1.9K) download
From 1a8aab9c9c86c8fa140ccdb53d3479a77de0e762 Mon Sep 17 00:00:00 2001
From: Nathan Bossart <nathan@postgresql.org>
Date: Wed, 2 Aug 2023 10:20:11 -0700
Subject: [PATCH 1/1] work-in-progress: fix pg_upgrade output
---
src/bin/pg_upgrade/util.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/bin/pg_upgrade/util.c b/src/bin/pg_upgrade/util.cindex 21ba4c8f12..bea6d7289d 100644--- a/src/bin/pg_upgrade/util.c+++ b/src/bin/pg_upgrade/util.c@@ -50,10 +50,10 @@ end_progress_output(void)
if (log_opts.isatty)
{
printf("\r");
- pg_log(PG_REPORT_NONL, "%-*s", MESSAGE_WIDTH, "");+ pg_log(PG_REPORT_NONL, "%-*s\r ", MESSAGE_WIDTH, "");
}
else if (log_opts.verbose)
- pg_log(PG_REPORT_NONL, "%-*s", MESSAGE_WIDTH, "");+ pg_log(PG_REPORT_NONL, " ");
}
/*
@@ -114,9 +114,6 @@ cleanup_output_dirs(void)
* prep_status
*
* Displays a message that describes an operation we are about to begin.
- * We pad the message out to MESSAGE_WIDTH characters so that all of the- * "ok" and "failed" indicators line up nicely. (Overlength messages- * will be truncated, so don't get too verbose.)
*
* A typical sequence would look like this:
* prep_status("about to flarb the next %d files", fileCount);
@@ -135,8 +132,7 @@ prep_status(const char *fmt,...)
vsnprintf(message, sizeof(message), fmt, args);
va_end(args);
- /* trim strings */- pg_log(PG_REPORT_NONL, "%-*s", MESSAGE_WIDTH, message);+ pg_log(PG_REPORT_NONL, "%s ... ", message);
}
/*
@@ -167,9 +163,9 @@ prep_status_progress(const char *fmt,...)
* put the individual progress items onto the next line.
*/
if (log_opts.isatty || log_opts.verbose)
- pg_log(PG_REPORT, "%-*s", MESSAGE_WIDTH, message);+ pg_log(PG_REPORT, "%s ...", message);
else
- pg_log(PG_REPORT_NONL, "%-*s", MESSAGE_WIDTH, message);+ pg_log(PG_REPORT_NONL, "%s ... ", message);
}
static void
--
2.25.1
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: pgsql-hackers@postgresql.org
Cc: nathandbossart@gmail.com, bharath.rupireddyforpostgres@gmail.com, peter@eisentraut.org
Subject: Re: add timing information to pg_upgrade
In-Reply-To: <20230802173939.GA1142777@nathanxps13>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox