src/api2/admin/datastore/backup/environment.rs: add more consistency checks

This commit is contained in:
Dietmar Maurer
2019-05-28 09:12:38 +02:00
parent 3dc5b2a203
commit 006f3ff407
2 changed files with 14 additions and 2 deletions

View File

@ -231,9 +231,18 @@ impl BackupEnvironment {
};
if data.chunk_count != chunk_count {
bail!("fixed writer '{}' close failed - unexpected chunk count ({} != {})", data.name, data.chunk_count, chunk_count);
bail!("fixed writer '{}' close failed - received wrong number of chunk ({} != {})", data.name, data.chunk_count, chunk_count);
}
let expected_count = data.index.index_length();
if chunk_count != (expected_count as u64) {
bail!("fixed writer '{}' close failed - unexpected chunk count ({} != {})", data.name, expected_count, chunk_count);
}
if size != (data.size as u64) {
bail!("fixed writer '{}' close failed - unexpected file size ({} != {})", data.name, data.size, size);
}
data.index.close()?;