Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
370a709c
Commit
370a709c
authored
Jun 27, 2006
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GUC update_process_title to control whether 'ps' display is updated
for every command, default to on.
parent
69d0a15e
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
89 additions
and
52 deletions
+89
-52
doc/src/sgml/config.sgml
doc/src/sgml/config.sgml
+16
-1
src/backend/bootstrap/bootstrap.c
src/backend/bootstrap/bootstrap.c
+2
-3
src/backend/commands/async.c
src/backend/commands/async.c
+3
-3
src/backend/postmaster/autovacuum.c
src/backend/postmaster/autovacuum.c
+3
-4
src/backend/postmaster/pgarch.c
src/backend/postmaster/pgarch.c
+2
-3
src/backend/postmaster/pgstat.c
src/backend/postmaster/pgstat.c
+3
-5
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+4
-4
src/backend/postmaster/syslogger.c
src/backend/postmaster/syslogger.c
+2
-3
src/backend/storage/lmgr/lock.c
src/backend/storage/lmgr/lock.c
+17
-11
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+8
-8
src/backend/utils/misc/guc.c
src/backend/utils/misc/guc.c
+12
-1
src/backend/utils/misc/postgresql.conf.sample
src/backend/utils/misc/postgresql.conf.sample
+3
-0
src/backend/utils/misc/ps_status.c
src/backend/utils/misc/ps_status.c
+9
-3
src/include/utils/ps_status.h
src/include/utils/ps_status.h
+5
-3
No files found.
doc/src/sgml/config.sgml
View file @
370a709c
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.6
7 2006/06/27 19:07:50
momjian Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.6
8 2006/06/27 22:16:43
momjian Exp $ -->
<chapter Id="runtime-config">
<title>Server Configuration</title>
...
...
@@ -2888,6 +2888,21 @@ SELECT * FROM parent WHERE key = 2400;
</listitem>
</varlistentry>
<varlistentry id="guc-update-process-title" xreflabel="update_process_title">
<term><varname>update_process_title</varname> (<type>boolean</type>)</term>
<indexterm>
<primary><varname>update_process_title</> configuration parameter</primary>
</indexterm>
<listitem>
<para>
Enables updating of the process title every time a new SQL command
is received by the server. The process title is typically viewed
by the <command>ps</> command or in Windows using the <application>Process
Explorer</>. Only superusers can change this setting.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-stats-start-collector" xreflabel="stats_start_collector">
<term><varname>stats_start_collector</varname> (<type>boolean</type>)</term>
<indexterm>
...
...
src/backend/bootstrap/bootstrap.c
View file @
370a709c
...
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.21
7 2006/06/18 15:38:36 petere
Exp $
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.21
8 2006/06/27 22:16:43 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -353,8 +353,7 @@ BootstrapMain(int argc, char *argv[])
statmsg
=
"??? process"
;
break
;
}
init_ps_display
(
statmsg
,
""
,
""
);
set_ps_display
(
""
);
init_ps_display
(
statmsg
,
""
,
""
,
""
);
}
/* Acquire configuration parameters, unless inherited from postmaster */
...
...
src/backend/commands/async.c
View file @
370a709c
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.13
1 2006/04/25 14:11:54
momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.13
2 2006/06/27 22:16:43
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -908,7 +908,7 @@ ProcessIncomingNotify(void)
if
(
Trace_notify
)
elog
(
DEBUG1
,
"ProcessIncomingNotify"
);
set_ps_display
(
"notify interrupt"
);
set_ps_display
(
"notify interrupt"
,
false
);
notifyInterruptOccurred
=
0
;
...
...
@@ -979,7 +979,7 @@ ProcessIncomingNotify(void)
*/
pq_flush
();
set_ps_display
(
"idle"
);
set_ps_display
(
"idle"
,
false
);
if
(
Trace_notify
)
elog
(
DEBUG1
,
"ProcessIncomingNotify: done"
);
...
...
src/backend/postmaster/autovacuum.c
View file @
370a709c
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.2
0 2006/06/18 15:38:37 petere
Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.2
1 2006/06/27 22:16:43 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -239,8 +239,7 @@ AutoVacMain(int argc, char *argv[])
MyProcPid
=
getpid
();
/* Identify myself via ps */
init_ps_display
(
"autovacuum process"
,
""
,
""
);
set_ps_display
(
""
);
init_ps_display
(
"autovacuum process"
,
""
,
""
,
""
);
SetProcessingMode
(
InitProcessing
);
...
...
@@ -416,7 +415,7 @@ AutoVacMain(int argc, char *argv[])
*/
InitPostgres
(
db
->
name
,
NULL
);
SetProcessingMode
(
NormalProcessing
);
set_ps_display
(
db
->
name
);
set_ps_display
(
db
->
name
,
false
);
ereport
(
DEBUG1
,
(
errmsg
(
"autovacuum: processing database
\"
%s
\"
"
,
db
->
name
)));
...
...
src/backend/postmaster/pgarch.c
View file @
370a709c
...
...
@@ -19,7 +19,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.2
3 2006/06/18 15:38:37 petere
Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.2
4 2006/06/27 22:16:43 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -244,8 +244,7 @@ PgArchiverMain(int argc, char *argv[])
/*
* Identify myself via ps
*/
init_ps_display
(
"archiver process"
,
""
,
""
);
set_ps_display
(
""
);
init_ps_display
(
"archiver process"
,
""
,
""
,
""
);
pgarch_MainLoop
();
...
...
src/backend/postmaster/pgstat.c
View file @
370a709c
...
...
@@ -13,7 +13,7 @@
*
* Copyright (c) 2001-2006, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.13
1 2006/06/27 03:45:16 alvherre
Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.13
2 2006/06/27 22:16:43 momjian
Exp $
* ----------
*/
#include "postgres.h"
...
...
@@ -1743,8 +1743,7 @@ PgstatCollectorMain(int argc, char *argv[])
/*
* Identify myself via ps
*/
init_ps_display
(
"stats collector process"
,
""
,
""
);
set_ps_display
(
""
);
init_ps_display
(
"stats collector process"
,
""
,
""
,
""
);
/*
* Arrange to write the initial status file right away
...
...
@@ -1975,8 +1974,7 @@ pgstat_recvbuffer(void)
/*
* Identify myself via ps
*/
init_ps_display
(
"stats buffer process"
,
""
,
""
);
set_ps_display
(
""
);
init_ps_display
(
"stats buffer process"
,
""
,
""
,
""
);
/*
* We want to die if our child collector process does. There are two ways
...
...
src/backend/postmaster/postmaster.c
View file @
370a709c
...
...
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.48
8 2006/06/20 22:52:00 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.48
9 2006/06/27 22:16:43 momjian
Exp $
*
* NOTES
*
...
...
@@ -2713,9 +2713,9 @@ BackendInitialize(Port *port)
* Now that we have the user and database name, we can set the process
* title for ps. It's good to do this as early as possible in startup.
*/
init_ps_display
(
port
->
user_name
,
port
->
database_name
,
remote_ps_data
);
set_ps_display
(
"authentication
"
);
init_ps_display
(
port
->
user_name
,
port
->
database_name
,
remote_ps_data
,
update_process_title
?
"authentication"
:
"
"
);
/*
* Now perform authentication exchange.
*/
...
...
src/backend/postmaster/syslogger.c
View file @
370a709c
...
...
@@ -18,7 +18,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.2
5 2006/06/18 15:38:37 petere
Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.2
6 2006/06/27 22:16:43 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -141,8 +141,7 @@ SysLoggerMain(int argc, char *argv[])
am_syslogger
=
true
;
init_ps_display
(
"logger process"
,
""
,
""
);
set_ps_display
(
""
);
init_ps_display
(
"logger process"
,
""
,
""
,
""
);
/*
* If we restarted, our stderr is already redirected into our own input
...
...
src/backend/storage/lmgr/lock.c
View file @
370a709c
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.16
4 2006/04/14 03:38:55 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.16
5 2006/06/27 22:16:43 momjian
Exp $
*
* NOTES
* A lock table is a shared memory hash table. When
...
...
@@ -1059,19 +1059,22 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner)
LOCKMETHODID
lockmethodid
=
LOCALLOCK_LOCKMETHOD
(
*
locallock
);
LockMethod
lockMethodTable
=
LockMethods
[
lockmethodid
];
const
char
*
old_status
;
char
*
new_status
;
char
*
new_status
=
NULL
;
int
len
;
LOCK_PRINT
(
"WaitOnLock: sleeping on lock"
,
locallock
->
lock
,
locallock
->
tag
.
mode
);
old_status
=
get_ps_display
(
&
len
);
new_status
=
(
char
*
)
palloc
(
len
+
8
+
1
);
memcpy
(
new_status
,
old_status
,
len
);
strcpy
(
new_status
+
len
,
" waiting"
);
set_ps_display
(
new_status
);
new_status
[
len
]
=
'\0'
;
/* truncate off " waiting" */
if
(
update_process_title
)
{
old_status
=
get_ps_display
(
&
len
);
new_status
=
(
char
*
)
palloc
(
len
+
8
+
1
);
memcpy
(
new_status
,
old_status
,
len
);
strcpy
(
new_status
+
len
,
" waiting"
);
set_ps_display
(
new_status
,
false
);
new_status
[
len
]
=
'\0'
;
/* truncate off " waiting" */
}
awaitedLock
=
locallock
;
awaitedOwner
=
owner
;
...
...
@@ -1108,8 +1111,11 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner)
awaitedLock
=
NULL
;
set_ps_display
(
new_status
);
pfree
(
new_status
);
if
(
update_process_title
)
{
set_ps_display
(
new_status
,
false
);
pfree
(
new_status
);
}
LOCK_PRINT
(
"WaitOnLock: wakeup on lock"
,
locallock
->
lock
,
locallock
->
tag
.
mode
);
...
...
src/backend/tcop/postgres.c
View file @
370a709c
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.4
89 2006/06/20 22:52:00 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.4
90 2006/06/27 22:16:44 momjian
Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
...
...
@@ -910,7 +910,7 @@ exec_simple_query(const char *query_string)
*/
commandTag
=
CreateCommandTag
(
parsetree
);
set_ps_display
(
commandTag
);
set_ps_display
(
commandTag
,
false
);
BeginCommand
(
commandTag
,
dest
);
...
...
@@ -1144,7 +1144,7 @@ exec_parse_message(const char *query_string, /* string to execute */
pgstat_report_activity
(
query_string
);
set_ps_display
(
"PARSE"
);
set_ps_display
(
"PARSE"
,
false
);
if
(
save_log_statement_stats
)
ResetUsage
();
...
...
@@ -1376,7 +1376,7 @@ exec_bind_message(StringInfo input_message)
pgstat_report_activity
(
"<BIND>"
);
set_ps_display
(
"BIND"
);
set_ps_display
(
"BIND"
,
false
);
/*
* Start up a transaction command so we can call functions etc. (Note that
...
...
@@ -1711,7 +1711,7 @@ exec_execute_message(const char *portal_name, long max_rows)
pgstat_report_activity
(
"<EXECUTE>"
);
}
set_ps_display
(
portal
->
commandTag
);
set_ps_display
(
portal
->
commandTag
,
false
);
/*
* We use save_log_statement_stats so ShowUsage doesn't report incorrect
...
...
@@ -2486,7 +2486,7 @@ PostgresMain(int argc, char *argv[], const char *username)
if
(
!
IsUnderPostmaster
)
MemoryContextInit
();
set_ps_display
(
"startup"
);
set_ps_display
(
"startup"
,
false
);
SetProcessingMode
(
InitProcessing
);
...
...
@@ -3121,14 +3121,14 @@ PostgresMain(int argc, char *argv[], const char *username)
{
if
(
IsTransactionOrTransactionBlock
())
{
set_ps_display
(
"idle in transaction"
);
set_ps_display
(
"idle in transaction"
,
false
);
pgstat_report_activity
(
"<IDLE> in transaction"
);
}
else
{
pgstat_report_tabstat
();
set_ps_display
(
"idle"
);
set_ps_display
(
"idle"
,
false
);
pgstat_report_activity
(
"<IDLE>"
);
}
...
...
src/backend/utils/misc/guc.c
View file @
370a709c
...
...
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.32
3 2006/06/27 19:07:50
momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.32
4 2006/06/27 22:16:44
momjian Exp $
*
*--------------------------------------------------------------------
*/
...
...
@@ -64,6 +64,7 @@
#include "utils/builtins.h"
#include "utils/memutils.h"
#include "utils/pg_locale.h"
#include "utils/ps_status.h"
#include "pgstat.h"
#include "access/gin.h"
...
...
@@ -728,6 +729,16 @@ static struct config_bool ConfigureNamesBool[] =
true
,
NULL
,
NULL
},
{
{
"update_process_title"
,
PGC_SUSET
,
STATS_COLLECTOR
,
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."
)
},
&
update_process_title
,
true
,
NULL
,
NULL
},
{
{
"autovacuum"
,
PGC_SIGHUP
,
AUTOVACUUM
,
gettext_noop
(
"Starts the autovacuum subprocess."
),
...
...
src/backend/utils/misc/postgresql.conf.sample
View file @
370a709c
...
...
@@ -323,11 +323,14 @@
# - Query/Index Statistics Collector -
#stats_command_string = on
#update_process_title = on
#stats_start_collector = on # needed for block or row stats
#stats_block_level = off
#stats_row_level = off
#stats_reset_on_server_start = off
# - Statistics Monitoring -
#log_parser_stats = off
...
...
src/backend/utils/misc/ps_status.c
View file @
370a709c
...
...
@@ -5,7 +5,7 @@
* to contain some useful information. Mechanism differs wildly across
* platforms.
*
* $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.3
0 2006/06/12 02:39:49 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.3
1 2006/06/27 22:16:44 momjian
Exp $
*
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
* various details abducted from various places
...
...
@@ -31,6 +31,7 @@
#include "utils/ps_status.h"
extern
char
**
environ
;
bool
update_process_title
=
true
;
/*
...
...
@@ -210,7 +211,7 @@ save_ps_display_args(int argc, char **argv)
*/
void
init_ps_display
(
const
char
*
username
,
const
char
*
dbname
,
const
char
*
host_info
)
const
char
*
host_info
,
const
char
*
initial_str
)
{
Assert
(
username
);
Assert
(
dbname
);
...
...
@@ -270,6 +271,7 @@ init_ps_display(const char *username, const char *dbname,
ps_buffer_fixed_size
=
strlen
(
ps_buffer
);
set_ps_display
(
initial_str
,
true
);
#endif
/* not PS_USE_NONE */
}
...
...
@@ -280,8 +282,12 @@ init_ps_display(const char *username, const char *dbname,
* indication of what you're currently doing passed in the argument.
*/
void
set_ps_display
(
const
char
*
activity
)
set_ps_display
(
const
char
*
activity
,
bool
force
)
{
if
(
!
force
&&
!
update_process_title
)
return
;
#ifndef PS_USE_NONE
/* no ps display for stand-alone backend */
if
(
!
IsUnderPostmaster
)
...
...
src/include/utils/ps_status.h
View file @
370a709c
...
...
@@ -4,7 +4,7 @@
*
* Declarations for backend/utils/misc/ps_status.c
*
* $PostgreSQL: pgsql/src/include/utils/ps_status.h,v 1.2
6 2005/11/05 03:04:53 tgl
Exp $
* $PostgreSQL: pgsql/src/include/utils/ps_status.h,v 1.2
7 2006/06/27 22:16:44 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -12,12 +12,14 @@
#ifndef PS_STATUS_H
#define PS_STATUS_H
extern
bool
update_process_title
;
extern
char
**
save_ps_display_args
(
int
argc
,
char
**
argv
);
extern
void
init_ps_display
(
const
char
*
username
,
const
char
*
dbname
,
const
char
*
host_info
);
const
char
*
host_info
,
const
char
*
initial_str
);
extern
void
set_ps_display
(
const
char
*
activity
);
extern
void
set_ps_display
(
const
char
*
activity
,
bool
force
);
extern
const
char
*
get_ps_display
(
int
*
displen
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment