Add some debug lines for Bad PMap issue

This commit is contained in:
Olivier 'reivilibre' 2023-05-26 21:00:22 +01:00
parent 470420665f
commit 5ffbf4fc1c
2 changed files with 9 additions and 2 deletions

View File

@ -2,7 +2,7 @@ use crate::descriptor_config::{SourceDescriptor, SourceDescriptorInner, VirtualS
use crate::pointer_names::{get_pointer_name_at, POINTER_NAME_DATETIME_SPLITTER};
use chrono::{DateTime, Utc};
use dashmap::DashSet;
use eyre::{bail, eyre, Context, ContextCompat};
use eyre::{bail, eyre, Context, ContextCompat, ensure};
use indicatif::ProgressStyle;
use patricia_tree::PatriciaMap;
use std::borrow::Cow;
@ -309,6 +309,9 @@ async fn backup_dir_sources(
StoragePipeline::launch_new(4, pwc.clone(), new_unflushed_chunks).await?;
let dir_sources2 = &dir_sources;
let mut submitted = 0;
let mut completed = 0;
let submitted_mut = &mut submitted;
let (submitter_task, receiver_task) = tokio::join!(
async move {
let pipeline_job_tx = pipeline_job_tx;
@ -325,6 +328,7 @@ async fn backup_dir_sources(
))
.await
.map_err(|_| eyre!("unable to send to pipeline."))?;
*submitted_mut += 1;
}
}
}
@ -337,6 +341,7 @@ async fn backup_dir_sources(
pipeline.next_result().await
{
chunk_file_maps[dir_source_idx].insert_str(&job_id, (rec_chunk_ref, real_size));
completed += 1;
Span::current().pb_inc(1);
}
// eprintln!("fin rec");
@ -347,6 +352,8 @@ async fn backup_dir_sources(
submitter_task?;
receiver_task?;
ensure!(completed == submitted, "completed: {completed:?} != submitted {submitted:?}");
assert_eq!(dir_sources.len(), chunk_file_maps.len());
let chunkmaps = pipeline.finish_into_chunkmaps().await?;

View File

@ -411,7 +411,7 @@ pub fn assemble_tree_from_scan_entries(
} => {
let (content, size) = chunkings
.remove(&key_string)
.context("bad chunkings PMap: missing entry")?;
.with_context(|| format!("bad chunkings PMap: missing entry: {key_string:?}"))?;
// note: for the root, this inserts the root file entry as a child called "" within a fake root 'directory'.
// That's fine. We'll patch this up later.