Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions docs/usage/oplog-replay.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,47 @@

Use the oplog replay functionality with caution, only when you are sure about the starting time from which to replay oplog. The oplog replay does not guarantee data consistency when restoring from any backup. However, it is less error-prone for backups made with Percona Backup for MongoDB.

## Ways to specify time for oplog replay

PBM uses MongoDB's timestamp format for oplog replay, which provides operation-level resolution. Each oplog operation is identified by `(epoch, ordinal)`, where `epoch` is the Unix time in seconds and `ordinal` distinguishes multiple operations within the same second. The specified operation is always included in the replay.

You can define the oplog replay stop point in two ways:

1. **By ISO timestamp**:
Specify an end time as an ISO timestamp (for example, `2025-01-02T15:00:00`). Use this method when you want to include all operations that occurred until the specified second.

2. **By MongoDB timestamp tuple**:
Specify the stop point as `epoch,ordinal` (e.g., `1764576382,20`). PBM includes all operations up to that exact operation. Use this method when you need precise control over which specific operations within a second to include.

Check failure on line 26 in docs/usage/oplog-replay.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/usage/oplog-replay.md#L26

[Google.Latin] Use 'for example' instead of 'e.g.'.
Raw output
{"message": "[Google.Latin] Use 'for example' instead of 'e.g.'.", "location": {"path": "docs/usage/oplog-replay.md", "range": {"start": {"line": 26, "column": 47}}}, "severity": "ERROR"}

## Oplog replay for physical backups

!!! note ""

Starting with version 2.2.0, oplog replay on top of a physical backups made with Percona Backup for MongoDB is done automatically as part of [point-in-time recovery](pitr-physical.md).

This section describes how to manually replay oplog on top of physical backups with Percona Backup for MongoDB version 2.1.0 and earlier.
This section describes how to **manually** replay oplog on top of physical backups made with Percona Backup for MongoDB version 2.1.0 and earlier.

After you [restored a physical backup](restore.md), do the following:

1. Stop point-in-time recovery, if enabled, to release the lock.

2. Run `pbm status` or `pbm list` commands to find oplog chunks available for replay.

3. Run the `pbm oplog-replay` command and specify the `--start` and `--end` flags. See [how you can specify the time](#ways-to-specify-time-for-oplog-replay).

3. Run the `pbm oplog-replay` command and specify the `--start` and `--end` flags with the timestamps.
=== "Use timestamp"

```bash
pbm oplog-replay --start="2022-01-02T15:00:00" --end="2022-01-03T15:00:00"
```
```bash
pbm oplog-replay --start="{{year}}-01-02T15:00:00" --end="{{year}}-01-03T15:00:00"
```

=== "Use `epoch,ordinal`"

For a fine-grained precision which exactly operations within a second to include, specify the values for the `--start` and `--end` flags as `epoch,ordinal` tuples.

```bash
pbm oplog-replay --end “1764576382,100”
```

4. After the oplog replay, make a fresh backup and enable the point-in-time recovery oplog slicing.

Expand Down