Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit cad66d9

Browse files
committed
Fix copying of cfm files in pg_upgrade
1 parent d1c3524 commit cad66d9

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/bin/pg_upgrade/relfilenode.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,16 @@ transfer_relfile(FileNameMap *map, const char *type_suffix, bool vm_must_add_fro
220220
char old_file[MAXPGPATH];
221221
char new_file[MAXPGPATH];
222222
int segno;
223-
char extent_suffix[65];
223+
char segno_text[65];
224+
char const* extent_prefix = "";
225+
char const* extent_suffix = "";
224226
struct stat statbuf;
225227

228+
if (strcmp(type_suffix, ".cfm") == 0)
229+
extent_prefix = segno_text;
230+
else
231+
extent_suffix = segno_text;
232+
226233
/*
227234
* Now copy/link any related segments as well. Remember, PG breaks large
228235
* files into 1GB segments, the first segment has no extension, subsequent
@@ -231,22 +238,24 @@ transfer_relfile(FileNameMap *map, const char *type_suffix, bool vm_must_add_fro
231238
for (segno = 0;; segno++)
232239
{
233240
if (segno == 0)
234-
extent_suffix[0] = '\0';
241+
segno_text[0] = '\0';
235242
else
236-
snprintf(extent_suffix, sizeof(extent_suffix), ".%d", segno);
243+
snprintf(segno_text, sizeof(segno_text), ".%d", segno);
237244

238-
snprintf(old_file, sizeof(old_file), "%s%s/%u/%u%s%s",
245+
snprintf(old_file, sizeof(old_file), "%s%s/%u/%u%s%s%s",
239246
map->old_tablespace,
240247
map->old_tablespace_suffix,
241248
map->old_db_oid,
242249
map->old_relfilenode,
250+
extent_prefix,
243251
type_suffix,
244252
extent_suffix);
245-
snprintf(new_file, sizeof(new_file), "%s%s/%u/%u%s%s",
253+
snprintf(new_file, sizeof(new_file), "%s%s/%u/%u%s%s%s",
246254
map->new_tablespace,
247255
map->new_tablespace_suffix,
248256
map->new_db_oid,
249257
map->new_relfilenode,
258+
extent_prefix,
250259
type_suffix,
251260
extent_suffix);
252261

src/include/storage/cfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "port/atomics.h"
77
#include "storage/rijndael.h"
88

9-
#define CFS_VERSION "0.45"
9+
#define CFS_VERSION "0.47"
1010

1111
#define CFS_GC_LOCK (MAX_BACKENDS+1)
1212

0 commit comments

Comments
 (0)