Point-in-time recovery
SDS Point-in-time recovery provides a finer data backup and recovery mechanism than snapshots. After turning on this feature, you can restore the table status to any specified point in time. Point-in-time recovery uses Stream mechanism to open Point-in-time recovery table. Checkpoint for queue will be periodically created in background to record offset in queue at a certain point in time. You can specify a timestamp less than minimum checkpoint, and restore the table back to the state of this timestamp.
Item configurations
- topicName: Queue name, used for opening Stream on this topic
- snapshotPeriod: Snapshot cycle
- ttl: Expiration time for Snapshot
- createdTimestamp: Create timestamp
- enablePointInTimeRecovery: On/off Switch
- timeToArchive: The time snapshot is archived to fds
Use process
- Create topic in Talos
- When building table or updating table schema, input topic name to add and open Stream, and add and turn on Point-in-time recovery at the same time
- Produce data in a table
- Specify timestamp ts to restore table back to the state at ts
- View existing snapshots of PointInTimeRecovery through pitrSnapshots in the result of listSnapshots() and find the closest snapshot that is less than ts. If snapshot has been archived to fds, contact us for recovery, or you can restore it through restoreSnapshot
- Find the largest checkPoint that is less than the snapshot time via getFloorStreamCheckpoint()
- Based on checkpoint, put the modified log of queue back to the table of snapshot recovery. In accordance with the timestamp in message, only put back modified log not larger than ts
Interface
- listSnapshots(tableName) can be used to view existing snapshots of PointInTimeRecovery through pitrSnapshots of the returned value
- getFloorStreamCheckpoint(ts) queries maximum stream checkpoint less than or equal to a timestamp
- restoreSnapshot(tableName, snapshotName, destTableName, snapshotType) restores table. destTableName is the name of the restored table. For snapshotType, select PITR
Issues to be noted
- Minimum snapshot cycle is 1 day, while maximum number is 5 (tentatively, and adjustable)
- Time for snapshot to be archived to fds takes at least 1 month
Example
Example table</a>. The following is example code for modifying table
$tableName = "php-note";
$tableSpec = $adminClient->describeTable($tableName);
$tableSpec->metadata->pitr = new PointInTimeRecovery(array(
'enablePointInTimeRecovery' => true,
'topicName' => 'test-pirt-topic',
'ttl' => 7776000,
'snapshotPeriod' => 2592000,
'timeToArchive' => 7776000
));
$adminClient->alterTable($tableName, $tableSpec);