szetszwo commented on PR #1322:
URL: https://github.com/apache/ratis/pull/1322#issuecomment-3666677614
@symious , that's great, thanks for testing it!
To play safe, let's make the readLock in SegmentedRaftLog configurable?
```java
+++
b/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLog.java
@@ -219,6 +219,11 @@ public final class SegmentedRaftLog extends RaftLogBase
{
stateMachineCachingEnabled =
RaftServerConfigKeys.Log.StateMachineData.cachingEnabled(b.properties);
}
+ @Override
+ public AutoCloseableLock readLock() {
+ return readLockEnabled ? super.readLock() : null;
+ }
+
@Override
public SegmentedRaftLogMetrics getRaftLogMetrics() {
return metrics;
@@ -338,8 +343,7 @@ public final class SegmentedRaftLog extends RaftLogBase {
public TermIndex getTermIndex(long index) {
checkLogState();
try(AutoCloseableLock readLock = readLock()) {
- LogRecord record = cache.getLogRecord(index);
- return record != null ? record.getTermIndex() : null;
+ return cache.getTermIndex(index);
}
}
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]