save erasure set size, initialize coding blob erasures with that size (#3910)

* save erasure set size, initialize coding blob erasures with that size

* fixup

* fixup
This commit is contained in:
Rob Walker
2019-04-19 20:22:51 -07:00
committed by GitHub
parent d83a71d89f
commit 3ab492ccf8
2 changed files with 19 additions and 23 deletions

View File

@@ -462,6 +462,7 @@ impl Blocktree {
.unwrap_or_else(|| ErasureMeta::new(set_index));
erasure_meta.set_coding_present(index, true);
erasure_meta.set_size(bytes.len() - BLOB_HEADER_SIZE);
let mut writebatch = self.db.batch()?;
@@ -1047,11 +1048,12 @@ impl Blocktree {
let erasure_meta = self.erasure_meta_cf.get((slot, set_index))?.unwrap();
let start_idx = erasure_meta.start_index();
let size = erasure_meta.size();
let (data_end_idx, coding_end_idx) = erasure_meta.end_indexes();
let present = &mut [true; ERASURE_SET_SIZE];
let mut blobs = Vec::with_capacity(ERASURE_SET_SIZE);
let mut size = 0;
for i in start_idx..coding_end_idx {
if erasure_meta.is_coding_present(i) {
@@ -1062,10 +1064,6 @@ impl Blocktree {
blob_bytes.drain(..BLOB_HEADER_SIZE);
if size == 0 {
size = blob_bytes.len();
}
blobs.push(blob_bytes);
} else {
let set_relative_idx = (i - start_idx) as usize + NUM_DATA;