Another vacuum fix.
This commit is contained in:
parent
09e125084a
commit
31309423c9
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.48 1998/08/19 02:01:32 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.49 1998/08/20 15:16:54 momjian Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@ -1308,6 +1308,7 @@ UpdateStats(Oid relid, long reltuples, bool hasindex)
|
||||
Datum values[Natts_pg_class];
|
||||
char nulls[Natts_pg_class];
|
||||
char replace[Natts_pg_class];
|
||||
HeapScanDesc pg_class_scan = NULL;
|
||||
|
||||
/* ----------------
|
||||
* This routine handles updates for both the heap and index relation
|
||||
@ -1340,11 +1341,30 @@ UpdateStats(Oid relid, long reltuples, bool hasindex)
|
||||
if (!RelationIsValid(pg_class))
|
||||
elog(ERROR, "UpdateStats: could not open RELATION relation");
|
||||
|
||||
tuple = SearchSysCacheTupleCopy(RELOID,
|
||||
ObjectIdGetDatum(relid),
|
||||
0, 0, 0);
|
||||
|
||||
if (!IsBootstrapProcessingMode())
|
||||
{
|
||||
tuple = SearchSysCacheTupleCopy(RELOID,
|
||||
ObjectIdGetDatum(relid),
|
||||
0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ScanKeyData key[1];
|
||||
|
||||
ScanKeyEntryInitialize(&key[0], 0,
|
||||
ObjectIdAttributeNumber,
|
||||
F_OIDEQ,
|
||||
ObjectIdGetDatum(relid));
|
||||
|
||||
pg_class_scan = heap_beginscan(pg_class, 0, SnapshotNow, 1, key);
|
||||
tuple = heap_getnext(pg_class_scan, 0);
|
||||
}
|
||||
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
{
|
||||
if (IsBootstrapProcessingMode())
|
||||
heap_endscan(pg_class_scan);
|
||||
heap_close(pg_class);
|
||||
elog(ERROR, "UpdateStats: cannot scan RELATION relation");
|
||||
}
|
||||
@ -1385,11 +1405,11 @@ UpdateStats(Oid relid, long reltuples, bool hasindex)
|
||||
* At bootstrap time, we don't need to worry about concurrency or
|
||||
* visibility of changes, so we cheat.
|
||||
*/
|
||||
|
||||
rd_rel = (Form_pg_class) GETSTRUCT(tuple);
|
||||
rd_rel->relpages = relpages;
|
||||
rd_rel->reltuples = reltuples;
|
||||
rd_rel->relhasindex = hasindex;
|
||||
WriteBuffer(pg_class_scan->rs_cbuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1402,14 +1422,18 @@ UpdateStats(Oid relid, long reltuples, bool hasindex)
|
||||
values[Anum_pg_class_relhasindex - 1] = CharGetDatum(hasindex);
|
||||
|
||||
newtup = heap_modifytuple(tuple, pg_class, values, nulls, replace);
|
||||
heap_replace(pg_class, &newtup->t_ctid, newtup);
|
||||
heap_replace(pg_class, &tuple->t_ctid, newtup);
|
||||
pfree(newtup);
|
||||
CatalogOpenIndices(Num_pg_class_indices, Name_pg_class_indices, idescs);
|
||||
CatalogIndexInsert(idescs, Num_pg_class_indices, pg_class, newtup);
|
||||
CatalogCloseIndices(Num_pg_class_indices, idescs);
|
||||
}
|
||||
|
||||
pfree(tuple);
|
||||
if (!IsBootstrapProcessingMode())
|
||||
pfree(tuple);
|
||||
else
|
||||
heap_endscan(pg_class_scan);
|
||||
|
||||
heap_close(pg_class);
|
||||
heap_close(whichRel);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.20 1998/08/19 02:01:33 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.21 1998/08/20 15:16:55 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -254,7 +254,7 @@ CatalogIndexFetchTuple(Relation heapRelation,
|
||||
|
||||
index_endscan(sd);
|
||||
pfree(sd);
|
||||
return (tuple);
|
||||
return tuple;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -276,7 +276,7 @@ AttributeNameIndexScan(Relation heapRelation,
|
||||
(bits16) 0x0,
|
||||
(AttrNumber) 1,
|
||||
(RegProcedure)F_OIDEQ,
|
||||
Int32GetDatum(relid));
|
||||
ObjectIdGetDatum(relid));
|
||||
|
||||
ScanKeyEntryInitialize(&skey[1],
|
||||
(bits16) 0x0,
|
||||
@ -456,7 +456,7 @@ ClassNameIndexScan(Relation heapRelation, char *relName)
|
||||
(bits16) 0x0,
|
||||
(AttrNumber) 1,
|
||||
(RegProcedure) F_NAMEEQ,
|
||||
(Datum) relName);
|
||||
PointerGetDatum(relName));
|
||||
|
||||
idesc = index_openr(ClassNameIndex);
|
||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.74 1998/08/19 23:48:21 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.75 1998/08/20 15:16:57 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -188,7 +188,7 @@ vc_init()
|
||||
|
||||
if ((fd = open("pg_vlock", O_CREAT | O_EXCL, 0600)) < 0)
|
||||
{
|
||||
elog(ERROR, "Can't create lock file -- another vacuum cleaner running?\n\
|
||||
elog(ERROR, "Can't create lock file. Is another vacuum cleaner running?\n\
|
||||
\tIf not, you may remove the pg_vlock file in the pgsql/data/base/your_db\n\
|
||||
\tdirectory");
|
||||
}
|
||||
@ -2204,24 +2204,25 @@ static void
|
||||
vc_mkindesc(Relation onerel, int nindices, Relation *Irel, IndDesc **Idesc)
|
||||
{
|
||||
IndDesc *idcur;
|
||||
HeapTuple tuple;
|
||||
HeapTuple tuple, cachetuple;
|
||||
AttrNumber *attnumP;
|
||||
int natts;
|
||||
int i;
|
||||
Buffer buffer;
|
||||
|
||||
|
||||
*Idesc = (IndDesc *) palloc(nindices * sizeof(IndDesc));
|
||||
|
||||
for (i = 0, idcur = *Idesc; i < nindices; i++, idcur++)
|
||||
{
|
||||
tuple = SearchSysCacheTuple(INDEXRELID,
|
||||
ObjectIdGetDatum(RelationGetRelid(Irel[i])),
|
||||
0, 0, 0);
|
||||
cachetuple = SearchSysCacheTupleCopy(INDEXRELID,
|
||||
ObjectIdGetDatum(RelationGetRelid(Irel[i])),
|
||||
0, 0, 0);
|
||||
Assert(tuple);
|
||||
|
||||
/* get the buffer cache tuple */
|
||||
tuple = heap_fetch(onerel, SnapshotNow, &tuple->t_ctid, &buffer);
|
||||
tuple = heap_fetch(onerel, SnapshotNow, &cachetuple->t_ctid, &buffer);
|
||||
Assert(tuple);
|
||||
pfree(cachetuple);
|
||||
|
||||
idcur->tform = (IndexTupleForm) GETSTRUCT(tuple);
|
||||
for (attnumP = &(idcur->tform->indkey[0]), natts = 0;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.48 1998/08/19 23:48:23 momjian Exp $
|
||||
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.49 1998/08/20 15:16:59 momjian Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -316,7 +316,7 @@ fi
|
||||
|
||||
BACKENDARGS="-boot -C -F -D$PGDATA $BACKEND_TALK_ARG"
|
||||
|
||||
echo "$CMDNAME: creating template database in $PGDATA/base/template1"
|
||||
echo "Creating template database in $PGDATA/base/template1"
|
||||
[ "$debug" -ne 0 ] && echo "Running: postgres $BACKENDARGS template1"
|
||||
|
||||
cat $TEMPLATE \
|
||||
|
Loading…
x
Reference in New Issue
Block a user