From commits-return-24632-archive-asf-public=cust-asf.ponee.io@pulsar.apache.org Sat Mar 16 01:28:54 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 6787C180627 for ; Sat, 16 Mar 2019 02:28:54 +0100 (CET) Received: (qmail 47174 invoked by uid 500); 16 Mar 2019 01:28:53 -0000 Mailing-List: contact commits-help@pulsar.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pulsar.apache.org Delivered-To: mailing list commits@pulsar.apache.org Received: (qmail 47165 invoked by uid 99); 16 Mar 2019 01:28:53 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Mar 2019 01:28:53 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id EC04785388; Sat, 16 Mar 2019 01:28:52 +0000 (UTC) Date: Sat, 16 Mar 2019 01:28:52 +0000 To: "commits@pulsar.apache.org" Subject: [pulsar] branch master updated: Use correct number of messages in batch for publish rate stats during replication (#3834) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155269973272.11340.6510724096227070547@gitbox.apache.org> From: mmerli@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: pulsar X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: fdaa9e3728e463bc67f5e946833d1dac392412e2 X-Git-Newrev: ce13251caf8649f74e3f5196784eec24c062046c X-Git-Rev: ce13251caf8649f74e3f5196784eec24c062046c X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. mmerli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pulsar.git The following commit(s) were added to refs/heads/master by this push: new ce13251 Use correct number of messages in batch for publish rate stats during replication (#3834) ce13251 is described below commit ce13251caf8649f74e3f5196784eec24c062046c Author: Matteo Merli AuthorDate: Fri Mar 15 18:28:47 2019 -0700 Use correct number of messages in batch for publish rate stats during replication (#3834) --- .../main/java/org/apache/pulsar/client/impl/ProducerImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java index 6dcaca0..0793a50 100644 --- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java +++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java @@ -372,12 +372,18 @@ public class ProducerImpl extends ProducerBase implements TimerTask, Conne ByteBuf encryptedPayload = encryptMessage(msgMetadataBuilder, compressedPayload); MessageMetadata msgMetadata = msgMetadataBuilder.build(); - ByteBufPair cmd = sendMessage(producerId, sequenceId, 1, msgMetadata, encryptedPayload); + + // When publishing during replication, we need to set the correct number of message in batch + // This is only used in tracking the publish rate stats + int numMessages = msg.getMessageBuilder().hasNumMessagesInBatch() + ? msg.getMessageBuilder().getNumMessagesInBatch() + : 1; + ByteBufPair cmd = sendMessage(producerId, sequenceId, numMessages, msgMetadata, encryptedPayload); msgMetadataBuilder.recycle(); msgMetadata.recycle(); final OpSendMsg op = OpSendMsg.create(msg, cmd, sequenceId, callback); - op.setNumMessagesInBatch(1); + op.setNumMessagesInBatch(numMessages); op.setBatchSizeByte(encryptedPayload.readableBytes()); pendingMessages.put(op); lastSendFuture = callback.getFuture();