You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2018/07/13 04:11:57 UTC
[GitHub] ctubbsii commented on a change in pull request #559: fixes #558 use
copy to avoid deadlock in tserver
ctubbsii 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_r202239383
##########
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 know I raised this before, but hopefully I can make my objection more clear this time around:
"Doomed" is an extremely ambiguous concept (it conveys no information about the end state, only that it will be "unfortunate", whatever that means in any given context). Using it here, especially in already error prone WAL code, introduces unnecessary confusion to subsequent contributors/debuggers. It should either be clearly documented when it is declared, with a direct, complete, and unambiguous answer to the question "What does it mean to be 'doomed' here?" or avoided entirely. I prefer to avoid: If we mean "logs to clear" then let's just say what we mean and call the variable "logsToClear". If we mean something else, then let's use similarly simple language to convey what we mean.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services