From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: zhq651@126.com
Subject: BUG #15663: set update_process_title =on/off did not take effect
Date: Sat, 02 Mar 2019 08:01:56 +0000
Message-ID: <15663-326924e96377961d@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15663
Logged by: DamionZ Zhao
Email address: zhq651@126.com
PostgreSQL version: 11.1
Operating system: linux
Description:
1.before setting
=================
postgres=# \! ps ux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
stream 7978 0.0 0.0 125128 2104 pts/4 S+ 13:33 0:00
/data3/damion/stream/run/bin/psql -p 6668 -d postgres -U postgres
stream 7979 0.0 0.0 292452 4840 ? Ss 13:33 0:00 postgres:
postgres postgres [local]
stream 8582 0.0 0.0 151028 1848 pts/4 R+ 13:33 0:00 ps ux
stream 27385 0.0 0.0 291368 16988 pts/6 S Mar01 0:01
/data3/damion/stream/run/bin/postgres -D /data3/damion/stream/data
stream 27387 0.0 0.0 291588 4816 ? Ss Mar01 0:00 postgres:
checkpointer
stream 27388 0.0 0.0 291524 2992 ? Ss Mar01 0:00 postgres:
background writer
stream 27389 0.0 0.0 291480 5852 ? Ss Mar01 0:00 postgres:
walwriter
stream 27390 0.0 0.0 291964 2580 ? Ss Mar01 0:01 postgres:
autovacuum launcher
stream 27391 0.0 0.0 141728 1640 ? Ss Mar01 0:02 postgres:
stats collector
stream 27393 0.0 0.0 291792 2336 ? Ss Mar01 0:00 postgres:
logical replication launcher
stream 27426 0.0 0.0 292456 3320 ? Ss Mar01 0:00 postgres:
walsender replica *.*.137.152(47426) streaming 0/312F240
postgres=# show update_process_title
postgres-# ;
update_process_title
----------------------
off
(1 row)
2.begin to set
==============
postgres=# set update_process_title =on;
SET
postgres=# \! pg_ctl reload
server signaled
postgres=# show update_process_title ;
update_process_title
----------------------
on
(1 row)
postgres=# create table t54(f1 int);
CREATE TABLE
3.check ps-title can be updated?
postgres=# \! ps ux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
stream 7978 0.0 0.0 125128 2244 pts/4 S+ 13:33 0:00
/data3/damion/stream/run/bin/psql -p 6668 -d postgres -U postgres
stream 7979 0.0 0.0 293072 7424 ? Ss 13:33 0:00 postgres:
postgres postgres [local] idle
stream 27385 0.0 0.0 291368 16988 pts/6 S Mar01 0:01
/data3/damion/stream/run/bin/postgres -D /data3/damion/stream/data
stream 27387 0.0 0.0 291588 4816 ? Ss Mar01 0:00 postgres:
checkpointer
stream 27388 0.0 0.0 291524 2996 ? Ss Mar01 0:00 postgres:
background writer
stream 27389 0.0 0.0 291480 5852 ? Ss Mar01 0:00 postgres:
walwriter
stream 27390 0.0 0.0 291964 2580 ? Ss Mar01 0:01 postgres:
autovacuum launcher
stream 27391 0.0 0.0 141728 1640 ? Ss Mar01 0:02 postgres:
stats collector
stream 27393 0.0 0.0 291792 2336 ? Ss Mar01 0:00 postgres:
logical replication launcher
stream 27426 0.0 0.0 292456 3320 ? Ss Mar01 0:00 postgres:
walsender replica 100.95.137.152(47426) streaming 0/312F240
lsn is still as before (streaming 0/312F240) in ps-title .
but will be ok, when modify postgres.conf and reload.
I find the following code in guc.c
{"update_process_title", PGC_SUSET, PROCESS_TITLE,
gettext_noop("Updates the process title to show the active SQL
command."),
gettext_noop("Enables updating of the process title every time a new SQL
command is received by the server.")
},
PGC_SUSET means user can modify it online. Yes, it's true by showing
update_process_title command.
but did not take effect. so I add debug-log in walsender.c like this:
/* Report progress of XLOG streaming in PS display */
if (update_process_title)
{
char activitymsg[50];
ereport(NOTICE,
(errmsg("xxxxxxxx update_process_title is
true.")));
snprintf(activitymsg, sizeof(activitymsg), "streaming
%X/%X",
(uint32) (sentPtr >> 32), (uint32)
sentPtr);
set_ps_display(activitymsg, false);
}
and test it like this
-------------------
postgres=# create table t8(f1 int);
CREATE TABLE
2019-03-02 15:53:36.621 CST [18452] NOTICE: xxxxxxxx update_process_title
is true.
postgres=# 2019-03-02 15:53:36.800 CST [24102] DEBUG: autovacuum:
processing database "postgres"
postgres=# 2019-03-02 15:53:38.531 CST [18452] NOTICE: xxxxxxxx
update_process_title is true.
postgres=# set update_process_title =off;
SET
postgres=# show update_process_title
postgres-# ;
update_process_title
----------------------
off
(1 row)
postgres=# create table t9(f1 int);
CREATE TABLE
2019-03-02 15:54:00.779 CST [18452] NOTICE: xxxxxxxx update_process_title
is true.
so not matter update_process_title is off or on, the global variable
update_process_title value is always true.
Is it reasonable???
4. other test
============
when I modify update_process_title in postgres.conf and pg_ctl reload. it
will take effect.
so its behavior is same as PGC_SIGHUP. It's so confusing.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, zhq651@126.com
Subject: Re: BUG #15663: set update_process_title =on/off did not take effect
In-Reply-To: <15663-326924e96377961d@postgresql.org>
References: <15663-326924e96377961d@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