Re: [BUGS] Bug#333854: pg_group file update problems - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [BUGS] Bug#333854: pg_group file update problems
Date
Msg-id 200510141737.j9EHbu426768@candle.pha.pa.us
Whole thread Raw
In response to Re: [BUGS] Bug#333854: pg_group file update problems  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUGS] Bug#333854: pg_group file update problems
List pgsql-patches
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > In the patch, notice the old comment that suggests we might need to use
> > CommandCounterIncrement().
>
> ... which you failed to fix in any meaningful way.  I'd suggest
>
>     /*
>      * Advance the commmand counter to ensure we see all results
>      * of current transaction.
>      */
>     CommandCounterIncrement();
>
> and then change SnapshotSelf to SnapshotNow, since there's no longer any
> reason for it to be special.  Compare to CVS tip which already does it
> that way.  See also the identical code in write_user_file (which perhaps
> has no bug, but ISTM it should stay identical).

OK, updated patch.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/commands/user.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/user.c,v
retrieving revision 1.147
diff -c -c -r1.147 user.c
*** src/backend/commands/user.c    31 Dec 2004 21:59:42 -0000    1.147
--- src/backend/commands/user.c    14 Oct 2005 17:36:54 -0000
***************
*** 175,184 ****

      /*
       * Read pg_group and write the file.  Note we use SnapshotSelf to
!      * ensure we see all effects of current transaction.  (Perhaps could
!      * do a CommandCounterIncrement beforehand, instead?)
       */
!     scan = heap_beginscan(grel, SnapshotSelf, 0, NULL);
      while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
      {
          Datum        datum,
--- 175,184 ----

      /*
       * Read pg_group and write the file.  Note we use SnapshotSelf to
!      * ensure we see all effects of current transaction.
       */
!     CommandCounterIncrement();    /* see our current changes */
!     scan = heap_beginscan(grel, SnapshotNow, 0, NULL);
      while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
      {
          Datum        datum,
***************
*** 322,331 ****

      /*
       * Read pg_shadow and write the file.  Note we use SnapshotSelf to
!      * ensure we see all effects of current transaction.  (Perhaps could
!      * do a CommandCounterIncrement beforehand, instead?)
       */
!     scan = heap_beginscan(urel, SnapshotSelf, 0, NULL);
      while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
      {
          Datum        datum;
--- 322,331 ----

      /*
       * Read pg_shadow and write the file.  Note we use SnapshotSelf to
!      * ensure we see all effects of current transaction.
       */
!     CommandCounterIncrement();    /* see our current changes */
!     scan = heap_beginscan(urel, SnapshotNow, 0, NULL);
      while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
      {
          Datum        datum;
***************
*** 781,786 ****
--- 781,787 ----
       * Set flag to update flat password file at commit.
       */
      user_file_update_needed();
+     group_file_update_needed();
  }


***************
*** 1200,1205 ****
--- 1201,1207 ----
       * Set flag to update flat password file at commit.
       */
      user_file_update_needed();
+     group_file_update_needed();
  }


***************
*** 1286,1291 ****
--- 1288,1294 ----
      heap_close(rel, NoLock);

      user_file_update_needed();
+     group_file_update_needed();
  }



pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUGS] Bug#333854: pg_group file update problems
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] Bug#333854: pg_group file update problems