/** * @return a collection of dirty CFIDs for this segment file. */ public synchronized Collection<UUID> getDirtyCFIDs() { if (cfClean.isEmpty() || cfDirty.isEmpty()) return cfDirty.keySet(); List<UUID> r = new ArrayList<>(cfDirty.size()); for (Map.Entry<UUID, AtomicInteger> dirty : cfDirty.entrySet()) { UUID cfId = dirty.getKey(); AtomicInteger dirtyPos = dirty.getValue(); AtomicInteger cleanPos = cfClean.get(cfId); if (cleanPos == null || cleanPos.intValue() < dirtyPos.intValue()) r.add(dirty.getKey()); } return r; }
/** * @return true if this segment is unused and safe to recycle or delete */ public synchronized boolean isUnused() { // if room to allocate, we're still in use as the active allocatingFrom, // so we don't want to race with updates to cfClean with removeCleanFromDirty if (isStillAllocating()) return false; removeCleanFromDirty(); return cfDirty.isEmpty(); }
/** * @return true if this segment is unused and safe to recycle or delete */ public synchronized boolean isUnused() { // if room to allocate, we're still in use as the active allocatingFrom, // so we don't want to race with updates to cfClean with removeCleanFromDirty if (isStillAllocating()) return false; removeCleanFromDirty(); return cfDirty.isEmpty(); }
/** * @return true if this segment is unused and safe to recycle or delete */ public synchronized boolean isUnused() { // if room to allocate, we're still in use as the active allocatingFrom, // so we don't want to race with updates to cfClean with removeCleanFromDirty if (isStillAllocating()) return false; removeCleanFromDirty(); return cfDirty.isEmpty(); }
/** * @return true if this segment is unused and safe to recycle or delete */ public synchronized boolean isUnused() { // if room to allocate, we're still in use as the active allocatingFrom, // so we don't want to race with updates to cfClean with removeCleanFromDirty if (isStillAllocating()) return false; removeCleanFromDirty(); return cfDirty.isEmpty(); }
/** * @return a collection of dirty CFIDs for this segment file. */ public synchronized Collection<UUID> getDirtyCFIDs() { if (cfClean.isEmpty() || cfDirty.isEmpty()) return cfDirty.keySet(); List<UUID> r = new ArrayList<>(cfDirty.size()); for (Map.Entry<UUID, IntegerInterval> dirty : cfDirty.entrySet()) { UUID cfId = dirty.getKey(); IntegerInterval dirtyInterval = dirty.getValue(); IntegerInterval.Set cleanSet = cfClean.get(cfId); if (cleanSet == null || !cleanSet.covers(dirtyInterval)) r.add(dirty.getKey()); } return r; }
/** * @return a collection of dirty CFIDs for this segment file. */ public synchronized Collection<UUID> getDirtyCFIDs() { if (cfClean.isEmpty() || cfDirty.isEmpty()) return cfDirty.keySet(); List<UUID> r = new ArrayList<>(cfDirty.size()); for (Map.Entry<UUID, IntegerInterval> dirty : cfDirty.entrySet()) { UUID cfId = dirty.getKey(); IntegerInterval dirtyInterval = dirty.getValue(); IntegerInterval.Set cleanSet = cfClean.get(cfId); if (cleanSet == null || !cleanSet.covers(dirtyInterval)) r.add(dirty.getKey()); } return r; }
/** * @return a collection of dirty CFIDs for this segment file. */ public synchronized Collection<UUID> getDirtyCFIDs() { if (cfClean.isEmpty() || cfDirty.isEmpty()) return cfDirty.keySet(); List<UUID> r = new ArrayList<>(cfDirty.size()); for (Map.Entry<UUID, IntegerInterval> dirty : cfDirty.entrySet()) { UUID cfId = dirty.getKey(); IntegerInterval dirtyInterval = dirty.getValue(); IntegerInterval.Set cleanSet = cfClean.get(cfId); if (cleanSet == null || !cleanSet.covers(dirtyInterval)) r.add(dirty.getKey()); } return r; }