keith-turner commented on a change in pull request #559: fixes #558 use copy to
avoid deadlock in tserver
URL: https://github.com/apache/accumulo/pull/559#discussion_r202343614
##########
File path:
server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
##########
@@ -2457,19 +2464,25 @@ public void importMapFiles(long tid,
Map<FileRef,MapFileInfo> fileMap, boolean s
}
private Set<DfsLogger> currentLogs = new HashSet<>();
+ private Set<DfsLogger> otherLogs = Collections.emptySet();
+
+ // An immutable copy of currentLogs + otherLogs. This exists so that
removeInUseLogs() does not
+ // have to get the tablet lock. See #558
+ private volatile Set<DfsLogger> referencedLogs = Collections.emptySet();
+
+ private synchronized void rebuildReferencedLogs() {
+ Builder<DfsLogger> builder = ImmutableSet.builder();
+ builder.addAll(currentLogs);
+ builder.addAll(otherLogs);
+ referencedLogs = builder.build();
+ }
public void removeInUseLogs(Set<DfsLogger> candidates) {
- synchronized (this) {
- // remove logs related to minor compacting data
- candidates.removeAll(otherLogs);
- // remove logs related to tablets in memory data
- candidates.removeAll(currentLogs);
- // remove logs related to minor compaction file being added to the
metadata table
- candidates.removeAll(doomedLogs);
- }
+ candidates.removeAll(referencedLogs);
}
Set<String> beginClearingUnusedLogs() {
+ Set<String> doomed = new HashSet<>();
Review comment:
I reverted changes to this code since 1.9.1 in order to minimize what I had
to consider. In this process I lost the doomed comment. I can make the
variable name more clear.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services