szetszwo commented on code in PR #1049:
URL: https://github.com/apache/ratis/pull/1049#discussion_r1527124008
##########
ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLog.java:
##########
@@ -323,17 +323,13 @@ public EntryWithData getEntryWithData(long index) throws
RaftLogIOException {
if (entryRef == null) {
throw new RaftLogIOException("Log entry not found: index = " + index);
}
- try {
- // TODO. The reference counted object should be passed to LogAppender
RATIS-2026.
- return getEntryWithData(entryRef.get());
- } finally {
- entryRef.release();
- }
+ return getEntryWithData(entryRef);
}
- private EntryWithData getEntryWithData(LogEntryProto entry) throws
RaftLogIOException {
+ private EntryWithData getEntryWithData(ReferenceCountedObject<LogEntryProto>
entryRef) throws RaftLogIOException {
Review Comment:
We should undo the change in RATIS-2028 and merge the methods:
```java
@@ -323,11 +323,8 @@ public final class SegmentedRaftLog extends RaftLogBase
{
if (entryRef == null) {
throw new RaftLogIOException("Log entry not found: index = " + index);
}
- return getEntryWithData(entryRef);
- }
- private EntryWithData
getEntryWithData(ReferenceCountedObject<LogEntryProto> entryRef) throws
RaftLogIOException {
- LogEntryProto entry = entryRef.get();
+ final LogEntryProto entry = entryRef.get();
if (!LogProtoUtils.isStateMachineDataEmpty(entry)) {
return newEntryWithData(entryRef, null);
}
```
##########
ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/SegmentedRaftLog.java:
##########
@@ -323,17 +323,13 @@ public EntryWithData getEntryWithData(long index) throws
RaftLogIOException {
if (entryRef == null) {
throw new RaftLogIOException("Log entry not found: index = " + index);
}
- try {
- // TODO. The reference counted object should be passed to LogAppender
RATIS-2026.
- return getEntryWithData(entryRef.get());
- } finally {
- entryRef.release();
- }
+ return getEntryWithData(entryRef);
}
- private EntryWithData getEntryWithData(LogEntryProto entry) throws
RaftLogIOException {
+ private EntryWithData getEntryWithData(ReferenceCountedObject<LogEntryProto>
entryRef) throws RaftLogIOException {
Review Comment:
We should undo the change in RATIS-2028 and merge back the methods:
```java
@@ -323,11 +323,8 @@ public final class SegmentedRaftLog extends RaftLogBase
{
if (entryRef == null) {
throw new RaftLogIOException("Log entry not found: index = " + index);
}
- return getEntryWithData(entryRef);
- }
- private EntryWithData
getEntryWithData(ReferenceCountedObject<LogEntryProto> entryRef) throws
RaftLogIOException {
- LogEntryProto entry = entryRef.get();
+ final LogEntryProto entry = entryRef.get();
if (!LogProtoUtils.isStateMachineDataEmpty(entry)) {
return newEntryWithData(entryRef, null);
}
```
--
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]