diff --git a/src/api2/admin/datastore/backup/environment.rs b/src/api2/admin/datastore/backup/environment.rs index b99d9b29..cffa555b 100644 --- a/src/api2/admin/datastore/backup/environment.rs +++ b/src/api2/admin/datastore/backup/environment.rs @@ -158,14 +158,15 @@ impl BackupEnvironment { None => bail!("dynamic writer '{}' not registered", wid), }; - data.offset += size as u64; - data.chunk_count += 1; if data.offset != offset { bail!("dynamic writer '{}' append chunk failed - got strange chunk offset ({} != {})", data.name, data.offset, offset); } + data.offset += size as u64; + data.chunk_count += 1; + data.index.add_chunk(data.offset, digest)?; Ok(()) diff --git a/src/client/http_client.rs b/src/client/http_client.rs index a51e16a4..68fd974a 100644 --- a/src/client/http_client.rs +++ b/src/client/http_client.rs @@ -445,8 +445,9 @@ impl BackupClient { let stream = stream. map(move |data| { let digest = openssl::sha::sha256(&data); + let offset = stream_len; stream_len += data.len() as u64; - ChunkInfo { data, digest, offset: stream_len } + ChunkInfo { data, digest, offset } }); let h2 = self.h2.clone();