Search in sources :

Example 1 with DfsLogger

use of org.apache.accumulo.tserver.log.DfsLogger in project accumulo by apache.

the class Tablet method beginClearingUnusedLogs.

Set<String> beginClearingUnusedLogs() {
    Set<String> doomed = new HashSet<>();
    ArrayList<String> otherLogsCopy = new ArrayList<>();
    ArrayList<String> currentLogsCopy = new ArrayList<>();
    // do not hold tablet lock while acquiring the log lock
    logLock.lock();
    synchronized (this) {
        if (removingLogs)
            throw new IllegalStateException("Attempted to clear logs when removal of logs in progress");
        for (DfsLogger logger : otherLogs) {
            otherLogsCopy.add(logger.toString());
            doomed.add(logger.getMeta());
        }
        for (DfsLogger logger : currentLogs) {
            currentLogsCopy.add(logger.toString());
            doomed.remove(logger.getMeta());
        }
        otherLogs = Collections.emptySet();
        if (doomed.size() > 0)
            removingLogs = true;
    }
    // do debug logging outside tablet lock
    for (String logger : otherLogsCopy) {
        log.debug("Logs for memory compacted: {} {}", getExtent(), logger.toString());
    }
    for (String logger : currentLogsCopy) {
        log.debug("Logs for current memory: {} {}", getExtent(), logger);
    }
    for (String logger : doomed) {
        log.debug("Logs to be destroyed: {} {}", getExtent(), logger);
    }
    return doomed;
}
Also used : CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) DfsLogger(org.apache.accumulo.tserver.log.DfsLogger)

Example 2 with DfsLogger

use of org.apache.accumulo.tserver.log.DfsLogger in project accumulo by apache.

the class TabletServer method markUnusedWALs.

private void markUnusedWALs() {
    Set<DfsLogger> candidates;
    synchronized (closedLogs) {
        candidates = new HashSet<>(closedLogs);
    }
    for (Tablet tablet : getOnlineTablets()) {
        candidates.removeAll(tablet.getCurrentLogFiles());
    }
    try {
        TServerInstance session = this.getTabletSession();
        for (DfsLogger candidate : candidates) {
            log.info("Marking " + candidate.getPath() + " as unreferenced");
            walMarker.walUnreferenced(session, candidate.getPath());
        }
        synchronized (closedLogs) {
            closedLogs.removeAll(candidates);
        }
    } catch (WalMarkerException ex) {
        log.info(ex.toString(), ex);
    }
}
Also used : Tablet(org.apache.accumulo.tserver.tablet.Tablet) TServerInstance(org.apache.accumulo.server.master.state.TServerInstance) DfsLogger(org.apache.accumulo.tserver.log.DfsLogger) WalMarkerException(org.apache.accumulo.server.log.WalStateManager.WalMarkerException)

Aggregations

DfsLogger (org.apache.accumulo.tserver.log.DfsLogger)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 WalMarkerException (org.apache.accumulo.server.log.WalStateManager.WalMarkerException)1 TServerInstance (org.apache.accumulo.server.master.state.TServerInstance)1 Tablet (org.apache.accumulo.tserver.tablet.Tablet)1