Skip to content

Enforce retry limit on backup tasks - #1172

Merged
mxsrc merged 5 commits into
mainfrom
fix-sfam-2785
Jul 13, 2026
Merged

Enforce retry limit on backup tasks#1172
mxsrc merged 5 commits into
mainfrom
fix-sfam-2785

Conversation

@mxsrc

@mxsrc mxsrc commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes https://simplyblock.atlassian.net/browse/SFAM-2785. The backup retry logic did not enforce the maximum retry limit, this is addressed by the initial commit. The follow up commits introduce testing to avoid this issue for other task runners where possible, and converts the simplyblock_core.services submodules to not execute at import time, allowing them to be tested individually.

Test failures seem to be coming from upstream, there's no real way to confirm this though.

if b.status in (Backup.STATUS_PENDING, Backup.STATUS_IN_PROGRESS):
_fail_backup(b, task, reason)
return
except KeyError:
# Merge did not finish; leave the old backup intact.
ob.status = Backup.STATUS_COMPLETED
ob.write_to_db()
except KeyError:
@mxsrc
mxsrc force-pushed the fix-sfam-2785 branch 2 times, most recently from 0d3c86f to 49ad031 Compare July 13, 2026 09:40
for node in nodes:
time.sleep(constants.DEV_DISCOVERY_INTERVAL_SEC)
break
if node.status != StorageNode.STATUS_ONLINE or node.is_secondary_node: # pass
# Inline (serialized) execution; _process_restart_task never
# raises, so a crash in one task cannot escape to the outer
# `while True` and kill recovery of every other node.
_process_restart_task(task.uuid)
fut: Future = Future()
try:
fut.set_result(fn(*args, **kwargs))
except BaseException as exc: # noqa: BLE001 - mirror pool semantics


def post_lvol_delete_rebalance(lvol):
def post_lvol_delete_rebalance(cluster, lvol):


def update_master_task(task):
def update_master_task(task, cl):
@mxsrc
mxsrc marked this pull request as ready for review July 13, 2026 11:41

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is not used and should be removed

@Hamdy-khader Hamdy-khader left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

mxsrc added 5 commits July 13, 2026 16:34
Having the code execution at module load time prevents/complicates
testing of the functions. This applies the idiomatic pattern of checking
for `__main__`, which is only the case when executing the module.
@mxsrc
mxsrc merged commit 7c2e837 into main Jul 13, 2026
10 of 11 checks passed
@mxsrc
mxsrc deleted the fix-sfam-2785 branch July 13, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants