Skip to content

Commit

Permalink
Prevent gRRPC's BackupStatus from canceling pending futures (#745)
Browse files Browse the repository at this point in the history
* Prevent gRRPC's BackupStatus from canceling pending futures

* Remove an inaccurate log line
  • Loading branch information
rzvoncek authored May 6, 2024
1 parent db850a5 commit 1045f57
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions medusa/backup_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def set_backup_future(backup_name, future):

# Sets the future for a backup; unknown on overall status at this point unless already existing
@staticmethod
def register_backup(backup_name, is_async):
def register_backup(backup_name, is_async, overwrite_existing=True):
if not backup_name:
raise RuntimeError(BackupMan.NO_BACKUP_NAME_ERR_MSG)

Expand All @@ -109,9 +109,9 @@ def register_backup(backup_name, is_async):
BackupMan()

if backup_name in BackupMan.__instance.__backups:
logging.debug("Registered backup name {} found existing, replacing with new".format(backup_name))
if not BackupMan.__clean(backup_name):
logging.error("Registered backup name {} cleanup failed prior to re-register.".format(backup_name))
if overwrite_existing:
if not BackupMan.__clean(backup_name):
logging.error(f"Registered backup name {backup_name} cleanup failed prior to re-register.")

BackupMan.__instance.__backups[backup_name] = [None, BackupMan.STATUS_UNKNOWN, is_async]
logging.info("Registered backup id {}".format(backup_name))
Expand Down
2 changes: 1 addition & 1 deletion medusa/service/grpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def BackupStatus(self, request, context):
response.finishTime = datetime.fromtimestamp(backup.finished).strftime(TIMESTAMP_FORMAT)
else:
response.finishTime = ""
BackupMan.register_backup(request.backupName, is_async=False)
BackupMan.register_backup(request.backupName, is_async=False, overwrite_existing=False)
status = BackupMan.STATUS_UNKNOWN
if backup.started:
status = BackupMan.STATUS_IN_PROGRESS
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/features/steps/integration_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ def _i_wait_for_async_backup_to_finish(context, backup_name):
if status == medusa_pb2.StatusType.SUCCESS:
break
logging.debug(f'Backup {backup_name} is not yet finished, waiting...')
time.sleep(2)
time.sleep(1)


@when(r'I perform a backup over gRPC in "{backup_mode}" mode of the node named "{backup_name}" and it fails')
Expand Down

0 comments on commit 1045f57

Please # to comment.