pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Tatsuo Ishii <ishii@postgresql.org>
To: masao.fujii@oss.nttdata.com
Cc: pgsql-hackers@postgresql.org
Subject: Re: Fix for Extra Parenthesis in pgbench progress message
Date: Wed, 27 Nov 2024 18:41:40 +0900 (JST)
Message-ID: <20241127.184140.897862112615216224.ishii@postgresql.org> (raw )
In-Reply-To: <ffc99be5-e418-40ee-91d6-62c3deb42918@oss.nttdata.com >
References: <95f1100e-e59b-41b7-a406-f865c2e69db7@oss.nttdata.com >
<20241125.083155.1820744655877715597.ishii@postgresql.org >
<ffc99be5-e418-40ee-91d6-62c3deb42918@oss.nttdata.com >
> Yes, I will.
>
> But, the patch didn't apply cleanly to some back branches, so I've
> created
> and attached updated patches for them. Could you review these?
> If they look good, I'll proceed with pushing them.
Sure. The patch for master to v15 look good to me. Unfortunately
v5-0001-pgbench-Ensure-previous-progress-message-is-fully-pg13-14.patch
applies to v14 but does not apply to v13.
$ git checkout REL_13_STABLE
Switched to branch 'REL_13_STABLE'
Your branch is up to date with 'origin/REL_13_STABLE'.
$ git apply ~/v5-0001-pgbench-Ensure-previous-progress-message-is-fully-pg13-14.patch
error: patch failed: src/bin/pgbench/pgbench.c:4222
error: src/bin/pgbench/pgbench.c: patch does not apply
So I created a patch for pg13 using patch command. Attached is the
patch for pg13.
Best reagards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
Attachments:
pgbench_v13.patch (text/x-patch, 2.3K) download
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 6ea89cabc9..6bccacaf86 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -3840,6 +3840,8 @@ initGenerateDataClientSide(PGconn *con)
PGresult *res;
int i;
int64 k;
+ int chars = 0;
+ int prev_chars = 0;
/* used to track elapsed time and estimate of the remaining time */
instr_time start,
@@ -3926,10 +3928,10 @@ initGenerateDataClientSide(PGconn *con)
elapsed_sec = INSTR_TIME_GET_DOUBLE(diff);
remaining_sec = ((double) scale * naccounts - j) * elapsed_sec / j;
- fprintf(stderr, INT64_FORMAT " of " INT64_FORMAT " tuples (%d%%) done (elapsed %.2f s, remaining %.2f s)%c",
- j, (int64) naccounts * scale,
- (int) (((int64) j * 100) / (naccounts * (int64) scale)),
- elapsed_sec, remaining_sec, eol);
+ chars = fprintf(stderr, INT64_FORMAT " of " INT64_FORMAT " tuples (%d%%) done (elapsed %.2f s, remaining %.2f s)",
+ j, (int64) naccounts * scale,
+ (int) (((int64) j * 100) / (naccounts * (int64) scale)),
+ elapsed_sec, remaining_sec);
}
/* let's not call the timing for each row, but only each 100 rows */
else if (use_quiet && (j % 100 == 0))
@@ -3943,14 +3945,24 @@ initGenerateDataClientSide(PGconn *con)
/* have we reached the next interval (or end)? */
if ((j == scale * naccounts) || (elapsed_sec >= log_interval * LOG_STEP_SECONDS))
{
- fprintf(stderr, INT64_FORMAT " of " INT64_FORMAT " tuples (%d%%) done (elapsed %.2f s, remaining %.2f s)%c",
- j, (int64) naccounts * scale,
- (int) (((int64) j * 100) / (naccounts * (int64) scale)), elapsed_sec, remaining_sec, eol);
+ chars = fprintf(stderr, INT64_FORMAT " of " INT64_FORMAT " tuples (%d%%) done (elapsed %.2f s, remaining %.2f s)",
+ j, (int64) naccounts * scale,
+ (int) (((int64) j * 100) / (naccounts * (int64) scale)), elapsed_sec, remaining_sec);
/* skip to the next interval */
log_interval = (int) ceil(elapsed_sec / LOG_STEP_SECONDS);
}
}
+
+ /*
+ * If the previous progress message is longer than the current one,
+ * add spaces to the current line to fully overwrite any remaining
+ * characters from the previous message.
+ */
+ if (prev_chars > chars)
+ fprintf(stderr, "%*c", prev_chars - chars, ' ');
+ fputc(eol, stderr);
+ prev_chars = chars;
}
if (eol != '\n')
view thread (24+ messages) latest in thread
Message-ID: <20241127.184140.897862112615216224.ishii@postgresql.org>
Permalink: ../20241127.184140.897862112615216224.ishii@postgresql.org/
Also on: postgresql.org/message-id/20241127.184140.897862112615216224.ishii@postgresql.org
copy link · copy postgr.es · copy git am
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: pgsql-hackers@postgresql.org
Cc: ishii@postgresql.org, masao.fujii@oss.nttdata.com
Subject: Re: Fix for Extra Parenthesis in pgbench progress message
In-Reply-To: <20241127.184140.897862112615216224.ishii@postgresql.org>
* 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