@@ -67,6 +67,7 @@ static void get_lsn(PGconn *conn, PGresult *res, XLogRecPtr *lsn, bool stop_back
67
67
static void get_xid (PGresult * res ,uint32 * xid );
68
68
static void pg_ptrack_clear (void );
69
69
static bool pg_ptrack_support (void );
70
+ static bool pg_ptrack_enable (void );
70
71
static bool pg_is_in_recovery (void );
71
72
static char * pg_ptrack_get_and_clear (Oid tablespace_oid ,
72
73
Oid db_oid ,
@@ -138,8 +139,13 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
138
139
139
140
is_ptrack_support = pg_ptrack_support ();
140
141
if (current .backup_mode == BACKUP_MODE_DIFF_PTRACK && !is_ptrack_support )
141
- elog (ERROR ,"Current Postgres instanceis not support ptrack" );
142
+ elog (ERROR ,"Current Postgres instancedoes not support ptrack" );
142
143
144
+ if (current .backup_mode == BACKUP_MODE_DIFF_PTRACK && !pg_ptrack_enable ())
145
+ elog (ERROR ,"ptrack is disabled" );
146
+
147
+ if (is_ptrack_support )
148
+ is_ptrack_support = pg_ptrack_enable ();
143
149
/*
144
150
* In differential backup mode, check if there is an already-validated
145
151
* full backup on current timeline.
@@ -662,6 +668,15 @@ pg_ptrack_support(void)
662
668
return false;
663
669
}
664
670
PQclear (res_db );
671
+ disconnect ();
672
+ return true;
673
+ }
674
+
675
+ static bool
676
+ pg_ptrack_enable (void )
677
+ {
678
+ PGresult * res_db ;
679
+ reconnect ();
665
680
res_db = execute ("show ptrack_enable" ,0 ,NULL );
666
681
if (strcmp (PQgetvalue (res_db ,0 ,0 ),"on" )!= 0 )
667
682
{