@@ -75,7 +75,7 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
75
75
76
76
/* Block backup operations on a standby */
77
77
if (pg_is_standby ())
78
- elog (ERROR_SYSTEM ,"Backup cannot run on a standby." );
78
+ elog (ERROR ,"Backup cannot run on a standby." );
79
79
80
80
elog (INFO ,"database backup start" );
81
81
@@ -102,7 +102,7 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
102
102
103
103
prev_backup = catalog_get_last_data_backup (backup_list ,current .tli );
104
104
if (prev_backup == NULL )
105
- elog (ERROR_SYSTEM ,"Valid full backup not found for "
105
+ elog (ERROR ,"Valid full backup not found for "
106
106
"differential backup. Either create a full backup "
107
107
"or validate existing one." );
108
108
}
@@ -123,7 +123,7 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
123
123
{
124
124
elog (LOG ,"backup_label does not exist, stopping backup" );
125
125
pg_stop_backup (NULL );
126
- elog (ERROR_SYSTEM ,"backup_label does not exist in PGDATA." );
126
+ elog (ERROR ,"backup_label does not exist in PGDATA." );
127
127
}
128
128
129
129
/*
@@ -138,12 +138,12 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
138
138
pgBackupGetPath (& current ,path ,lengthof (path ),MKDIRS_SH_FILE );
139
139
fp = fopen (path ,"wt" );
140
140
if (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" ,
142
142
path ,strerror (errno ));
143
143
dir_print_mkdirs_sh (fp ,backup_files_list ,pgdata );
144
144
fclose (fp );
145
145
if (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 ,
147
147
strerror (errno ));
148
148
}
149
149
@@ -255,12 +255,12 @@ do_backup(pgBackupOption bkupopt)
255
255
256
256
/* PGDATA and BACKUP_MODE are always required */
257
257
if (pgdata == NULL )
258
- elog (ERROR_ARGS ,"Required parameter not specified: PGDATA "
258
+ elog (ERROR ,"Required parameter not specified: PGDATA "
259
259
"(-D, --pgdata)" );
260
260
261
261
/* A backup mode is needed */
262
262
if (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 "
264
264
"(-b, --backup-mode)" );
265
265
266
266
/* Confirm data block size and xlog block size are compatible */
@@ -280,9 +280,9 @@ do_backup(pgBackupOption bkupopt)
280
280
/* get exclusive lock of backup catalog */
281
281
ret = catalog_lock ();
282
282
if (ret == -1 )
283
- elog (ERROR_SYSTEM ,"cannot lock backup catalog" );
283
+ elog (ERROR ,"cannot lock backup catalog" );
284
284
else if (ret == 1 )
285
- elog (ERROR_ALREADY_RUNNING ,
285
+ elog (ERROR ,
286
286
"another pg_arman is running, skipping this backup" );
287
287
288
288
/* initialize backup result */
@@ -302,15 +302,15 @@ do_backup(pgBackupOption bkupopt)
302
302
if (!check )
303
303
{
304
304
if (pgBackupCreateDir (& current ))
305
- elog (ERROR_SYSTEM ,"cannot create backup directory" );
305
+ elog (ERROR ,"cannot create backup directory" );
306
306
pgBackupWriteIni (& current );
307
307
}
308
308
elog (LOG ,"backup destination is initialized" );
309
309
310
310
/* get list of backups already taken */
311
311
backup_list = catalog_get_backup_list (NULL );
312
312
if (!backup_list )
313
- elog (ERROR_SYSTEM ,"cannot process any more" );
313
+ elog (ERROR ,"cannot process any more" );
314
314
315
315
/* set the error processing function for the backup process */
316
316
pgut_atexit_push (backup_cleanup ,NULL );
@@ -379,7 +379,7 @@ check_server_version(void)
379
379
/* confirm server version */
380
380
server_version = PQserverVersion (connection );
381
381
if (server_version != PG_VERSION_NUM )
382
- elog (ERROR_PG_INCOMPATIBLE ,
382
+ elog (ERROR ,
383
383
"server version is %d.%d.%d, must be %s or higher." ,
384
384
server_version /10000 ,
385
385
(server_version /100 ) %100 ,
@@ -402,12 +402,12 @@ confirm_block_size(const char *name, int blcksz)
402
402
403
403
res = execute ("SELECT current_setting($1)" ,1 ,& name );
404
404
if (PQntuples (res )!= 1 || PQnfields (res )!= 1 )
405
- elog (ERROR_PG_COMMAND ,"cannot get %s: %s" ,
405
+ elog (ERROR ,"cannot get %s: %s" ,
406
406
name ,PQerrorMessage (connection ));
407
407
block_size = strtol (PQgetvalue (res ,0 ,0 ),& endp ,10 );
408
408
PQclear (res );
409
409
if ((endp && * endp )|| block_size != blcksz )
410
- elog (ERROR_PG_INCOMPATIBLE ,
410
+ elog (ERROR ,
411
411
"%s(%d) is not compatible(%d expected)" ,
412
412
name ,block_size ,blcksz );
413
413
}
@@ -494,11 +494,11 @@ wait_for_archive(pgBackup *backup, const char *sql)
494
494
{
495
495
sleep (1 );
496
496
if (interrupted )
497
- elog (ERROR_INTERRUPTED ,
497
+ elog (ERROR ,
498
498
"interrupted during waiting for WAL archiving" );
499
499
try_count ++ ;
500
500
if (try_count > TIMEOUT_ARCHIVE )
501
- elog (ERROR_ARCHIVE_FAILED ,
501
+ elog (ERROR ,
502
502
"switched WAL could not be archived in %d seconds" ,
503
503
TIMEOUT_ARCHIVE );
504
504
}
@@ -539,7 +539,7 @@ get_lsn(PGresult *res, XLogRecPtr *lsn)
539
539
uint32 xrecoff ;
540
540
541
541
if (res == NULL || PQntuples (res )!= 1 || PQnfields (res )!= 1 )
542
- elog (ERROR_PG_COMMAND ,
542
+ elog (ERROR ,
543
543
"result of backup command is invalid: %s" ,
544
544
PQerrorMessage (connection ));
545
545
@@ -560,13 +560,13 @@ static void
560
560
get_xid (PGresult * res ,uint32 * xid )
561
561
{
562
562
if (res == NULL || PQntuples (res )!= 1 || PQnfields (res )!= 1 )
563
- elog (ERROR_PG_COMMAND ,
563
+ elog (ERROR ,
564
564
"result of txid_current() is invalid: %s" ,
565
565
PQerrorMessage (connection ));
566
566
567
567
if (sscanf (PQgetvalue (res ,0 ,0 ),"%u" ,xid )!= 1 )
568
568
{
569
- elog (ERROR_PG_COMMAND ,
569
+ elog (ERROR ,
570
570
"result of txid_current() is invalid: %s" ,
571
571
PQerrorMessage (connection ));
572
572
}
@@ -653,12 +653,12 @@ backup_files(const char *from_root,
653
653
654
654
/* If current time is rewinded, abort this backup. */
655
655
if (tv .tv_sec < file -> mtime )
656
- elog (ERROR_SYSTEM ,
656
+ elog (ERROR ,
657
657
"current time may be rewound. Please retry with full backup mode." );
658
658
659
659
/* check for interrupt */
660
660
if (interrupted )
661
- elog (ERROR_INTERRUPTED ,"interrupted during backup" );
661
+ elog (ERROR ,"interrupted during backup" );
662
662
663
663
/* print progress in verbose mode */
664
664
if (verbose )
@@ -688,7 +688,7 @@ backup_files(const char *from_root,
688
688
}
689
689
else
690
690
{
691
- elog (ERROR_SYSTEM ,
691
+ elog (ERROR ,
692
692
"can't stat backup mode. \"%s\": %s" ,
693
693
file -> path ,strerror (errno ));
694
694
}
@@ -852,7 +852,7 @@ create_file_list(parray *files,
852
852
pgBackupGetPath (& current ,path ,lengthof (path ),subdir );
853
853
fp = fopen (path ,is_append ?"at" :"wt" );
854
854
if (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 ,
856
856
strerror (errno ));
857
857
dir_print_file_list (fp ,files ,root ,prefix );
858
858
fclose (fp );