Hello, this is a patch that add the function to clear backup
location information to pg_resetxlog.
As per the discussion held before, this function cannot be back
patched to the older versions than 9.4. And it also slipped over
9.4 so proposed in this CF.
This simplly erases the backup location information in pg_control
written during recovery. This is seen as the output of
pg_controldata.
| $ pg_controldata
| pg_control version number: 942
| Catalog version number: 201406121
| ...
!| Backup start location: 0/0
!| Backup end location: 0/0
!| End-of-backup record required: no
| ...
Under some condition, this values sticks having valid values even
though the WAL record which indicates the end of backup won't
come. This option could be used to forcibly finish the blocked
recovery procedure.
regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c
index 915a1ed..5b80cfa 100644
--- a/src/bin/pg_resetxlog/pg_resetxlog.c
+++ b/src/bin/pg_resetxlog/pg_resetxlog.c
@@ -86,6 +86,7 @@ main(int argc, char *argv[])
int c;
bool force = false;
bool noupdate = false;
+ bool resetbackuplocs = false;
MultiXactId set_oldestmxid = 0;
char *endptr;
char *endptr2;
@@ -111,7 +112,7 @@ main(int argc, char *argv[])
}
- while ((c = getopt(argc, argv, "fl:m:no:O:x:e:")) != -1)
+ while ((c = getopt(argc, argv, "fl:m:no:O:x:e:b")) != -1)
{
switch (c)
{
@@ -123,6 +124,10 @@ main(int argc, char *argv[])
noupdate = true;
break;
+ case 'b':
+ resetbackuplocs = true;
+ break;
+
case 'e':
set_xid_epoch = strtoul(optarg, &endptr, 0);
if (endptr == optarg || *endptr != '\0')
@@ -351,6 +356,13 @@ main(int argc, char *argv[])
ControlFile.checkPointCopy.PrevTimeLineID = minXlogTli;
}
+ if (resetbackuplocs)
+ {
+ ControlFile.backupStartPoint = InvalidXLogRecPtr;
+ ControlFile.backupEndPoint = InvalidXLogRecPtr;
+ ControlFile.backupEndRequired = false;
+ }
+
if (minXlogSegNo > newXlogSegNo)
newXlogSegNo = minXlogSegNo;
@@ -1088,6 +1100,7 @@ usage(void)
printf(_(" -O OFFSET set next multitransaction offset\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -x XID set next transaction ID\n"));
+ printf(_(" -b reset backup start/end locations\n"));
printf(_(" -?, --help show this help, then exit\n"));
printf(_("\nReport bugs to <[email protected]>.\n"));
}
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers