*
*
* 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
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
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");
}
* 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
{
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);
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
index_endscan(sd);
pfree(sd);
- return (tuple);
+ return tuple;
}
/*
(bits16) 0x0,
(AttrNumber) 1,
(RegProcedure)F_OIDEQ,
- Int32GetDatum(relid));
+ ObjectIdGetDatum(relid));
ScanKeyEntryInitialize(&skey[1],
(bits16) 0x0,
(bits16) 0x0,
(AttrNumber) 1,
(RegProcedure) F_NAMEEQ,
- (Datum) relName);
+ PointerGetDatum(relName));
idesc = index_openr(ClassNameIndex);
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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");
}
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;