|
22 | 22 | * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group |
23 | 23 | * Portions Copyright (c) 1994, Regents of the University of California |
24 | 24 | * |
25 | | - * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.2 2005/02/2004:45:59 tgl Exp $ |
| 25 | + * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.3 2005/02/2022:02:19 tgl Exp $ |
26 | 26 | * |
27 | 27 | *------------------------------------------------------------------------- |
28 | 28 | */ |
@@ -235,11 +235,9 @@ write_database_file(Relation drel) |
235 | 235 | tempname))); |
236 | 236 |
|
237 | 237 | /* |
238 | | - * Read pg_database and write the file. Note we use SnapshotSelf to |
239 | | - * ensure we see all effects of current transaction. (Perhaps could |
240 | | - * do a CommandCounterIncrement beforehand, instead?) |
| 238 | + * Read pg_database and write the file. |
241 | 239 | */ |
242 | | -scan=heap_beginscan(drel,SnapshotSelf,0,NULL); |
| 240 | +scan=heap_beginscan(drel,SnapshotNow,0,NULL); |
243 | 241 | while ((tuple=heap_getnext(scan,ForwardScanDirection))!=NULL) |
244 | 242 | { |
245 | 243 | Form_pg_databasedbform= (Form_pg_database)GETSTRUCT(tuple); |
@@ -349,11 +347,9 @@ write_group_file(Relation grel) |
349 | 347 | tempname))); |
350 | 348 |
|
351 | 349 | /* |
352 | | - * Read pg_group and write the file. Note we use SnapshotSelf to |
353 | | - * ensure we see all effects of current transaction. (Perhaps could |
354 | | - * do a CommandCounterIncrement beforehand, instead?) |
| 350 | + * Read pg_group and write the file. |
355 | 351 | */ |
356 | | -scan=heap_beginscan(grel,SnapshotSelf,0,NULL); |
| 352 | +scan=heap_beginscan(grel,SnapshotNow,0,NULL); |
357 | 353 | while ((tuple=heap_getnext(scan,ForwardScanDirection))!=NULL) |
358 | 354 | { |
359 | 355 | Form_pg_groupgrpform= (Form_pg_group)GETSTRUCT(tuple); |
@@ -491,11 +487,9 @@ write_user_file(Relation urel) |
491 | 487 | tempname))); |
492 | 488 |
|
493 | 489 | /* |
494 | | - * Read pg_shadow and write the file. Note we use SnapshotSelf to |
495 | | - * ensure we see all effects of current transaction. (Perhaps could |
496 | | - * do a CommandCounterIncrement beforehand, instead?) |
| 490 | + * Read pg_shadow and write the file. |
497 | 491 | */ |
498 | | -scan=heap_beginscan(urel,SnapshotSelf,0,NULL); |
| 492 | +scan=heap_beginscan(urel,SnapshotNow,0,NULL); |
499 | 493 | while ((tuple=heap_getnext(scan,ForwardScanDirection))!=NULL) |
500 | 494 | { |
501 | 495 | Form_pg_shadowpwform= (Form_pg_shadow)GETSTRUCT(tuple); |
@@ -713,6 +707,12 @@ AtEOXact_UpdateFlatFiles(bool isCommit) |
713 | 707 | return; |
714 | 708 | } |
715 | 709 |
|
| 710 | +/* |
| 711 | + * Advance command counter to be certain we see all effects of the |
| 712 | + * current transaction. |
| 713 | + */ |
| 714 | +CommandCounterIncrement(); |
| 715 | + |
716 | 716 | /* |
717 | 717 | * We use ExclusiveLock to ensure that only one backend writes the |
718 | 718 | * flat file(s) at a time.That's sufficient because it's okay to |
|