summaryrefslogtreecommitdiff
path: root/trove/backup
diff options
context:
space:
mode:
authorMorgan Jones <morgan@parelastic.com>2015-03-06 12:29:09 -0500
committerMorgan Jones <morgan@parelastic.com>2015-03-18 14:49:57 -0400
commitd67997f2517a0bc57852256bb8989ecc15845c99 (patch)
tree103050b5124258677b12b2aeb97939d9cf31e166 /trove/backup
parente0144328a67da7e6db507ee4e602b5e2fe6692df (diff)
downloadtrove-d67997f2517a0bc57852256bb8989ecc15845c99.tar.gz
Replication V2
The V2 implentation of replication, including: - Ubuntu 14.04 - Mysql 5.6 - GTID Replication Strategy - promote-to-replica-source - eject-replica-source - --replica_count option to create - replica creation from incremental backups By agreement with Slicknik (Trove PTL), the following exclusions from the spec have been made: - slave promoted to master by eject not replaced - slave promoted by eject chosen by txn count rather than most recent txn Authored-By: Morgan Jones <morgan@parelastic.com> Co-Authored-By: Peter Stachowski <peter@tesora.com> Co-Authored-By: Doug Shelley <doug@parelastic.com> Co-Authored-By: Duk Loi <duk@tesora.com> Co-Authored-By: Petr Malik <pmalik@tesora.com> Change-Id: I7f921b75e66081cac9ec5a60fb204d61162e9a12 Depends-On: I8eec708f41e791e3db04a2c7b7c12855118b64ac Depends-On: I9075365a8fae754e29d27d6e371a1d8c8980e26b Implements: blueprint replication-v2
Diffstat (limited to 'trove/backup')
-rw-r--r--trove/backup/models.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/trove/backup/models.py b/trove/backup/models.py
index da9b04b1..3dd90695 100644
--- a/trove/backup/models.py
+++ b/trove/backup/models.py
@@ -207,6 +207,28 @@ class Backup(object):
return cls._paginate(context, query)
@classmethod
+ def get_last_completed(cls, context, instance_id,
+ include_incremental=True):
+ """
+ returns last completed backup
+ :param cls:
+ :param instance_id:
+ :param include_incremental:
+ :return:
+ """
+ last_backup = None
+ backups, marker = cls.list_for_instance(context, instance_id)
+ # we don't care about the marker since we only want the first backup
+ # and they are ordered descending based on date (what we want)
+ for backup in backups:
+ if backup.state == BackupState.COMPLETED and (
+ include_incremental or not backup.parent_id):
+ if not last_backup or backup.updated > last_backup.updated:
+ last_backup = backup
+
+ return last_backup
+
+ @classmethod
def fail_for_instance(cls, instance_id):
query = DBBackup.query()
query = query.filter(DBBackup.instance_id == instance_id,