public boolean isCompacting(Iterable<ColumnFamilyStore> cfses) { for (ColumnFamilyStore cfs : cfses) if (!cfs.getTracker().getCompacting().isEmpty()) return true; return false; }
public boolean isCompacting(Iterable<ColumnFamilyStore> cfses) { for (ColumnFamilyStore cfs : cfses) if (!cfs.getTracker().getCompacting().isEmpty()) return true; return false; }
public boolean isCompacting(Iterable<ColumnFamilyStore> cfses) { for (ColumnFamilyStore cfs : cfses) if (!cfs.getTracker().getCompacting().isEmpty()) return true; return false; }
private Set<SSTableReader> getCompacting(int level) { Set<SSTableReader> sstables = new HashSet<>(); Set<SSTableReader> levelSSTables = new HashSet<>(getLevel(level)); for (SSTableReader sstable : cfs.getTracker().getCompacting()) { if (levelSSTables.contains(sstable)) sstables.add(sstable); } return sstables; }
public LifecycleTransaction call() { assert data.getCompacting().isEmpty() : data.getCompacting(); Iterable<SSTableReader> sstables = getLiveSSTables(); sstables = AbstractCompactionStrategy.filterSuspectSSTables(sstables); sstables = ImmutableList.copyOf(sstables); LifecycleTransaction modifier = data.tryModify(sstables, operationType); assert modifier != null: "something marked things compacting while compactions are disabled"; return modifier; } };
public LifecycleTransaction call() { assert data.getCompacting().isEmpty() : data.getCompacting(); Iterable<SSTableReader> sstables = getLiveSSTables(); sstables = AbstractCompactionStrategy.filterSuspectSSTables(sstables); sstables = ImmutableList.copyOf(sstables); LifecycleTransaction modifier = data.tryModify(sstables, operationType); assert modifier != null: "something marked things compacting while compactions are disabled"; return modifier; } };
private Set<SSTableReader> getCompacting(int level) { Set<SSTableReader> sstables = new HashSet<>(); Set<SSTableReader> levelSSTables = new HashSet<>(getLevel(level)); for (SSTableReader sstable : cfs.getTracker().getCompacting()) { if (levelSSTables.contains(sstable)) sstables.add(sstable); } return sstables; }
private Set<SSTableReader> getCompacting(int level) { Set<SSTableReader> sstables = new HashSet<>(); Set<SSTableReader> levelSSTables = new HashSet<>(getLevel(level)); for (SSTableReader sstable : cfs.getTracker().getCompacting()) { if (levelSSTables.contains(sstable)) sstables.add(sstable); } return sstables; }
public LifecycleTransaction call() { assert data.getCompacting().isEmpty() : data.getCompacting(); Iterable<SSTableReader> sstables = getLiveSSTables(); sstables = AbstractCompactionStrategy.filterSuspectSSTables(sstables); sstables = ImmutableList.copyOf(sstables); LifecycleTransaction modifier = data.tryModify(sstables, operationType); assert modifier != null: "something marked things compacting while compactions are disabled"; return modifier; } };
/** * @param cfs * @param transaction the modifying managing the status of the sstables we're replacing */ public AbstractCompactionTask(ColumnFamilyStore cfs, LifecycleTransaction transaction) { this.cfs = cfs; this.transaction = transaction; this.isUserDefined = false; this.compactionType = OperationType.COMPACTION; // enforce contract that caller should mark sstables compacting Set<SSTableReader> compacting = transaction.tracker.getCompacting(); for (SSTableReader sstable : transaction.originals()) assert compacting.contains(sstable) : sstable.getFilename() + " is not correctly marked compacting"; }
/** * Discard all SSTables that were created before given timestamp. * * Caller should first ensure that comapctions have quiesced. * * @param truncatedAt The timestamp of the truncation * (all SSTables before that timestamp are going be marked as compacted) */ public void discardSSTables(long truncatedAt) { assert data.getCompacting().isEmpty() : data.getCompacting(); List<SSTableReader> truncatedSSTables = new ArrayList<>(); for (SSTableReader sstable : getSSTables(SSTableSet.LIVE)) { if (!sstable.newSince(truncatedAt)) truncatedSSTables.add(sstable); } if (!truncatedSSTables.isEmpty()) markObsolete(truncatedSSTables, OperationType.UNKNOWN); }
/** * Discard all SSTables that were created before given timestamp. * * Caller should first ensure that comapctions have quiesced. * * @param truncatedAt The timestamp of the truncation * (all SSTables before that timestamp are going be marked as compacted) */ public void discardSSTables(long truncatedAt) { assert data.getCompacting().isEmpty() : data.getCompacting(); List<SSTableReader> truncatedSSTables = new ArrayList<>(); for (SSTableReader sstable : getSSTables(SSTableSet.LIVE)) { if (!sstable.newSince(truncatedAt)) truncatedSSTables.add(sstable); } if (!truncatedSSTables.isEmpty()) markObsolete(truncatedSSTables, OperationType.UNKNOWN); }
/** * Discard all SSTables that were created before given timestamp. * * Caller should first ensure that comapctions have quiesced. * * @param truncatedAt The timestamp of the truncation * (all SSTables before that timestamp are going be marked as compacted) */ public void discardSSTables(long truncatedAt) { assert data.getCompacting().isEmpty() : data.getCompacting(); List<SSTableReader> truncatedSSTables = new ArrayList<>(); for (SSTableReader sstable : getSSTables(SSTableSet.LIVE)) { if (!sstable.newSince(truncatedAt)) truncatedSSTables.add(sstable); } if (!truncatedSSTables.isEmpty()) markObsolete(truncatedSSTables, OperationType.UNKNOWN); }
/** * @param cfs * @param transaction the modifying managing the status of the sstables we're replacing */ public AbstractCompactionTask(ColumnFamilyStore cfs, LifecycleTransaction transaction) { this.cfs = cfs; this.transaction = transaction; this.isUserDefined = false; this.compactionType = OperationType.COMPACTION; // enforce contract that caller should mark sstables compacting Set<SSTableReader> compacting = transaction.tracker.getCompacting(); for (SSTableReader sstable : transaction.originals()) assert compacting.contains(sstable) : sstable.getFilename() + " is not correctly marked compacting"; }
/** * @param cfs * @param transaction the modifying managing the status of the sstables we're replacing */ public AbstractCompactionTask(ColumnFamilyStore cfs, LifecycleTransaction transaction) { this.cfs = cfs; this.transaction = transaction; this.isUserDefined = false; this.compactionType = OperationType.COMPACTION; // enforce contract that caller should mark sstables compacting Set<SSTableReader> compacting = transaction.tracker.getCompacting(); for (SSTableReader sstable : transaction.originals()) assert compacting.contains(sstable) : sstable.getFilename() + " is not correctly marked compacting"; }
@Override @SuppressWarnings("resource") public void runMayThrow() throws Exception { LifecycleTransaction modifier = null; while (modifier == null) { for (SSTableReader compactingSSTable : cfs.getTracker().getCompacting()) sstables.releaseIfHolds(compactingSSTable); Set<SSTableReader> compactedSSTables = new HashSet<>(); for (SSTableReader sstable : sstables) if (sstable.isMarkedCompacted()) compactedSSTables.add(sstable); sstables.release(compactedSSTables); modifier = cfs.getTracker().tryModify(sstables, OperationType.ANTICOMPACTION); } performAnticompaction(cfs, ranges, sstables, modifier, repairedAt, parentRepairSession); } };
private SSTableReader findDroppableSSTable(final int gcBefore) { level: for (int i = manifest.getLevelCount(); i >= 0; i--) { // sort sstables by droppable ratio in descending order SortedSet<SSTableReader> sstables = manifest.getLevelSorted(i, new Comparator<SSTableReader>() { public int compare(SSTableReader o1, SSTableReader o2) { double r1 = o1.getEstimatedDroppableTombstoneRatio(gcBefore); double r2 = o2.getEstimatedDroppableTombstoneRatio(gcBefore); return -1 * Doubles.compare(r1, r2); } }); if (sstables.isEmpty()) continue; Set<SSTableReader> compacting = cfs.getTracker().getCompacting(); for (SSTableReader sstable : sstables) { if (sstable.getEstimatedDroppableTombstoneRatio(gcBefore) <= tombstoneThreshold) continue level; else if (!compacting.contains(sstable) && !sstable.isMarkedSuspect() && worthDroppingTombstones(sstable, gcBefore)) return sstable; } } return null; }
private SSTableReader findDroppableSSTable(final int gcBefore) { level: for (int i = manifest.getLevelCount(); i >= 0; i--) { // sort sstables by droppable ratio in descending order SortedSet<SSTableReader> sstables = manifest.getLevelSorted(i, new Comparator<SSTableReader>() { public int compare(SSTableReader o1, SSTableReader o2) { double r1 = o1.getEstimatedDroppableTombstoneRatio(gcBefore); double r2 = o2.getEstimatedDroppableTombstoneRatio(gcBefore); return -1 * Doubles.compare(r1, r2); } }); if (sstables.isEmpty()) continue; Set<SSTableReader> compacting = cfs.getTracker().getCompacting(); for (SSTableReader sstable : sstables) { if (sstable.getEstimatedDroppableTombstoneRatio(gcBefore) <= tombstoneThreshold) continue level; else if (!compacting.contains(sstable) && !sstable.isMarkedSuspect() && worthDroppingTombstones(sstable, gcBefore)) return sstable; } } return null; }
@Override @SuppressWarnings("resource") public void runMayThrow() throws Exception { LifecycleTransaction modifier = null; while (modifier == null) { for (SSTableReader compactingSSTable : cfs.getTracker().getCompacting()) sstables.releaseIfHolds(compactingSSTable); // We don't anti-compact any SSTable that has been compacted during repair as it may have been compacted // with unrepaired data. Set<SSTableReader> compactedSSTables = new HashSet<>(); for (SSTableReader sstable : sstables) if (sstable.isMarkedCompacted()) compactedSSTables.add(sstable); sstables.release(compactedSSTables); modifier = cfs.getTracker().tryModify(sstables, OperationType.ANTICOMPACTION); } performAnticompaction(cfs, ranges, sstables, modifier, repairedAt, parentRepairSession); } };
@Override @SuppressWarnings("resource") public void runMayThrow() throws Exception { LifecycleTransaction modifier = null; while (modifier == null) { for (SSTableReader compactingSSTable : cfs.getTracker().getCompacting()) sstables.releaseIfHolds(compactingSSTable); // We don't anti-compact any SSTable that has been compacted during repair as it may have been compacted // with unrepaired data. Set<SSTableReader> compactedSSTables = new HashSet<>(); for (SSTableReader sstable : sstables) if (sstable.isMarkedCompacted()) compactedSSTables.add(sstable); sstables.release(compactedSSTables); modifier = cfs.getTracker().tryModify(sstables, OperationType.ANTICOMPACTION); } performAnticompaction(cfs, ranges, sstables, modifier, repairedAt, parentRepairSession); } };