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
main
Nathan Bronson 9 years ago
parent c745f1d2c4
commit 2b42000f43
  1. 5
      db/write_thread.cc

@ -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;

Loading…
Cancel
Save