Skip to content

Commit 7cd2a3c

Browse files
authored
Update oplog-replay.md (#323)
Update doplog-replay.md Added info about using (epoch, ordinal) pair
1 parent 6c499b6 commit 7cd2a3c

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

docs/usage/oplog-replay.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,47 @@ By replaying these oplog slices on top of the backup snapshot with the [`pbm opl
1313

1414
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.
1515

16+
## Ways to specify time for oplog replay
17+
18+
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.
19+
20+
You can define the oplog replay stop point in two ways:
21+
22+
1. **By ISO timestamp**:
23+
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.
24+
25+
2. **By MongoDB timestamp tuple**:
26+
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.
27+
1628
## Oplog replay for physical backups
1729

1830
!!! note ""
1931

2032
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).
2133

22-
This section describes how to manually replay oplog on top of physical backups with Percona Backup for MongoDB version 2.1.0 and earlier.
34+
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.
2335

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

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

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

42+
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).
3043

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

33-
```bash
34-
pbm oplog-replay --start="2022-01-02T15:00:00" --end="2022-01-03T15:00:00"
35-
```
46+
```bash
47+
pbm oplog-replay --start="{{year}}-01-02T15:00:00" --end="{{year}}-01-03T15:00:00"
48+
```
49+
50+
=== "Use `epoch,ordinal`"
51+
52+
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.
53+
54+
```bash
55+
pbm oplog-replay --end “1764576382,100”
56+
```
3657

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

0 commit comments

Comments
 (0)