This is an automated email from the ASF dual-hosted git repository.
szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ratis.git
The following commit(s) were added to refs/heads/master by this push:
new 2f12607 RATIS-625. LogSegment#append leaks entryCache when the
entries are loaded on a restart. Contributed by Mukul Kumar Singh
2f12607 is described below
commit 2f126074ce79af1b584931a934c4b266057eacc6
Author: Tsz Wo Nicholas Sze <[email protected]>
AuthorDate: Thu Jul 18 14:09:38 2019 -0700
RATIS-625. LogSegment#append leaks entryCache when the entries are loaded
on a restart. Contributed by Mukul Kumar Singh
---
.../java/org/apache/ratis/server/raftlog/segmented/LogSegment.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git
a/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/LogSegment.java
b/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/LogSegment.java
index 5bf6e8a..e696247 100644
---
a/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/LogSegment.java
+++
b/ratis-server/src/main/java/org/apache/ratis/server/raftlog/segmented/LogSegment.java
@@ -277,6 +277,7 @@ class LogSegment implements Comparable<Long> {
final LogRecord record = new LogRecord(totalSize, entry);
records.add(record);
if (keepEntryInCache) {
+ hasEntryCache = true;
entryCache.put(record.getTermIndex(), entry);
}
if (entry.hasConfigurationEntry()) {
@@ -304,8 +305,8 @@ class LogSegment implements Comparable<Long> {
return entry;
}
try {
- entry = cacheLoader.load(record);
hasEntryCache = true;
+ entry = cacheLoader.load(record);
return entry;
} catch (Exception e) {
throw new RaftLogIOException(e);