Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite36924a

Browse files
committed
[PBCKP-146] review fixes
1 parentf253798 commite36924a

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

‎src/catalog.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ get_backup_filelist(pgBackup *backup, bool strict)
10691069
charlinked[MAXPGPATH];
10701070
charcompress_alg_string[MAXPGPATH];
10711071
int64write_size,
1072-
full_size,
1072+
uncompressed_size,
10731073
mode,/* bit length of mode_t depends on platforms */
10741074
is_datafile,
10751075
is_cfs,
@@ -1088,8 +1088,6 @@ get_backup_filelist(pgBackup *backup, bool strict)
10881088

10891089
get_control_value_str(buf,"path",path,sizeof(path),true);
10901090
get_control_value_int64(buf,"size",&write_size, true);
1091-
if (!get_control_value_int64(buf,"full_size",&full_size, false))
1092-
full_size=write_size;
10931091
get_control_value_int64(buf,"mode",&mode, true);
10941092
get_control_value_int64(buf,"is_datafile",&is_datafile, true);
10951093
get_control_value_int64(buf,"is_cfs",&is_cfs, false);
@@ -1100,7 +1098,6 @@ get_backup_filelist(pgBackup *backup, bool strict)
11001098

11011099
file=pgFileInit(path);
11021100
file->write_size= (int64)write_size;
1103-
file->uncompressed_size=full_size;
11041101
file->mode= (mode_t)mode;
11051102
file->is_datafile=is_datafile ? true : false;
11061103
file->is_cfs=is_cfs ? true : false;
@@ -1136,6 +1133,11 @@ get_backup_filelist(pgBackup *backup, bool strict)
11361133
if (get_control_value_int64(buf,"hdr_size",&hdr_size, false))
11371134
file->hdr_size= (int)hdr_size;
11381135

1136+
if (get_control_value_int64(buf,"full_size",&uncompressed_size, false))
1137+
file->uncompressed_size=uncompressed_size;
1138+
else
1139+
file->uncompressed_size=write_size;
1140+
11391141
if (file->external_dir_num==0)
11401142
set_forkname(file);
11411143

‎src/data.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,11 +1447,12 @@ backup_non_data_file_internal(const char *from_fullpath,
14471447
elog(ERROR,"Cannot access remote file \"%s\"",from_fullpath);
14481448
}
14491449

1450-
pg_free(errmsg);/* ????? */
1451-
14521450
file->uncompressed_size=file->read_size;
14531451

14541452
cleanup:
1453+
if (errmsg!=NULL)
1454+
pg_free(errmsg);
1455+
14551456
/* finish CRC calculation and store into pgFile */
14561457
FIN_FILE_CRC32(true,file->crc);
14571458

‎tests/cfs_backup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ def test_fullbackup_after_create_table(self):
171171
"ERROR: File pg_compression not found in {0}".format(
172172
os.path.join(self.backup_dir,'node',backup_id))
173173
)
174+
175+
# check cfm size
174176
cfms=find_by_extensions(
175177
[os.path.join(self.backup_dir,'backups','node',backup_id)],
176178
['.cfm'])

‎tests/cfs_catchup.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ def test_full_catchup_with_tablespace(self):
5656
self.pgdata_content(dst_pg.data_dir)
5757
)
5858

59+
# check cfm size
60+
cfms=find_by_extensions([os.path.join(dst_pg.data_dir)], ['.cfm'])
61+
self.assertTrue(cfms,"ERROR: .cfm files not found in backup dir")
62+
forcfmincfms:
63+
size=os.stat(cfm).st_size
64+
self.assertLessEqual(size,4096,
65+
"ERROR: {0} is not truncated (has size {1} > 4096)".format(
66+
cfm,size
67+
))
68+
5969
# make changes in master tablespace
6070
src_pg.safe_psql(
6171
"postgres",
@@ -89,6 +99,16 @@ def test_full_catchup_with_tablespace(self):
8999
]
90100
)
91101

102+
# check cfm size again
103+
cfms=find_by_extensions([os.path.join(dst_pg.data_dir)], ['.cfm'])
104+
self.assertTrue(cfms,"ERROR: .cfm files not found in backup dir")
105+
forcfmincfms:
106+
size=os.stat(cfm).st_size
107+
self.assertLessEqual(size,4096,
108+
"ERROR: {0} is not truncated (has size {1} > 4096)".format(
109+
cfm,size
110+
))
111+
92112
# run&recover catchup'ed instance
93113
dst_options= {}
94114
dst_options['port']=str(dst_pg.port)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp