File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ static void pg_ptrack_clear(void);
73
73
static bool pg_ptrack_support (void );
74
74
static bool pg_ptrack_enable (void );
75
75
static bool pg_is_in_recovery (void );
76
+ static bool pg_archive_enabled (void );
76
77
static char * pg_ptrack_get_and_clear (Oid tablespace_oid ,
77
78
Oid db_oid ,
78
79
Oid rel_oid ,
@@ -410,6 +411,10 @@ do_backup(void)
410
411
elog (ERROR , "Ptrack is disabled" );
411
412
}
412
413
414
+ /* archiving check */
415
+ if (!current .stream && !pg_archive_enabled ())
416
+ elog (ERROR , "Archiving must be enabled for archive backup" );
417
+
413
418
/* Get exclusive lock of backup catalog */
414
419
catalog_lock ();
415
420
@@ -676,6 +681,25 @@ pg_is_in_recovery(void)
676
681
return false;
677
682
}
678
683
684
+ /*
685
+ * Check if archiving is enabled
686
+ */
687
+ static bool
688
+ pg_archive_enabled (void )
689
+ {
690
+ PGresult * res_db ;
691
+
692
+ res_db = pgut_execute (backup_conn , "show archive_mode" , 0 , NULL );
693
+
694
+ if (strcmp (PQgetvalue (res_db , 0 , 0 ), "off" ) == 0 )
695
+ {
696
+ PQclear (res_db );
697
+ return false;
698
+ }
699
+ PQclear (res_db );
700
+ return true;
701
+ }
702
+
679
703
/* Clear ptrack files in all databases of the instance we connected to */
680
704
static void
681
705
pg_ptrack_clear (void )
You can’t perform that action at this time.
0 commit comments