Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6d6a584

Browse files
committed
Separate errors message for "ptrack off" and "ptrack does not support"
1 parent 9d31d4a commit 6d6a584

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

backup.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ static void get_lsn(PGconn *conn, PGresult *res, XLogRecPtr *lsn, bool stop_back
6767
static void get_xid(PGresult *res, uint32 *xid);
6868
static void pg_ptrack_clear(void);
6969
static bool pg_ptrack_support(void);
70+
static bool pg_ptrack_enable(void);
7071
static bool pg_is_in_recovery(void);
7172
static char *pg_ptrack_get_and_clear(Oid tablespace_oid,
7273
Oid db_oid,
@@ -138,8 +139,13 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
138139

139140
is_ptrack_support = pg_ptrack_support();
140141
if (current.backup_mode == BACKUP_MODE_DIFF_PTRACK && !is_ptrack_support)
141-
elog(ERROR, "Current Postgres instance is not support ptrack");
142+
elog(ERROR, "Current Postgres instance does not support ptrack");
142143

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();
143149
/*
144150
* In differential backup mode, check if there is an already-validated
145151
* full backup on current timeline.
@@ -662,6 +668,15 @@ pg_ptrack_support(void)
662668
return false;
663669
}
664670
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();
665680
res_db = execute("show ptrack_enable", 0, NULL);
666681
if (strcmp(PQgetvalue(res_db, 0, 0), "on") != 0)
667682
{

0 commit comments

Comments
 (0)