Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite6ec0f2

Browse files
committed
Check if archiving is enabled during archive backup
1 parent9f9c95c commite6ec0f2

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

‎backup.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ static void pg_ptrack_clear(void);
7373
staticboolpg_ptrack_support(void);
7474
staticboolpg_ptrack_enable(void);
7575
staticboolpg_is_in_recovery(void);
76+
staticboolpg_archive_enabled(void);
7677
staticchar*pg_ptrack_get_and_clear(Oidtablespace_oid,
7778
Oiddb_oid,
7879
Oidrel_oid,
@@ -410,6 +411,10 @@ do_backup(void)
410411
elog(ERROR,"Ptrack is disabled");
411412
}
412413

414+
/* archiving check */
415+
if (!current.stream&& !pg_archive_enabled())
416+
elog(ERROR,"Archiving must be enabled for archive backup");
417+
413418
/* Get exclusive lock of backup catalog */
414419
catalog_lock();
415420

@@ -676,6 +681,25 @@ pg_is_in_recovery(void)
676681
return false;
677682
}
678683

684+
/*
685+
* Check if archiving is enabled
686+
*/
687+
staticbool
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+
679703
/* Clear ptrack files in all databases of the instance we connected to */
680704
staticvoid
681705
pg_ptrack_clear(void)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp