You've already forked pgbackrest
							
							
				mirror of
				https://github.com/pgbackrest/pgbackrest.git
				synced 2025-10-30 23:37:45 +02:00 
			
		
		
		
	Add constants for path and archive.info/backup.info combinations.
Contributed by Cynthia Shang.
This commit is contained in:
		
				
					committed by
					
						 David Steele
						David Steele
					
				
			
			
				
	
			
			
			
						parent
						
							ede7df9fb1
						
					
				
				
					commit
					cdb75ac8b3
				
			| @@ -50,8 +50,7 @@ archiveGetCheck(const String *archiveFile, CipherType cipherType, const String * | ||||
|         PgControl controlInfo = pgControlFromFile(cfgOptionStr(cfgOptPgPath)); | ||||
|  | ||||
|         // Attempt to load the archive info file | ||||
|         InfoArchive *info = infoArchiveNewLoad( | ||||
|             storageRepo(), STRDEF(STORAGE_REPO_ARCHIVE "/" INFO_ARCHIVE_FILE), cipherType, cipherPass); | ||||
|         InfoArchive *info = infoArchiveNewLoad(storageRepo(), INFO_ARCHIVE_PATH_FILE_STR, cipherType, cipherPass); | ||||
|  | ||||
|         // Loop through the pg history in case the WAL we need is not in the most recent archive id | ||||
|         String *archiveId = NULL; | ||||
|   | ||||
| @@ -216,8 +216,7 @@ archivePushCheck(CipherType cipherType, const String *cipherPass) | ||||
|         PgControl controlInfo = pgControlFromFile(cfgOptionStr(cfgOptPgPath)); | ||||
|  | ||||
|         // Attempt to load the archive info file | ||||
|         InfoArchive *info = infoArchiveNewLoad( | ||||
|             storageRepo(), STRDEF(STORAGE_REPO_ARCHIVE "/" INFO_ARCHIVE_FILE), cipherType, cipherPass); | ||||
|         InfoArchive *info = infoArchiveNewLoad(storageRepo(), INFO_ARCHIVE_PATH_FILE_STR, cipherType, cipherPass); | ||||
|  | ||||
|         // Get archive id for the most recent version -- archive-push will only operate against the most recent version | ||||
|         String *archiveId = infoPgArchiveId(infoArchivePg(info), infoPgDataCurrentId(infoArchivePg(info))); | ||||
|   | ||||
| @@ -308,8 +308,8 @@ removeExpiredArchive(InfoBackup *infoBackup) | ||||
|             { | ||||
|                 // Attempt to load the archive info file | ||||
|                 InfoArchive *infoArchive = infoArchiveNewLoad( | ||||
|                     storageRepo(), STRDEF(STORAGE_REPO_ARCHIVE "/" INFO_ARCHIVE_FILE), | ||||
|                     cipherType(cfgOptionStr(cfgOptRepoCipherType)), cfgOptionStr(cfgOptRepoCipherPass)); | ||||
|                     storageRepo(), INFO_ARCHIVE_PATH_FILE_STR, cipherType(cfgOptionStr(cfgOptRepoCipherType)), | ||||
|                     cfgOptionStr(cfgOptRepoCipherPass)); | ||||
|  | ||||
|                 InfoPg *infoArchivePgData = infoArchivePg(infoArchive); | ||||
|  | ||||
| @@ -672,14 +672,15 @@ cmdExpire(void) | ||||
|  | ||||
|         // Load the backup.info | ||||
|         InfoBackup *infoBackup = infoBackupNewLoad( | ||||
|             storageRepo(), STRDEF(STORAGE_REPO_BACKUP "/" INFO_BACKUP_FILE), cipherType(cfgOptionStr(cfgOptRepoCipherType)), | ||||
|             storageRepo(), INFO_BACKUP_PATH_FILE_STR, cipherType(cfgOptionStr(cfgOptRepoCipherType)), | ||||
|             cfgOptionStr(cfgOptRepoCipherPass)); | ||||
|  | ||||
|         expireFullBackup(infoBackup); | ||||
|         expireDiffBackup(infoBackup); | ||||
|  | ||||
|         infoBackupSave(infoBackup, storageRepoWrite(), STRDEF(STORAGE_REPO_BACKUP "/" INFO_BACKUP_FILE), | ||||
|             cipherType(cfgOptionStr(cfgOptRepoCipherType)), cfgOptionStr(cfgOptRepoCipherPass)); | ||||
|         infoBackupSave( | ||||
|             infoBackup, storageRepoWrite(), INFO_BACKUP_PATH_FILE_STR, cipherType(cfgOptionStr(cfgOptRepoCipherType)), | ||||
|             cfgOptionStr(cfgOptRepoCipherPass)); | ||||
|  | ||||
|         removeExpiredBackup(infoBackup); | ||||
|         removeExpiredArchive(infoBackup); | ||||
|   | ||||
| @@ -18,6 +18,12 @@ Archive Info Handler | ||||
| #include "postgres/interface.h" | ||||
| #include "storage/helper.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Constants | ||||
| ***********************************************************************************************************************************/ | ||||
| STRING_EXTERN(INFO_ARCHIVE_PATH_FILE_STR,                           INFO_ARCHIVE_PATH_FILE); | ||||
| STRING_EXTERN(INFO_ARCHIVE_PATH_FILE_COPY_STR,                      INFO_ARCHIVE_PATH_FILE_COPY); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
|   | ||||
| @@ -23,6 +23,11 @@ Archive info filename | ||||
| #define INFO_ARCHIVE_FILE                                           "archive.info" | ||||
| #define REGEX_ARCHIVE_DIR_DB_VERSION                                "^[0-9]+(\\.[0-9]+)*-[0-9]+$" | ||||
|  | ||||
| #define INFO_ARCHIVE_PATH_FILE                                      STORAGE_REPO_ARCHIVE "/" INFO_ARCHIVE_FILE | ||||
|     STRING_DECLARE(INFO_ARCHIVE_PATH_FILE_STR); | ||||
| #define INFO_ARCHIVE_PATH_FILE_COPY                                 INFO_ARCHIVE_PATH_FILE INFO_COPY_EXT | ||||
|     STRING_DECLARE(INFO_ARCHIVE_PATH_FILE_COPY_STR); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Constructor | ||||
| ***********************************************************************************************************************************/ | ||||
|   | ||||
| @@ -25,7 +25,7 @@ Backup Info Handler | ||||
| #include "storage/helper.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Internal constants | ||||
| Constants | ||||
| ??? INFO_BACKUP_SECTION should be in a separate include since it will also be used when reading the manifest | ||||
| ***********************************************************************************************************************************/ | ||||
| #define INFO_BACKUP_SECTION                                         "backup" | ||||
| @@ -37,6 +37,9 @@ VARIANT_STRDEF_STATIC(INFO_BACKUP_KEY_BACKUP_INFO_SIZE_VAR,            "backup-i | ||||
| VARIANT_STRDEF_STATIC(INFO_BACKUP_KEY_BACKUP_INFO_SIZE_DELTA_VAR,      "backup-info-size-delta"); | ||||
| VARIANT_STRDEF_STATIC(INFO_BACKUP_KEY_BACKUP_REFERENCE_VAR,            "backup-reference"); | ||||
|  | ||||
| STRING_EXTERN(INFO_BACKUP_PATH_FILE_STR,                            INFO_BACKUP_PATH_FILE); | ||||
| STRING_EXTERN(INFO_BACKUP_PATH_FILE_COPY_STR,                       INFO_BACKUP_PATH_FILE_COPY); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
| ***********************************************************************************************************************************/ | ||||
|   | ||||
| @@ -22,6 +22,11 @@ Constants | ||||
| ***********************************************************************************************************************************/ | ||||
| #define INFO_BACKUP_FILE                                            "backup.info" | ||||
|  | ||||
| #define INFO_BACKUP_PATH_FILE                                       STORAGE_REPO_BACKUP "/" INFO_BACKUP_FILE | ||||
|     STRING_DECLARE(INFO_BACKUP_PATH_FILE_STR); | ||||
| #define INFO_BACKUP_PATH_FILE_COPY                                  INFO_BACKUP_PATH_FILE INFO_COPY_EXT | ||||
|     STRING_DECLARE(INFO_BACKUP_PATH_FILE_COPY_STR); | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Information about an existing backup | ||||
| ***********************************************************************************************************************************/ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user