neuyilan commented on a change in pull request #1894:
URL: https://github.com/apache/iotdb/pull/1894#discussion_r514134194
##########
File path: cluster/src/main/java/org/apache/iotdb/cluster/log/LogDispatcher.java
##########
@@ -289,32 +294,44 @@ private AppendEntriesRequest
prepareRequest(List<ByteBuffer> logList,
request.setEntries(logList);
// set index for raft
- request.setPrevLogIndex(currBatch.get(0).getLog().getCurrLogIndex() - 1);
+
request.setPrevLogIndex(currBatch.get(firstIndex).getLog().getCurrLogIndex() -
1);
try {
-
request.setPrevLogTerm(currBatch.get(0).getAppendEntryRequest().prevLogTerm);
+
request.setPrevLogTerm(currBatch.get(firstIndex).getAppendEntryRequest().prevLogTerm);
} catch (Exception e) {
logger.error("getTerm failed for newly append entries", e);
}
return request;
}
private void sendLogs(List<SendLogRequest> currBatch) throws TException {
- List<ByteBuffer> logList = new ArrayList<>();
- for (SendLogRequest request : currBatch) {
- Timer.Statistic.LOG_DISPATCHER_LOG_IN_QUEUE
- .calOperationCostTimeFromStart(request.getLog().getCreateTime());
- logList.add(request.getAppendEntryRequest().entry);
- }
+ int logIndex = 0;
+ logger.info("send logs from index {} to {}",
currBatch.get(0).getLog().getCurrLogIndex(),
+ currBatch.get(currBatch.size() - 1).getLog().getCurrLogIndex());
+ while (logIndex < currBatch.size()) {
+ long logSize =
IoTDBDescriptor.getInstance().getConfig().getThriftMaxFrameSize();
Review comment:
maybe we can move the line outside of the while loop
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]