Commit d950c197 authored by Bruce Momjian's avatar Bruce Momjian

more cleanup

parent ac4de0cc
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.154 2000/05/29 16:06:37 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.155 2000/05/29 16:21:04 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
...@@ -74,10 +74,10 @@ static TransactionId XmaxRecent; ...@@ -74,10 +74,10 @@ static TransactionId XmaxRecent;
/* non-export function prototypes */ /* non-export function prototypes */
static void vacuum_init(void); static void vacuum_init(void);
static void vacuum_shutdown(void); static void vacuum_shutdown(void);
static void vac_vacuum(NameData *VacRelP, bool analyze, List *va_cols); static void vac_vacuum(NameData *VacRelP, bool analyze, List *anal_cols2);
static VRelList getrels(NameData *VacRelP); static VRelList getrels(NameData *VacRelP);
static void vacuum_rel(Oid relid, bool analyze, List *va_cols); static void vacuum_rel(Oid relid, bool analyze);
static void analyze_rel(Oid relid, List *va_cols); static void analyze_rel(Oid relid, List *anal_cols2);
static void scan_heap(VRelStats *vacrelstats, Relation onerel, VPageList vacuum_pages, VPageList fraged_pages); static void scan_heap(VRelStats *vacrelstats, Relation onerel, VPageList vacuum_pages, VPageList fraged_pages);
static void repair_frag(VRelStats *vacrelstats, Relation onerel, VPageList vacuum_pages, VPageList fraged_pages, int nindices, Relation *Irel); static void repair_frag(VRelStats *vacrelstats, Relation onerel, VPageList vacuum_pages, VPageList fraged_pages, int nindices, Relation *Irel);
static void vacuum_heap(VRelStats *vacrelstats, Relation onerel, VPageList vpl); static void vacuum_heap(VRelStats *vacrelstats, Relation onerel, VPageList vpl);
...@@ -105,16 +105,16 @@ static char *show_rusage(struct rusage * ru0); ...@@ -105,16 +105,16 @@ static char *show_rusage(struct rusage * ru0);
/* CommonSpecialPortal function at the bottom */ /* CommonSpecialPortal function at the bottom */
void void
vacuum(char *vacrel, bool verbose, bool analyze, List *va_spec) vacuum(char *vacrel, bool verbose, bool analyze, List *anal_cols)
{ {
NameData VacRel; NameData VacRel;
Name VacRelName; Name VacRelName;
PortalVariableMemory pmem; PortalVariableMemory pmem;
MemoryContext old; MemoryContext old;
List *le; List *le;
List *va_cols = NIL; List *anal_cols2 = NIL;
if (va_spec != NIL && !analyze) if (anal_cols != NIL && !analyze)
elog(ERROR, "Can't vacuum columns, only tables. You can 'vacuum analyze' columns."); elog(ERROR, "Can't vacuum columns, only tables. You can 'vacuum analyze' columns.");
/* /*
...@@ -149,11 +149,11 @@ vacuum(char *vacrel, bool verbose, bool analyze, List *va_spec) ...@@ -149,11 +149,11 @@ vacuum(char *vacrel, bool verbose, bool analyze, List *va_spec)
/* must also copy the column list, if any, to safe storage */ /* must also copy the column list, if any, to safe storage */
pmem = CommonSpecialPortalGetMemory(); pmem = CommonSpecialPortalGetMemory();
old = MemoryContextSwitchTo((MemoryContext) pmem); old = MemoryContextSwitchTo((MemoryContext) pmem);
foreach(le, va_spec) foreach(le, anal_cols)
{ {
char *col = (char *) lfirst(le); char *col = (char *) lfirst(le);
va_cols = lappend(va_cols, pstrdup(col)); anal_cols2 = lappend(anal_cols2, pstrdup(col));
} }
MemoryContextSwitchTo(old); MemoryContextSwitchTo(old);
...@@ -168,7 +168,7 @@ vacuum(char *vacrel, bool verbose, bool analyze, List *va_spec) ...@@ -168,7 +168,7 @@ vacuum(char *vacrel, bool verbose, bool analyze, List *va_spec)
vacuum_init(); vacuum_init();
/* vacuum the database */ /* vacuum the database */
vac_vacuum(VacRelName, analyze, va_cols); vac_vacuum(VacRelName, analyze, anal_cols2);
/* clean up */ /* clean up */
vacuum_shutdown(); vacuum_shutdown();
...@@ -234,7 +234,7 @@ vacuum_shutdown() ...@@ -234,7 +234,7 @@ vacuum_shutdown()
* locks at one time. * locks at one time.
*/ */
static void static void
vac_vacuum(NameData *VacRelP, bool analyze, List *va_cols) vac_vacuum(NameData *VacRelP, bool analyze, List *anal_cols2)
{ {
VRelList vrl, VRelList vrl,
cur; cur;
...@@ -244,12 +244,12 @@ vac_vacuum(NameData *VacRelP, bool analyze, List *va_cols) ...@@ -244,12 +244,12 @@ vac_vacuum(NameData *VacRelP, bool analyze, List *va_cols)
/* vacuum each heap relation */ /* vacuum each heap relation */
for (cur = vrl; cur != (VRelList) NULL; cur = cur->vrl_next) for (cur = vrl; cur != (VRelList) NULL; cur = cur->vrl_next)
vacuum_rel(cur->vrl_relid, analyze, va_cols); vacuum_rel(cur->vrl_relid, analyze);
/* analyze separately so locking is minimized */ /* analyze separately so locking is minimized */
if (analyze) if (analyze)
for (cur = vrl; cur != (VRelList) NULL; cur = cur->vrl_next) for (cur = vrl; cur != (VRelList) NULL; cur = cur->vrl_next)
analyze_rel(cur->vrl_relid, va_cols); analyze_rel(cur->vrl_relid, anal_cols2);
} }
static VRelList static VRelList
...@@ -359,7 +359,7 @@ getrels(NameData *VacRelP) ...@@ -359,7 +359,7 @@ getrels(NameData *VacRelP)
* us to lock the entire database during one pass of the vacuum cleaner. * us to lock the entire database during one pass of the vacuum cleaner.
*/ */
static void static void
vacuum_rel(Oid relid, bool analyze, List *va_cols) vacuum_rel(Oid relid, bool analyze)
{ {
HeapTuple tuple; HeapTuple tuple;
Relation onerel; Relation onerel;
...@@ -508,7 +508,7 @@ vacuum_rel(Oid relid, bool analyze, List *va_cols) ...@@ -508,7 +508,7 @@ vacuum_rel(Oid relid, bool analyze, List *va_cols)
* analyze_rel() -- analyze relation * analyze_rel() -- analyze relation
*/ */
static void static void
analyze_rel(Oid relid, List *va_cols) analyze_rel(Oid relid, List *anal_cols2)
{ {
HeapTuple tuple, HeapTuple tuple,
typetuple; typetuple;
...@@ -569,16 +569,16 @@ analyze_rel(Oid relid, List *va_cols) ...@@ -569,16 +569,16 @@ analyze_rel(Oid relid, List *va_cols)
attr_cnt = onerel->rd_att->natts; attr_cnt = onerel->rd_att->natts;
attr = onerel->rd_att->attrs; attr = onerel->rd_att->attrs;
if (va_cols != NIL) if (anal_cols2 != NIL)
{ {
int tcnt = 0; int tcnt = 0;
List *le; List *le;
if (length(va_cols) > attr_cnt) if (length(anal_cols2) > attr_cnt)
elog(ERROR, "vacuum: too many attributes specified for relation %s", elog(ERROR, "vacuum: too many attributes specified for relation %s",
RelationGetRelationName(onerel)); RelationGetRelationName(onerel));
attnums = (int *) palloc(attr_cnt * sizeof(int)); attnums = (int *) palloc(attr_cnt * sizeof(int));
foreach(le, va_cols) foreach(le, anal_cols2)
{ {
char *col = (char *) lfirst(le); char *col = (char *) lfirst(le);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: vacuum.h,v 1.28 2000/05/29 15:44:55 momjian Exp $ * $Id: vacuum.h,v 1.29 2000/05/29 16:21:05 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -132,7 +132,7 @@ typedef struct VRelStats ...@@ -132,7 +132,7 @@ typedef struct VRelStats
extern bool VacuumRunning; extern bool VacuumRunning;
extern void vc_abort(void); extern void vc_abort(void);
extern void vacuum(char *vacrel, bool verbose, bool analyze, List *va_spec); extern void vacuum(char *vacrel, bool verbose, bool analyze, List *anal_cols);
#define ATTNVALS_SCALE 1000000000 /* XXX so it can act as a float4 */ #define ATTNVALS_SCALE 1000000000 /* XXX so it can act as a float4 */
......
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