incorrect batch group size computation for write throttling

Summary:
When a write batch can't join a batch group due to the total
size of the contained batches, the write controller's GetDelay is passed
a size value that includes the rejected batch.

Test Plan: make check

Reviewers: sdong, igor

Reviewed By: igor

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D50343
This commit is contained in:
Nathan Bronson 2015-11-02 09:23:39 -08:00
parent c745f1d2c4
commit 2b42000f43

View File

@ -120,12 +120,13 @@ size_t WriteThread::EnterAsBatchGroupLeader(
break;
}
size += WriteBatchInternal::ByteSize(w->batch);
if (size > max_size) {
auto batch_size = WriteBatchInternal::ByteSize(w->batch);
if (size + batch_size > max_size) {
// Do not make batch too big
break;
}
size += batch_size;
write_batch_group->push_back(w->batch);
w->in_batch_group = true;
*last_writer = w;