Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions bftengine/src/bftengine/ReplicaImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,18 +711,25 @@ PrePrepareMsg *ReplicaImp::createPrePrepareMessage() {
ClientRequestMsg *ReplicaImp::addRequestToPrePrepareMessage(ClientRequestMsg *&nextRequest,
PrePrepareMsg &prePrepareMsg,
uint32_t maxStorageForRequests) {
if (nextRequest->size() <= prePrepareMsg.remainingSizeForRequests()) {
uint64_t remaining_size = prePrepareMsg.remainingSizeForRequests();
if (nextRequest->size() <= remaining_size) {
SCOPED_MDC_CID(nextRequest->getCid());
if (clientsManager->canBecomePending(nextRequest->clientProxyId(), nextRequest->requestSeqNum())) {
prePrepareMsg.addRequest(nextRequest->body(), nextRequest->size());
clientsManager->addPendingRequest(
nextRequest->clientProxyId(), nextRequest->requestSeqNum(), nextRequest->getCid());
metric_primary_batching_duration_.finishMeasurement(nextRequest->getCid());
}
} else if (nextRequest->size() > maxStorageForRequests) { // The message is too big
} else if (nextRequest->size() >
maxStorageForRequests) { // The message will never be able to get into a prepreapre message
LOG_WARN(GL,
"Request was dropped because it exceeds maximum allowed size" << KVLOG(
prePrepareMsg.seqNumber(), nextRequest->senderId(), nextRequest->size(), maxStorageForRequests));
} else {
LOG_WARN(GL,
"Request was dropped because it exceeds the prePrepare remaining size"
<< KVLOG(prePrepareMsg.seqNumber(), nextRequest->senderId(), nextRequest->size(), remaining_size));
return nullptr;
}
primaryCombinedReqSize -= nextRequest->size();
requestsQueueOfPrimary.pop();
Expand Down