[PATCH] pgbench: Remove ecnt, a member variable of CState

Started by miyake_koutaalmost 5 years ago5 messages
#1miyake_kouta
miyake_kouta@oss.nttdata.com
1 attachment(s)

Hi.

I created a patch to remove ecnt which is a member variable of CState.
This variable is incremented in some places, but it's not used for any
purpose.
Also, the current pgbench's client abandons processing after hitting
error, so this variable is no need, I think.

Regards
--
Kota Miyake

Attachments:

remove_ecnt.patchtext/x-diff; name=remove_ecnt.patchDownload
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 627a244fb7..31a4df45f5 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -427,7 +427,6 @@ typedef struct
 
 	/* per client collected stats */
 	int64		cnt;			/* client transaction count, for -t */
-	int			ecnt;			/* error count */
 } CState;
 
 /*
@@ -2716,7 +2715,6 @@ sendCommand(CState *st, Command *command)
 	if (r == 0)
 	{
 		pg_log_debug("client %d could not send %s", st->id, command->argv[0]);
-		st->ecnt++;
 		return false;
 	}
 	else
@@ -2828,14 +2826,12 @@ readCommandResponse(CState *st, MetaCommand meta, char *varprefix)
 	if (qrynum == 0)
 	{
 		pg_log_error("client %d command %d: no results", st->id, st->command);
-		st->ecnt++;
 		return false;
 	}
 
 	return true;
 
 error:
-	st->ecnt++;
 	PQclear(res);
 	PQclear(next_res);
 	do
#2Michael Paquier
michael@paquier.xyz
In reply to: miyake_kouta (#1)
Re: [PATCH] pgbench: Remove ecnt, a member variable of CState

On Fri, Feb 26, 2021 at 05:39:31PM +0900, miyake_kouta wrote:

Also, the current pgbench's client abandons processing after hitting error,
so this variable is no need, I think.

Agreed. Its last use was in 12788ae, as far as I can see. So let's
just cleanup that.
--
Michael

#3Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Michael Paquier (#2)
Re: [PATCH] pgbench: Remove ecnt, a member variable of CState

On 2021-Feb-26, Michael Paquier wrote:

On Fri, Feb 26, 2021 at 05:39:31PM +0900, miyake_kouta wrote:

Also, the current pgbench's client abandons processing after hitting error,
so this variable is no need, I think.

Agreed. Its last use was in 12788ae, as far as I can see. So let's
just cleanup that.

+1

--
�lvaro Herrera Valdivia, Chile

#4Michael Paquier
michael@paquier.xyz
In reply to: Alvaro Herrera (#3)
Re: [PATCH] pgbench: Remove ecnt, a member variable of CState

On Fri, Feb 26, 2021 at 04:36:41PM -0300, Alvaro Herrera wrote:

+1

Thanks, done.
--
Michael

#5miyake_kouta
miyake_kouta@oss.nttdata.com
In reply to: Michael Paquier (#4)
Re: [PATCH] pgbench: Remove ecnt, a member variable of CState

2021-02-28 08:06, Michael Paquier wrote:

On Fri, Feb 26, 2021 at 04:36:41PM -0300, Alvaro Herrera wrote:

+1

Thanks, done.
--
Michael

Thanks for reviewing and committing this patch!

Regards
--
Kota Miyake