Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #441 only dereference WALs after minc finishes #443

Merged
merged 2 commits into from
Apr 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3352,7 +3352,10 @@ private void markUnusedWALs() {
candidates = new HashSet<>(closedLogs);
}
for (Tablet tablet : getOnlineTablets()) {
candidates.removeAll(tablet.getCurrentLogFiles());
tablet.removeInUseLogs(candidates);
if (candidates.isEmpty()) {
break;
}
}
try {
TServerInstance session = this.getTabletSession();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2457,11 +2457,13 @@ public List<FileRef> call() throws Exception {
}
}

private ConcurrentSkipListSet<DfsLogger> currentLogs = new ConcurrentSkipListSet<>();
private Set<DfsLogger> currentLogs = new HashSet<>();

// currentLogs may be updated while a tablet is otherwise locked
public Set<DfsLogger> getCurrentLogFiles() {
return new HashSet<>(currentLogs);
public synchronized void removeInUseLogs(Set<DfsLogger> candidates) {
// remove logs related to minor compacting data
candidates.removeAll(otherLogs);
// remove logs related to tablets in memory data
candidates.removeAll(currentLogs);
}

Set<String> beginClearingUnusedLogs() {
Expand Down Expand Up @@ -2520,7 +2522,7 @@ synchronized void finishClearingUnusedLogs() {
// this lock is basically used to synchronize writing of log info to metadata
private final ReentrantLock logLock = new ReentrantLock();

public int getLogCount() {
public synchronized int getLogCount() {
return currentLogs.size();
}

Expand Down