17
17
#ifdef PAGE_CONVERSION
18
18
19
19
20
- static const char * getPageVersion (
20
+ static void getPageVersion (
21
21
uint16 * version , const char * pathName );
22
22
static pageCnvCtx * loadConverterPlugin (
23
23
uint16 newPageVersion , uint16 oldPageVersion );
@@ -33,13 +33,9 @@ static pageCnvCtx *loadConverterPlugin(
33
33
* to the new format. If the versions are identical, this function just
34
34
* returns a NULL pageCnvCtx pointer to indicate that page-by-page conversion
35
35
* 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.
40
36
*/
41
- const char *
42
- setupPageConverter (pageCnvCtx * * result )
37
+ pageCnvCtx *
38
+ setupPageConverter (void )
43
39
{
44
40
uint16 oldPageVersion ;
45
41
uint16 newPageVersion ;
@@ -53,35 +49,28 @@ setupPageConverter(pageCnvCtx **result)
53
49
snprintf (srcName , sizeof (srcName ), "%s/global/%u" , old_cluster .pgdata ,
54
50
old_cluster .pg_database_oid );
55
51
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 );
61
54
62
55
/*
63
56
* If the old cluster and new cluster use the same page layouts, then we
64
57
* don't need a page converter.
65
58
*/
66
- if (newPageVersion = = oldPageVersion )
59
+ if (newPageVersion ! = oldPageVersion )
67
60
{
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" );
77
69
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
+ }
80
72
else
81
- {
82
- * result = converter ;
83
73
return NULL ;
84
- }
85
74
}
86
75
87
76
@@ -94,27 +83,24 @@ setupPageConverter(pageCnvCtx **result)
94
83
* if an error occurs, this function returns an error message (in the form
95
84
* of a null-terminated string).
96
85
*/
97
- static const char *
86
+ static void
98
87
getPageVersion (uint16 * version , const char * pathName )
99
88
{
100
89
int relfd ;
101
90
PageHeaderData page ;
102
91
ssize_t bytesRead ;
103
92
104
93
if ((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 ) ;
106
95
107
96
if ((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 );
112
98
113
99
* version = PageGetPageLayoutVersion (& page );
114
100
115
101
close (relfd );
116
102
117
- return NULL ;
103
+ return ;
118
104
}
119
105
120
106
0 commit comments