mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-26 13:47:40 +00:00
Remove corrupt package references in db recover
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.
This commit is contained in:
committed by
Silke Hofstra
parent
c05068c2e8
commit
d8a4a28259
@@ -1 +1,2 @@
|
||||
Recovering database...
|
||||
Checking database integrity...
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
Recovering database...
|
||||
Checking database integrity...
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
Loading mirrors, local repos, snapshots and published repos...
|
||||
Loading list of all packages...
|
||||
Deleting unreferenced packages (0)...
|
||||
Building list of files referenced by packages...
|
||||
Building list of files in package pool...
|
||||
Deleting unreferenced files (1)...
|
||||
Disk space freed: 12.18 KiB...
|
||||
Compacting database...
|
||||
@@ -0,0 +1,3 @@
|
||||
Recovering database...
|
||||
Checking database integrity...
|
||||
Removing dangling database reference "Pamd64 hardlink 0.2.1 daf8fcecbf8210ad"
|
||||
@@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
from lib import BaseTest
|
||||
|
||||
|
||||
@@ -23,3 +25,27 @@ class RecoverDB2Test(BaseTest):
|
||||
def check(self):
|
||||
self.check_output()
|
||||
self.check_cmd_output("aptly mirror list", "mirror_list")
|
||||
|
||||
|
||||
class RecoverDB3Test(BaseTest):
|
||||
"""
|
||||
recover db: dangling reference
|
||||
"""
|
||||
fixtureDB = True
|
||||
fixtureCmds = [
|
||||
"aptly repo create db3test",
|
||||
"aptly repo add db3test changes/hardlink_0.2.1_amd64.deb",
|
||||
]
|
||||
|
||||
runCmd = "aptly db recover"
|
||||
|
||||
def prepare(self):
|
||||
super(RecoverDB3Test, self).prepare()
|
||||
|
||||
self.run_cmd(["go", "run", "files/corruptdb.go",
|
||||
"-db", os.path.join(os.environ["HOME"], self.aptlyDir, "db"),
|
||||
"-prefix", "Pamd64 hardlink 0.2.1"])
|
||||
|
||||
def check(self):
|
||||
self.check_output()
|
||||
self.check_cmd_output("aptly db cleanup", "cleanup")
|
||||
|
||||
Reference in New Issue
Block a user