Point-in-Time Recovery Implementation
OSO Kafka Backup provides millisecond-precision point-in-time recovery (PITR), allowing you to restore Kafka data to any specific moment.
How PITR Works
Timestamp-Based Filtering
Every Kafka record has a timestamp. PITR uses these timestamps to filter which records are restored:
Backup Contains Records:
┌──────────────────────────────────────────────────────────────┐
│ T=1000 T=1001 T=1002 T=1003 T=1004 T=1005 T=1006 │
│ │ │ │ │ │ │ │ │
│ ▼ ▼ ▼ ▼ ▼ ▼ ▼ │
│ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ │
│ │ A │ │ B │ │ C │ │ D │ │ E │ │ F │ │ G │ │
│ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ │
└──────────────────────────────────────────────────────────────┘
PITR Request: time_window_start=1002, time_window_end=1005
Restored Records:
┌──────────────────────────────────────────────────────────────┐
│ T=1002 T=1003 T=1004 T=1005 │
│ │ │ │ │ │
│ ▼ ▼ ▼ ▼ │
│ ┌───┐ ┌───┐ ┌───┐ ┌───┐ │
│ │ C │ │ D │ │ E │ │ F │ │
│ └───┘ └───┘ └───┘ └───┘ │
└──────────────────────────────────────── ──────────────────────┘
Timestamp Types
Kafka records have two timestamp types:
| Type | Description | When Set |
|---|---|---|
CreateTime | When producer created the record | Producer-side |
LogAppendTime | When broker received the record | Broker-side |
PITR filters based on the record's actual timestamp, regardless of type.
Configuration
Basic PITR Restore
mode: restore
backup_id: "production-backup-20241201"
restore:
# Unix timestamp in milliseconds
time_window_start: 1701388800000 # Dec 1, 2024 00:00:00 UTC
time_window_end: 1701475199000 # Dec 1, 2024 23:59:59 UTC