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

Commit18c3bbe

Browse files
committed
cleanup
1 parent4ac5ae0 commit18c3bbe

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

‎contrib/pg_probackup/backup.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,19 +1113,23 @@ backup_cleanup(bool fatal, void *userdata)
11131113
staticlong
11141114
file_size(constchar*file)
11151115
{
1116-
longr;
1117-
FILE*f=fopen(file,"r");
1118-
1119-
if (!f)
1120-
{
1121-
elog(ERROR,"pg_probackup: could not open file \"%s\" for reading: %s\n",
1122-
file,strerror(errno));
1123-
return-1;
1124-
}
1125-
fseek(f,0,SEEK_END);
1126-
r=ftell(f);
1127-
fclose(f);
1128-
returnr;
1116+
structstatst;
1117+
stat(file,&st);
1118+
elog(NOTICE,"file_size(). %lu",st.st_size);
1119+
returnst.st_size;
1120+
// longr;
1121+
// FILE *f = fopen(file, "r");
1122+
//
1123+
// if (!f)
1124+
// {
1125+
// elog(ERROR, "pg_probackup: could not open file \"%s\" for reading: %s\n",
1126+
// file, strerror(errno));
1127+
// return -1;
1128+
// }
1129+
// fseek(f, 0, SEEK_END);
1130+
// r = ftell(f);
1131+
// fclose(f);
1132+
// return r;
11291133
}
11301134

11311135
bool

‎contrib/pg_probackup/data.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ restore_file_partly(const char *from_root,const char *to_root, pgFile *file)
491491
write_size+=read_len;
492492
}
493493

494-
elog(NOTICE,"write_size %lu, file->write_size %lu",write_size,file->write_size);
494+
elog(NOTICE,"restore_file_partly().write_size %lu, file->write_size %lu",write_size,file->write_size);
495495

496496
/* update file permission */
497497
if (chmod(to_path,file->mode)==-1)
@@ -529,14 +529,16 @@ restore_compressed_file(const char *from_root,
529529
return;
530530
}
531531

532+
elog(NOTICE,"restore_compressed_file(). map %s",tmp_file.path);
532533
map=cfs_mmap(md);
533534
if (map==MAP_FAILED)
534535
{
535536
elog(LOG,"restore_compressed_file(). cfs_compression_ration failed to map file %s: %m",tmp_file.path);
536-
close(md);
537+
if (close(md)<0)
538+
elog(LOG,"restore_compressed_file(). CFS failed to close file %s: %m",tmp_file.path);
539+
pfree(tmp_file.path);
540+
return;
537541
}
538-
elog(LOG,"restore_compressed_file(). %s",to_path);
539-
540542

541543
if (map->generation!=file->generation)
542544
copy_file(from_root,to_root,file);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp