Skip to content

Conversation

@silkeh
Copy link
Contributor

@silkeh silkeh commented Apr 22, 2025

Description of the Change

When aptly crashes it is possible to get a corrupt database with a dangling key reference. This results in an error with 'key not found', eg:

ERROR: unable to load package Pall example-package 1.2.3 778cf6f877bf6e2d: key not found

This change makes db recover fix this situation by removing the dangling references.

With this change aptly db recover can be used to recover from the situation seen in #1119.

Checklist

  • unit-test added (if change is algorithm)
  • functional test added/updated (if change is functional)
  • man page updated (if applicable)
  • bash completion updated (if applicable)
  • documentation updated
  • author name in AUTHORS

@silkeh silkeh force-pushed the fix-db-references branch from 73de94f to 2e57947 Compare April 22, 2025 16:27
@neolynx neolynx self-assigned this Apr 25, 2025
@neolynx
Copy link
Member

neolynx commented Apr 25, 2025

Hi and thanks a lot for this improvement !

I tried to rebase on master, but don't have the permissions on your repo. could you somehow share the PR or rebase ?

The system tests should be working again on master...

@neolynx neolynx added the needs rebase The PR needs to be rebased on master label Apr 26, 2025
silkeh added 2 commits April 30, 2025 12:21
When aptly crashes it is possible to get a corrupt database with a dangling key reference.
This results in an error with 'key not found', eg:

    ERROR: unable to load package Pall example-package 1.2.3 778cf6f877bf6e2d: key not found

This change makes `db recover` fix this situation by removing the dangling references.
@silkeh silkeh force-pushed the fix-db-references branch from 2e57947 to 6dbb28b Compare April 30, 2025 10:21
@silkeh
Copy link
Contributor Author

silkeh commented Apr 30, 2025

I tried to rebase on master, but don't have the permissions on your repo. could you somehow share the PR or rebase ?

Hmm, strange, I have the 'allow edits by maintainers' box checked.

I've rebased the PR, let's see if the tests are happy 🙂

@codecov
Copy link

codecov bot commented Apr 30, 2025

Codecov Report

Attention: Patch coverage is 41.25000% with 47 lines in your changes missing coverage. Please review.

Project coverage is 74.55%. Comparing base (c05068c) to head (6dbb28b).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
system/files/corruptdb.go 0.00% 26 Missing ⚠️
cmd/db_recover.go 58.62% 8 Missing and 4 partials ⚠️
deb/find_dangling.go 64.00% 6 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1445      +/-   ##
==========================================
- Coverage   75.02%   74.55%   -0.48%     
==========================================
  Files         157      159       +2     
  Lines       18362    18441      +79     
==========================================
- Hits        13776    13748      -28     
- Misses       3446     3550     +104     
- Partials     1140     1143       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@neolynx
Copy link
Member

neolynx commented May 1, 2025

they are happy indeed ! great job :-)

I love the corruptdb.go 👍

awesome PR, thanks a lot !

@neolynx neolynx requested a review from a team May 1, 2025 08:23
@neolynx neolynx removed the needs rebase The PR needs to be rebased on master label May 1, 2025
@neolynx neolynx merged commit 27c1568 into aptly-dev:master May 1, 2025
42 of 43 checks passed
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