Improve an assertion in RandomGenerator::Generate() in db_bench.
Summary: RandomGenerator::Generate() currently has an assertion len < data_.size(). However, it is actually fine to have len == data_.size(). This diff change the assertion to len <= data_.size(). Test Plan: make db_bench ./db_bench Reviewers: haobo, sdong, ljin Reviewed By: ljin Subscribers: leveldb Differential Revision: https://reviews.facebook.net/D19269
This commit is contained in:
parent
85f9bb4ef4
commit
faa8d21922
@ -584,9 +584,9 @@ class RandomGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Slice Generate(unsigned int len) {
|
Slice Generate(unsigned int len) {
|
||||||
|
assert(len <= data_.size());
|
||||||
if (pos_ + len > data_.size()) {
|
if (pos_ + len > data_.size()) {
|
||||||
pos_ = 0;
|
pos_ = 0;
|
||||||
assert(len < data_.size());
|
|
||||||
}
|
}
|
||||||
pos_ += len;
|
pos_ += len;
|
||||||
return Slice(data_.data() + pos_ - len, len);
|
return Slice(data_.data() + pos_ - len, len);
|
||||||
|
Loading…
Reference in New Issue
Block a user