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

Commitc2d6824

Browse files
committed
Issue 52: treat DONE backups as OK
1 parent9ca020c commitc2d6824

File tree

4 files changed

+29
-15
lines changed

4 files changed

+29
-15
lines changed

‎src/delete.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ do_delete(time_t backup_id)
9494
{
9595
pgBackup*backup= (pgBackup*)parray_get(backup_list, (size_t)i);
9696

97-
if (backup->status==BACKUP_STATUS_OK)
97+
if (backup->status==BACKUP_STATUS_OK||backup->status==BACKUP_STATUS_DONE)
9898
{
9999
oldest_lsn=backup->start_lsn;
100100
oldest_tli=backup->tli;

‎src/merge.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ do_merge(time_t backup_id)
7878
{
7979
/* sanity */
8080
if (backup->status!=BACKUP_STATUS_OK&&
81+
backup->status!=BACKUP_STATUS_DONE&&
8182
/* It is possible that previous merging was interrupted */
8283
backup->status!=BACKUP_STATUS_MERGING&&
8384
backup->status!=BACKUP_STATUS_DELETING)
@@ -107,6 +108,7 @@ do_merge(time_t backup_id)
107108

108109
/* sanity */
109110
if (full_backup->status!=BACKUP_STATUS_OK&&
111+
full_backup->status!=BACKUP_STATUS_DONE&&
110112
/* It is possible that previous merging was interrupted */
111113
full_backup->status!=BACKUP_STATUS_MERGING)
112114
elog(ERROR,"Backup %s has status: %s",
@@ -119,6 +121,7 @@ do_merge(time_t backup_id)
119121
{
120122
/* sanity */
121123
if (dest_backup->status!=BACKUP_STATUS_OK&&
124+
dest_backup->status!=BACKUP_STATUS_DONE&&
122125
/* It is possible that previous merging was interrupted */
123126
dest_backup->status!=BACKUP_STATUS_MERGING&&
124127
dest_backup->status!=BACKUP_STATUS_DELETING)
@@ -193,7 +196,8 @@ merge_backups(pgBackup *to_backup, pgBackup *from_backup)
193196
* BACKUP_STATUS_MERGING status then it isn't valid backup until merging
194197
* finished.
195198
*/
196-
if (to_backup->status==BACKUP_STATUS_OK)
199+
if (to_backup->status==BACKUP_STATUS_OK||
200+
to_backup->status==BACKUP_STATUS_DONE)
197201
{
198202
pgBackupValidate(to_backup);
199203
if (to_backup->status==BACKUP_STATUS_CORRUPT)
@@ -205,6 +209,7 @@ merge_backups(pgBackup *to_backup, pgBackup *from_backup)
205209
* BACKUP_STATUS_MERGING status.
206210
*/
207211
Assert(from_backup->status==BACKUP_STATUS_OK||
212+
from_backup->status==BACKUP_STATUS_DONE||
208213
from_backup->status==BACKUP_STATUS_MERGING);
209214
pgBackupValidate(from_backup);
210215
if (from_backup->status==BACKUP_STATUS_CORRUPT)

‎src/restore.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
9494

9595
if (is_restore&&
9696
target_backup_id==INVALID_BACKUP_ID&&
97-
current_backup->status!=BACKUP_STATUS_OK)
97+
(current_backup->status!=BACKUP_STATUS_OK&&
98+
current_backup->status!=BACKUP_STATUS_DONE))
9899
{
99100
elog(WARNING,"Skipping backup %s, because it has non-valid status: %s",
100101
base36enc(current_backup->start_time),status2str(current_backup->status));
@@ -110,7 +111,7 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
110111
{
111112

112113
/* backup is not ok,
113-
* but in case of CORRUPT, ORPHANorDONE revalidation is possible
114+
* but in case of CORRUPTorORPHAN revalidation is possible
114115
* unless --no-validate is used,
115116
* in other cases throw an error.
116117
*/
@@ -119,10 +120,10 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
119120
// 3. restore -i INVALID_ID <- allowed revalidate and restore
120121
// 4. restore <- impossible
121122
// 5. restore --no-validate <- forbidden
122-
if (current_backup->status!=BACKUP_STATUS_OK)
123+
if (current_backup->status!=BACKUP_STATUS_OK&&
124+
current_backup->status!=BACKUP_STATUS_DONE)
123125
{
124-
if ((current_backup->status==BACKUP_STATUS_DONE||
125-
current_backup->status==BACKUP_STATUS_ORPHAN||
126+
if ((current_backup->status==BACKUP_STATUS_ORPHAN||
126127
current_backup->status==BACKUP_STATUS_CORRUPT||
127128
current_backup->status==BACKUP_STATUS_RUNNING)
128129
&& !rt->no_validate)
@@ -205,7 +206,8 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
205206
*/
206207
if (is_parent(missing_backup_start_time,backup, false))
207208
{
208-
if (backup->status==BACKUP_STATUS_OK)
209+
if (backup->status==BACKUP_STATUS_OK||
210+
backup->status==BACKUP_STATUS_DONE)
209211
{
210212
write_backup_status(backup,BACKUP_STATUS_ORPHAN);
211213

@@ -238,7 +240,8 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
238240

239241
if (is_parent(tmp_backup->start_time,backup, false))
240242
{
241-
if (backup->status==BACKUP_STATUS_OK)
243+
if (backup->status==BACKUP_STATUS_OK||
244+
backup->status==BACKUP_STATUS_DONE)
242245
{
243246
write_backup_status(backup,BACKUP_STATUS_ORPHAN);
244247

@@ -374,7 +377,8 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
374377

375378
if (is_parent(corrupted_backup->start_time,backup, false))
376379
{
377-
if (backup->status==BACKUP_STATUS_OK)
380+
if (backup->status==BACKUP_STATUS_OK||
381+
backup->status==BACKUP_STATUS_DONE)
378382
{
379383
write_backup_status(backup,BACKUP_STATUS_ORPHAN);
380384

@@ -393,7 +397,8 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
393397
* If dest backup is corrupted or was orphaned in previous check
394398
* produce corresponding error message
395399
*/
396-
if (dest_backup->status==BACKUP_STATUS_OK)
400+
if (dest_backup->status==BACKUP_STATUS_OK||
401+
dest_backup->status==BACKUP_STATUS_DONE)
397402
{
398403
if (rt->no_validate)
399404
elog(INFO,"Backup %s is used without validation.",base36enc(dest_backup->start_time));
@@ -473,7 +478,8 @@ restore_backup(pgBackup *backup, const char *external_dir_str)
473478
boolrestore_isok= true;
474479

475480

476-
if (backup->status!=BACKUP_STATUS_OK)
481+
if (backup->status!=BACKUP_STATUS_OK&&
482+
backup->status!=BACKUP_STATUS_DONE)
477483
elog(ERROR,"Backup %s cannot be restored because it is not valid",
478484
base36enc(backup->start_time));
479485

‎src/validate.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,8 @@ do_validate_instance(void)
417417
corrupted_backup_found= true;
418418

419419
/* orphanize current_backup */
420-
if (current_backup->status==BACKUP_STATUS_OK)
420+
if (current_backup->status==BACKUP_STATUS_OK||
421+
current_backup->status==BACKUP_STATUS_DONE)
421422
{
422423
write_backup_status(current_backup,BACKUP_STATUS_ORPHAN);
423424
elog(WARNING,"Backup %s is orphaned because his parent %s is missing",
@@ -440,7 +441,8 @@ do_validate_instance(void)
440441
{
441442
char*backup_id=base36enc_dup(tmp_backup->start_time);
442443
/* orphanize current_backup */
443-
if (current_backup->status==BACKUP_STATUS_OK)
444+
if (current_backup->status==BACKUP_STATUS_OK||
445+
current_backup->status==BACKUP_STATUS_DONE)
444446
{
445447
write_backup_status(current_backup,BACKUP_STATUS_ORPHAN);
446448
elog(WARNING,"Backup %s is orphaned because his parent %s has status: %s",
@@ -512,7 +514,8 @@ do_validate_instance(void)
512514

513515
if (is_parent(current_backup->start_time,backup, false))
514516
{
515-
if (backup->status==BACKUP_STATUS_OK)
517+
if (backup->status==BACKUP_STATUS_OK||
518+
backup->status==BACKUP_STATUS_DONE)
516519
{
517520
write_backup_status(backup,BACKUP_STATUS_ORPHAN);
518521

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp