Skip to content

Commit 7d6f800

Browse files
committed
Fix reversed sense of is_backup_running check
1 parent 5a88bc5 commit 7d6f800

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

bin/manage.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ def create_snapshot():
420420
#'--compress',
421421
'--stream=tar',
422422
'/tmp/backup'], stdout=f)
423-
423+
log.debug('snapshot completed, uploading to object store')
424424
manta_config.put_backup(backup_id, '/tmp/backup.tar')
425425
consul.kv.put(LAST_BACKUP_KEY, backup_id)
426426

@@ -815,9 +815,11 @@ def is_backup_running():
815815
try:
816816
fcntl.flock(backup_lock, fcntl.LOCK_EX|fcntl.LOCK_NB)
817817
fcntl.flock(backup_lock, fcntl.LOCK_UN)
818-
return True
819-
except IOError:
818+
log.debug('is_backup_running: False')
820819
return False
820+
except IOError:
821+
log.debug('is_backup_running: True')
822+
return True
821823
finally:
822824
backup_lock.close()
823825

@@ -827,8 +829,11 @@ def is_binlog_stale(conn):
827829
binlog_file = results[0][0]
828830
last_binlog_file = get_from_consul(LAST_BINLOG_KEY)
829831
except IndexError:
832+
log.debug('is_binlog_stale: True (no LAST_BINLOG_KEY)')
830833
return True
831-
return binlog_file != last_binlog_file
834+
is_stale = binlog_file != last_binlog_file
835+
log.debug('is_binlog_stale: %s', is_stale)
836+
return is_stale
832837

833838
def is_time_for_snapshot():
834839
""" Check if it's time to do a snapshot """
@@ -837,9 +842,12 @@ def is_time_for_snapshot():
837842
check = consul.agent.checks()[BACKUP_TTL_KEY]
838843
log.debug(check)
839844
if check['Status'] == 'passing':
845+
log.debug('is_time_for_snapshot: False')
840846
return False
847+
log.debug('is_time_for_snapshot: True')
841848
return True
842849
except KeyError:
850+
log.debug('is_time_for_snapshot: True')
843851
return True
844852

845853
def write_snapshot(conn):
@@ -859,7 +867,7 @@ def write_snapshot(conn):
859867
# health checks will fail during backups. When periodic tasks
860868
# support lands in ContainerPilot we should move the snapshot
861869
# to a task and avoid this mess.
862-
subprocess.Popen(['python', '/usr/local/bin/triton-mysql.py', 'create_snapshot'])
870+
subprocess.Popen(['python', '/usr/local/bin/manage.py', 'create_snapshot'])
863871

864872
def set_backup_ttl():
865873
"""

0 commit comments

Comments
 (0)