Fix the unit test failure in devbox
Summary: My last diff was developed in MacOS but in devserver environment error occurs. I dug into the problem and found the way we calcuate approximate data size is pretty out-of-date. We can use table properties to get more accurate results. Test Plan: ran ./table_test and passed Reviewers: igor, dhruba, haobo, sdong CC: leveldb Differential Revision: https://reviews.facebook.net/D16509
This commit is contained in:
parent
74939a9e13
commit
ff151132b3
@ -1025,11 +1025,15 @@ uint64_t BlockBasedTable::ApproximateOffsetOf(const Slice& key) {
|
|||||||
result = rep_->metaindex_handle.offset();
|
result = rep_->metaindex_handle.offset();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// key is past the last key in the file. Approximate the offset
|
// key is past the last key in the file. If table_properties is not
|
||||||
// by returning the offset of the metaindex block (which is
|
// available, approximate the offset by returning the offset of the
|
||||||
// right near the end of the file).
|
// metaindex block (which is right near the end of the file).
|
||||||
|
result = rep_->table_properties->data_size;
|
||||||
|
// table_properties is not present in the table.
|
||||||
|
if (result == 0) {
|
||||||
result = rep_->metaindex_handle.offset();
|
result = rep_->metaindex_handle.offset();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user