diff options
Diffstat (limited to 'src/backend/storage/smgr/md.c')
-rw-r--r-- | src/backend/storage/smgr/md.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c index 2207af4fa19..23551044c25 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.74 2000/07/17 03:05:11 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.75 2000/10/16 14:52:12 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -75,8 +75,14 @@ static void mdclose_fd(int fd); static int _mdfd_getrelnfd(Relation reln); static MdfdVec *_mdfd_openseg(Relation reln, int segno, int oflags); static MdfdVec *_mdfd_getseg(Relation reln, int blkno); + +#ifdef OLD_FILE_NAMING static int _mdfd_blind_getseg(char *dbname, char *relname, Oid dbid, Oid relid, int blkno); +#else +static int _mdfd_blind_getseg(RelFileNode rnode, int blkno); +#endif + static int _fdvec_alloc(void); static void _fdvec_free(int); static BlockNumber _mdnblocks(File file, Size blcksz); @@ -128,7 +134,11 @@ mdcreate(Relation reln) Assert(reln->rd_unlinked && reln->rd_fd < 0); +#ifdef OLD_FILE_NAMING path = relpath(RelationGetPhysicalRelationName(reln)); +#else + path = relpath(reln->rd_node); +#endif fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | PG_BINARY, 0600); /* @@ -326,7 +336,11 @@ mdopen(Relation reln) int vfd; Assert(reln->rd_fd < 0); +#ifdef OLD_FILE_NAMING path = relpath(RelationGetPhysicalRelationName(reln)); +#else + path = relpath(reln->rd_node); +#endif fd = FileNameOpenFile(path, O_RDWR | PG_BINARY, 0600); if (fd < 0) @@ -565,6 +579,7 @@ mdflush(Relation reln, BlockNumber blocknum, char *buffer) * the file, making it more like mdflush(). */ int +#ifdef OLD_FILE_NAMING mdblindwrt(char *dbname, char *relname, Oid dbid, @@ -572,12 +587,22 @@ mdblindwrt(char *dbname, BlockNumber blkno, char *buffer, bool dofsync) +#else +mdblindwrt(RelFileNode rnode, + BlockNumber blkno, + char *buffer, + bool dofsync) +#endif { int status; long seekpos; int fd; +#ifdef OLD_FILE_NAMING fd = _mdfd_blind_getseg(dbname, relname, dbid, relid, blkno); +#else + fd = _mdfd_blind_getseg(rnode, blkno); +#endif if (fd < 0) return SM_FAIL; @@ -651,16 +676,25 @@ mdmarkdirty(Relation reln, BlockNumber blkno) * rather than building md/fd datastructures to postpone it till later. */ int +#ifdef OLD_FILE_NAMING mdblindmarkdirty(char *dbname, char *relname, Oid dbid, Oid relid, BlockNumber blkno) +#else +mdblindmarkdirty(RelFileNode rnode, + BlockNumber blkno) +#endif { int status; int fd; +#ifdef OLD_FILE_NAMING fd = _mdfd_blind_getseg(dbname, relname, dbid, relid, blkno); +#else + fd = _mdfd_blind_getseg(rnode, blkno); +#endif if (fd < 0) return SM_FAIL; @@ -969,7 +1003,11 @@ _mdfd_openseg(Relation reln, int segno, int oflags) *fullpath; /* be sure we have enough space for the '.segno', if any */ +#ifdef OLD_FILE_NAMING path = relpath(RelationGetPhysicalRelationName(reln)); +#else + path = relpath(reln->rd_node); +#endif if (segno > 0) { @@ -1084,8 +1122,12 @@ _mdfd_getseg(Relation reln, int blkno) */ static int +#ifdef OLD_FILE_NAMING _mdfd_blind_getseg(char *dbname, char *relname, Oid dbid, Oid relid, int blkno) +#else +_mdfd_blind_getseg(RelFileNode rnode, int blkno) +#endif { char *path; int fd; @@ -1095,8 +1137,12 @@ _mdfd_blind_getseg(char *dbname, char *relname, Oid dbid, Oid relid, #endif +#ifdef OLD_FILE_NAMING /* construct the path to the relation */ path = relpath_blind(dbname, relname, dbid, relid); +#else + path = relpath(rnode); +#endif #ifndef LET_OS_MANAGE_FILESIZE /* append the '.segno', if needed */ |