1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-07 19:06:32 +03:00

Preserve relfilenodes:

Add support to pg_dump --binary-upgrade to preserve all relfilenodes,
for use by pg_migrator.
This commit is contained in:
Bruce Momjian
2010-01-06 03:04:03 +00:00
parent 3ccb97b2e4
commit f98fbc78c3
9 changed files with 152 additions and 73 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.328 2010/01/02 16:57:36 momjian Exp $
* $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.329 2010/01/06 03:03:58 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -79,6 +79,9 @@ typedef struct
tups_inserted;
} v_i_state;
/* For simple relation creation, this is the toast index relfilenode */
Oid binary_upgrade_next_index_relfilenode = InvalidOid;
/* non-export function prototypes */
static TupleDesc ConstructTupleDescriptor(Relation heapRelation,
IndexInfo *indexInfo,
@@ -640,15 +643,22 @@ index_create(Oid heapRelationId,
accessMethodObjectId,
classObjectId);
/*
* Allocate an OID for the index, unless we were told what to use.
*
* The OID will be the relfilenode as well, so make sure it doesn't
* collide with either pg_class OIDs or existing physical files.
*/
if (!OidIsValid(indexRelationId))
if (OidIsValid(binary_upgrade_next_index_relfilenode))
{
indexRelationId = binary_upgrade_next_index_relfilenode;
binary_upgrade_next_index_relfilenode = InvalidOid;
}
else if (!OidIsValid(indexRelationId))
{
/*
* Allocate an OID for the index, unless we were told what to use.
*
* The OID will be the relfilenode as well, so make sure it doesn't
* collide with either pg_class OIDs or existing physical files.
*/
indexRelationId = GetNewRelFileNode(tableSpaceId, shared_relation,
pg_class);
}
/*
* create the index relation's relcache entry and physical disk file. (If