You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ji...@apache.org on 2023/03/10 01:24:07 UTC
[iotdb] branch native_raft updated: add some monitors
This is an automated email from the ASF dual-hosted git repository.
jiangtian pushed a commit to branch native_raft
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/native_raft by this push:
new 5024170f34 add some monitors
5024170f34 is described below
commit 5024170f3457a4d8c8188204bbb66d69acd0c98b
Author: Tian Jiang <jt...@163.com>
AuthorDate: Fri Mar 10 09:25:51 2023 +0800
add some monitors
---
.../org/apache/iotdb/consensus/natraft/protocol/RaftMember.java | 6 ++----
.../natraft/protocol/log/sequencing/SynchronousSequencer.java | 1 +
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/RaftMember.java b/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/RaftMember.java
index 77a199e515..ea26a6d3c9 100644
--- a/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/RaftMember.java
+++ b/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/RaftMember.java
@@ -654,7 +654,6 @@ public class RaftMember {
// assign term and index to the new log and append it
VotingEntry votingEntry = logSequencer.sequence(entry);
- entry.createTime = System.nanoTime();
Statistic.LOG_DISPATCHER_FROM_RECEIVE_TO_CREATE.add(entry.createTime - entry.receiveTime);
if (config.isUseFollowerLoadBalance()) {
@@ -761,17 +760,16 @@ public class RaftMember {
}
long waitTime = 1;
AcceptedType acceptedType = votingLogList.computeAcceptedType(log);
- synchronized (log) {
+ synchronized (log.getEntry()) {
while (acceptedType == AcceptedType.NOT_ACCEPTED
&& alreadyWait < config.getWriteOperationTimeoutMS()) {
try {
- log.wait(waitTime);
+ log.getEntry().wait(waitTime);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
logger.warn("Unexpected interruption when sending a log", e);
}
acceptedType = votingLogList.computeAcceptedType(log);
- waitTime = waitTime * 2;
alreadyWait = (System.nanoTime() - waitStart) / 1000000;
if (alreadyWait > nextTimeToPrint) {
diff --git a/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/log/sequencing/SynchronousSequencer.java b/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/log/sequencing/SynchronousSequencer.java
index 624bf0af85..8b0445dfd5 100644
--- a/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/log/sequencing/SynchronousSequencer.java
+++ b/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/log/sequencing/SynchronousSequencer.java
@@ -67,6 +67,7 @@ public class SynchronousSequencer implements LogSequencer {
e.setCurrLogIndex(lastIndex + 1);
e.setPrevTerm(lastTerm);
e.setFromThisNode(true);
+ e.createTime = System.nanoTime();
// logDispatcher will serialize log, and set log size, and we will use the size after it
logManager.append(Collections.singletonList(e));