BUG #15663: set update_process_title =on/off did not take effect

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: zhq651(at)126(dot)com
Subject: BUG #15663: set update_process_title =on/off did not take effect
Date: 2019-03-02 08:01:56
Message-ID: 15663-326924e96377961d@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15663
Logged by: DamionZ Zhao
Email address: zhq651(at)126(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-03-02 16:54:51 Re: BUG #15663: set update_process_title =on/off did not take effect
Previous Message Guy Rouillier 2019-03-02 05:19:20 Re: pgAdmin - Download as CSV