diff options
| author | Neil Conway <neilc@samurai.com> | 2004-01-06 18:07:32 +0000 |
|---|---|---|
| committer | Neil Conway <neilc@samurai.com> | 2004-01-06 18:07:32 +0000 |
| commit | dfc7e7b71d86771c3242ac4fab6a04496ed0cf98 (patch) | |
| tree | 0c7ac2974fc05c725bac73ab0565402fa4ffc4ea /src/backend/commands/vacuum.c | |
| parent | 030f8e731326f39a5438af9ce3adc48479332f8b (diff) | |
| download | postgresql-dfc7e7b71d86771c3242ac4fab6a04496ed0cf98.tar.gz | |
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
Diffstat (limited to 'src/backend/commands/vacuum.c')
| -rw-r--r-- | src/backend/commands/vacuum.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 8901231940..71844ff9b9 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * 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; /* 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, TransactionId vacuumXID, TransactionId frozenXID); @@ -161,7 +161,7 @@ vacuum(VacuumStmt *vacstmt) TransactionId initialOldestXmin = InvalidTransactionId; TransactionId initialFreezeLimit = InvalidTransactionId; bool all_rels; - List *vrl, + List *relations, *cur; if (vacstmt->verbose) @@ -216,7 +216,7 @@ vacuum(VacuumStmt *vacstmt) all_rels = (vacstmt->relation == NULL); /* 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 @@ -282,7 +282,7 @@ vacuum(VacuumStmt *vacstmt) /* * Loop to process each selected relation. */ - foreach(cur, vrl) + foreach(cur, relations) { Oid relid = lfirsto(cur); @@ -383,21 +383,21 @@ vacuum(VacuumStmt *vacstmt) * per-relation transactions. */ 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; if (vacrel) { - /* Process specific relation */ + /* Process a specific relation */ Oid relid; relid = RangeVarGetRelid(vacrel, false); /* Make a relation list entry for this guy */ oldcontext = MemoryContextSwitchTo(vac_context); - vrl = lappendo(vrl, relid); + oid_list = lappendo(oid_list, relid); MemoryContextSwitchTo(oldcontext); } else @@ -421,7 +421,7 @@ getrels(const RangeVar *vacrel, const char *stmttype) { /* Make a relation list entry for this guy */ oldcontext = MemoryContextSwitchTo(vac_context); - vrl = lappendo(vrl, HeapTupleGetOid(tuple)); + oid_list = lappendo(oid_list, HeapTupleGetOid(tuple)); MemoryContextSwitchTo(oldcontext); } @@ -429,7 +429,7 @@ getrels(const RangeVar *vacrel, const char *stmttype) heap_close(pgclass, AccessShareLock); } - return vrl; + return oid_list; } /* @@ -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 - * seems safer to check after we've locked the relation. + * Check that it's a plain table; we used to do this in + * get_rel_oids() but seems safer to check after we've locked the + * relation. */ if (onerel->rd_rel->relkind != expected_relkind) { |
