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
main
Yueh-Hsuan Chiang 11 years ago
parent 85f9bb4ef4
commit faa8d21922
  1. 2
      db/db_bench.cc

@ -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…
Cancel
Save