Pbm Delete backup

I’m using pbm version 2.2.1 and unable to delete the backups.

[mongod@tora-pl211 ~]$ pbm delete-backup 2024-03-16T01:00:02Z
Are you sure you want delete backup(s)? [y/N] y
Waiting for delete to be done ..Error: deleting: unable to delete: backup is a base for '2024-03-16T13:31:43 - 2024-04-02T11:22:05'

I had to delete the PITR backups using “pbm delete-pitr --older-than=” command before deleting the full logical backup.
Is this a bug in 2.2.1?

@aranjith0

Thanks for reaching out to us here.

Basically, there are certain conditions on backup type due to which backups cannot be deleted by pbm delete-backup command.

  1. A backup that is the base for any point-in-time recovery and with point-in-time recovery time ranges derived from it.

  2. The most recent backup, if Point-in-Time Recovery is enabled and there are no oplog slices following this backup yet.

It seems the backup you are trying to delete is used by the PITR [‘2024-03-16T13:31:43 - 2024-04-02T11:22:05’]

I had to delete the PITR backups using “pbm delete-pitr --older-than=”

Yes, in that case you have to rely on above command. Also, you can try pbm cleanup --older-than … in order to remove both backup and pitr slices together.

Reference:- Delete backups - Percona Backup for MongoDB

This doesn’t seems to be a bug rather its a behaviour!!

Let us know if this brings some clarity or if you having any further questions.

When i try to remove both backup and pitr slices together older than 10days using the command pbm cleanup --older-than=10d --yes
But it shows nothing to delete.

[mongod@tora-pl211 ~]$  pbm status
Cluster:
========
shard3ReplSet:
  - shard3ReplSet/pmgo-pl206.int.compumark.com:27018 [S]: pbm-agent v2.2.1 OK
  - shard3ReplSet/pmgo-pl205.int.compumark.com:27018 [P]: pbm-agent v2.2.1 OK
  - shard3ReplSet/pmgo-pl201.int.compumark.com:27028 [S]: pbm-agent v2.2.1 OK
shard1ReplSet:
  - shard1ReplSet/pmgo-pl203.int.compumark.com:27018 [S]: pbm-agent v2.2.1 OK
  - shard1ReplSet/pmgo-pl201.int.compumark.com:27018 [P]: pbm-agent v2.2.1 OK
  - shard1ReplSet/pmgo-pl202.int.compumark.com:27028 [S]: pbm-agent v2.2.1 OK
shard2ReplSet:
  - shard2ReplSet/pmgo-pl204.int.compumark.com:27018 [S]: pbm-agent v2.2.1 OK
  - shard2ReplSet/pmgo-pl202.int.compumark.com:27018 [P]: pbm-agent v2.2.1 OK
  - shard2ReplSet/pmgo-pl205.int.compumark.com:27028 [S]: pbm-agent v2.2.1 OK
configReplSet:
  - configReplSet/pmgo-pl204.int.compumark.com:27019 [S]: pbm-agent v2.2.1 OK
  - configReplSet/pmgo-pl202.int.compumark.com:27019 [P]: pbm-agent v2.2.1 OK
  - configReplSet/pmgo-pl206.int.compumark.com:27029 [S]: pbm-agent v2.2.1 OK


PITR incremental backup:
========================
Status [ON]

Currently running:
==================
(none)

Backups:
========
S3 us-east-1 s3://cm-mongo-db-shared-prod-va/percona/backup/
  Snapshots:
    2024-04-06T06:00:02Z 2.05TB <logical> [restore_to_time: 2024-04-06T16:25:25Z]
    2024-03-30T01:00:02Z 2.05TB <logical> [restore_to_time: 2024-03-30T11:19:59Z]
    2024-03-23T01:00:02Z 1.97TB <logical> [restore_to_time: 2024-03-23T10:54:59Z]
  PITR chunks [822.15GB]:
    2024-03-23T10:55:00Z - 2024-04-08T04:25:53Z
[mongod@tora-pl211 ~]$  pbm cleanup --older-than=10d --yes
nothing to delete

@aranjith0

Can you please confirm the pbm list output as well in order to verify the existing backups ?

Did you also tried with exact timestamp condition as below. Can you confirm if this is running fine ?

