Skip to content

Commit

Permalink
[ISSUE 3019] Fixed bug with batch-sent message statistics
Browse files Browse the repository at this point in the history
Signed-off-by: zhangyang <Git_Yang@163.com>
  • Loading branch information
Git-Yang authored Jun 21, 2021
1 parent e126310 commit 2b236c3
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ public PutMessageResult putMessages(final MessageExtBatch messageExtBatch) {
msgIdBuilder.setLength(0);
long elapsedTimeInLock;
long queueOffset;
long msgNum = 0;
int msgNum = 0;
try {
beginTimeInDledgerLock = this.defaultMessageStore.getSystemClock().now();
queueOffset = getQueueOffsetByKey(encodeResult.queueOffsetKey, tranType);
Expand Down Expand Up @@ -592,6 +592,7 @@ public PutMessageResult putMessages(final MessageExtBatch messageExtBatch) {
elapsedTimeInLock = this.defaultMessageStore.getSystemClock().now() - beginTimeInDledgerLock;
appendResult = new AppendMessageResult(AppendMessageStatus.PUT_OK, firstWroteOffset, encodeResult.totalMsgLen,
msgIdBuilder.toString(), System.currentTimeMillis(), queueOffset, elapsedTimeInLock);
appendResult.setMsgNum(msgNum);
DLedgerCommitLog.this.topicQueueTable.put(encodeResult.queueOffsetKey, queueOffset + msgNum);
} catch (Exception e) {
log.error("Put message error", e);
Expand Down Expand Up @@ -779,7 +780,7 @@ public CompletableFuture<PutMessageResult> asyncPutMessages(MessageExtBatch mess
msgIdBuilder.setLength(0);
long elapsedTimeInLock;
long queueOffset;
long msgNum = 0;
int msgNum = 0;
try {
beginTimeInDledgerLock = this.defaultMessageStore.getSystemClock().now();
queueOffset = getQueueOffsetByKey(encodeResult.queueOffsetKey, tranType);
Expand Down Expand Up @@ -818,6 +819,7 @@ public CompletableFuture<PutMessageResult> asyncPutMessages(MessageExtBatch mess
elapsedTimeInLock = this.defaultMessageStore.getSystemClock().now() - beginTimeInDledgerLock;
appendResult = new AppendMessageResult(AppendMessageStatus.PUT_OK, firstWroteOffset, encodeResult.totalMsgLen,
msgIdBuilder.toString(), System.currentTimeMillis(), queueOffset, elapsedTimeInLock);
appendResult.setMsgNum(msgNum);
DLedgerCommitLog.this.topicQueueTable.put(encodeResult.queueOffsetKey, queueOffset + msgNum);
} catch (Exception e) {
log.error("Put message error", e);
Expand Down

0 comments on commit 2b236c3

Please sign in to comment.