@@ -75,7 +75,7 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
7575
7676/* Block backup operations on a standby */
7777if (pg_is_standby ())
78- elog (ERROR_SYSTEM ,"Backup cannot run on a standby." );
78+ elog (ERROR ,"Backup cannot run on a standby." );
7979
8080elog (INFO ,"database backup start" );
8181
@@ -102,7 +102,7 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
102102
103103prev_backup = catalog_get_last_data_backup (backup_list ,current .tli );
104104if (prev_backup == NULL )
105- elog (ERROR_SYSTEM ,"Valid full backup not found for "
105+ elog (ERROR ,"Valid full backup not found for "
106106"differential backup. Either create a full backup "
107107"or validate existing one." );
108108}
@@ -123,7 +123,7 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
123123{
124124elog (LOG ,"backup_label does not exist, stopping backup" );
125125pg_stop_backup (NULL );
126- elog (ERROR_SYSTEM ,"backup_label does not exist in PGDATA." );
126+ elog (ERROR ,"backup_label does not exist in PGDATA." );
127127}
128128
129129/*
@@ -138,12 +138,12 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
138138pgBackupGetPath (& current ,path ,lengthof (path ),MKDIRS_SH_FILE );
139139fp = fopen (path ,"wt" );
140140if (fp == NULL )
141- elog (ERROR_SYSTEM ,"can't open make directory script \"%s\": %s" ,
141+ elog (ERROR ,"can't open make directory script \"%s\": %s" ,
142142path ,strerror (errno ));
143143dir_print_mkdirs_sh (fp ,backup_files_list ,pgdata );
144144fclose (fp );
145145if (chmod (path ,DIR_PERMISSION )== -1 )
146- elog (ERROR_SYSTEM ,"can't change mode of \"%s\": %s" ,path ,
146+ elog (ERROR ,"can't change mode of \"%s\": %s" ,path ,
147147strerror (errno ));
148148}
149149
@@ -255,12 +255,12 @@ do_backup(pgBackupOption bkupopt)
255255
256256/* PGDATA and BACKUP_MODE are always required */
257257if (pgdata == NULL )
258- elog (ERROR_ARGS ,"Required parameter not specified: PGDATA "
258+ elog (ERROR ,"Required parameter not specified: PGDATA "
259259"(-D, --pgdata)" );
260260
261261/* A backup mode is needed */
262262if (current .backup_mode == BACKUP_MODE_INVALID )
263- elog (ERROR_ARGS ,"Required parameter not specified: BACKUP_MODE "
263+ elog (ERROR ,"Required parameter not specified: BACKUP_MODE "
264264"(-b, --backup-mode)" );
265265
266266/* Confirm data block size and xlog block size are compatible */
@@ -280,9 +280,9 @@ do_backup(pgBackupOption bkupopt)
280280/* get exclusive lock of backup catalog */
281281ret = catalog_lock ();
282282if (ret == -1 )
283- elog (ERROR_SYSTEM ,"cannot lock backup catalog" );
283+ elog (ERROR ,"cannot lock backup catalog" );
284284else if (ret == 1 )
285- elog (ERROR_ALREADY_RUNNING ,
285+ elog (ERROR ,
286286"another pg_arman is running, skipping this backup" );
287287
288288/* initialize backup result */
@@ -302,15 +302,15 @@ do_backup(pgBackupOption bkupopt)
302302if (!check )
303303{
304304if (pgBackupCreateDir (& current ))
305- elog (ERROR_SYSTEM ,"cannot create backup directory" );
305+ elog (ERROR ,"cannot create backup directory" );
306306pgBackupWriteIni (& current );
307307}
308308elog (LOG ,"backup destination is initialized" );
309309
310310/* get list of backups already taken */
311311backup_list = catalog_get_backup_list (NULL );
312312if (!backup_list )
313- elog (ERROR_SYSTEM ,"cannot process any more" );
313+ elog (ERROR ,"cannot process any more" );
314314
315315/* set the error processing function for the backup process */
316316pgut_atexit_push (backup_cleanup ,NULL );
@@ -379,7 +379,7 @@ check_server_version(void)
379379/* confirm server version */
380380server_version = PQserverVersion (connection );
381381if (server_version != PG_VERSION_NUM )
382- elog (ERROR_PG_INCOMPATIBLE ,
382+ elog (ERROR ,
383383"server version is %d.%d.%d, must be %s or higher." ,
384384server_version /10000 ,
385385 (server_version /100 ) %100 ,
@@ -402,12 +402,12 @@ confirm_block_size(const char *name, int blcksz)
402402
403403res = execute ("SELECT current_setting($1)" ,1 ,& name );
404404if (PQntuples (res )!= 1 || PQnfields (res )!= 1 )
405- elog (ERROR_PG_COMMAND ,"cannot get %s: %s" ,
405+ elog (ERROR ,"cannot get %s: %s" ,
406406name ,PQerrorMessage (connection ));
407407block_size = strtol (PQgetvalue (res ,0 ,0 ),& endp ,10 );
408408PQclear (res );
409409if ((endp && * endp )|| block_size != blcksz )
410- elog (ERROR_PG_INCOMPATIBLE ,
410+ elog (ERROR ,
411411"%s(%d) is not compatible(%d expected)" ,
412412name ,block_size ,blcksz );
413413}
@@ -494,11 +494,11 @@ wait_for_archive(pgBackup *backup, const char *sql)
494494{
495495sleep (1 );
496496if (interrupted )
497- elog (ERROR_INTERRUPTED ,
497+ elog (ERROR ,
498498"interrupted during waiting for WAL archiving" );
499499try_count ++ ;
500500if (try_count > TIMEOUT_ARCHIVE )
501- elog (ERROR_ARCHIVE_FAILED ,
501+ elog (ERROR ,
502502"switched WAL could not be archived in %d seconds" ,
503503TIMEOUT_ARCHIVE );
504504}
@@ -539,7 +539,7 @@ get_lsn(PGresult *res, XLogRecPtr *lsn)
539539uint32 xrecoff ;
540540
541541if (res == NULL || PQntuples (res )!= 1 || PQnfields (res )!= 1 )
542- elog (ERROR_PG_COMMAND ,
542+ elog (ERROR ,
543543"result of backup command is invalid: %s" ,
544544PQerrorMessage (connection ));
545545
@@ -560,13 +560,13 @@ static void
560560get_xid (PGresult * res ,uint32 * xid )
561561{
562562if (res == NULL || PQntuples (res )!= 1 || PQnfields (res )!= 1 )
563- elog (ERROR_PG_COMMAND ,
563+ elog (ERROR ,
564564"result of txid_current() is invalid: %s" ,
565565PQerrorMessage (connection ));
566566
567567if (sscanf (PQgetvalue (res ,0 ,0 ),"%u" ,xid )!= 1 )
568568{
569- elog (ERROR_PG_COMMAND ,
569+ elog (ERROR ,
570570"result of txid_current() is invalid: %s" ,
571571PQerrorMessage (connection ));
572572}
@@ -653,12 +653,12 @@ backup_files(const char *from_root,
653653
654654/* If current time is rewinded, abort this backup. */
655655if (tv .tv_sec < file -> mtime )
656- elog (ERROR_SYSTEM ,
656+ elog (ERROR ,
657657"current time may be rewound. Please retry with full backup mode." );
658658
659659/* check for interrupt */
660660if (interrupted )
661- elog (ERROR_INTERRUPTED ,"interrupted during backup" );
661+ elog (ERROR ,"interrupted during backup" );
662662
663663/* print progress in verbose mode */
664664if (verbose )
@@ -688,7 +688,7 @@ backup_files(const char *from_root,
688688}
689689else
690690{
691- elog (ERROR_SYSTEM ,
691+ elog (ERROR ,
692692"can't stat backup mode. \"%s\": %s" ,
693693file -> path ,strerror (errno ));
694694}
@@ -852,7 +852,7 @@ create_file_list(parray *files,
852852pgBackupGetPath (& current ,path ,lengthof (path ),subdir );
853853fp = fopen (path ,is_append ?"at" :"wt" );
854854if (fp == NULL )
855- elog (ERROR_SYSTEM ,"can't open file list \"%s\": %s" ,path ,
855+ elog (ERROR ,"can't open file list \"%s\": %s" ,path ,
856856strerror (errno ));
857857dir_print_file_list (fp ,files ,root ,prefix );
858858fclose (fp );