tape: write_chunk_archive - do not consume partially written chunk at EOT
So that it is re-written to the next tape.
This commit is contained in:
parent
355a41a763
commit
e8913fea12
@ -96,7 +96,6 @@ impl SnapshotReader {
|
||||
/// Note: The iterator returns a `Result`, and the iterator state is
|
||||
/// undefined after the first error. So it make no sense to continue
|
||||
/// iteration after the first error.
|
||||
#[derive(Clone)]
|
||||
pub struct SnapshotChunkIterator<'a> {
|
||||
snapshot_reader: &'a SnapshotReader,
|
||||
todo_list: Vec<String>,
|
||||
|
@ -418,14 +418,17 @@ fn write_chunk_archive<'a>(
|
||||
let mut leom = false;
|
||||
|
||||
loop {
|
||||
let digest = match chunk_iter.next() {
|
||||
let digest = match chunk_iter.peek() {
|
||||
None => break,
|
||||
Some(digest) => digest?,
|
||||
Some(Ok(digest)) => *digest,
|
||||
Some(Err(err)) => bail!("{}", err),
|
||||
};
|
||||
|
||||
if media_catalog.contains_chunk(&digest)
|
||||
|| chunk_index.contains(&digest)
|
||||
|| media_set_catalog.contains_chunk(&digest)
|
||||
{
|
||||
chunk_iter.next(); // consume
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -433,11 +436,13 @@ fn write_chunk_archive<'a>(
|
||||
//println!("CHUNK {} size {}", proxmox::tools::digest_to_hex(&digest), blob.raw_size());
|
||||
|
||||
match writer.try_write_chunk(&digest, &blob) {
|
||||
Ok(true) => {
|
||||
Ok(true) => {
|
||||
chunk_iter.next(); // consume
|
||||
chunk_index.insert(digest);
|
||||
chunk_list.push(digest);
|
||||
}
|
||||
Ok(false) => {
|
||||
// Note; we do not consume the chunk (no chunk_iter.next())
|
||||
leom = true;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user