indexer: Drop old package-dead-marking code for Arch
A much simpler approach to dead-marking is to do a periodic UPDATE packages SET dead = true WHERE system = $1; before running the indexer. Not as efficient in terms of avoiding database writes, but there's no need to run this very often anyway.
This commit is contained in:
parent
ca07b78610
commit
c67091f096
1 changed files with 0 additions and 32 deletions
|
|
@ -92,7 +92,6 @@ pub fn sync<T: postgres::GenericClient>(pg: &mut T, sys: i32, mirror: &str, repo
|
||||||
|
|
||||||
let mut hasman = false;
|
let mut hasman = false;
|
||||||
let mut meta = None;
|
let mut meta = None;
|
||||||
//let mut allpkgs = HashSet::new();
|
|
||||||
let r = archive::walk(ent, |x| {
|
let r = archive::walk(ent, |x| {
|
||||||
if x.filetype() == archive::FileType::Directory {
|
if x.filetype() == archive::FileType::Directory {
|
||||||
hasman = false;
|
hasman = false;
|
||||||
|
|
@ -121,7 +120,6 @@ pub fn sync<T: postgres::GenericClient>(pg: &mut T, sys: i32, mirror: &str, repo
|
||||||
canbelocal: false,
|
canbelocal: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
//allpkgs.insert(m.name.into_boxed_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
|
|
@ -130,34 +128,4 @@ pub fn sync<T: postgres::GenericClient>(pg: &mut T, sys: i32, mirror: &str, repo
|
||||||
if let Err(e) = r {
|
if let Err(e) = r {
|
||||||
error!("Error reading package index: {}", e);
|
error!("Error reading package index: {}", e);
|
||||||
}
|
}
|
||||||
//mark_dead(pg, sys, repo, allpkgs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Dead-marking of packages is currently broken.
|
|
||||||
* Since the removal of the repo information from the `packages` table, the approach below isn't
|
|
||||||
* going to work anymore. Needs to be revisited... sometime.
|
|
||||||
*
|
|
||||||
fn mark_dead<T: postgres::GenericClient>(pg: &mut T, sys: i32, repo: &str, pkgs: HashSet<Box<str>>) {
|
|
||||||
let mut dead = Vec::new();
|
|
||||||
for row in pg.query("SELECT id, name FROM packages WHERE system = $1 AND category = $2 AND NOT dead", &[&sys,&repo]).unwrap() {
|
|
||||||
let id: i32 = row.get(0);
|
|
||||||
let name: &str = row.get(1);
|
|
||||||
if !pkgs.contains(name) {
|
|
||||||
info!("Package not available in database anymore, marking dead; sys {} / {} / pkg {} ({})", sys, repo, id, name);
|
|
||||||
dead.push(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if dead.is_empty() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut tr = pg.transaction().unwrap();
|
|
||||||
let q = tr.prepare("UPDATE packages SET dead = TRUE WHERE id = $1").unwrap();
|
|
||||||
for id in dead {
|
|
||||||
tr.execute(&q, &[&id]).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Err(e) = tr.commit() {
|
|
||||||
error!("Error finishing transaction: {}", e);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue