Jump to: navigation, search

Trove/PointInTimeRecovery

< Trove
Revision as of 13:27, 12 March 2014 by Denis M. (talk | contribs) (ReST routes)

Trove. Point-in-Time recovery.

Introduction

Every once in a while, an event might happen that corrupts a database. We have all made a stupid mistake at least once that had trashed a database. When this happens what do you do? If you do not have a database backup, then you had better own up to the problem you caused and tell your boss that you screwed up. If you do have at least a complete database backup then you most likely will be able to recover the corrupted database, up to the point that you corrupted the data. This article will discuss how to use a point in time restore to recover your databases.
If you google “Point in time recovery” you also could find “Point in time restore”. So, let decide how to call it. Historically, database has a feature called Point in time recovery.

What is a point-in-time recovery?

So what is a point in time recovery? A point in time recovery is restoring a database to a specified date and time. When you have completed a point in time recovery, your database will be in the state it was at the specific date and time you identified when restoring your database. A point in time recovery is a method to recover your database to any point in time since the last database backup.

What does it take to do a point-in-time recovery?

In order to perform a point in time recovery you will need to have an entire series of backups (complete, differential, and transaction log backups) up to and/or beyond the point in time in which you want to recover. If you are missing any backups, or have truncated the transaction log without first performing a transaction log backup, then you will not be able to perform a point in time recovery. At a minimum, you will need a complete backup and all the transaction log backups taken following the complete backup. Optionally if you are taking differential backups, then you will need the complete backup, the last differential backup prior to the corruption, then all the transaction log backups taken following the differential backup.

Trove and Point-in-time recovery

OpenStack DBaaS Trove is able to perform instance restoration (whole new instance, from scratch) from previously stored backup in remote storage (OpenStack Swift, Amazon AWS S3, etc). From administration/regular user perspective Trove should be able to perform point in time recovery. Basically it’s almost the same as restoring new instance, but the difference between restore (in terms of Trove) and recovery is huge.
Restore gives an ability to spin-up new instance from backup (as mentioned earlier), but the Recovery gives an ability to restore already running instance from backup. For the beginning Trove would be able to recover/restore running instance from full backup.

Trove core ReST API and Point-in-Time Recovery/Restore flow

ReST routes

HTTP method Routes
POST {tenant_id}/instances/{instance_id}/recover or {tenant_id}/instances/{instance_id}/restore

Request body

{
   "recovery": {
       "instance": "UUDI", 
       "backup": "UUID", 
   }
}

Response object

{
   "recovery": {
       "id": "UUDI", 
       "name": "instance", 
       "status": "BUILDING", 
       "datastore": "mysql", 
       "recovered_from_backup": "backup_id",
       "point_in_time": "2011-01-22T13:25:27-06:00", 
   }
}

Trove taskmanager RPC API and Point-in-Time Recovery/Restore flow

RPC message

RPC method Method parameters
do_instance_recovery instance_id, backup_id

RPC message type

CAST with poll until instance reach ACTIVE status.

Trove guestagent RPC API and Point-in-Time Recovery/Restore flow

RPC message

RPC method Method parameters
do_recovery
   "backup_info": {
       "id": "backup_id",
       "location": "location",
       "type": "backup_type",
       "checksum": "checksum",
   }

RPC message type

CAST

Method implementation

Re-used restore functionality (restore from full backup).