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

Commite44beef

Browse files
committed
Code review of CLUSTER patch. Clean up problems with relcache getting
confused, toasted data getting lost, etc.
1 parent9bccdf1 commite44beef

File tree

12 files changed

+558
-429
lines changed

12 files changed

+558
-429
lines changed

‎doc/src/sgml/release.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.145 2002/08/02 18:15:04 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.146 2002/08/11 21:17:34 tgl Exp $
33
-->
44

55
<appendix id="release">
@@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without
2424
worries about funny characters.
2525
-->
2626
<literallayout><![CDATA[
27+
CLUSTER is no longer hazardous to your schema
2728
COPY accepts a list of columns to copy
2829
ALTER TABLE DROP COLUMN
2930
CREATE OPERATOR CLASS/DROP OPERATOR CLASS

‎src/backend/catalog/heap.c

Lines changed: 11 additions & 15 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.219 2002/08/06 02:36:33 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.220 2002/08/11 21:17:34 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -198,7 +198,8 @@ SystemAttributeByName(const char *attname, bool relhasoids)
198198
*Remove the system relation specific code to elsewhere eventually.
199199
*
200200
* If storage_create is TRUE then heap_storage_create is called here,
201-
* else caller must call heap_storage_create later.
201+
* else caller must call heap_storage_create later (or not at all,
202+
* if the relation doesn't need physical storage).
202203
* ----------------------------------------------------------------
203204
*/
204205
Relation
@@ -291,7 +292,7 @@ heap_create(const char *relname,
291292
nailme);
292293

293294
/*
294-
* have the storage manager create the relation.
295+
* have the storage manager create the relation's disk file, if wanted.
295296
*/
296297
if (storage_create)
297298
heap_storage_create(rel);
@@ -684,20 +685,21 @@ heap_create_with_catalog(const char *relname,
684685
tupdesc->tdhasoid=BoolToHasOid(relhasoids);
685686

686687
/*
687-
* Tell heap_create not to create a physical file; we'll do that below
688-
* after all our catalog updates are done.(This isn't really
689-
* necessary anymore, but we may as well avoid the cycles of creating
690-
* and deleting the file in case we fail.)
688+
* Create the relcache entry (mostly dummy at this point) and the
689+
* physical disk file. (If we fail further down, it's the smgr's
690+
* responsibility to remove the disk file again.)
691+
*
692+
* NB: create a physical file only if it's not a view.
691693
*/
692694
new_rel_desc=heap_create(relname,
693695
relnamespace,
694696
tupdesc,
695697
shared_relation,
696-
false,
698+
(relkind!=RELKIND_VIEW),
697699
allow_system_table_mods);
698700

699701
/* Fetch the relation OID assigned by heap_create */
700-
new_rel_oid=new_rel_desc->rd_att->attrs[0]->attrelid;
702+
new_rel_oid=RelationGetRelid(new_rel_desc);
701703

702704
/* Assign an OID for the relation's tuple type */
703705
new_type_oid=newoid();
@@ -761,12 +763,6 @@ heap_create_with_catalog(const char *relname,
761763
*/
762764
StoreConstraints(new_rel_desc,tupdesc);
763765

764-
/*
765-
* We create the disk file for this relation here
766-
*/
767-
if (relkind!=RELKIND_VIEW)
768-
heap_storage_create(new_rel_desc);
769-
770766
/*
771767
* ok, the relation has been cataloged, so close our relations and
772768
* return the oid of the newly created relation.

‎src/backend/catalog/index.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.188 2002/08/05 03:29:16 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.189 2002/08/11 21:17:34 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -578,14 +578,18 @@ index_create(Oid heapRelationId,
578578

579579
indexTupDesc->tdhasoid=WITHOUTOID;
580580
/*
581-
* create the index relation (but don't create storage yet)
581+
* create the index relation's relcache entry and physical disk file.
582+
* (If we fail further down, it's the smgr's responsibility to remove
583+
* the disk file again.)
582584
*/
583585
indexRelation=heap_create(indexRelationName,
584586
namespaceId,
585587
indexTupDesc,
586588
shared_relation,
587-
false,
589+
true,
588590
allow_system_table_mods);
591+
592+
/* Fetch the relation OID assigned by heap_create */
589593
indexoid=RelationGetRelid(indexRelation);
590594

591595
/*
@@ -611,11 +615,6 @@ index_create(Oid heapRelationId,
611615
*/
612616
UpdateRelationRelation(indexRelation);
613617

614-
/*
615-
* We create the disk file for this relation here
616-
*/
617-
heap_storage_create(indexRelation);
618-
619618
/*
620619
* now update the object id's of all the attribute tuple forms in the
621620
* index relation's tuple descriptor

‎src/backend/catalog/pg_depend.c

Lines changed: 7 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/catalog/pg_depend.c,v 1.4 2002/08/05 03:29:16 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_depend.c,v 1.5 2002/08/11 21:17:34 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -121,15 +121,16 @@ recordMultipleDependencies(const ObjectAddress *depender,
121121

122122
/*
123123
* deleteDependencyRecordsFor -- delete all records with given depender
124-
* classId/objectId.
124+
* classId/objectId. Returns the number of records deleted.
125125
*
126126
* This is used when redefining an existing object. Links leading to the
127127
* object do not change, and links leading from it will be recreated
128128
* (possibly with some differences from before).
129129
*/
130-
void
130+
long
131131
deleteDependencyRecordsFor(OidclassId,OidobjectId)
132132
{
133+
longcount=0;
133134
RelationdepRel;
134135
ScanKeyDatakey[2];
135136
SysScanDescscan;
@@ -150,11 +151,14 @@ deleteDependencyRecordsFor(Oid classId, Oid objectId)
150151
while (HeapTupleIsValid(tup=systable_getnext(scan)))
151152
{
152153
simple_heap_delete(depRel,&tup->t_self);
154+
count++;
153155
}
154156

155157
systable_endscan(scan);
156158

157159
heap_close(depRel,RowExclusiveLock);
160+
161+
returncount;
158162
}
159163

160164
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp