Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite3a97b3

Browse files
author
Hiroshi Inoue
committed
Implement reindex command
1 parente3befe4 commite3a97b3

File tree

29 files changed

+1209
-230
lines changed

29 files changed

+1209
-230
lines changed

‎src/backend/access/index/istrat.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.40 2000/01/26 05:55:57 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.41 2000/02/18 09:29:16 inoue Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -477,8 +477,9 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
477477
{
478478
HeapTupletuple;
479479
HeapScanDescscan=NULL;
480+
boolcachesearch= (!IsBootstrapProcessingMode())&&IsCacheInitialized();
480481

481-
if (!IsBootstrapProcessingMode())
482+
if (cachesearch)
482483
{
483484
tuple=SearchSysCacheTuple(OPEROID,
484485
ObjectIdGetDatum(operatorObjectId),
@@ -501,7 +502,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
501502

502503
if (!HeapTupleIsValid(tuple))
503504
{
504-
if (IsBootstrapProcessingMode())
505+
if (!cachesearch)
505506
heap_endscan(scan);
506507
elog(ERROR,"OperatorObjectIdFillScanKeyEntry: unknown operator %u",
507508
operatorObjectId);
@@ -512,7 +513,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
512513
fmgr_info(entry->sk_procedure,&entry->sk_func);
513514
entry->sk_nargs=entry->sk_func.fn_nargs;
514515

515-
if (IsBootstrapProcessingMode())
516+
if (!cachesearch)
516517
heap_endscan(scan);
517518

518519
if (!RegProcedureIsValid(entry->sk_procedure))
@@ -546,8 +547,9 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
546547
AttrNumberattributeNumber;
547548
intattributeIndex;
548549
OidoperatorClassObjectId[INDEX_MAX_KEYS];
550+
boolcachesearch= (!IsBootstrapProcessingMode())&&IsCacheInitialized();
549551

550-
if (!IsBootstrapProcessingMode())
552+
if (cachesearch)
551553
{
552554
tuple=SearchSysCacheTuple(INDEXRELID,
553555
ObjectIdGetDatum(indexObjectId),
@@ -589,7 +591,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
589591
operatorClassObjectId[attributeIndex]=iform->indclass[attributeIndex];
590592
}
591593

592-
if (IsBootstrapProcessingMode())
594+
if (!cachesearch)
593595
{
594596
heap_endscan(scan);
595597
heap_close(relation,AccessShareLock);

‎src/backend/access/nbtree/nbtree.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.52 2000/01/26 05:55:58 momjian Exp $
15+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.53 2000/02/18 09:29:54 inoue Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -310,16 +310,22 @@ btbuild(Relation heap,
310310
{
311311
Oidhrelid=RelationGetRelid(heap);
312312
Oidirelid=RelationGetRelid(index);
313+
boolinplace=IsReindexProcessing();
313314

314315
heap_close(heap,NoLock);
315316
index_close(index);
317+
/*
316318
UpdateStats(hrelid, nhtups, true);
317319
UpdateStats(irelid, nitups, false);
320+
*/
321+
UpdateStats(hrelid,nhtups,inplace);
322+
UpdateStats(irelid,nitups,inplace);
318323
if (oldPred!=NULL)
319324
{
320325
if (nitups==nhtups)
321326
pred=NULL;
322-
UpdateIndexPredicate(irelid,oldPred,pred);
327+
if (!inplace)
328+
UpdateIndexPredicate(irelid,oldPred,pred);
323329
}
324330
}
325331

‎src/backend/access/transam/xact.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.60 2000/01/29 16:58:29 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.61 2000/02/18 09:30:20 inoue Exp $
1212
*
1313
* NOTES
1414
*Transaction aborts can now occur two ways:
@@ -147,6 +147,7 @@
147147

148148
#include"access/nbtree.h"
149149
#include"catalog/heap.h"
150+
#include"catalog/index.h"
150151
#include"commands/async.h"
151152
#include"commands/sequence.h"
152153
#include"commands/vacuum.h"
@@ -850,6 +851,7 @@ StartTransaction()
850851
*/
851852
s->state=TRANS_START;
852853

854+
SetReindexProcessing(false);
853855
/* ----------------
854856
*generate a new transaction id
855857
* ----------------
@@ -1046,8 +1048,8 @@ AbortTransaction()
10461048
AtAbort_Notify();
10471049
CloseSequences();
10481050
AtEOXact_portals();
1049-
if (VacuumRunning)
1050-
vc_abort();
1051+
if (CommonSpecialPortalIsOpen())
1052+
CommonSpecialPortalClose();
10511053
RecordTransactionAbort();
10521054
RelationPurgeLocalRelation(false);
10531055
DropNoNameRels();

‎src/backend/bootstrap/bootstrap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.79 2000/01/26 05:56:07 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.80 2000/02/18 09:28:39 inoue Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -292,6 +292,7 @@ BootstrapMain(int argc, char *argv[])
292292
dbName=argv[optind];
293293

294294
SetProcessingMode(BootstrapProcessing);
295+
IgnoreSystemIndexes(true);
295296

296297
if (!DataDir)
297298
{

‎src/backend/catalog/heap.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.121 2000/02/15 03:36:34 thomas Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.122 2000/02/18 09:28:40 inoue Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -713,7 +713,7 @@ AddNewRelationTuple(Relation pg_class_desc,
713713
if (temp_relname)
714714
create_temp_relation(temp_relname,tup);
715715

716-
if (!IsBootstrapProcessingMode())
716+
if (!IsIgnoringSystemIndexes())
717717
{
718718
/*
719719
* First, open the catalog indices and insert index tuples for the
@@ -1263,8 +1263,7 @@ heap_truncate(char *relname)
12631263
rel->rd_nblocks=0;
12641264

12651265
/* If this relation has indexes, truncate the indexes too */
1266-
if (rel->rd_rel->relhasindex)
1267-
RelationTruncateIndexes(rel);
1266+
RelationTruncateIndexes(rel);
12681267

12691268
/*
12701269
* Close the relation, but keep exclusive lock on it until commit.
@@ -1491,8 +1490,8 @@ heap_drop_with_catalog(const char *relname)
14911490
*remove indexes if necessary
14921491
* ----------------
14931492
*/
1494-
if (rel->rd_rel->relhasindex)
1495-
RelationRemoveIndexes(rel);
1493+
/* should ignorerelhasindex */
1494+
RelationRemoveIndexes(rel);
14961495

14971496
/* ----------------
14981497
*remove rules if necessary

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp