This is an automated email from the ASF dual-hosted git repository.
jt2594838 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 1c20df4ea7c Persist writer meta out of lock (#18124)
1c20df4ea7c is described below
commit 1c20df4ea7cdac5ec6c465e625ca045d16a631fe
Author: Jiang Tian <[email protected]>
AuthorDate: Tue Jul 7 10:35:04 2026 +0800
Persist writer meta out of lock (#18124)
---
.../apache/iotdb/consensus/iot/IoTConsensusServerImpl.java | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
index 37a68a47363..2fd379c2d6c 100644
---
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
+++
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
@@ -331,7 +331,9 @@ public class IoTConsensusServerImpl {
}
searchIndex.incrementAndGet();
}
- updateWriterMetaOnSuccess(indexedConsensusRequest);
+ latestWriterMeta =
+ new WriterMeta(
+ indexedConsensusRequest.getLocalSeq(),
indexedConsensusRequest.getPhysicalTime());
// statistic the time of offering request into queue
ioTConsensusServerMetrics.recordOfferRequestToQueueTime(
System.nanoTime() - writeToStateMachineEndTime);
@@ -351,6 +353,7 @@ public class IoTConsensusServerImpl {
return result;
} finally {
stateMachineLock.unlock();
+ persistLatestWriterMeta(false);
}
}
@@ -1046,9 +1049,7 @@ public class IoTConsensusServerImpl {
}
private void updateWriterMetaOnSuccess(final IndexedConsensusRequest
indexedConsensusRequest) {
- latestWriterMeta =
- new WriterMeta(
- indexedConsensusRequest.getLocalSeq(),
indexedConsensusRequest.getPhysicalTime());
+
persistLatestWriterMeta(false);
}
@@ -1067,8 +1068,8 @@ public class IoTConsensusServerImpl {
synchronized (writerMetaPersistLock) {
final WriterMeta latestMeta = latestWriterMeta;
if (latestMeta == null
- || (latestMeta.getLastAllocatedLocalSeq() ==
lastPersistedWriterLocalSeq
- && latestMeta.getLastAssignedPhysicalTimeMs() ==
lastPersistedWriterPhysicalTime)) {
+ || (latestMeta.getLastAllocatedLocalSeq() <=
lastPersistedWriterLocalSeq
+ && latestMeta.getLastAssignedPhysicalTimeMs() <=
lastPersistedWriterPhysicalTime)) {
return;
}