Skip to content

For gpkg file restore always use diff checkpoints#594

Open
varmar05 wants to merge 1 commit intodevelopfrom
gpgk_restore_from_checkpoints
Open

For gpkg file restore always use diff checkpoints#594
varmar05 wants to merge 1 commit intodevelopfrom
gpgk_restore_from_checkpoints

Conversation

@varmar05
Copy link
Collaborator

Drop legacy support to use individual 0 rank diffs. Instead always use diff checkpoints and create them recursively if needed. This change uses the same logic as we do in v2 endpoints.

Please note that reconstruction can still throw 502/504 if backend does not make it within allowed time. As each try can now take less time to finish (intermediate checkpoints created), clients can implement retry logic.

Drop legacy support to use individual 0 rank diffs. Instead always use diff checkpoints and create them recursively if needed.
This change uses the same logic as we do in v2 endpoints.
@varmar05 varmar05 requested a review from MarcelGeo March 13, 2026 15:00
@coveralls
Copy link

Pull Request Test Coverage Report for Build 23056716878

Details

  • 60 of 65 (92.31%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 94.62%

Changes Missing Coverage Covered Lines Changed/Added Lines %
server/mergin/sync/models.py 16 21 76.19%
Totals Coverage Status
Change from base Build 22944359470: -0.02%
Covered Lines: 9093
Relevant Lines: 9610

💛 - Coveralls

if not os.path.exists(abs_path):
logging.error(f"Missing file {namespace}/{project_name}/{file_path}")
abort(404)
if version and not diff:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably add some reolving map on the start of controller, where we can make actions based on this version and diff attributes.

If not version and diff: abort
If version and diff: download_diff
If not diff and version: dowload_geopackage

Where is handled a non gpkg file?

Copy link
Collaborator

@MarcelGeo MarcelGeo left a comment

Choose a reason for hiding this comment

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

Nice

)
.filter(
FileDiff.version >= item.start, FileDiff.version <= item.end
db.session.add(diff)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want to follow commit in the end?

diff = FileDiff.query.filter_by(
file_path_id=file_path_id, version=20, rank=1
).first()
os.remove(diff.abs_path)
Copy link
Collaborator

@MarcelGeo MarcelGeo Mar 13, 2026

Choose a reason for hiding this comment

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

Why removed assert which was before here on this line?

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.

3 participants