1717#ifdef PAGE_CONVERSION
1818
1919
20- static const char * getPageVersion (
20+ static void getPageVersion (
2121uint16 * version ,const char * pathName );
2222static pageCnvCtx * loadConverterPlugin (
2323uint16 newPageVersion ,uint16 oldPageVersion );
@@ -33,13 +33,9 @@ static pageCnvCtx *loadConverterPlugin(
3333 *to the new format.If the versions are identical, this function just
3434 *returns a NULL pageCnvCtx pointer to indicate that page-by-page conversion
3535 *is not required.
36- *
37- *If successful this function sets *result and returns NULL.If an error
38- *occurs, this function returns an error message in the form of an null-terminated
39- *string.
4036 */
41- const char *
42- setupPageConverter (pageCnvCtx * * result )
37+ pageCnvCtx *
38+ setupPageConverter (void )
4339{
4440uint16 oldPageVersion ;
4541uint16 newPageVersion ;
@@ -53,35 +49,28 @@ setupPageConverter(pageCnvCtx **result)
5349snprintf (srcName ,sizeof (srcName ),"%s/global/%u" ,old_cluster .pgdata ,
5450old_cluster .pg_database_oid );
5551
56- if ((msg = getPageVersion (& oldPageVersion ,srcName ))!= NULL )
57- return msg ;
58-
59- if ((msg = getPageVersion (& newPageVersion ,dstName ))!= NULL )
60- return msg ;
52+ getPageVersion (& oldPageVersion ,srcName );
53+ getPageVersion (& newPageVersion ,dstName );
6154
6255/*
6356 * If the old cluster and new cluster use the same page layouts, then we
6457 * don't need a page converter.
6558 */
66- if (newPageVersion = =oldPageVersion )
59+ if (newPageVersion ! =oldPageVersion )
6760{
68- * result = NULL ;
69- return NULL ;
70- }
71-
72- /*
73- * The clusters use differing page layouts, see if we can find a plugin
74- * that knows how to convert from the old page layout to the new page
75- * layout.
76- */
61+ /*
62+ * The clusters use differing page layouts, see if we can find a plugin
63+ * that knows how to convert from the old page layout to the new page
64+ * layout.
65+ */
66+
67+ if ((converter = loadConverterPlugin (newPageVersion ,oldPageVersion ))== NULL )
68+ pg_log (PG_FATAL ,"could not find plugin to convert from old page layout to new page layout\n" );
7769
78- if (( converter = loadConverterPlugin ( newPageVersion , oldPageVersion )) == NULL )
79- return "could not find plugin to convert from old page layout to new page layout" ;
70+ return converter ;
71+ }
8072else
81- {
82- * result = converter ;
8373return NULL ;
84- }
8574}
8675
8776
@@ -94,27 +83,24 @@ setupPageConverter(pageCnvCtx **result)
9483 *if an error occurs, this function returns an error message (in the form
9584 *of a null-terminated string).
9685 */
97- static const char *
86+ static void
9887getPageVersion (uint16 * version ,const char * pathName )
9988{
10089int relfd ;
10190PageHeaderData page ;
10291ssize_t bytesRead ;
10392
10493if ((relfd = open (pathName ,O_RDONLY ,0 ))< 0 )
105- return "could not open relation" ;
94+ pg_log ( PG_FATAL , "could not open relation %s\n" , pathName ) ;
10695
10796if ((bytesRead = read (relfd ,& page ,sizeof (page )))!= sizeof (page ))
108- {
109- close (relfd );
110- return "could not read page header" ;
111- }
97+ pg_log (PG_FATAL ,"could not read page header of %s\n" ,pathName );
11298
11399* version = PageGetPageLayoutVersion (& page );
114100
115101close (relfd );
116102
117- return NULL ;
103+ return ;
118104}
119105
120106