Is it possible to retain PITR when oplogOnly=true and when only physical backups in use

Hello there! Could you please help with the next
I want to switch from using logical backups to physical only. I want to keep my backups 1 year and at the same time I want to retain PITR slices older than 2 weeks. But when I’m trying to delete proper PITR, I just see in logs:

[deletePitr/2024-02-05T13:55:47Z] deleting pitr chunks older than 2024-02-05 13:55:47 +0000 UTC
[deletePitr/2024-02-05T13:55:47Z] nothing to delete
[deletePitr/2024-02-05T13:55:47Z] done

So, is it possible to delete PITR when only physical backups were created and oplogOnly=true?

Hi,

Kindly share the output of below commands -

  1. pbm status
  2. pbm list
  3. pbm config
  4. Command that you ran to delete the PITR.

Regards,
Parag

Hi @Parag_Bhayani

  1. pbm status
Cluster:
========
rsmain:
  - rsmain/ci-dev8-nas1:27017 [S]: pbm-agent v2.3.1 OK
  - rsmain/ci-dev8-nas2:27017 [P]: pbm-agent v2.3.1 OK
  - rsmain/ci-dev8-nat1:27017 [!Arbiter]: arbiter node is not supported


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

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

Backups:
========
S3 europe-west3 s3://https://storage.googleapis.com/ci-dev8-backup1/mongo-pbm/ci-dev8
  Snapshots:
    2024-02-12T20:20:55Z 3.13GB <physical> [restore_to_time: 2024-02-12T20:20:57Z]
  PITR chunks [3.10MB]:
    2024-02-12T20:20:58Z - 2024-02-12T23:22:03Z
  1. pbm list
Backup snapshots:
  2024-02-12T20:20:55Z <physical> [restore_to_time: 2024-02-12T20:20:57Z]

PITR <on>:
  2024-02-12T20:20:58Z - 2024-02-12T23:22:03Z
  1. pbm config
pitr:
  enabled: true
  oplogSpanMin: 0
  compression: s2
storage:
  type: s3
  s3:
    provider: gcs
    region: europe-west1
    endpointUrl: https://storage.googleapis.com
    forcePathStyle: true
    bucket: ci-dev8-backup1
    prefix: mongo-pbm/ci-dev8
    credentials:
      access-key-id: '***'
      secret-access-key: '***'
    uploadPartSize: 104857600
    maxUploadParts: 10000
    storageClass: STANDARD
    insecureSkipTLSVerify: false
restore:
  batchSize: 500
  numInsertionWorkers: 10
backup:
  compression: s2
    1. Command that I ran to delete the PITR:
pbm delete-pitr --older-than 2024-02-12T20:50:00

Are you sure you want to delete chunks? [y/N] y
Waiting for delete to be done ...[done]
Backup snapshots:
  2024-02-12T20:20:55Z <physical> [restore_to_time: 2024-02-12T20:20:57Z]

PITR <on>:
  2024-02-12T20:20:58Z - 2024-02-12T23:32:03Z

Logs:

Feb 12 23:33:26 ci-dev8-nas1 pbm-agent[5382]: 2024-02-12T23:33:26.000+0000 I [deletePitr/2024-02-12T20:50:00Z] deleting pitr chunks older than 2024-02-12 20:50:00 +0000 UTC
Feb 12 23:33:26 ci-dev8-nas1 pbm-agent[5382]: 2024-02-12T23:33:26.000+0000 D [deletePitr/2024-02-12T20:50:00Z] nothing to delete
Feb 12 23:33:26 ci-dev8-nas1 pbm-agent[5382]: 2024-02-12T23:33:26.000+0000 I [deletePitr/2024-02-12T20:50:00Z] done

More logs:

Feb 12 20:32:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T20:32:06.000+0000 I [pitr] created chunk 2024-02-12T20:20:57 - 2024-02-12T20:32:03. Next chunk creation scheduled to begin at ~2024-02-12T20:42:03
Feb 12 20:42:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T20:42:06.000+0000 I [pitr] created chunk 2024-02-12T20:32:03 - 2024-02-12T20:42:03. Next chunk creation scheduled to begin at ~2024-02-12T20:52:03
Feb 12 20:52:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T20:52:06.000+0000 I [pitr] created chunk 2024-02-12T20:42:03 - 2024-02-12T20:52:03. Next chunk creation scheduled to begin at ~2024-02-12T21:02:03
Feb 12 21:02:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T21:02:06.000+0000 I [pitr] created chunk 2024-02-12T20:52:03 - 2024-02-12T21:02:03. Next chunk creation scheduled to begin at ~2024-02-12T21:12:03
Feb 12 21:12:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T21:12:06.000+0000 I [pitr] created chunk 2024-02-12T21:02:03 - 2024-02-12T21:12:03. Next chunk creation scheduled to begin at ~2024-02-12T21:22:03
Feb 12 21:22:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T21:22:06.000+0000 I [pitr] created chunk 2024-02-12T21:12:03 - 2024-02-12T21:22:03. Next chunk creation scheduled to begin at ~2024-02-12T21:32:03
Feb 12 21:32:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T21:32:06.000+0000 I [pitr] created chunk 2024-02-12T21:22:03 - 2024-02-12T21:32:03. Next chunk creation scheduled to begin at ~2024-02-12T21:42:03
Feb 12 21:42:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T21:42:06.000+0000 I [pitr] created chunk 2024-02-12T21:32:03 - 2024-02-12T21:42:03. Next chunk creation scheduled to begin at ~2024-02-12T21:52:03
Feb 12 21:52:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T21:52:06.000+0000 I [pitr] created chunk 2024-02-12T21:42:03 - 2024-02-12T21:52:03. Next chunk creation scheduled to begin at ~2024-02-12T22:02:03
Feb 12 22:02:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T22:02:06.000+0000 I [pitr] created chunk 2024-02-12T21:52:03 - 2024-02-12T22:02:03. Next chunk creation scheduled to begin at ~2024-02-12T22:12:03
Feb 12 22:12:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T22:12:06.000+0000 I [pitr] created chunk 2024-02-12T22:02:03 - 2024-02-12T22:12:03. Next chunk creation scheduled to begin at ~2024-02-12T22:22:03
Feb 12 22:22:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T22:22:06.000+0000 I [pitr] created chunk 2024-02-12T22:12:03 - 2024-02-12T22:22:03. Next chunk creation scheduled to begin at ~2024-02-12T22:32:03
Feb 12 22:32:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T22:32:06.000+0000 I [pitr] created chunk 2024-02-12T22:22:03 - 2024-02-12T22:32:03. Next chunk creation scheduled to begin at ~2024-02-12T22:42:03
Feb 12 22:42:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T22:42:06.000+0000 I [pitr] created chunk 2024-02-12T22:32:03 - 2024-02-12T22:42:03. Next chunk creation scheduled to begin at ~2024-02-12T22:52:03
Feb 12 22:52:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T22:52:06.000+0000 I [pitr] created chunk 2024-02-12T22:42:03 - 2024-02-12T22:52:03. Next chunk creation scheduled to begin at ~2024-02-12T23:02:03
Feb 12 23:02:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T23:02:06.000+0000 I [pitr] created chunk 2024-02-12T22:52:03 - 2024-02-12T23:02:03. Next chunk creation scheduled to begin at ~2024-02-12T23:12:03
Feb 12 23:12:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T23:12:06.000+0000 I [pitr] created chunk 2024-02-12T23:02:03 - 2024-02-12T23:12:03. Next chunk creation scheduled to begin at ~2024-02-12T23:22:03
Feb 12 23:22:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T23:22:06.000+0000 I [pitr] created chunk 2024-02-12T23:12:03 - 2024-02-12T23:22:03. Next chunk creation scheduled to begin at ~2024-02-12T23:32:03
Feb 12 23:32:06 ci-dev8-nas2 pbm-agent[6255]: 2024-02-12T23:32:06.000+0000 I [pitr] created chunk 2024-02-12T23:22:03 - 2024-02-12T23:32:03. Next chunk creation scheduled to begin at ~2024-02-12T23:42:03

Hi,

Behavior of delete-pitr:

To enable point-in-time recovery from the most recent backup snapshot, Percona Backup for MongoDB does not delete slices that were made after that snapshot.
For example, if the most recent snapshot is 2021-07-20T07:05:23Z [restore_to_time: 2021-07-21T07:05:44] and you specify the timestamp 2021-07-20T07:05:44, Percona Backup for MongoDB deletes only slices that were made before 2021-07-20T07:05:23Z.

Ref.: Delete backups - Percona Backup for MongoDB

Regards,
Parag

Hi,
You are right, deleting is working, but a bit tricky:
let’s say I have phys backups A (the oldest), B,C and D and between each I have 10 pitr chunks (A1-A10, B1-B10 and so on). So, When I run a command to delete pitrs older than B5 the next pitrs will be deleted: A1-…-B1. Only when I specify the time after backup C all B pitrs will be deleted (B2-C1). This is what I see in my tests… A bit confusing but I can work with that. But if you could share more details here that would be greate.

The second question:
Can I somehow delete PITR slices when oplogOnly=true and only physical backups are creating? I tried on 2.2.1 and had no any success.

Thank you