pbm cleanup --older-than=%Y-%M-%D --yes
pbm cleanup --older-than=%Y-%M-%DT%H:%M:%S --yes
  • %Y-%M-%DT%H:%M:%S (for example, 2023-04-20T13:13:20) or
  • %Y-%M-%D (2023-04-20)

Please also share the below logs to check about some events.

pbm logs --event=pitr
pbm logs --event=delete

Hi Anil,

The command doesn’t delete anything. whereas this command works fine. ( pbm cleanup --older-than=%Y-%M-%DT%H:%M:%S --yes)
[mongod@tora-pl211 ~]$ pbm status
Cluster:

shard1ReplSet:

  • shard1ReplSet/pmgo-pl203.int.compumark.com:27018 [S]: pbm-agent v2.2.1 OK
  • shard1ReplSet/pmgo-pl201.int.compumark.com:27018 [P]: pbm-agent v2.2.1 OK
  • shard1ReplSet/pmgo-pl202.int.compumark.com:27028 [S]: pbm-agent v2.2.1 OK
    shard3ReplSet:
  • shard3ReplSet/pmgo-pl206.int.compumark.com:27018 [S]: pbm-agent v2.2.1 OK
  • shard3ReplSet/pmgo-pl205.int.compumark.com:27018 [P]: pbm-agent v2.2.1 OK
  • shard3ReplSet/pmgo-pl201.int.compumark.com:27028 [S]: pbm-agent v2.2.1 OK
    configReplSet:
  • configReplSet/pmgo-pl204.int.compumark.com:27019 [S]: pbm-agent v2.2.1 OK
  • configReplSet/pmgo-pl202.int.compumark.com:27019 [P]: pbm-agent v2.2.1 OK
  • configReplSet/pmgo-pl206.int.compumark.com:27029 [S]: pbm-agent v2.2.1 OK
    shard2ReplSet:
  • shard2ReplSet/pmgo-pl204.int.compumark.com:27018 [S]: pbm-agent v2.2.1 OK
  • shard2ReplSet/pmgo-pl202.int.compumark.com:27018 [P]: pbm-agent v2.2.1 OK
  • shard2ReplSet/pmgo-pl205.int.compumark.com:27028 [S]: pbm-agent v2.2.1 OK

PITR incremental backup:

Status [ON]

Currently running:

(none)

Backups:

S3 us-east-1 s3://cm-mongo-db-shared-prod-va/percona/backup/
Snapshots:
2024-04-20T06:00:02Z 2.06TB [restore_to_time: 2024-04-20T16:29:30Z]
2024-04-13T06:00:02Z 2.06TB [restore_to_time: 2024-04-13T16:34:59Z]
2024-04-06T06:00:02Z 2.05TB [restore_to_time: 2024-04-06T16:25:25Z]
PITR chunks [236.19GB]:
2024-04-06T16:25:26Z - 2024-04-26T04:29:46Z

[mongod@tora-pl211 ~]$ pbm cleanup --older-than=2024-04-13 --yes
nothing to delete
[mongod@tora-pl211 ~]$ pbm logs --event=pitr
2024-04-24T04:29:49Z I [configReplSet/pmgo-pl204.int.compumark.com:27019] [pitr] created chunk 2024-04-23T16:29:47 - 2024-04-24T04:29:47. Next chunk creation scheduled to begin at ~2024-04-24T11:29:47
2024-04-24T04:30:03Z I [shard1ReplSet/pmgo-pl202.int.compumark.com:27028] [pitr] created chunk 2024-04-23T16:29:46 - 2024-04-24T04:29:46. Next chunk creation scheduled to begin at ~2024-04-24T11:29:47
2024-04-24T04:30:08Z I [shard2ReplSet/pmgo-pl204.int.compumark.com:27018] [pitr] created chunk 2024-04-23T16:29:46 - 2024-04-24T04:29:46. Next chunk creation scheduled to begin at ~2024-04-24T11:29:51
2024-04-24T04:30:15Z I [shard3ReplSet/pmgo-pl201.int.compumark.com:27028] [pitr] created chunk 2024-04-23T16:29:46 - 2024-04-24T04:29:46. Next chunk creation scheduled to begin at ~2024-04-24T11:29:56
2024-04-24T16:29:48Z I [configReplSet/pmgo-pl204.int.compumark.com:27019] [pitr] created chunk 2024-04-24T04:29:47 - 2024-04-24T16:29:47. Next chunk creation scheduled to begin at ~2024-04-24T23:29:47
2024-04-24T16:30:02Z I [shard2ReplSet/pmgo-pl204.int.compumark.com:27018] [pitr] created chunk 2024-04-24T04:29:46 - 2024-04-24T16:29:46. Next chunk creation scheduled to begin at ~2024-04-24T23:29:51
2024-04-24T16:30:10Z I [shard3ReplSet/pmgo-pl201.int.compumark.com:27028] [pitr] created chunk 2024-04-24T04:29:46 - 2024-04-24T16:29:46. Next chunk creation scheduled to begin at ~2024-04-24T23:29:56
2024-04-24T16:31:05Z I [shard1ReplSet/pmgo-pl202.int.compumark.com:27028] [pitr] created chunk 2024-04-24T04:29:46 - 2024-04-24T16:29:46. Next chunk creation scheduled to begin at ~2024-04-24T23:29:47
2024-04-25T04:29:48Z I [configReplSet/pmgo-pl204.int.compumark.com:27019] [pitr] created chunk 2024-04-24T16:29:47 - 2024-04-25T04:29:47. Next chunk creation scheduled to begin at ~2024-04-25T11:29:47
2024-04-25T04:30:14Z I [shard3ReplSet/pmgo-pl201.int.compumark.com:27028] [pitr] created chunk 2024-04-24T16:29:46 - 2024-04-25T04:29:56. Next chunk creation scheduled to begin at ~2024-04-25T11:29:56
2024-04-25T04:30:14Z I [shard2ReplSet/pmgo-pl204.int.compumark.com:27018] [pitr] created chunk 2024-04-24T16:29:46 - 2024-04-25T04:29:49. Next chunk creation scheduled to begin at ~2024-04-25T11:29:51
2024-04-25T04:31:33Z I [shard1ReplSet/pmgo-pl202.int.compumark.com:27028] [pitr] created chunk 2024-04-24T16:29:46 - 2024-04-25T04:29:46. Next chunk creation scheduled to begin at ~2024-04-25T11:29:47
2024-04-25T16:29:49Z I [configReplSet/pmgo-pl204.int.compumark.com:27019] [pitr] created chunk 2024-04-25T04:29:47 - 2024-04-25T16:29:47. Next chunk creation scheduled to begin at ~2024-04-25T23:29:47
2024-04-25T16:30:11Z I [shard1ReplSet/pmgo-pl202.int.compumark.com:27028] [pitr] created chunk 2024-04-25T04:29:46 - 2024-04-25T16:29:46. Next chunk creation scheduled to begin at ~2024-04-25T23:29:47
2024-04-25T16:30:12Z I [shard2ReplSet/pmgo-pl204.int.compumark.com:27018] [pitr] created chunk 2024-04-25T04:29:49 - 2024-04-25T16:29:46. Next chunk creation scheduled to begin at ~2024-04-25T23:29:51
2024-04-25T16:30:22Z I [shard3ReplSet/pmgo-pl201.int.compumark.com:27028] [pitr] created chunk 2024-04-25T04:29:56 - 2024-04-25T16:29:46. Next chunk creation scheduled to begin at ~2024-04-25T23:29:56
2024-04-26T04:29:48Z I [configReplSet/pmgo-pl204.int.compumark.com:27019] [pitr] created chunk 2024-04-25T16:29:47 - 2024-04-26T04:29:47. Next chunk creation scheduled to begin at ~2024-04-26T11:29:47
2024-04-26T04:30:08Z I [shard1ReplSet/pmgo-pl202.int.compumark.com:27028] [pitr] created chunk 2024-04-25T16:29:46 - 2024-04-26T04:29:46. Next chunk creation scheduled to begin at ~2024-04-26T11:29:47
2024-04-26T04:30:14Z I [shard2ReplSet/pmgo-pl204.int.compumark.com:27018] [pitr] created chunk 2024-04-25T16:29:46 - 2024-04-26T04:29:46. Next chunk creation scheduled to begin at ~2024-04-26T11:29:51
2024-04-26T04:30:20Z I [shard3ReplSet/pmgo-pl201.int.compumark.com:27028] [pitr] created chunk 2024-04-25T16:29:46 - 2024-04-26T04:29:46. Next chunk creation scheduled to begin at ~2024-04-26T11:29:56
[mongod@tora-pl211 ~]$ pbm logs --event=delete
2024-04-13T21:01:34Z I [shard1ReplSet/pmgo-pl203.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-04-13T21:01:34Z I [shard3ReplSet/pmgo-pl201.int.compumark.com:27028] [delete] not a member of the leader rs, skipping
2024-04-13T21:01:35Z I [configReplSet/pmgo-pl202.int.compumark.com:27019] [delete/2024-04-03T00:00:00Z] deleting backups older than 2024-04-03 00:00:00 +0000 UTC
2024-04-13T21:01:35Z I [configReplSet/pmgo-pl202.int.compumark.com:27019] [delete/2024-04-03T00:00:00Z] deleting 2024-03-30T01:00:02Z: unable to delete: backup is a base for ‘2024-03-30T11:19:59 - 2024-04-13T16:34:59’
2024-04-13T21:01:35Z I [configReplSet/pmgo-pl202.int.compumark.com:27019] [delete/2024-04-03T00:00:00Z] done
2024-04-13T21:01:35Z I [shard1ReplSet/pmgo-pl201.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-04-13T21:01:35Z I [shard3ReplSet/pmgo-pl205.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-04-13T21:01:35Z I [shard3ReplSet/pmgo-pl206.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-04-20T21:01:40Z I [shard2ReplSet/pmgo-pl204.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-04-20T21:01:40Z I [shard3ReplSet/pmgo-pl201.int.compumark.com:27028] [delete] not a member of the leader rs, skipping
2024-04-20T21:01:40Z I [shard1ReplSet/pmgo-pl201.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-04-20T21:01:40Z I [shard2ReplSet/pmgo-pl202.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-04-20T21:01:40Z I [shard2ReplSet/pmgo-pl205.int.compumark.com:27028] [delete] not a member of the leader rs, skipping
2024-04-20T21:01:40Z I [shard1ReplSet/pmgo-pl203.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-04-20T21:01:40Z I [shard1ReplSet/pmgo-pl202.int.compumark.com:27028] [delete] not a member of the leader rs, skipping
2024-04-20T21:01:40Z I [configReplSet/pmgo-pl204.int.compumark.com:27019] [delete/2024-04-10T00:00:00Z] deleting backups older than 2024-04-10 00:00:00 +0000 UTC
2024-04-20T21:01:40Z I [configReplSet/pmgo-pl204.int.compumark.com:27019] [delete/2024-04-10T00:00:00Z] deleting 2024-04-06T06:00:02Z: unable to delete: backup is a base for ‘2024-04-06T16:25:25 - 2024-04-20T16:29:30’
2024-04-20T21:01:40Z I [configReplSet/pmgo-pl204.int.compumark.com:27019] [delete/2024-04-10T00:00:00Z] done
2024-04-20T21:01:40Z I [shard3ReplSet/pmgo-pl205.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-04-20T21:01:40Z I [shard3ReplSet/pmgo-pl206.int.compumark.com:27018] [delete] not a member of the leader rs, skipping

[mongod@tora-pl211 ~]$ pbm cleanup --older-than=“2024-05-11” --yes
nothing to delete
[mongod@tora-pl211 ~]$ pbm cleanup --older-than=“2024-05-11T16:44:20” --yes
Processing by agents. Please check status later

I upgraded the pbm version to 2.5.0. and ran the below command to remove both backup and pitr slices together. But it doesn’t work.
As per the doc, In recent version delete/cleanup command will delete both backup and pitr slices together, but its not working.

In earlier versions i could delete pitr first and then the backups. ( this is not a ideal solution now because i use cronjob to delete the backups )

[mongod@tora-pl211 scripts]$ pbm version
Version:   2.5.0
Platform:  linux/amd64
GitCommit: 0d1a4ce8f0471ca3fc6ed13f5a5ed9986990dad1
GitBranch: release-2.5.0
BuildTime: 2024-05-15_10:10_UTC
GoVersion: go1.22.3
[mongod@tora-pl211 scripts]$ pbm list
Backup snapshots:
  2024-07-13T06:00:01Z <logical> [restore_to_time: 2024-07-13T12:59:00Z]
  2024-07-20T06:00:02Z <logical> [restore_to_time: 2024-07-20T12:57:17Z]

PITR <on>:
  2024-07-13T12:59:01Z - 2024-07-26T14:21:22Z
[mongod@tora-pl211 scripts]$ pbm delete-backup --older-than 2024-07-16 --yes
Waiting for delete to be done .[done]
Backup snapshots:
  2024-07-13T06:00:01Z <logical> [restore_to_time: 2024-07-13T12:59:00Z]
  2024-07-20T06:00:02Z <logical> [restore_to_time: 2024-07-20T12:57:17Z]

PITR <on>:
  2024-07-13T12:59:01Z - 2024-07-26T14:21:22Z

[mongod@tora-pl211 scripts]$ pbm cleanup --older-than="2024-07-15"  --yes
nothing to delete
[mongod@tora-pl211 scripts]$ pbm logs --event=delete
2024-07-26T16:03:29Z I [shard2ReplSet/pmgo-pl205.int.compumark.com:27028] [delete] not a member of the leader rs, skipping
2024-07-26T16:03:29Z I [configReplSet/pmgo-pl206.int.compumark.com:27029] [delete/2024-07-16T00:00:00Z] deleting backups older than 2024-07-16 00:00:00 +0000 UTC
2024-07-26T16:03:29Z I [configReplSet/pmgo-pl206.int.compumark.com:27029] [delete/2024-07-16T00:00:00Z] done
2024-07-26T16:03:29Z I [shard1ReplSet/pmgo-pl201.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-07-26T16:03:29Z I [shard2ReplSet/pmgo-pl204.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-07-26T16:03:29Z I [shard3ReplSet/pmgo-pl206.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-07-26T16:03:29Z I [shard3ReplSet/pmgo-pl201.int.compumark.com:27028] [delete] not a member of the leader rs, skipping
2024-07-26T16:03:29Z I [shard2ReplSet/pmgo-pl202.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-07-26T16:03:29Z I [shard1ReplSet/pmgo-pl203.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-07-26T16:06:17Z I [shard3ReplSet/pmgo-pl205.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-07-26T16:06:17Z I [configReplSet/pmgo-pl202.int.compumark.com:27019] [delete/2024-07-16T00:00:00Z] deleting backups older than 2024-07-16 00:00:00 +0000 UTC
2024-07-26T16:06:17Z I [configReplSet/pmgo-pl202.int.compumark.com:27019] [delete/2024-07-16T00:00:00Z] done
2024-07-26T16:06:17Z I [shard1ReplSet/pmgo-pl202.int.compumark.com:27028] [delete] not a member of the leader rs, skipping
2024-07-26T16:06:17Z I [shard2ReplSet/pmgo-pl205.int.compumark.com:27028] [delete] not a member of the leader rs, skipping
2024-07-26T16:06:17Z I [shard1ReplSet/pmgo-pl201.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-07-26T16:06:17Z I [shard2ReplSet/pmgo-pl204.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-07-26T16:06:17Z I [shard3ReplSet/pmgo-pl206.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-07-26T16:06:17Z I [shard3ReplSet/pmgo-pl201.int.compumark.com:27028] [delete] not a member of the leader rs, skipping
2024-07-26T16:06:17Z I [shard2ReplSet/pmgo-pl202.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
2024-07-26T16:06:18Z I [shard1ReplSet/pmgo-pl203.int.compumark.com:27018] [delete] not a member of the leader rs, skipping
[mongod@tora-pl211 scripts]$ pbm list
Backup snapshots:
  2024-07-13T06:00:01Z <logical> [restore_to_time: 2024-07-13T12:59:00Z]
  2024-07-20T06:00:02Z <logical> [restore_to_time: 2024-07-20T12:57:17Z]

PITR <on>:
  2024-07-13T12:59:01Z - 2024-07-26T14:21:22Z

1 Like

I am in the same situation. i am using pbm version 2.5.0. it is not able delete or cleanup by old backups