diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-02-20 22:02:19 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-02-20 22:02:19 +0000 |
commit | bb0aed591f1e8c9bee51360bf6cb77be8c6eb475 (patch) | |
tree | b87645fdf7fe454bb7f92426ae3ce510625ba5b1 /src/backend/utils/init/flatfiles.c | |
parent | 4aefe75553e6ec82b7308f961edd480d8001ec12 (diff) | |
download | postgresql-bb0aed591f1e8c9bee51360bf6cb77be8c6eb475.tar.gz postgresql-bb0aed591f1e8c9bee51360bf6cb77be8c6eb475.zip |
Use SnapshotNow instead of SnapshotSelf for reading the catalogs
during flat-file writing. The only difference is that SnapshotSelf
would consider tuples of the 'current command' within the current
transaction as valid, where SnapshotNow wouldn't. We can eliminate
the need for this with one extra CommandCounterIncrement call before
we start reading the catalogs.
Diffstat (limited to 'src/backend/utils/init/flatfiles.c')
-rw-r--r-- | src/backend/utils/init/flatfiles.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/backend/utils/init/flatfiles.c b/src/backend/utils/init/flatfiles.c index 0cbb878f9ff..8968d572c88 100644 --- a/src/backend/utils/init/flatfiles.c +++ b/src/backend/utils/init/flatfiles.c @@ -22,7 +22,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.2 2005/02/20 04:45:59 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.3 2005/02/20 22:02:19 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -235,11 +235,9 @@ write_database_file(Relation drel) tempname))); /* - * Read pg_database and write the file. Note we use SnapshotSelf to - * ensure we see all effects of current transaction. (Perhaps could - * do a CommandCounterIncrement beforehand, instead?) + * Read pg_database and write the file. */ - scan = heap_beginscan(drel, SnapshotSelf, 0, NULL); + scan = heap_beginscan(drel, SnapshotNow, 0, NULL); while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { Form_pg_database dbform = (Form_pg_database) GETSTRUCT(tuple); @@ -349,11 +347,9 @@ write_group_file(Relation grel) tempname))); /* - * 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?) + * Read pg_group and write the file. */ - scan = heap_beginscan(grel, SnapshotSelf, 0, NULL); + scan = heap_beginscan(grel, SnapshotNow, 0, NULL); while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { Form_pg_group grpform = (Form_pg_group) GETSTRUCT(tuple); @@ -491,11 +487,9 @@ write_user_file(Relation urel) tempname))); /* - * 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?) + * Read pg_shadow and write the file. */ - scan = heap_beginscan(urel, SnapshotSelf, 0, NULL); + scan = heap_beginscan(urel, SnapshotNow, 0, NULL); while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { Form_pg_shadow pwform = (Form_pg_shadow) GETSTRUCT(tuple); @@ -714,6 +708,12 @@ AtEOXact_UpdateFlatFiles(bool isCommit) } /* + * Advance command counter to be certain we see all effects of the + * current transaction. + */ + CommandCounterIncrement(); + + /* * We use ExclusiveLock to ensure that only one backend writes the * flat file(s) at a time. That's sufficient because it's okay to * allow plain reads of the tables in parallel. There is some chance |