Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
f75383e6
Commit
f75383e6
authored
Jan 07, 2011
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In pg_upgrade, track only one copy of namespace/relname in FileNameMap
because the old and new values are identical.
parent
519c008a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
30 deletions
+18
-30
contrib/pg_upgrade/info.c
contrib/pg_upgrade/info.c
+7
-10
contrib/pg_upgrade/pg_upgrade.h
contrib/pg_upgrade/pg_upgrade.h
+2
-5
contrib/pg_upgrade/relfilenode.c
contrib/pg_upgrade/relfilenode.c
+9
-15
No files found.
contrib/pg_upgrade/info.c
View file @
f75383e6
...
...
@@ -54,7 +54,7 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
if
(
strcmp
(
old_rel
->
nspname
,
"pg_toast"
)
==
0
)
continue
;
/* old/new
non-toast relation name
s match */
/* old/new
relation names alway
s match */
new_rel
=
relarr_lookup_rel_name
(
&
new_cluster
,
&
new_db
->
rel_arr
,
old_rel
->
nspname
,
old_rel
->
relname
);
...
...
@@ -135,11 +135,9 @@ create_rel_filename_map(const char *old_data, const char *new_data,
map
->
old_relfilenode
=
old_rel
->
relfilenode
;
map
->
new_relfilenode
=
new_rel
->
relfilenode
;
/* used only for logging and error reporing */
snprintf
(
map
->
old_nspname
,
sizeof
(
map
->
old_nspname
),
"%s"
,
old_rel
->
nspname
);
snprintf
(
map
->
new_nspname
,
sizeof
(
map
->
new_nspname
),
"%s"
,
new_rel
->
nspname
);
snprintf
(
map
->
old_relname
,
sizeof
(
map
->
old_relname
),
"%s"
,
old_rel
->
relname
);
snprintf
(
map
->
new_relname
,
sizeof
(
map
->
new_relname
),
"%s"
,
new_rel
->
relname
);
/* used only for logging and error reporing, old/new are identical */
snprintf
(
map
->
nspname
,
sizeof
(
map
->
nspname
),
"%s"
,
old_rel
->
nspname
);
snprintf
(
map
->
relname
,
sizeof
(
map
->
relname
),
"%s"
,
old_rel
->
relname
);
}
...
...
@@ -153,10 +151,9 @@ print_maps(FileNameMap *maps, int n, const char *dbName)
pg_log
(
PG_DEBUG
,
"mappings for db %s:
\n
"
,
dbName
);
for
(
mapnum
=
0
;
mapnum
<
n
;
mapnum
++
)
pg_log
(
PG_DEBUG
,
"%s.%s:
%u ==> %s.%s:
%u
\n
"
,
maps
[
mapnum
].
old_nspname
,
maps
[
mapnum
].
old_
relname
,
pg_log
(
PG_DEBUG
,
"%s.%s:
%u to
%u
\n
"
,
maps
[
mapnum
].
nspname
,
maps
[
mapnum
].
relname
,
maps
[
mapnum
].
old_relfilenode
,
maps
[
mapnum
].
new_nspname
,
maps
[
mapnum
].
new_relname
,
maps
[
mapnum
].
new_relfilenode
);
pg_log
(
PG_DEBUG
,
"
\n\n
"
);
...
...
@@ -265,7 +262,7 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
char
query
[
QUERY_ALLOC
];
/*
* pg_largeobject contains user data that does not appear
the
pg_dumpall
* pg_largeobject contains user data that does not appear
in
pg_dumpall
* --schema-only output, so we have to copy that system table heap and
* index. Ideally we could just get the relfilenode from template1 but
* pg_largeobject_loid_pn_index's relfilenode can change if the table was
...
...
contrib/pg_upgrade/pg_upgrade.h
View file @
f75383e6
...
...
@@ -94,11 +94,8 @@ typedef struct
Oid
old_relfilenode
;
Oid
new_relfilenode
;
/* the rest are used only for logging and error reporting */
char
old_nspname
[
NAMEDATALEN
];
/* namespaces */
char
new_nspname
[
NAMEDATALEN
];
/* old/new relnames differ for toast tables and toast indexes */
char
old_relname
[
NAMEDATALEN
];
char
new_relname
[
NAMEDATALEN
];
char
nspname
[
NAMEDATALEN
];
/* namespaces */
char
relname
[
NAMEDATALEN
];
}
FileNameMap
;
/*
...
...
contrib/pg_upgrade/relfilenode.c
View file @
f75383e6
...
...
@@ -17,8 +17,7 @@ static void transfer_single_new_db(pageCnvCtx *pageConverter,
FileNameMap
*
maps
,
int
size
);
static
void
transfer_relfile
(
pageCnvCtx
*
pageConverter
,
const
char
*
fromfile
,
const
char
*
tofile
,
const
char
*
old_nspname
,
const
char
*
new_nspname
,
const
char
*
old_relname
,
const
char
*
new_relname
);
const
char
*
nspname
,
const
char
*
relname
);
/* used by scandir(), must be global */
char
scandir_file_pattern
[
MAXPGPATH
];
...
...
@@ -149,8 +148,7 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
*/
unlink
(
new_file
);
transfer_relfile
(
pageConverter
,
old_file
,
new_file
,
maps
[
mapnum
].
old_nspname
,
maps
[
mapnum
].
new_nspname
,
maps
[
mapnum
].
old_relname
,
maps
[
mapnum
].
new_relname
);
maps
[
mapnum
].
nspname
,
maps
[
mapnum
].
relname
);
/* fsm/vm files added in PG 8.4 */
if
(
GET_MAJOR_VERSION
(
old_cluster
.
major_version
)
>=
804
)
...
...
@@ -173,8 +171,7 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
unlink
(
new_file
);
transfer_relfile
(
pageConverter
,
old_file
,
new_file
,
maps
[
mapnum
].
old_nspname
,
maps
[
mapnum
].
new_nspname
,
maps
[
mapnum
].
old_relname
,
maps
[
mapnum
].
new_relname
);
maps
[
mapnum
].
nspname
,
maps
[
mapnum
].
relname
);
}
}
}
...
...
@@ -201,8 +198,7 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
unlink
(
new_file
);
transfer_relfile
(
pageConverter
,
old_file
,
new_file
,
maps
[
mapnum
].
old_nspname
,
maps
[
mapnum
].
new_nspname
,
maps
[
mapnum
].
old_relname
,
maps
[
mapnum
].
new_relname
);
maps
[
mapnum
].
nspname
,
maps
[
mapnum
].
relname
);
}
}
}
...
...
@@ -224,8 +220,7 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
*/
static
void
transfer_relfile
(
pageCnvCtx
*
pageConverter
,
const
char
*
old_file
,
const
char
*
new_file
,
const
char
*
old_nspname
,
const
char
*
new_nspname
,
const
char
*
old_relname
,
const
char
*
new_relname
)
const
char
*
new_file
,
const
char
*
nspname
,
const
char
*
relname
)
{
const
char
*
msg
;
...
...
@@ -238,8 +233,8 @@ transfer_relfile(pageCnvCtx *pageConverter, const char *old_file,
pg_log
(
PG_INFO
,
"copying %s to %s
\n
"
,
old_file
,
new_file
);
if
((
msg
=
copyAndUpdateFile
(
pageConverter
,
old_file
,
new_file
,
true
))
!=
NULL
)
pg_log
(
PG_FATAL
,
"error while copying %s.%s
(%s) to %s.%s(
%s): %s
\n
"
,
old_nspname
,
old_relname
,
old_file
,
new_nspname
,
new_relnam
e
,
new_file
,
msg
);
pg_log
(
PG_FATAL
,
"error while copying %s.%s
(%s to
%s): %s
\n
"
,
nspname
,
relname
,
old_fil
e
,
new_file
,
msg
);
}
else
{
...
...
@@ -247,9 +242,8 @@ transfer_relfile(pageCnvCtx *pageConverter, const char *old_file,
if
((
msg
=
linkAndUpdateFile
(
pageConverter
,
old_file
,
new_file
))
!=
NULL
)
pg_log
(
PG_FATAL
,
"error while creating link from %s.%s(%s) to %s.%s(%s): %s
\n
"
,
old_nspname
,
old_relname
,
old_file
,
new_nspname
,
new_relname
,
new_file
,
msg
);
"error while creating link from %s.%s (%s to %s): %s
\n
"
,
nspname
,
relname
,
old_file
,
new_file
,
msg
);
}
return
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment