Percona backup: unable to do PITR restore

I have having a trouble with PITR restore

Entries in pbmPITRChunks

rs0:PRIMARY> db.pbmPITRChunks.find()
{ "_id" : ObjectId("604dfff66c3acc761ba2e45a"), "rs" : "rs0", "fname" : "pbmPitr/rs0/20210314/20210314121204-3.20210314122209-2.oplog.snappy", "compression" : "s2", "start_ts" : Timestamp(1615723924, 3), "end_ts" : Timestamp(1615724529, 2) }
{ "_id" : ObjectId("604e00c86c3acc761ba2e45d"), "rs" : "rs0", "fname" : "pbmPitr/rs0/20210314/20210314122209-2.20210314122539-3.oplog.snappy", "compression" : "s2", "start_ts" : Timestamp(1615724529, 2), "end_ts" : Timestamp(1615724739, 3) }

pbm list

Backup snapshots:
  2021-03-14T12:11:42Z [complete: 2021-03-14T12:12:04]

PITR <off>:
  2021-03-14T12:12:04 - 2021-03-14T12:25:39

and when I try to restore it with pbm restore I am getting error

 **pbm restore --time="2021-03-14T12:12:04"**
..Error: define last oplog slice: get: mongo: no documents in result

pbm agent logs

2021-03-14T19:57:09.000+0545 I got command pitrestore [name: 2021-03-14T14:12:08.9699Z, point-in-time ts: 1615723924] <ts: 1615731128>
2021-03-14T19:57:09.000+0545 I got epoch {1615724729 2}
2021-03-14T19:57:09.000+0545 I [pitr/2021-03-14T12:12:04Z] recovery started
2021-03-14T19:57:10.000+0545 E [pitr/2021-03-14T12:12:04Z] restore: define last oplog slice: get: mongo: no documents in result

Above restore produces this query in mongo and does not look quite right

“op” : “query”,
“ns” : “admin.pbmPITRChunks”,
“command” : {
“find” : “pbmPITRChunks”,
“filter” : {
“rs” : “rs0”,
“start_ts” : {
“$lte” : Timestamp(1615723924, 0)
},
“end_ts” : {
“$gte” : Timestamp(1615723924, 0)
}
},
“limit” : 1,
“singleBatch” : true,
“readConcern” : {
“level” : “majority”
},
“lsid” : {
“id” : UUID(“5c31c699-58b7-4835-aa58-56300a56ce25”)
},
“$clusterTime” : {
“clusterTime” : Timestamp(1615737655, 1),
“signature” : {
“hash” : BinData(0,“AAAAAAAAAAAAAAAAAAAAAAAAAAA=”),
“keyId” : 0
}
},
“$db” : “admin”,
“$readPreference” : {
“mode” : “primary”
}
},

2 Likes

Hi, what version of PBM are you using? there were some fixes recently deployed that are related to the PITR functionality so I suggest upgrading to 1.5.0 if you haven’t already. The query above looks good to me, it should return the first slice you have… or am I missing something?
If still running into this problem and suspect a bug, you can open a ticket in jira.percona.com

1 Like

Hi @Sameer_Kattel

This is the bug of the PITR ranges displaying.

The first second of the displayed PITR range is basically exclusive (2021-03-14T12:12:04 in your case). That starting second is equal to (covered by) the snapshot “complete time”. pbm restore 2021-03-14T12:11:42Z will restore the database to the 2021-03-14T12:12:04 time (this is the complete time of this snapshot). Restore to the next second (pbm restore --time="2021-03-14T12:12:05") should work fine. But if you what to restore to exactly this second - restore of the snapshot will do.

1 Like

I’ll just create a Jira ticket for this improvement request: [PBM-686] Don't show the starting second of a PITR range which can't be used for PITR restore - Percona JIRA

1 Like