Skip to content

Commit c678325

Browse files
committed
Add backup_label to file_database.txt for all checks.
1 parent e829899 commit c678325

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

backup.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@ get_lsn(PGconn *conn, PGresult *res, XLogRecPtr *lsn, bool stop_backup)
888888
char path_backup_label[MAXPGPATH];
889889
char path_tablespace_map[MAXPGPATH];
890890
FILE *fp;
891+
pgFile *file;
891892

892893
pgBackupGetPath(&current, path, lengthof(path), DATABASE_DIR);
893894
snprintf(path_backup_label, lengthof(path_backup_label), "%s/backup_label", path);
@@ -900,6 +901,11 @@ get_lsn(PGconn *conn, PGresult *res, XLogRecPtr *lsn, bool stop_backup)
900901

901902
fwrite(PQgetvalue(res, 0, 1), 1, strlen(PQgetvalue(res, 0, 1)), fp);
902903
fclose(fp);
904+
file = pgFileNew(path_backup_label, true);
905+
calc_file(file);
906+
free(file->path);
907+
file->path = strdup("backup_label");
908+
parray_append(backup_files_list, file);
903909
if (strlen(PQgetvalue(res, 0, 2)) == 0)
904910
return;
905911

@@ -910,6 +916,11 @@ get_lsn(PGconn *conn, PGresult *res, XLogRecPtr *lsn, bool stop_backup)
910916

911917
fwrite(PQgetvalue(res, 0, 2), 1, strlen(PQgetvalue(res, 0, 2)), fp);
912918
fclose(fp);
919+
file = pgFileNew(path_tablespace_map, true);
920+
calc_file(file);
921+
free(file->path);
922+
file->path = strdup("tablespace_map");
923+
parray_append(backup_files_list, file);
913924
}
914925
}
915926

data.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -722,14 +722,16 @@ calc_file(pgFile *file)
722722

723723
for (;;)
724724
{
725-
if ((read_len = fread(buf, 1, sizeof(buf), in)) != sizeof(buf))
725+
read_len = fread(buf, 1, sizeof(buf), in);
726+
727+
if(read_len == 0)
726728
break;
727729

728730
/* update CRC */
729731
COMP_CRC32C(crc, buf, read_len);
730732

731-
file->write_size += sizeof(buf);
732-
file->read_size += sizeof(buf);
733+
file->write_size += read_len;
734+
file->read_size += read_len;
733735
}
734736

735737
errno_tmp = errno;

dir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const char *pgdata_exclude[] =
3131
NULL
3232
};
3333

34-
static pgFile *pgFileNew(const char *path, bool omit_symlink);
34+
pgFile *pgFileNew(const char *path, bool omit_symlink);
3535
static int BlackListCompare(const void *str1, const void *str2);
3636

3737
/* create directory, also create parent directories if necessary */
@@ -60,7 +60,7 @@ dir_create_dir(const char *dir, mode_t mode)
6060
return 0;
6161
}
6262

63-
static pgFile *
63+
pgFile *
6464
pgFileNew(const char *path, bool omit_symlink)
6565
{
6666
struct stat st;

pg_arman.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ extern parray *dir_read_file_list(const char *root, const char *file_txt);
283283
extern int dir_create_dir(const char *path, mode_t mode);
284284
extern void dir_copy_files(const char *from_root, const char *to_root);
285285

286+
extern pgFile *pgFileNew(const char *path, bool omit_symlink);
286287
extern void pgFileDelete(pgFile *file);
287288
extern void pgFileFree(void *file);
288289
extern pg_crc32 pgFileGetCRC(pgFile *file);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy