Re: limiting connections per user/database

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: limiting connections per user/database
Дата
Msg-id 42BF859E.7010603@samurai.com
обсуждение исходный текст
Ответ на Re: limiting connections per user/database  (Petr Jelínek <pjmodos@parba.cz>)
Ответы Re: limiting connections per user/database  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Petr Jelínek wrote:
> I am bit confused now because I am no really sure if it's intended to be
> this way or not - 8.0 behaviour was to report numbackends when stats
> were on, now it reports numbackends when stats_row_level is true.

Yeah, this is a bug. Attached is a fix. I'll apply this to HEAD later
today barring any objections.

-Neil
Index: src/backend/postmaster/pgstat.c
===================================================================
RCS file: /var/lib/cvs/pgsql/src/backend/postmaster/pgstat.c,v
retrieving revision 1.96
diff -c -r1.96 pgstat.c
*** src/backend/postmaster/pgstat.c    25 Jun 2005 23:58:57 -0000    1.96
--- src/backend/postmaster/pgstat.c    27 Jun 2005 04:47:44 -0000
***************
*** 2073,2078 ****
--- 2073,2079 ----
          result->n_blocks_fetched = 0;
          result->n_blocks_hit = 0;
          result->destroy = 0;
+         result->n_backends = 0;

          memset(&hash_ctl, 0, sizeof(hash_ctl));
          hash_ctl.keysize = sizeof(Oid);
***************
*** 2321,2327 ****
   * pgstat_read_statsfile() -
   *
   *    Reads in an existing statistics collector and initializes the
!  *    databases hash table (who's entries point to the tables hash tables)
   *    and the current backend table.
   * ----------
   */
--- 2322,2328 ----
   * pgstat_read_statsfile() -
   *
   *    Reads in an existing statistics collector and initializes the
!  *    databases hash table (whose entries point to the table's hash tables)
   *    and the current backend table.
   * ----------
   */
***************
*** 2627,2632 ****
--- 2628,2636 ----
      entry->userid = msg->m_userid;
      memcpy(&entry->clientaddr, &msg->m_clientaddr, sizeof(entry->clientaddr));
      entry->databaseid = msg->m_databaseid;
+
+     /* Initialize the backend's entry in the db hash table */
+     (void) pgstat_get_db_entry(msg->m_databaseid);
  }


Index: src/include/pgstat.h
===================================================================
RCS file: /var/lib/cvs/pgsql/src/include/pgstat.h,v
retrieving revision 1.30
diff -c -r1.30 pgstat.h
*** src/include/pgstat.h    25 Jun 2005 23:58:58 -0000    1.30
--- src/include/pgstat.h    27 Jun 2005 02:46:23 -0000
***************
*** 209,215 ****
   */

  /* ----------
!  * PgStat_StatDBEntry            The collectors data per database
   * ----------
   */
  typedef struct PgStat_StatDBEntry
--- 209,215 ----
   */

  /* ----------
!  * PgStat_StatDBEntry            The collector's data per database
   * ----------
   */
  typedef struct PgStat_StatDBEntry
***************
*** 226,232 ****


  /* ----------
!  * PgStat_StatBeEntry            The collectors data per backend
   * ----------
   */
  typedef struct PgStat_StatBeEntry
--- 226,232 ----


  /* ----------
!  * PgStat_StatBeEntry            The collector's data per backend
   * ----------
   */
  typedef struct PgStat_StatBeEntry
***************
*** 269,275 ****


  /* ----------
!  * PgStat_StatTabEntry            The collectors data table data
   * ----------
   */
  typedef struct PgStat_StatTabEntry
--- 269,275 ----


  /* ----------
!  * PgStat_StatTabEntry            The collector's data table data
   * ----------
   */
  typedef struct PgStat_StatTabEntry

В списке pgsql-patches по дате отправления:

Предыдущее
От: "Luke Lonergan"
Дата:
Сообщение: Re: COPY FROM performance improvements
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: COPY FROM performance improvements