1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-05-22 10:15:16 +02:00

Error on db history mismatch when expiring.

Amend commit 434cd832 to error when the db history in archive.info and backup.info do not match.

The Perl code would attempt to reconcile the history by matching on system id and version but we are not planning to migrate that code to C.  It's possible that there are users with mismatches but if so they should have been getting errors from info for the last six months.  It's easy enough to manually fix these files if there are any mismatches in the field.

Contributed by Cynthia Shang.
This commit is contained in:
Cynthia Shang
2019-06-24 11:59:44 -04:00
committed by David Steele
parent 039e515a31
commit b498188f01
6 changed files with 320 additions and 65 deletions
+66 -36
View File
@@ -535,31 +535,8 @@ P00 INFO: full backup size = 48MB
P00 INFO: new backup label = [BACKUP-FULL-1]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: full backup total < 2 - using oldest full backup for 9.3-1 archive retention
P00 INFO: expire command end: completed successfully
+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
----------------------------------------------------------
[db]
pg1-path=[TEST_PATH]/db-master/db/base
[global]
compress-level=3
db-timeout=45
lock-path=[TEST_PATH]/db-master/lock
log-level-console=detail
log-level-file=trace
log-level-stderr=off
log-path=[TEST_PATH]/db-master/log
log-subprocess=y
log-timestamp=n
protocol-timeout=60
repo1-path=[TEST_PATH]/db-master/repo
spool-path=[TEST_PATH]/db-master/spool
[global:backup]
archive-copy=y
start-fast=y
P00 ERROR: [029]: archive expiration cannot continue - archive and backup history lists do not match
P00 INFO: expire command end: aborted with exception [029]
stanza-create db - fail no force to recreate the stanza from backups (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db --no-online stanza-create
@@ -631,6 +608,7 @@ stanza-upgrade db - successfully upgrade with XX.Y-Z (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db --no-online stanza-upgrade
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: stanza-upgrade command begin [BACKREST-VERSION]: --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db
P00 WARN: backup [BACKUP-FULL-1] found in repository added to backup.info
P00 INFO: stanza-upgrade command end: completed successfully
+ supplemental file: [TEST_PATH]/db-master/repo/backup/db/backup.info
@@ -646,13 +624,14 @@ backrest-version="[VERSION-1]"
[db]
db-catalog-version=201510051
db-control-version=942
db-id=2
db-id=3
db-system-id=1000000000000000095
db-version="9.5"
[db:history]
1={"db-catalog-version":201409291,"db-control-version":942,"db-system-id":1000000000000000094,"db-version":"9.4"}
2={"db-catalog-version":201510051,"db-control-version":942,"db-system-id":1000000000000000095,"db-version":"9.5"}
1={"db-catalog-version":201306121,"db-control-version":937,"db-system-id":1000000000000000093,"db-version":"9.3"}
2={"db-catalog-version":201409291,"db-control-version":942,"db-system-id":1000000000000000094,"db-version":"9.4"}
3={"db-catalog-version":201510051,"db-control-version":942,"db-system-id":1000000000000000095,"db-version":"9.5"}
+ supplemental file: [TEST_PATH]/db-master/repo/archive/db/archive.info
-----------------------------------------------------------------------
@@ -669,9 +648,54 @@ db-version="9.5"
[db:history]
1={"db-id":1000000000000000093,"db-version":"9.3"}
2={"db-id":1000000000000000094,"db-version":"9.4"}
3={"db-id":1000000000000000094,"db-version":"10.0"}
3={"db-id":1000000000000000100,"db-version":"10"}
4={"db-id":1000000000000000095,"db-version":"9.5"}
stanza-upgrade db - successfully upgrade - no info file mismatch (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db --no-online stanza-upgrade
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: stanza-upgrade command begin [BACKREST-VERSION]: --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db
P00 INFO: stanza-upgrade command end: completed successfully
+ supplemental file: [TEST_PATH]/db-master/repo/backup/db/backup.info
---------------------------------------------------------------------
[backrest]
backrest-checksum="[CHECKSUM]"
backrest-format=5
backrest-version="[VERSION-1]"
[backup:current]
[BACKUP-FULL-1]={"backrest-format":5,"backrest-version":"[VERSION-1]","backup-archive-start":null,"backup-archive-stop":null,"backup-info-repo-size":[SIZE],"backup-info-repo-size-delta":[DELTA],"backup-info-size":[SIZE],"backup-info-size-delta":[DELTA],"backup-timestamp-start":[TIMESTAMP],"backup-timestamp-stop":[TIMESTAMP],"backup-type":"full","db-id":1,"option-archive-check":true,"option-archive-copy":true,"option-backup-standby":false,"option-checksum-page":false,"option-compress":true,"option-hardlink":false,"option-online":false}
[db]
db-catalog-version=201510051
db-control-version=942
db-id=3
db-system-id=1000000000000000095
db-version="9.5"
[db:history]
1={"db-catalog-version":201306121,"db-control-version":937,"db-system-id":1000000000000000093,"db-version":"9.3"}
2={"db-catalog-version":201409291,"db-control-version":942,"db-system-id":1000000000000000094,"db-version":"9.4"}
3={"db-catalog-version":201510051,"db-control-version":942,"db-system-id":1000000000000000095,"db-version":"9.5"}
+ supplemental file: [TEST_PATH]/db-master/repo/archive/db/archive.info
-----------------------------------------------------------------------
[backrest]
backrest-checksum="[CHECKSUM]"
backrest-format=5
backrest-version="[VERSION-1]"
[db]
db-id=3
db-system-id=1000000000000000095
db-version="9.5"
[db:history]
1={"db-id":1000000000000000093,"db-version":"9.3"}
2={"db-id":1000000000000000094,"db-version":"9.4"}
3={"db-id":1000000000000000095,"db-version":"9.5"}
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn --archive-push-queue-max=33554432 --stanza=db archive-push [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001
------------------------------------------------------------------------------------------------------------------------------------
@@ -690,6 +714,7 @@ P00 INFO: full backup size = 48MB
P00 INFO: new backup label = [BACKUP-FULL-2]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: remove archive path: [TEST_PATH]/db-master/repo/archive/db/9.4-2
P00 INFO: expire command end: completed successfully
+ supplemental file: [TEST_PATH]/db-master/pgbackrest.conf
@@ -725,15 +750,15 @@ info all stanzas - db upgraded - db-1 and db-2 listed (db-master host)
"database" : {
"id" : 1
},
"id" : "9.4-2",
"max" : "000000010000000100000001",
"min" : "000000010000000100000001"
"id" : "9.3-1",
"max" : "000000010000000100000002",
"min" : "000000010000000100000002"
},
{
"database" : {
"id" : 2
"id" : 3
},
"id" : "9.5-4",
"id" : "9.5-3",
"max" : "000000010000000100000001",
"min" : "000000010000000100000001"
}
@@ -778,7 +803,7 @@ info all stanzas - db upgraded - db-1 and db-2 listed (db-master host)
"version" : "[VERSION-1]"
},
"database" : {
"id" : 2
"id" : 3
},
"info" : {
"delta" : [DELTA],
@@ -802,11 +827,16 @@ info all stanzas - db upgraded - db-1 and db-2 listed (db-master host)
"db" : [
{
"id" : 1,
"system-id" : 1000000000000000093,
"version" : "9.3"
},
{
"id" : 2,
"system-id" : 1000000000000000094,
"version" : "9.4"
},
{
"id" : 2,
"id" : 3,
"system-id" : 1000000000000000095,
"version" : "9.5"
}
+4 -5
View File
@@ -428,7 +428,7 @@ db-version="9.4"
1={"db-id":1000000000000000093,"db-version":"9.3"}
2={"db-id":1000000000000000094,"db-version":"9.4"}
stanza-upgrade db - successfully upgrade with XX.Y-Z (backup host)
stanza-upgrade db - successfully upgrade - no info file mismatch (backup host)
> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --stanza=db --no-online stanza-upgrade
------------------------------------------------------------------------------------------------------------------------------------
P00 INFO: stanza-upgrade command begin [BACKREST-VERSION]: --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/backup/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-1] --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-cipher-pass=<redacted> --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key=<redacted> --repo1-s3-key-secret=<redacted> --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db
@@ -470,15 +470,14 @@ backrest-version="[VERSION-1]"
cipher-pass=[CIPHER-PASS-2]
[db]
db-id=4
db-id=3
db-system-id=1000000000000000095
db-version="9.5"
[db:history]
1={"db-id":1000000000000000093,"db-version":"9.3"}
2={"db-id":1000000000000000094,"db-version":"9.4"}
3={"db-id":1000000000000000094,"db-version":"10.0"}
4={"db-id":1000000000000000095,"db-version":"9.5"}
3={"db-id":1000000000000000095,"db-version":"9.5"}
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=warn --archive-push-queue-max=33554432 --stanza=db archive-push [TEST_PATH]/db-master/db/base/pg_xlog/000000010000000100000001
------------------------------------------------------------------------------------------------------------------------------------
@@ -579,7 +578,7 @@ info all stanzas - db upgraded - db-1 and db-2 listed (db-master host)
"database" : {
"id" : 3
},
"id" : "9.5-4",
"id" : "9.5-3",
"max" : "000000010000000100000001",
"min" : "000000010000000100000001"
}