Re: [PATCHES] Small patch to replace 'idle' by 'trans' if transactionis still open - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [PATCHES] Small patch to replace 'idle' by 'trans' if transactionis still open
Date
Msg-id 200101241553.KAA27634@candle.pha.pa.us
Whole thread Raw
In response to Re: [PATCHES] Small patch to replace 'idle' by 'trans' if transactionis still open  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
> Tom Lane writes:
>
> > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > Any solid consensus on this?
> >
> > I'm for it (given a short status string --- "idle in tx" or "idle in trans"
> > seem fine).  Marc's for it.  Who's against it?
>
> (I'm not.)  If you're going to do "idle in trans" you might as well spell
> it out.  The string will be truncated to the allowed length with no penalty.

OK, patch applied:

    #$ ps -ax|grep post
    27085  ??  Ss     0:00.05 ./bin/postmaster -B 384 -i -d0 -o -F -d0
    27108  ??  S      0:00.04 postgres test [local] idle (postmaster)
    27150  p7  S+     0:00.01 grep post
    #$ ps -ax|grep post
    27085  ??  Is     0:00.05 ./bin/postmaster -B 384 -i -d0 -o -F -d0
    27108  ??  S      0:00.04 postgres test [local] idle in transaction (postmaster
    27185  p7  S+     0:00.02 grep post
    #$

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
? config.log
? config.cache
? config.status
? GNUmakefile
? src/Makefile.custom
? src/GNUmakefile
? src/Makefile.global
? src/log
? src/crtags
? src/backend/postgres
? src/backend/catalog/global.description
? src/backend/catalog/global.bki
? src/backend/catalog/template1.bki
? src/backend/catalog/template1.description
? src/backend/port/Makefile
? src/bin/initdb/initdb
? src/bin/initlocation/initlocation
? src/bin/ipcclean/ipcclean
? src/bin/pg_config/pg_config
? src/bin/pg_ctl/pg_ctl
? src/bin/pg_dump/pg_dump
? src/bin/pg_dump/pg_restore
? src/bin/pg_dump/pg_dumpall
? src/bin/pg_id/pg_id
? src/bin/pg_passwd/pg_passwd
? src/bin/pgaccess/pgaccess
? src/bin/pgtclsh/Makefile.tkdefs
? src/bin/pgtclsh/Makefile.tcldefs
? src/bin/pgtclsh/pgtclsh
? src/bin/pgtclsh/pgtksh
? src/bin/psql/psql
? src/bin/scripts/createlang
? src/include/config.h
? src/include/stamp-h
? src/interfaces/ecpg/lib/libecpg.so.3.2.0
? src/interfaces/ecpg/preproc/ecpg
? src/interfaces/libpgeasy/libpgeasy.so.2.1
? src/interfaces/libpgtcl/libpgtcl.so.2.1
? src/interfaces/libpq/libpq.so.2.1
? src/interfaces/perl5/blib
? src/interfaces/perl5/Makefile
? src/interfaces/perl5/pm_to_blib
? src/interfaces/perl5/Pg.c
? src/interfaces/perl5/Pg.bs
? src/pl/plperl/blib
? src/pl/plperl/Makefile
? src/pl/plperl/pm_to_blib
? src/pl/plperl/SPI.c
? src/pl/plperl/plperl.bs
? src/pl/plpgsql/src/libplpgsql.so.1.0
? src/pl/tcl/Makefile.tcldefs
Index: src/backend/tcop/postgres.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/tcop/postgres.c,v
retrieving revision 1.204
diff -c -r1.204 postgres.c
*** src/backend/tcop/postgres.c    2001/01/24 14:32:32    1.204
--- src/backend/tcop/postgres.c    2001/01/24 15:52:18
***************
*** 1791,1797 ****

          EnableNotifyInterrupt();

!         set_ps_display("idle");

          /* Allow "die" interrupt to be processed while waiting */
          ImmediateInterruptOK = true;
--- 1791,1799 ----

          EnableNotifyInterrupt();

!         if (!IsTransactionBlock())
!             set_ps_display("idle");
!         else    set_ps_display("idle in transaction");

          /* Allow "die" interrupt to be processed while waiting */
          ImmediateInterruptOK = true;
Index: src/backend/utils/misc/postgresql.conf.sample
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/misc/postgresql.conf.sample,v
retrieving revision 1.2
diff -c -r1.2 postgresql.conf.sample
*** src/backend/utils/misc/postgresql.conf.sample    2000/12/03 21:12:19    1.2
--- src/backend/utils/misc/postgresql.conf.sample    2001/01/24 15:52:18
***************
*** 18,20 ****
--- 18,196 ----
  # Any option can also be given as a command line switch to the
  # postmaster, e.g., 'postmaster -c log_connections=on'. Some options
  # can be set at run-time with the 'SET' SQL command.
+
+
+     enable_seqscan = true
+     enable_indexscan = true
+     enable_tidscan = true
+     enable_sort = true
+     enable_nestloop = true
+     enable_mergejoin = true
+     enable_hashjoin = true
+
+     ksqo = izer, false
+     geqo = true
+
+     tcpip_socket = false
+     ssl = false
+     fsync = true
+     silent_mode = false
+
+     log_connections = false
+     log_timestamp = false
+     log_pid = false
+
+ #ifdef USE_ASSERT_CHECKING
+     debug_assertions = true
+ #endif
+
+     debug_print_query = false
+     debug_print_parse = false
+     debug_print_rewritten = false
+     debug_print_plan = false
+     debug_pretty_print = false
+
+     show_parser_stats = false
+     show_planner_stats = false
+     show_executor_stats = false
+     show_query_stats = false
+ #ifdef BTREE_BUILD_STATS
+     show_btree_build_stats = false
+ #endif
+
+     trace_notify = false
+
+ #ifdef LOCK_DEBUG
+     trace_locks = false
+     trace_userlocks = false
+     trace_spinlocks = false
+     debug_deadlocks = false
+ #endif
+
+     hostname_lookup = false
+     show_source_port = false
+
+     sql_inheritance = true
+
+     {NULL, 0, NULL, false}
+ };
+
+
+ static struct config_int
+ ConfigureNamesInt[] =
+ {
+     geqo_threshold = PGC_USERSET,            &geqo_rels,
+      DEFAULT_GEQO_RELS, 2, INT_MAX
+     geqo_pool_size = PGC_USERSET,            &Geqo_pool_size,
+      DEFAULT_GEQO_POOL_SIZE, 0, MAX_GEQO_POOL_SIZE
+     geqo_effort = PGC_USERSET,            &Geqo_effort,
+      1, 1, INT_MAX
+     geqo_generations = PGC_USERSET,            &Geqo_generations,
+      0, 0, INT_MAX
+     geqo_random_seed = PGC_USERSET,            &Geqo_random_seed,
+      -1, INT_MIN, INT_MAX
+
+     deadlock_timeout = PGC_POSTMASTER,         &DeadlockTimeout,
+      1000, 0, INT_MAX
+
+ #ifdef ENABLE_SYSLOG
+     syslog = PGC_SIGHUP,             &Use_syslog,
+      0, 0, 2
+ #endif
+
+     /*
+      * Note: There is some postprocessing done in PostmasterMain() to
+      * make sure the buffers are at least twice the number of
+      * backends, so the constraints here are partially unused.
+      */
+     max_connections = PGC_POSTMASTER,         &MaxBackends,
+      DEF_MAXBACKENDS, 1, MAXBACKENDS
+     shared_buffers = PGC_POSTMASTER,         &NBuffers,
+      DEF_NBUFFERS, 16, INT_MAX
+     port = PGC_POSTMASTER,         &PostPortNumber,
+      DEF_PGPORT, 1, 65535
+
+     sort_mem = PGC_USERSET,            &SortMem,
+      512, 1, INT_MAX
+
+     debug_level = PGC_USERSET,            &DebugLvl,
+      0, 0, 16
+
+ #ifdef LOCK_DEBUG
+     trace_lock_oidmin = PGC_SUSET,              &Trace_lock_oidmin,
+      BootstrapObjectIdData, 1, INT_MAX
+     trace_lock_table = PGC_SUSET,              &Trace_lock_table,
+      0, 0, INT_MAX
+ #endif
+     max_expr_depth = PGC_USERSET,            &max_expr_depth,
+      DEFAULT_MAX_EXPR_DEPTH, 10, INT_MAX
+
+     unix_socket_permissions = PGC_POSTMASTER,         &Unix_socket_permissions,
+      0777, 0000, 0777
+
+     checkpoint_timeout",    PGC_POSTMASTER,            &CheckPointTimeout,
+      300, 30, 1800
+
+     wal_buffers",            PGC_POSTMASTER,            &XLOGbuffers,
+      8, 4, INT_MAX
+
+     wal_files",            PGC_POSTMASTER,            &XLOGfiles,
+      0, 0, 64
+
+     wal_debug",            PGC_SUSET,                &XLOG_DEBUG,
+      0, 0, 16
+
+     commit_delay",        PGC_USERSET,            &CommitDelay,
+      5, 0, 1000
+
+     {NULL, 0, NULL, 0, 0, 0}
+ };
+
+
+ static struct config_real
+ ConfigureNamesReal[] =
+ {
+     effective_cache_size = PGC_USERSET,          &effective_cache_size,
+      DEFAULT_EFFECTIVE_CACHE_SIZE, 0, DBL_MAX
+     random_page_cost = PGC_USERSET,          &random_page_cost,
+      DEFAULT_RANDOM_PAGE_COST, 0, DBL_MAX
+     cpu_tuple_cost = PGC_USERSET,          &cpu_tuple_cost,
+      DEFAULT_CPU_TUPLE_COST, 0, DBL_MAX
+     cpu_index_tuple_cost = PGC_USERSET,          &cpu_index_tuple_cost,
+      DEFAULT_CPU_INDEX_TUPLE_COST, 0, DBL_MAX
+     cpu_operator_cost = PGC_USERSET,          &cpu_operator_cost,
+      DEFAULT_CPU_OPERATOR_COST, 0, DBL_MAX
+
+     geqo_selection_bias = PGC_USERSET,          &Geqo_selection_bias,
+      DEFAULT_GEQO_SELECTION_BIAS,   MIN_GEQO_SELECTION_BIAS, MAX_GEQO_SELECTION_BIAS
+
+     {NULL, 0, NULL, 0.0, 0.0, 0.0}
+ };
+
+
+ static struct config_string
+ ConfigureNamesString[] =
+ {
+     krb_server_keyfile = PGC_POSTMASTER,       &pg_krb_server_keyfile,
+      PG_KRB_SRVTAB, NULL
+
+     unix_socket_group = PGC_POSTMASTER,       &Unix_socket_group,
+      " = NULL
+
+ #ifdef ENABLE_SYSLOG
+     syslog_facility = PGC_POSTMASTER,        &Syslog_facility,
+     "LOCAL0 = check_facility
+     syslog_ident = PGC_POSTMASTER,        &Syslog_ident,
+     "postgres = NULL
+ #endif
+
+     unix_socket_directory",      PGC_POSTMASTER,       &UnixSocketDir,
+      " = NULL
+
+     virtual_host",              PGC_POSTMASTER,        &VirtualHost,
+      " = NULL
+
+     {NULL, 0, NULL, NULL, NULL}
+ };
+
+

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] MySQL -> Postgres dump converter
Next
From: Peter Eisentraut
Date:
Subject: Re: LEFT JOIN in pg_dumpall is a bug