mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Implement reindex command
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.40 2000/01/26 05:55:57 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.41 2000/02/18 09:29:16 inoue Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -477,8 +477,9 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
|
||||
{
|
||||
HeapTuple tuple;
|
||||
HeapScanDesc scan = NULL;
|
||||
bool cachesearch = (!IsBootstrapProcessingMode()) && IsCacheInitialized();
|
||||
|
||||
if (!IsBootstrapProcessingMode())
|
||||
if (cachesearch)
|
||||
{
|
||||
tuple = SearchSysCacheTuple(OPEROID,
|
||||
ObjectIdGetDatum(operatorObjectId),
|
||||
@@ -501,7 +502,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
|
||||
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
{
|
||||
if (IsBootstrapProcessingMode())
|
||||
if (!cachesearch)
|
||||
heap_endscan(scan);
|
||||
elog(ERROR, "OperatorObjectIdFillScanKeyEntry: unknown operator %u",
|
||||
operatorObjectId);
|
||||
@@ -512,7 +513,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
|
||||
fmgr_info(entry->sk_procedure, &entry->sk_func);
|
||||
entry->sk_nargs = entry->sk_func.fn_nargs;
|
||||
|
||||
if (IsBootstrapProcessingMode())
|
||||
if (!cachesearch)
|
||||
heap_endscan(scan);
|
||||
|
||||
if (!RegProcedureIsValid(entry->sk_procedure))
|
||||
@@ -546,8 +547,9 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
||||
AttrNumber attributeNumber;
|
||||
int attributeIndex;
|
||||
Oid operatorClassObjectId[INDEX_MAX_KEYS];
|
||||
bool cachesearch = (!IsBootstrapProcessingMode()) && IsCacheInitialized();
|
||||
|
||||
if (!IsBootstrapProcessingMode())
|
||||
if (cachesearch)
|
||||
{
|
||||
tuple = SearchSysCacheTuple(INDEXRELID,
|
||||
ObjectIdGetDatum(indexObjectId),
|
||||
@@ -589,7 +591,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
|
||||
operatorClassObjectId[attributeIndex] = iform->indclass[attributeIndex];
|
||||
}
|
||||
|
||||
if (IsBootstrapProcessingMode())
|
||||
if (!cachesearch)
|
||||
{
|
||||
heap_endscan(scan);
|
||||
heap_close(relation, AccessShareLock);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.52 2000/01/26 05:55:58 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.53 2000/02/18 09:29:54 inoue Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -310,16 +310,22 @@ btbuild(Relation heap,
|
||||
{
|
||||
Oid hrelid = RelationGetRelid(heap);
|
||||
Oid irelid = RelationGetRelid(index);
|
||||
bool inplace = IsReindexProcessing();
|
||||
|
||||
heap_close(heap, NoLock);
|
||||
index_close(index);
|
||||
/*
|
||||
UpdateStats(hrelid, nhtups, true);
|
||||
UpdateStats(irelid, nitups, false);
|
||||
*/
|
||||
UpdateStats(hrelid, nhtups, inplace);
|
||||
UpdateStats(irelid, nitups, inplace);
|
||||
if (oldPred != NULL)
|
||||
{
|
||||
if (nitups == nhtups)
|
||||
pred = NULL;
|
||||
UpdateIndexPredicate(irelid, oldPred, pred);
|
||||
if (!inplace)
|
||||
UpdateIndexPredicate(irelid, oldPred, pred);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.60 2000/01/29 16:58:29 petere Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.61 2000/02/18 09:30:20 inoue Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Transaction aborts can now occur two ways:
|
||||
@@ -147,6 +147,7 @@
|
||||
|
||||
#include "access/nbtree.h"
|
||||
#include "catalog/heap.h"
|
||||
#include "catalog/index.h"
|
||||
#include "commands/async.h"
|
||||
#include "commands/sequence.h"
|
||||
#include "commands/vacuum.h"
|
||||
@@ -850,6 +851,7 @@ StartTransaction()
|
||||
*/
|
||||
s->state = TRANS_START;
|
||||
|
||||
SetReindexProcessing(false);
|
||||
/* ----------------
|
||||
* generate a new transaction id
|
||||
* ----------------
|
||||
@@ -1046,8 +1048,8 @@ AbortTransaction()
|
||||
AtAbort_Notify();
|
||||
CloseSequences();
|
||||
AtEOXact_portals();
|
||||
if (VacuumRunning)
|
||||
vc_abort();
|
||||
if (CommonSpecialPortalIsOpen())
|
||||
CommonSpecialPortalClose();
|
||||
RecordTransactionAbort();
|
||||
RelationPurgeLocalRelation(false);
|
||||
DropNoNameRels();
|
||||
|
||||
Reference in New Issue
Block a user