Add logging for new bug with gradual scans
This commit is contained in:
parent
22beea0c50
commit
31ffb1ce86
@ -7,7 +7,7 @@ use dashmap::DashSet;
|
||||
use eyre::{bail, ensure, eyre, Context, ContextCompat};
|
||||
use indicatif::ProgressStyle;
|
||||
use patricia_tree::PatriciaMap;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::collections::{BTreeMap, BTreeSet, HashMap};
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
use std::process::{Child, Command, Stdio};
|
||||
@ -260,9 +260,24 @@ async fn scan_dir_sources(
|
||||
|
||||
let (chunk_file_map, pruned_scan_entry_map, prepopulated_scan_entry_map) =
|
||||
if let Some(ref parent_node) = parent {
|
||||
let (cfm, prepopulated, pruned) =
|
||||
let (cfm, pruned, prepopulated) =
|
||||
scan::prepopulate_unmodified(&parent_node.root.node, &scan_entry_map);
|
||||
|
||||
// debug
|
||||
let pruned_keys: BTreeSet<String> = pruned
|
||||
.keys()
|
||||
.map(|b| String::from_utf8(b).unwrap())
|
||||
.collect();
|
||||
let prepop_keys: BTreeSet<String> = prepopulated
|
||||
.keys()
|
||||
.map(|b| String::from_utf8(b).unwrap())
|
||||
.collect();
|
||||
let ix_keys: BTreeSet<&String> =
|
||||
pruned_keys.intersection(&prepop_keys).collect();
|
||||
if !ix_keys.is_empty() {
|
||||
bail!("bug: intersecting prepop and prune keys: {ix_keys:?}");
|
||||
}
|
||||
|
||||
(cfm, pruned, prepopulated)
|
||||
} else {
|
||||
(
|
||||
|
@ -220,7 +220,7 @@ fn scan_one_no_recurse(path: &Path, metadata: Metadata) -> eyre::Result<Option<S
|
||||
|
||||
/// Given the parent pointer's root TreeNode and a scan entry map of the current pointer,
|
||||
/// return a chunkings map prepopulated with the reusable entries.
|
||||
/// Also returns a prepopulated and pruned copy of the scan entry map.
|
||||
/// Also returns a pruned and prepopulated copy of the scan entry map.
|
||||
pub fn prepopulate_unmodified(
|
||||
parent_tree: &TreeNode,
|
||||
scan_entry_map: &PatriciaMap<ScanEntry>,
|
||||
@ -290,8 +290,8 @@ pub fn prepopulate_unmodified(
|
||||
.expect("no reason to fail");
|
||||
(
|
||||
reusable_chunkings,
|
||||
prepopulated_scan_entry_map,
|
||||
pruned_scan_entry_map,
|
||||
prepopulated_scan_entry_map,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -390,6 +390,8 @@ pub fn integrate_node_in_place(new: &mut TreeNode, old: &TreeNode) {
|
||||
}
|
||||
}
|
||||
|
||||
/// `new_scan` and `reused_scan` should be disjoint, but `reused_scan` must contain all directories
|
||||
/// needed for itself; `new_scan` is allowed to reuse those directories.
|
||||
pub fn assemble_tree_from_scan_entries(
|
||||
new_scan: PatriciaMap<ScanEntry>,
|
||||
reused_scan: PatriciaMap<ScanEntry>,
|
||||
@ -434,7 +436,9 @@ pub fn assemble_tree_from_scan_entries(
|
||||
ownership,
|
||||
permissions,
|
||||
} => {
|
||||
dirs.insert(key_string.clone(), BTreeMap::new());
|
||||
if !dirs.insert(key_string.clone(), BTreeMap::new()).is_none() {
|
||||
bail!("bug: {key_string:?} already in dirs...");
|
||||
}
|
||||
// note: for the root, this inserts the root directory entry as a child called "" within the root.
|
||||
// That's fine. We'll patch this up later.
|
||||
dirs.get_mut(parent_dir_name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user