Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qRFpC-001405-Rp for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Aug 2023 17:39:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qRFpA-006qyr-HY for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Aug 2023 17:39:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qRFpA-006qyj-8K for pgsql-hackers@lists.postgresql.org; Wed, 02 Aug 2023 17:39:52 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qRFp3-000BYP-E3 for pgsql-hackers@postgresql.org; Wed, 02 Aug 2023 17:39:51 +0000 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-686f8614ce5so22017b3a.3 for ; Wed, 02 Aug 2023 10:39:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690997983; x=1691602783; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=ZZA/1kj6L0quhxPJbHi3XH9bU45hrjJgQ1Ek9hHtbY4=; b=Yixo0Djfj53hcBKDjKNoWPGY+Iro2XEtA7DrOQiQ5K3nS5EbWc4B+xytzhpUeYTzB6 6D9gfnHWQOz5erh/obgZdnBtZ+ABB+KFbht4SzRJhi0EPgrcjpzgNRSNUW2znMvohvej 4AOVCn21zNcAjKpno9zhiFK7g2k9irNHd7wGZ4w4IvVxGGBES6NxV1ofsx+rqc73Tg3n u7UFG7bihtwMXN5/6gJi6ccTbRqFYQA6n5qqZNfIJuVVdwzgty8n7ccGHnCL4lroUBZS 5VtTjLL4dgcRK+tB2orrInAd3KnV09eWUT479Xeby51r1hUoXTZutNvhFuMesPZCTva9 Gkkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690997983; x=1691602783; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZZA/1kj6L0quhxPJbHi3XH9bU45hrjJgQ1Ek9hHtbY4=; b=BIJMnHxt+zn3eP+8v/wTd7r79mDXSXoLNsaZcUbNZkTB9PWJDuQ/O8Ag2sEH8f0TCC IGOqa+DwcjunM6hVcq//wpQZ7A++5sz9qDzb3L3q/3107I3VbBmRl7GqHWdCKbCePtKi Lslno/vmJI7wtkEOpCUZPc2BRXInWJ46jzFpjgELUOLZYEu4RY8bCnRaYF13XR056m+O MMgM4p1K4IbdmO7LVsaX2liJBApTqqcVdO4OY+4ii76nc4KIqGxxppqLZgOWUIlbIeCT E5MdLQuP9EAP1qBRsSsUNC8Z+iOd03umwUfyfOG9LQbiqTO6AyDIHYR8cp21fRx2SbOB dZaw== X-Gm-Message-State: ABy/qLafNboe359XK1ZGgoThDPR7VzOfvGywWfvwsXlC2Aim0T7qt7r1 MfSsthUgPk09T3k5Spw2x/M= X-Google-Smtp-Source: APBJJlGAXdbEkDO42jHls3BLTt+K44tWEe2oF+A9Gl4rd2Jrd5UjdjDFEpoFSLHlgTPWvsnkfb7OLw== X-Received: by 2002:a05:6a20:938b:b0:13e:f5b5:48ee with SMTP id x11-20020a056a20938b00b0013ef5b548eemr3441930pzh.59.1690997982874; Wed, 02 Aug 2023 10:39:42 -0700 (PDT) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id i13-20020aa7908d000000b00682ed27f99dsm11311892pfa.46.2023.08.02.10.39.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 10:39:42 -0700 (PDT) Date: Wed, 2 Aug 2023 10:39:39 -0700 From: Nathan Bossart To: Bharath Rupireddy Cc: Peter Eisentraut , PostgreSQL-development Subject: Re: add timing information to pg_upgrade Message-ID: <20230802173939.GA1142777@nathanxps13> References: <20230728184735.GC3661419@nathanxps13> <20230729211418.GA189222@nathanxps13> <20230731183702.GA537853@nathanxps13> <20230801154554.GA723589@nathanxps13> <68c0092c-2d81-68a4-04c5-920bc428feac@eisentraut.org> <20230802160914.GA1025261@nathanxps13> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="gBBFr7Ir9EOA20Yy" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230802160914.GA1025261@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --gBBFr7Ir9EOA20Yy Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 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.com --gBBFr7Ir9EOA20Yy Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-work-in-progress-fix-pg_upgrade-output.patch" From 1a8aab9c9c86c8fa140ccdb53d3479a77de0e762 Mon Sep 17 00:00:00 2001 From: Nathan Bossart 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.c index 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 --gBBFr7Ir9EOA20Yy--