aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2020-03-11 16:36:40 +0100
committerPeter Eisentraut <peter@eisentraut.org>2020-03-11 16:38:31 +0100
commitbf68b79e50e3359accc85c94fa23cc03abb9350a (patch)
tree0b09b97eec0aa5978ab073e580cf97a51014dd66 /src/backend/tcop/postgres.c
parent899a04f5ed61c3db7a2bd84957ecf530c09fd05a (diff)
downloadpostgresql-bf68b79e50e3359accc85c94fa23cc03abb9350a.tar.gz
postgresql-bf68b79e50e3359accc85c94fa23cc03abb9350a.zip
Refactor ps_status.c API
The init_ps_display() arguments were mostly lies by now, so to match typical usage, just use one argument and let the caller assemble it from multiple sources if necessary. The only user of the additional arguments is BackendInitialize(), which was already doing string assembly on the caller side anyway. Remove the second argument of set_ps_display() ("force") and just handle that in init_ps_display() internally. BackendInitialize() also used to set the initial status as "authentication", but that was very far from where authentication actually happened. So now it's set to "initializing" and then "authentication" just before the actual call to ClientAuthentication(). Reviewed-by: Julien Rouhaud <rjuju123@gmail.com> Reviewed-by: Kuntal Ghosh <kuntalghosh.2007@gmail.com> Reviewed-by: Alvaro Herrera <alvherre@2ndquadrant.com> Discussion: https://www.postgresql.org/message-id/flat/c65e5196-4f04-4ead-9353-6088c19615a3@2ndquadrant.com
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 9dba3b0566a..00c77b66c74 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -1081,7 +1081,7 @@ exec_simple_query(const char *query_string)
*/
commandTag = CreateCommandTag(parsetree->stmt);
- set_ps_display(GetCommandTagName(commandTag), false);
+ set_ps_display(GetCommandTagName(commandTag));
BeginCommand(commandTag, dest);
@@ -1365,7 +1365,7 @@ exec_parse_message(const char *query_string, /* string to execute */
pgstat_report_activity(STATE_RUNNING, query_string);
- set_ps_display("PARSE", false);
+ set_ps_display("PARSE");
if (save_log_statement_stats)
ResetUsage();
@@ -1656,7 +1656,7 @@ exec_bind_message(StringInfo input_message)
pgstat_report_activity(STATE_RUNNING, psrc->query_string);
- set_ps_display("BIND", false);
+ set_ps_display("BIND");
if (save_log_statement_stats)
ResetUsage();
@@ -2099,7 +2099,7 @@ exec_execute_message(const char *portal_name, long max_rows)
pgstat_report_activity(STATE_RUNNING, sourceText);
- set_ps_display(GetCommandTagName(portal->commandTag), false);
+ set_ps_display(GetCommandTagName(portal->commandTag));
if (save_log_statement_stats)
ResetUsage();
@@ -4175,7 +4175,7 @@ PostgresMain(int argc, char *argv[],
{
if (IsAbortedTransactionBlockState())
{
- set_ps_display("idle in transaction (aborted)", false);
+ set_ps_display("idle in transaction (aborted)");
pgstat_report_activity(STATE_IDLEINTRANSACTION_ABORTED, NULL);
/* Start the idle-in-transaction timer */
@@ -4188,7 +4188,7 @@ PostgresMain(int argc, char *argv[],
}
else if (IsTransactionOrTransactionBlock())
{
- set_ps_display("idle in transaction", false);
+ set_ps_display("idle in transaction");
pgstat_report_activity(STATE_IDLEINTRANSACTION, NULL);
/* Start the idle-in-transaction timer */
@@ -4215,7 +4215,7 @@ PostgresMain(int argc, char *argv[],
pgstat_report_stat(false);
- set_ps_display("idle", false);
+ set_ps_display("idle");
pgstat_report_activity(STATE_IDLE, NULL);
}
@@ -4365,7 +4365,7 @@ PostgresMain(int argc, char *argv[],
/* Report query to various monitoring facilities. */
pgstat_report_activity(STATE_FASTPATH, NULL);
- set_ps_display("<FASTPATH>", false);
+ set_ps_display("<FASTPATH>");
/* start an xact for this function invocation */
start_xact_command();