mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
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.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.116 2005/06/20 18:37:01 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.117 2005/07/04 04:51:49 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -155,7 +155,7 @@ mdcreate(SMgrRelation reln, bool isRedo)
|
||||
|
||||
path = relpath(reln->smgr_rnode);
|
||||
|
||||
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY, 0600);
|
||||
fd = PathNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY, 0600);
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
@@ -169,7 +169,7 @@ mdcreate(SMgrRelation reln, bool isRedo)
|
||||
* mdopen)
|
||||
*/
|
||||
if (isRedo || IsBootstrapProcessingMode())
|
||||
fd = FileNameOpenFile(path, O_RDWR | PG_BINARY, 0600);
|
||||
fd = PathNameOpenFile(path, O_RDWR | PG_BINARY, 0600);
|
||||
if (fd < 0)
|
||||
{
|
||||
pfree(path);
|
||||
@@ -340,7 +340,7 @@ mdopen(SMgrRelation reln, bool allowNotFound)
|
||||
|
||||
path = relpath(reln->smgr_rnode);
|
||||
|
||||
fd = FileNameOpenFile(path, O_RDWR | PG_BINARY, 0600);
|
||||
fd = PathNameOpenFile(path, O_RDWR | PG_BINARY, 0600);
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
@@ -352,7 +352,7 @@ mdopen(SMgrRelation reln, bool allowNotFound)
|
||||
* (See mdcreate)
|
||||
*/
|
||||
if (IsBootstrapProcessingMode())
|
||||
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY, 0600);
|
||||
fd = PathNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY, 0600);
|
||||
if (fd < 0)
|
||||
{
|
||||
pfree(path);
|
||||
@@ -879,7 +879,7 @@ _mdfd_openseg(SMgrRelation reln, BlockNumber segno, int oflags)
|
||||
fullpath = path;
|
||||
|
||||
/* open the file */
|
||||
fd = FileNameOpenFile(fullpath, O_RDWR | PG_BINARY | oflags, 0600);
|
||||
fd = PathNameOpenFile(fullpath, O_RDWR | PG_BINARY | oflags, 0600);
|
||||
|
||||
pfree(fullpath);
|
||||
|
||||
|
Reference in New Issue
Block a user