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

Commitd1c6416

Browse files
committed
Update with newer version of CLUSTER patch posted August 8.
> Looks like Alvaro got sideswiped by the system catalog indexing changes> I made over the weekend. It's a simple change, just reduce the whole> mess to a "CatalogUpdateIndexes()" call.I update two tuples, so I manually CatalogOpenIndexes() andCatalogIndexInsert() two times, as per comments inCatalogUpdateIndexes().I also removed a couple of useless CommandCounterIncrement(), someuseless definitions in src/include/commands/cluster.h and uselessincludes in src/backend/commands/cluster.c. This version passes theregression test I had made for previous versions.Alvaro Herrera
1 parent8db20b4 commitd1c6416

File tree

2 files changed

+7
-23
lines changed

2 files changed

+7
-23
lines changed

‎src/backend/commands/cluster.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.84 2002/08/1020:43:46 momjian Exp $
18+
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.85 2002/08/1021:00:34 momjian Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -29,12 +29,9 @@
2929
#include"catalog/index.h"
3030
#include"catalog/indexing.h"
3131
#include"catalog/catname.h"
32-
#include"catalog/pg_index.h"
33-
#include"catalog/pg_proc.h"
3432
#include"commands/cluster.h"
3533
#include"commands/tablecmds.h"
3634
#include"miscadmin.h"
37-
#include"utils/builtins.h"
3835
#include"utils/fmgroids.h"
3936
#include"utils/lsyscache.h"
4037
#include"utils/syscache.h"
@@ -81,8 +78,6 @@ Relation RelationIdGetRelation(Oid relationId);
8178
* AccessExclusiveLock right before swapping the filenodes.
8279
* This would allow users to CLUSTER on a regular basis,
8380
* practically eliminating the need for auto-clustered indexes.
84-
*
85-
*Preserve constraint bit for the indexes.
8681
*/
8782
void
8883
cluster(RangeVar*oldrelation,char*oldindexname)
@@ -349,9 +344,6 @@ recreate_indexattr(Oid OIDOldHeap, List *indexes)
349344
swap_relfilenodes(newIndexOID,attrs->indexOID);
350345
setRelhasindex(OIDOldHeap, true,attrs->isPrimary,InvalidOid);
351346

352-
/* I'm not sure this one is needed, but let's be safe. */
353-
CommandCounterIncrement();
354-
355347
/* Destroy new index with old filenode */
356348
object.classId=RelOid_pg_class;
357349
object.objectId=newIndexOID;
@@ -380,11 +372,11 @@ swap_relfilenodes(Oid r1, Oid r2)
380372
* it every time.
381373
*/
382374
RelationrelRelation,
383-
irels[Num_pg_class_indices],
384375
rel;
385376
HeapTuplereltup[2];
386377
OidtempRFNode;
387378
inti;
379+
CatalogIndexStateindstate;
388380

389381
/* We need both RelationRelationName tuples. */
390382
relRelation=heap_openr(RelationRelationName,RowExclusiveLock);
@@ -429,11 +421,10 @@ swap_relfilenodes(Oid r1, Oid r2)
429421
simple_heap_update(relRelation,&reltup[0]->t_self,reltup[0]);
430422

431423
/* To keep system catalogs current. */
432-
CatalogOpenIndices(Num_pg_class_indices,Name_pg_class_indices,irels);
433-
CatalogIndexInsert(irels,Num_pg_class_indices,relRelation,reltup[1]);
434-
CatalogIndexInsert(irels,Num_pg_class_indices,relRelation,reltup[0]);
435-
CatalogCloseIndices(Num_pg_class_indices,irels);
436-
CommandCounterIncrement();
424+
indstate=CatalogOpenIndexes(relRelation);
425+
CatalogIndexInsert(indstate,reltup[1]);
426+
CatalogIndexInsert(indstate,reltup[0]);
427+
CatalogCloseIndexes(indstate);
437428

438429
heap_close(relRelation,NoLock);
439430
heap_freetuple(reltup[0]);

‎src/include/commands/cluster.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,13 @@
66
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994-5, Regents of the University of California
88
*
9-
* $Id: cluster.h,v 1.14 2002/06/20 20:29:49 momjian Exp $
9+
* $Id: cluster.h,v 1.15 2002/08/10 21:00:34 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
1313
#ifndefCLUSTER_H
1414
#defineCLUSTER_H
1515

16-
/*
17-
* defines for contant stuff
18-
*/
19-
#define_TEMP_RELATION_KEY_"clXXXXXXXX"
20-
#define_SIZE_OF_TEMP_RELATION_KEY_11
21-
22-
2316
/*
2417
* functions
2518
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp