You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "symious (via GitHub)" <gi...@apache.org> on 2025/12/10 01:17:34 UTC
Re: [PR] [DRAFT] RATIS-2129. Low replication performance because of lock contention on RaftLog [ratis]
symious commented on code in PR #1322:
URL: https://github.com/apache/ratis/pull/1322#discussion_r2604866896
##########
ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLogCache.java:
##########
@@ -614,10 +614,12 @@ long getLastIndexInClosedSegments() {
TermIndex getLastTermIndex() {
try (AutoCloseableLock readLock = closedSegments.readLock()) {
- return (openSegment != null && openSegment.getLastTermIndex() != null) ?
- openSegment.getLastTermIndex() :
- (closedSegments.isEmpty() ? null :
- closedSegments.get(closedSegments.size() - 1).getLastTermIndex());
+ TermIndex lastOpenIndex =
+ (openSegment != null) ? openSegment.getLastTermIndex() : null;
+ return lastOpenIndex != null
Review Comment:
Reverted and use tmpSegment to avoid NPE.
--
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: issues-unsubscribe@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org