mirror of
https://github.com/NLnetLabs/krill.git
synced 2026-09-22 17:34:56 +02:00
Get repo for migration but don't 'warm' the cache as this also triggers cleanups..
This commit is contained in:
@@ -72,16 +72,6 @@ impl CaObjectsMigration {
|
||||
info!("Populate the CA Objects Store introduced in Krill 0.9.0");
|
||||
let store = AggregateStore::<OldCertAuth>::disk(&config.data_dir, CASERVER_DIR)?;
|
||||
|
||||
// for ca in
|
||||
|
||||
// if store.warm().is_err() {
|
||||
// // most likely we are dealing with off by one errors in old krill info files. Archive them for migration and try again.
|
||||
// for c in store.list()? {
|
||||
// let info_key = KeyStoreKey::scoped(c.to_string(), "info.json".to_string());
|
||||
// kv.drop_key(&info_key)?;
|
||||
// }
|
||||
// }
|
||||
|
||||
let ca_objects_store =
|
||||
CaObjectsStore::disk(&config.upgrade_data_dir(), config.issuance_timing.clone(), signer)?;
|
||||
|
||||
|
||||
@@ -75,16 +75,29 @@ impl PubdObjectsMigration {
|
||||
fn populate_repo_content(config: Arc<Config>) -> UpgradeResult<()> {
|
||||
info!("Populate the repository content based on current state");
|
||||
let old_store = AggregateStore::<OldRepository>::disk(&config.data_dir, PUBSERVER_DIR)?;
|
||||
if old_store.warm().is_err() {
|
||||
// This is most likely because the info last event is off by one which affected
|
||||
// some old version. Try archiving the info.json to force that the publication
|
||||
// server is rebuilt from scratch.
|
||||
let kv = KeyValueStore::disk(&config.data_dir, PUBSERVER_DIR)?;
|
||||
let info = KeyStoreKey::scoped("0".to_string(), "info.json".to_string());
|
||||
kv.archive_to(&info, "archived")?;
|
||||
}
|
||||
|
||||
let old_repo = old_store.get_latest(&Self::repository_handle())?;
|
||||
let repo_handle = Self::repository_handle();
|
||||
|
||||
let old_repo = match old_store.get_latest(&repo_handle) {
|
||||
Ok(repo) => repo,
|
||||
Err(_) => {
|
||||
// most likely an off by one error in the info.json of early releases
|
||||
// try to move the info file out of the way and reload.
|
||||
let kv = KeyValueStore::disk(&config.data_dir, PUBSERVER_DIR)?;
|
||||
let info_key = KeyStoreKey::scoped(repo_handle.to_string(), "info.json".to_string());
|
||||
let tmp_key = KeyStoreKey::scoped(repo_handle.to_string(), "tmp-info.json".to_string());
|
||||
kv.move_key(&info_key, &tmp_key)?;
|
||||
|
||||
// Get latest (may still error)
|
||||
let res = old_store.get_latest(&repo_handle);
|
||||
|
||||
// move the key back to leave things as they were
|
||||
kv.move_key(&tmp_key, &info_key)?;
|
||||
|
||||
// Get the repo or error out if this failed.
|
||||
res?
|
||||
}
|
||||
};
|
||||
|
||||
let publishers = old_repo
|
||||
.publishers
|
||||
|
||||
Reference in New Issue
Block a user