1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2026-04-26 21:22:39 +02:00

PBCKP-80 add catalog_new for tests

This commit is contained in:
Sergey Fukanchik
2022-12-18 14:49:35 +03:00
committed by Yura Sokolov
parent 76bbd0401b
commit c77b50b7b1
3 changed files with 17 additions and 7 deletions
+15
View File
@@ -818,6 +818,21 @@ pgBackupGetBackupMode(pgBackup *backup, bool show_color)
return backupModes[backup->backup_mode];
}
/* Build `CatalogState' from `backup_path' */
CatalogState *
catalog_new(const char *backup_path)
{
CatalogState *catalogState = pgut_new0(CatalogState);
strncpy(catalogState->catalog_path, backup_path, MAXPGPATH);
join_path_components(catalogState->backup_subdir_path,
catalogState->catalog_path, BACKUPS_DIR);
join_path_components(catalogState->wal_subdir_path,
catalogState->catalog_path, WAL_SUBDIR);
catalogState->backup_location = pioDriveForLocation(FIO_BACKUP_HOST);
return catalogState;
}
/*
* Create list of instances in given backup catalog.
*
+1 -7
View File
@@ -474,13 +474,7 @@ pbk_main(int argc, char *argv[])
if (!is_absolute_path(backup_path))
elog(ERROR, "-B, --backup-path must be an absolute path");
catalogState = pgut_new0(CatalogState);
strncpy(catalogState->catalog_path, backup_path, MAXPGPATH);
join_path_components(catalogState->backup_subdir_path,
catalogState->catalog_path, BACKUPS_DIR);
join_path_components(catalogState->wal_subdir_path,
catalogState->catalog_path, WAL_SUBDIR);
catalogState->backup_location = pioDriveForLocation(FIO_BACKUP_HOST);
catalogState = catalog_new(backup_path);
}
/* backup_path is required for all pg_probackup commands except help, version, checkdb and catchup */
+1
View File
@@ -888,6 +888,7 @@ extern parray* get_history_streaming(ConnectionOptions *conn_opt, TimeLineID tli
#define PAGE_LSN_FROM_FUTURE (-6)
/* in catalog.c */
extern CatalogState * catalog_new(const char *backup_path);
extern pgBackup *read_backup(pioDrive_i drive, const char *root_dir);
extern pgBackup *readBackupControlFile(pioDrive_i drive, const char *path);
extern void write_backup(pgBackup *backup, bool strict);