From faa8d21922b09988c86c75887cd7a49895120e25 Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Tue, 24 Jun 2014 15:29:28 -0600 Subject: [PATCH] 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 --- db/db_bench.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/db_bench.cc b/db/db_bench.cc index b46d68099..201133c66 100644 --- a/db/db_bench.cc +++ b/db/db_bench.cc @@ -584,9 +584,9 @@ class RandomGenerator { } Slice Generate(unsigned int len) { + assert(len <= data_.size()); if (pos_ + len > data_.size()) { pos_ = 0; - assert(len < data_.size()); } pos_ += len; return Slice(data_.data() + pos_ - len, len);