diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-07-04 04:51:52 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-07-04 04:51:52 +0000 |
| commit | eb5949d190e80360386113fde0f05854f0c9824d (patch) | |
| tree | f5683b4ff77c0b311ae975817b88c5ccc65ce5a9 /src/backend/access/transam/twophase.c | |
| parent | 7504f0bae853b0b9fec03c8e361c8b1a4b1c3209 (diff) | |
Arrange for the postmaster (and standalone backends, initdb, etc) to
chdir into PGDATA and subsequently use relative paths instead of absolute
paths to access all files under PGDATA. This seems to give a small
performance improvement, and it should make the system more robust
against naive DBAs doing things like moving a database directory that
has a live postmaster in it. Per recent discussion.
Diffstat (limited to 'src/backend/access/transam/twophase.c')
| -rw-r--r-- | src/backend/access/transam/twophase.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index ccd8b802157..5f7ea98ffe1 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.7 2005/06/28 05:08:51 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.8 2005/07/04 04:51:44 tgl Exp $ * * NOTES * Each global transaction is associated with a global transaction @@ -661,7 +661,7 @@ TwoPhaseGetDummyProc(TransactionId xid) /************************************************************************/ #define TwoPhaseFilePath(path, xid) \ - snprintf(path, MAXPGPATH, "%s/%s/%08X", DataDir, TWOPHASE_DIR, xid) + snprintf(path, MAXPGPATH, TWOPHASE_DIR "/%08X", xid) /* * 2PC state file format: @@ -1434,14 +1434,11 @@ PrescanPreparedTransactions(void) { TransactionId origNextXid = ShmemVariableCache->nextXid; TransactionId result = origNextXid; - char dir[MAXPGPATH]; DIR *cldir; struct dirent *clde; - snprintf(dir, MAXPGPATH, "%s/%s", DataDir, TWOPHASE_DIR); - - cldir = AllocateDir(dir); - while ((clde = ReadDir(cldir, dir)) != NULL) + cldir = AllocateDir(TWOPHASE_DIR); + while ((clde = ReadDir(cldir, TWOPHASE_DIR)) != NULL) { if (strlen(clde->d_name) == 8 && strspn(clde->d_name, "0123456789ABCDEF") == 8) @@ -1540,7 +1537,7 @@ RecoverPreparedTransactions(void) DIR *cldir; struct dirent *clde; - snprintf(dir, MAXPGPATH, "%s/%s", DataDir, TWOPHASE_DIR); + snprintf(dir, MAXPGPATH, "%s", TWOPHASE_DIR); cldir = AllocateDir(dir); while ((clde = ReadDir(cldir, dir)) != NULL) |
