Commit dfc7e7b7 authored by Neil Conway's avatar Neil Conway

Code cleanup, mostly in the smgr:

     - Update comment in IsReservedName() to the present day

     - Improve some variable & function names in commands/vacuum.c. I
       was planning to rewrite this to avoid lappend(), but since I
       still intend to do the list rewrite, there's no need for that.

     - Update some smgr comments which seemed to imply that we still
       forced all dirty pages to disk at commit-time.

     - Replace some #ifdef DIAGNOSTIC code with assertions.

     - Make the distinction between OS-level file descriptors and
       virtual file descriptors a little clearer in a few comments

     - Other minor comment improvements in the smgr code
parent 030f8e73
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.50 2003/11/29 19:51:42 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.51 2004/01/06 18:07:31 neilc Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -165,8 +165,9 @@ IsToastNamespace(Oid namespaceId) ...@@ -165,8 +165,9 @@ IsToastNamespace(Oid namespaceId)
* IsReservedName * IsReservedName
* True iff name starts with the pg_ prefix. * True iff name starts with the pg_ prefix.
* *
* For some classes of objects, the prefix pg_ is reserved * For some classes of objects, the prefix pg_ is reserved for
* for system objects only. * system objects only. As of 7.3, this is now only true for
* schema names.
*/ */
bool bool
IsReservedName(const char *name) IsReservedName(const char *name)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.65 2003/11/29 19:51:47 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.66 2004/01/06 18:07:31 neilc Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -204,8 +204,9 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt) ...@@ -204,8 +204,9 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt)
} }
/* /*
* Check that it's a plain table; we used to do this in getrels() but * Check that it's a plain table; we used to do this in
* seems safer to check after we've locked the relation. * get_rel_oids() but seems safer to check after we've locked the
* relation.
*/ */
if (onerel->rd_rel->relkind != RELKIND_RELATION) if (onerel->rd_rel->relkind != RELKIND_RELATION)
{ {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.269 2003/11/29 19:51:47 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.270 2004/01/06 18:07:31 neilc Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -108,7 +108,7 @@ static TransactionId FreezeLimit; ...@@ -108,7 +108,7 @@ static TransactionId FreezeLimit;
/* non-export function prototypes */ /* non-export function prototypes */
static List *getrels(const RangeVar *vacrel, const char *stmttype); static List *get_rel_oids(const RangeVar *vacrel, const char *stmttype);
static void vac_update_dbstats(Oid dbid, static void vac_update_dbstats(Oid dbid,
TransactionId vacuumXID, TransactionId vacuumXID,
TransactionId frozenXID); TransactionId frozenXID);
...@@ -161,7 +161,7 @@ vacuum(VacuumStmt *vacstmt) ...@@ -161,7 +161,7 @@ vacuum(VacuumStmt *vacstmt)
TransactionId initialOldestXmin = InvalidTransactionId; TransactionId initialOldestXmin = InvalidTransactionId;
TransactionId initialFreezeLimit = InvalidTransactionId; TransactionId initialFreezeLimit = InvalidTransactionId;
bool all_rels; bool all_rels;
List *vrl, List *relations,
*cur; *cur;
if (vacstmt->verbose) if (vacstmt->verbose)
...@@ -216,7 +216,7 @@ vacuum(VacuumStmt *vacstmt) ...@@ -216,7 +216,7 @@ vacuum(VacuumStmt *vacstmt)
all_rels = (vacstmt->relation == NULL); all_rels = (vacstmt->relation == NULL);
/* Build list of relations to process (note this lives in vac_context) */ /* Build list of relations to process (note this lives in vac_context) */
vrl = getrels(vacstmt->relation, stmttype); relations = get_rel_oids(vacstmt->relation, stmttype);
/* /*
* Formerly, there was code here to prevent more than one VACUUM from * Formerly, there was code here to prevent more than one VACUUM from
...@@ -282,7 +282,7 @@ vacuum(VacuumStmt *vacstmt) ...@@ -282,7 +282,7 @@ vacuum(VacuumStmt *vacstmt)
/* /*
* Loop to process each selected relation. * Loop to process each selected relation.
*/ */
foreach(cur, vrl) foreach(cur, relations)
{ {
Oid relid = lfirsto(cur); Oid relid = lfirsto(cur);
...@@ -383,21 +383,21 @@ vacuum(VacuumStmt *vacstmt) ...@@ -383,21 +383,21 @@ vacuum(VacuumStmt *vacstmt)
* per-relation transactions. * per-relation transactions.
*/ */
static List * static List *
getrels(const RangeVar *vacrel, const char *stmttype) get_rel_oids(const RangeVar *vacrel, const char *stmttype)
{ {
List *vrl = NIL; List *oid_list = NIL;
MemoryContext oldcontext; MemoryContext oldcontext;
if (vacrel) if (vacrel)
{ {
/* Process specific relation */ /* Process a specific relation */
Oid relid; Oid relid;
relid = RangeVarGetRelid(vacrel, false); relid = RangeVarGetRelid(vacrel, false);
/* Make a relation list entry for this guy */ /* Make a relation list entry for this guy */
oldcontext = MemoryContextSwitchTo(vac_context); oldcontext = MemoryContextSwitchTo(vac_context);
vrl = lappendo(vrl, relid); oid_list = lappendo(oid_list, relid);
MemoryContextSwitchTo(oldcontext); MemoryContextSwitchTo(oldcontext);
} }
else else
...@@ -421,7 +421,7 @@ getrels(const RangeVar *vacrel, const char *stmttype) ...@@ -421,7 +421,7 @@ getrels(const RangeVar *vacrel, const char *stmttype)
{ {
/* Make a relation list entry for this guy */ /* Make a relation list entry for this guy */
oldcontext = MemoryContextSwitchTo(vac_context); oldcontext = MemoryContextSwitchTo(vac_context);
vrl = lappendo(vrl, HeapTupleGetOid(tuple)); oid_list = lappendo(oid_list, HeapTupleGetOid(tuple));
MemoryContextSwitchTo(oldcontext); MemoryContextSwitchTo(oldcontext);
} }
...@@ -429,7 +429,7 @@ getrels(const RangeVar *vacrel, const char *stmttype) ...@@ -429,7 +429,7 @@ getrels(const RangeVar *vacrel, const char *stmttype)
heap_close(pgclass, AccessShareLock); heap_close(pgclass, AccessShareLock);
} }
return vrl; return oid_list;
} }
/* /*
...@@ -818,8 +818,9 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) ...@@ -818,8 +818,9 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind)
} }
/* /*
* Check that it's a plain table; we used to do this in getrels() but * Check that it's a plain table; we used to do this in
* seems safer to check after we've locked the relation. * get_rel_oids() but seems safer to check after we've locked the
* relation.
*/ */
if (onerel->rd_rel->relkind != expected_relkind) if (onerel->rd_rel->relkind != expected_relkind)
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.99 2003/11/29 19:51:57 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.100 2004/01/06 18:07:31 neilc Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -25,18 +25,15 @@ ...@@ -25,18 +25,15 @@
#include "utils/inval.h" #include "utils/inval.h"
#include "utils/memutils.h" #include "utils/memutils.h"
#undef DIAGNOSTIC
/* /*
* The magnetic disk storage manager keeps track of open file descriptors * The magnetic disk storage manager keeps track of open file
* in its own descriptor pool. This happens for two reasons. First, at * descriptors in its own descriptor pool. This is done to make it
* transaction boundaries, we walk the list of descriptors and flush * easier to support relations that are larger than the operating
* anything that we've dirtied in the current transaction. Second, we want * system's file size limit (often 2GBytes). In order to do that, we
* to support relations larger than the OS' file size limit (often 2GBytes). * we break relations up into chunks of < 2GBytes and store one chunk
* In order to do that, we break relations up into chunks of < 2GBytes * in each of several files that represent the relation. See the
* and store one chunk in each of several files that represent the relation. * BLCKSZ and RELSEG_SIZE configuration constants in
* See the BLCKSZ and RELSEG_SIZE configuration constants in include/pg_config.h. * include/pg_config.h.
* *
* The file descriptor stored in the relation cache (see RelationGetFile()) * The file descriptor stored in the relation cache (see RelationGetFile())
* is actually an index into the Md_fdvec array. -1 indicates not open. * is actually an index into the Md_fdvec array. -1 indicates not open.
...@@ -67,7 +64,7 @@ static MdfdVec *Md_fdvec = (MdfdVec *) NULL; ...@@ -67,7 +64,7 @@ static MdfdVec *Md_fdvec = (MdfdVec *) NULL;
static int Md_Free = -1; /* head of freelist of unused fdvec static int Md_Free = -1; /* head of freelist of unused fdvec
* entries */ * entries */
static int CurFd = 0; /* first never-used fdvec index */ static int CurFd = 0; /* first never-used fdvec index */
static MemoryContext MdCxt; /* context for all my allocations */ static MemoryContext MdCxt; /* context for all md.c allocations */
/* routines declared here */ /* routines declared here */
static void mdclose_fd(int fd); static void mdclose_fd(int fd);
...@@ -84,11 +81,8 @@ static BlockNumber _mdnblocks(File file, Size blcksz); ...@@ -84,11 +81,8 @@ static BlockNumber _mdnblocks(File file, Size blcksz);
/* /*
* mdinit() -- Initialize private state for magnetic disk storage manager. * mdinit() -- Initialize private state for magnetic disk storage manager.
* *
* We keep a private table of all file descriptors. Whenever we do * We keep a private table of all file descriptors. This routine
* a write to one, we mark it dirty in our table. Whenever we force * allocates and initializes the table.
* changes to disk, we mark the file descriptor clean. At transaction
* commit, we force changes to disk for all dirty file descriptors.
* This routine allocates and initializes the table.
* *
* Returns SM_SUCCESS or SM_FAIL with errno set as appropriate. * Returns SM_SUCCESS or SM_FAIL with errno set as appropriate.
*/ */
...@@ -247,16 +241,13 @@ mdextend(Relation reln, BlockNumber blocknum, char *buffer) ...@@ -247,16 +241,13 @@ mdextend(Relation reln, BlockNumber blocknum, char *buffer)
#ifndef LET_OS_MANAGE_FILESIZE #ifndef LET_OS_MANAGE_FILESIZE
seekpos = (long) (BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE))); seekpos = (long) (BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)));
#ifdef DIAGNOSTIC Assert(seekpos < BLCKSZ * RELSEG_SIZE);
if (seekpos >= BLCKSZ * RELSEG_SIZE)
elog(FATAL, "seekpos too big");
#endif
#else #else
seekpos = (long) (BLCKSZ * (blocknum)); seekpos = (long) (BLCKSZ * (blocknum));
#endif #endif
/* /*
* Note: because caller obtained blocknum by calling mdnblocks, which * Note: because caller obtained blocknum by calling _mdnblocks, which
* did a seek(SEEK_END), this seek is often redundant and will be * did a seek(SEEK_END), this seek is often redundant and will be
* optimized away by fd.c. It's not redundant, however, if there is a * optimized away by fd.c. It's not redundant, however, if there is a
* partial page at the end of the file. In that case we want to try * partial page at the end of the file. In that case we want to try
...@@ -282,10 +273,7 @@ mdextend(Relation reln, BlockNumber blocknum, char *buffer) ...@@ -282,10 +273,7 @@ mdextend(Relation reln, BlockNumber blocknum, char *buffer)
} }
#ifndef LET_OS_MANAGE_FILESIZE #ifndef LET_OS_MANAGE_FILESIZE
#ifdef DIAGNOSTIC Assert(_mdnblocks(v->mdfd_vfd, BLCKSZ) <= ((BlockNumber) RELSEG_SIZE));
if (_mdnblocks(v->mdfd_vfd, BLCKSZ) > ((BlockNumber) RELSEG_SIZE))
elog(FATAL, "segment too big");
#endif
#endif #endif
return SM_SUCCESS; return SM_SUCCESS;
...@@ -335,11 +323,7 @@ mdopen(Relation reln) ...@@ -335,11 +323,7 @@ mdopen(Relation reln)
Md_fdvec[vfd].mdfd_flags = (uint16) 0; Md_fdvec[vfd].mdfd_flags = (uint16) 0;
#ifndef LET_OS_MANAGE_FILESIZE #ifndef LET_OS_MANAGE_FILESIZE
Md_fdvec[vfd].mdfd_chain = (MdfdVec *) NULL; Md_fdvec[vfd].mdfd_chain = (MdfdVec *) NULL;
Assert(_mdnblocks(fd, BLCKSZ) <= ((BlockNumber) RELSEG_SIZE));
#ifdef DIAGNOSTIC
if (_mdnblocks(fd, BLCKSZ) > ((BlockNumber) RELSEG_SIZE))
elog(FATAL, "segment too big");
#endif
#endif #endif
return vfd; return vfd;
...@@ -348,7 +332,7 @@ mdopen(Relation reln) ...@@ -348,7 +332,7 @@ mdopen(Relation reln)
/* /*
* mdclose() -- Close the specified relation, if it isn't closed already. * mdclose() -- Close the specified relation, if it isn't closed already.
* *
* AND FREE fd vector! It may be re-used for other relation! * AND FREE fd vector! It may be re-used for other relations!
* reln should be flushed from cache after closing !.. * reln should be flushed from cache after closing !..
* *
* Returns SM_SUCCESS or SM_FAIL with errno set as appropriate. * Returns SM_SUCCESS or SM_FAIL with errno set as appropriate.
...@@ -418,11 +402,7 @@ mdread(Relation reln, BlockNumber blocknum, char *buffer) ...@@ -418,11 +402,7 @@ mdread(Relation reln, BlockNumber blocknum, char *buffer)
#ifndef LET_OS_MANAGE_FILESIZE #ifndef LET_OS_MANAGE_FILESIZE
seekpos = (long) (BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE))); seekpos = (long) (BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)));
Assert(seekpos < BLCKSZ * RELSEG_SIZE);
#ifdef DIAGNOSTIC
if (seekpos >= BLCKSZ * RELSEG_SIZE)
elog(FATAL, "seekpos too big");
#endif
#else #else
seekpos = (long) (BLCKSZ * (blocknum)); seekpos = (long) (BLCKSZ * (blocknum));
#endif #endif
...@@ -466,10 +446,7 @@ mdwrite(Relation reln, BlockNumber blocknum, char *buffer) ...@@ -466,10 +446,7 @@ mdwrite(Relation reln, BlockNumber blocknum, char *buffer)
#ifndef LET_OS_MANAGE_FILESIZE #ifndef LET_OS_MANAGE_FILESIZE
seekpos = (long) (BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE))); seekpos = (long) (BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)));
#ifdef DIAGNOSTIC Assert(seekpos < BLCKSZ * RELSEG_SIZE);
if (seekpos >= BLCKSZ * RELSEG_SIZE)
elog(FATAL, "seekpos too big");
#endif
#else #else
seekpos = (long) (BLCKSZ * (blocknum)); seekpos = (long) (BLCKSZ * (blocknum));
#endif #endif
...@@ -505,10 +482,7 @@ mdblindwrt(RelFileNode rnode, ...@@ -505,10 +482,7 @@ mdblindwrt(RelFileNode rnode,
#ifndef LET_OS_MANAGE_FILESIZE #ifndef LET_OS_MANAGE_FILESIZE
seekpos = (long) (BLCKSZ * (blkno % ((BlockNumber) RELSEG_SIZE))); seekpos = (long) (BLCKSZ * (blkno % ((BlockNumber) RELSEG_SIZE)));
#ifdef DIAGNOSTIC Assert(seekpos < BLCKSZ * RELSEG_SIZE);
if (seekpos >= BLCKSZ * RELSEG_SIZE)
elog(FATAL, "seekpos too big");
#endif
#else #else
seekpos = (long) (BLCKSZ * (blkno)); seekpos = (long) (BLCKSZ * (blkno));
#endif #endif
...@@ -722,8 +696,6 @@ mdcommit(void) ...@@ -722,8 +696,6 @@ mdcommit(void)
/* /*
* mdabort() -- Abort a transaction. * mdabort() -- Abort a transaction.
*
* Changes need not be forced to disk at transaction abort.
*/ */
int int
mdabort(void) mdabort(void)
...@@ -748,7 +720,7 @@ mdsync(void) ...@@ -748,7 +720,7 @@ mdsync(void)
} }
/* /*
* _fdvec_alloc () -- grab a free (or new) md file descriptor vector. * _fdvec_alloc() -- Grab a free (or new) md file descriptor vector.
*/ */
static int static int
_fdvec_alloc(void) _fdvec_alloc(void)
...@@ -802,7 +774,7 @@ _fdvec_alloc(void) ...@@ -802,7 +774,7 @@ _fdvec_alloc(void)
} }
/* /*
* _fdvec_free () -- free md file descriptor vector. * _fdvec_free() -- free md file descriptor vector.
* *
*/ */
static static
...@@ -853,19 +825,18 @@ _mdfd_openseg(Relation reln, BlockNumber segno, int oflags) ...@@ -853,19 +825,18 @@ _mdfd_openseg(Relation reln, BlockNumber segno, int oflags)
v->mdfd_flags = (uint16) 0; v->mdfd_flags = (uint16) 0;
#ifndef LET_OS_MANAGE_FILESIZE #ifndef LET_OS_MANAGE_FILESIZE
v->mdfd_chain = (MdfdVec *) NULL; v->mdfd_chain = (MdfdVec *) NULL;
Assert(_mdnblocks(fd, BLCKSZ) <= ((BlockNumber) RELSEG_SIZE));
#ifdef DIAGNOSTIC
if (_mdnblocks(fd, BLCKSZ) > ((BlockNumber) RELSEG_SIZE))
elog(FATAL, "segment too big");
#endif
#endif #endif
/* all done */ /* all done */
return v; return v;
} }
/* Get the fd for the relation, opening it if it's not already open */ /*
* _mdfd_getrelnfd() -- Get the (virtual) fd for the relation,
* opening it if it's not already open
*
*/
static int static int
_mdfd_getrelnfd(Relation reln) _mdfd_getrelnfd(Relation reln)
{ {
...@@ -882,8 +853,11 @@ _mdfd_getrelnfd(Relation reln) ...@@ -882,8 +853,11 @@ _mdfd_getrelnfd(Relation reln)
return fd; return fd;
} }
/* Find the segment of the relation holding the specified block */ /*
* _mdfd_getseg() -- Find the segment of the relation holding the
* specified block
*
*/
static MdfdVec * static MdfdVec *
_mdfd_getseg(Relation reln, BlockNumber blkno) _mdfd_getseg(Relation reln, BlockNumber blkno)
{ {
...@@ -942,7 +916,6 @@ _mdfd_getseg(Relation reln, BlockNumber blkno) ...@@ -942,7 +916,6 @@ _mdfd_getseg(Relation reln, BlockNumber blkno)
* *
* The return value is the kernel descriptor, or -1 on failure. * The return value is the kernel descriptor, or -1 on failure.
*/ */
static int static int
_mdfd_blind_getseg(RelFileNode rnode, BlockNumber blkno) _mdfd_blind_getseg(RelFileNode rnode, BlockNumber blkno)
{ {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.67 2003/12/12 18:45:09 petere Exp $ * $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.68 2004/01/06 18:07:31 neilc Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -382,7 +382,7 @@ smgrblindwrt(int16 which, ...@@ -382,7 +382,7 @@ smgrblindwrt(int16 which,
} }
/* /*
* smgrnblocks() -- Calculate the number of POSTGRES blocks in the * smgrnblocks() -- Calculate the number of blocks in the
* supplied relation. * supplied relation.
* *
* Returns the number of blocks on success, aborts the current * Returns the number of blocks on success, aborts the current
...@@ -411,7 +411,7 @@ smgrnblocks(int16 which, Relation reln) ...@@ -411,7 +411,7 @@ smgrnblocks(int16 which, Relation reln)
} }
/* /*
* smgrtruncate() -- Truncate supplied relation to a specified number * smgrtruncate() -- Truncate supplied relation to the specified number
* of blocks * of blocks
* *
* Returns the number of blocks on success, aborts the current * Returns the number of blocks on success, aborts the current
...@@ -444,7 +444,7 @@ smgrtruncate(int16 which, Relation reln, BlockNumber nblocks) ...@@ -444,7 +444,7 @@ smgrtruncate(int16 which, Relation reln, BlockNumber nblocks)
} }
/* /*
* smgrDoPendingDeletes() -- take care of relation deletes at end of xact. * smgrDoPendingDeletes() -- Take care of relation deletes at end of xact.
*/ */
int int
smgrDoPendingDeletes(bool isCommit) smgrDoPendingDeletes(bool isCommit)
...@@ -538,7 +538,7 @@ smgrabort(void) ...@@ -538,7 +538,7 @@ smgrabort(void)
} }
/* /*
* Sync files to disk at checkpoint time. * smgrsync() -- Sync files to disk at checkpoint time.
*/ */
int int
smgrsync(void) smgrsync(void)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/utils/rel.h,v 1.71 2003/11/29 22:41:16 pgsql Exp $ * $PostgreSQL: pgsql/src/include/utils/rel.h,v 1.72 2004/01/06 18:07:32 neilc Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -104,7 +104,9 @@ typedef struct PgStat_Info ...@@ -104,7 +104,9 @@ typedef struct PgStat_Info
typedef struct RelationData typedef struct RelationData
{ {
File rd_fd; /* open file descriptor, or -1 if none */ File rd_fd; /* open file descriptor, or -1 if
* none; this is NOT an operating
* system file descriptor */
RelFileNode rd_node; /* file node (physical identifier) */ RelFileNode rd_node; /* file node (physical identifier) */
BlockNumber rd_nblocks; /* number of blocks in rel */ BlockNumber rd_nblocks; /* number of blocks in rel */
BlockNumber rd_targblock; /* current insertion target block, or BlockNumber rd_targblock; /* current insertion target block, or
...@@ -220,22 +222,21 @@ typedef Relation *RelationPtr; ...@@ -220,22 +222,21 @@ typedef Relation *RelationPtr;
/* /*
* RelationGetRelid * RelationGetRelid
* * Returns the OID of the relation
* returns the OID of the relation
*/ */
#define RelationGetRelid(relation) ((relation)->rd_id) #define RelationGetRelid(relation) ((relation)->rd_id)
/* /*
* RelationGetFile * RelationGetFile
* * Returns the open file descriptor for the rel, or -1 if
* Returns the open file descriptor for the rel * none. This is NOT an operating system file descriptor; see md.c
* for more information
*/ */
#define RelationGetFile(relation) ((relation)->rd_fd) #define RelationGetFile(relation) ((relation)->rd_fd)
/* /*
* RelationGetNumberOfAttributes * RelationGetNumberOfAttributes
* * Returns the number of attributes in a relation.
* Returns the number of attributes.
*/ */
#define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts) #define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts)
...@@ -247,7 +248,6 @@ typedef Relation *RelationPtr; ...@@ -247,7 +248,6 @@ typedef Relation *RelationPtr;
/* /*
* RelationGetRelationName * RelationGetRelationName
*
* Returns the rel's name. * Returns the rel's name.
* *
* Note that the name is only unique within the containing namespace. * Note that the name is only unique within the containing namespace.
...@@ -257,7 +257,6 @@ typedef Relation *RelationPtr; ...@@ -257,7 +257,6 @@ typedef Relation *RelationPtr;
/* /*
* RelationGetNamespace * RelationGetNamespace
*
* Returns the rel's namespace OID. * Returns the rel's namespace OID.
*/ */
#define RelationGetNamespace(relation) \ #define RelationGetNamespace(relation) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment