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

Commit46d2882

Browse files
committed
Improve C comments about backend variables set by pg_upgrade_support
functions.
1 parent7f40e30 commit46d2882

File tree

7 files changed

+43
-9
lines changed

7 files changed

+43
-9
lines changed

‎contrib/pg_upgrade/pg_upgrade.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,28 @@
77
*contrib/pg_upgrade/pg_upgrade.c
88
*/
99

10+
/*
11+
*To simplify the upgrade process, we force certain system items to be
12+
*consistent between old and new clusters:
13+
*
14+
*We control all assignments of pg_class.relfilenode so we can keep the
15+
*same relfilenodes for old and new files. The only exception is
16+
*pg_largeobject, pg_largeobject_metadata, and its indexes, which can
17+
*change due to a cluster, reindex, or vacuum full. (We don't create
18+
*those so have no control over their oid/relfilenode values.)
19+
*
20+
*While pg_class.oid and pg_class.relfilenode are intially the same, they
21+
*can diverge due to cluster, reindex, or vacuum full. The new cluster
22+
*will again have matching pg_class.relfilenode and pg_class.oid values,
23+
*but based on the new relfilenode value, so the old/new oids might
24+
*differ.
25+
*
26+
*We control all assignments of pg_type.oid because these are stored
27+
*in composite types.
28+
*/
29+
30+
31+
1032
#include"pg_upgrade.h"
1133

1234
#ifdefHAVE_LANGINFO_H

‎src/backend/catalog/heap.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
#include"utils/tqual.h"
7474

7575

76-
/*Kluge for upgrade-in-place support */
76+
/*Potentially set by contrib/pg_upgrade_support functions */
7777
Oidbinary_upgrade_next_heap_relfilenode=InvalidOid;
7878
Oidbinary_upgrade_next_toast_relfilenode=InvalidOid;
7979

@@ -986,7 +986,10 @@ heap_create_with_catalog(const char *relname,
986986
*/
987987
if (!OidIsValid(relid))
988988
{
989-
/* Use binary-upgrade overrides if applicable */
989+
/*
990+
*Use binary-upgrade override for pg_class.relfilenode/oid,
991+
*if supplied.
992+
*/
990993
if (OidIsValid(binary_upgrade_next_heap_relfilenode)&&
991994
(relkind==RELKIND_RELATION||relkind==RELKIND_SEQUENCE||
992995
relkind==RELKIND_VIEW||relkind==RELKIND_COMPOSITE_TYPE||

‎src/backend/catalog/index.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
#include"utils/tqual.h"
6969

7070

71-
/*Kluge for upgrade-in-place support */
71+
/*Potentially set by contrib/pg_upgrade_support functions */
7272
Oidbinary_upgrade_next_index_relfilenode=InvalidOid;
7373

7474
/* state info for validate_index bulkdelete callback */
@@ -640,7 +640,10 @@ index_create(Oid heapRelationId,
640640
*/
641641
if (!OidIsValid(indexRelationId))
642642
{
643-
/* Use binary-upgrade override if applicable */
643+
/*
644+
*Use binary-upgrade override for pg_class.relfilenode/oid,
645+
*if supplied.
646+
*/
644647
if (OidIsValid(binary_upgrade_next_index_relfilenode))
645648
{
646649
indexRelationId=binary_upgrade_next_index_relfilenode;

‎src/backend/catalog/pg_enum.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include"utils/tqual.h"
2929

3030

31+
/* Potentially set by contrib/pg_upgrade_support functions */
3132
Oidbinary_upgrade_next_pg_enum_oid=InvalidOid;
3233

3334
staticvoidRenumberEnumType(Relationpg_enum,HeapTuple*existing,intnelems);
@@ -313,9 +314,9 @@ AddEnumLabel(Oid enumTypeOid,
313314
if (OidIsValid(binary_upgrade_next_pg_enum_oid))
314315
{
315316
/*
316-
* Inbinary upgrades, just add the new label with the predetermined
317-
* Oid. It's pg_upgrade'sresponsibility that the Oid meets
318-
* requirements.
317+
*Usebinary-upgrade override for pg_enum.oid, if supplied.
318+
*During binary upgrade, all pg_enum.oid'sare set this way
319+
*so they are guaranteed to be consistent.
319320
*/
320321
if (neighbor!=NULL)
321322
ereport(ERROR,

‎src/backend/catalog/pg_type.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include"utils/rel.h"
3434
#include"utils/syscache.h"
3535

36+
/* Potentially set by contrib/pg_upgrade_support functions */
3637
Oidbinary_upgrade_next_pg_type_oid=InvalidOid;
3738

3839
/* ----------------------------------------------------------------
@@ -121,6 +122,7 @@ TypeShellMake(const char *typeName, Oid typeNamespace, Oid ownerId)
121122
*/
122123
tup=heap_form_tuple(tupDesc,values,nulls);
123124

125+
/* Use binary-upgrade override for pg_type.oid, if supplied. */
124126
if (OidIsValid(binary_upgrade_next_pg_type_oid))
125127
{
126128
HeapTupleSetOid(tup,binary_upgrade_next_pg_type_oid);
@@ -422,6 +424,7 @@ TypeCreate(Oid newTypeOid,
422424
/* Force the OID if requested by caller */
423425
if (OidIsValid(newTypeOid))
424426
HeapTupleSetOid(tup,newTypeOid);
427+
/* Use binary-upgrade override for pg_type.oid, if supplied. */
425428
elseif (OidIsValid(binary_upgrade_next_pg_type_oid))
426429
{
427430
HeapTupleSetOid(tup,binary_upgrade_next_pg_type_oid);

‎src/backend/catalog/toasting.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include"utils/builtins.h"
3232
#include"utils/syscache.h"
3333

34-
/*Kluges for upgrade-in-place support */
34+
/*Potentially set by contrib/pg_upgrade_support functions */
3535
externOidbinary_upgrade_next_toast_relfilenode;
3636

3737
Oidbinary_upgrade_next_pg_type_toast_oid=InvalidOid;
@@ -200,6 +200,7 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, Datum reloptio
200200
else
201201
namespaceid=PG_TOAST_NAMESPACE;
202202

203+
/* Use binary-upgrade override for pg_type.oid, if supplied. */
203204
if (OidIsValid(binary_upgrade_next_pg_type_toast_oid))
204205
{
205206
toast_typid=binary_upgrade_next_pg_type_toast_oid;

‎src/backend/commands/typecmds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ typedef struct
7474
/* atts[] is of allocated length RelationGetNumberOfAttributes(rel) */
7575
}RelToCheck;
7676

77+
/* Potentially set by contrib/pg_upgrade_support functions */
7778
Oidbinary_upgrade_next_pg_type_array_oid=InvalidOid;
7879

7980
staticOidfindTypeInputFunction(List*procname,OidtypeOid);
@@ -1517,7 +1518,7 @@ AssignTypeArrayOid(void)
15171518
{
15181519
Oidtype_array_oid;
15191520

1520-
/*Pre-assign the type's array OIDforuse inpg_type.typarray */
1521+
/*Use binary-upgrade overridefor pg_type.typarray, if supplied. */
15211522
if (OidIsValid(binary_upgrade_next_pg_type_array_oid))
15221523
{
15231524
type_array_oid=binary_upgrade_next_pg_type_array_oid;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp