Permalink
Browse files

fix build post-rebase

  • Loading branch information...
1 parent 220a828 commit 4902bdc7b97d8f514724ebf1ccb2598f8e69d64d @jbellis jbellis committed Apr 8, 2013
@@ -1894,15 +1894,15 @@ public CFMetaData apply(ColumnFamilyStore cfs)
}
}
- public Collection<SSTableReader> markAllCompacting()
+ public Iterable<SSTableReader> markAllCompacting()
{
- Callable<Collection<SSTableReader>> callable = new Callable<Collection<SSTableReader>>()
+ Callable<Iterable<SSTableReader>> callable = new Callable<Iterable<SSTableReader>>()
{
- public Collection<SSTableReader> call() throws Exception
+ public Iterable<SSTableReader> call() throws Exception
{
assert data.getCompacting().isEmpty() : data.getCompacting();
- Collection<SSTableReader> sstables = AbstractCompactionStrategy.filterSuspectSSTables(getSSTables());
- if (sstables.isEmpty())
+ Iterable<SSTableReader> sstables = AbstractCompactionStrategy.filterSuspectSSTables(getSSTables());
+ if (Iterables.isEmpty(sstables))
return null;
boolean success = data.markCompacting(sstables);
assert success : "something marked things compacting while compactions are disabled";
@@ -186,13 +186,13 @@ public void maybeIncrementallyBackup(final SSTableReader sstable)
* unmarkCompacting, but since we will never call markCompacted on a sstable marked
* as compacting (unless there is a serious bug), we can skip this.
*/
- public boolean markCompacting(Collection<SSTableReader> sstables)
+ public boolean markCompacting(Iterable<SSTableReader> sstables)
{
- assert sstables != null && !sstables.isEmpty();
+ assert sstables != null && !Iterables.isEmpty(sstables);
View currentView = view.get();
Set<SSTableReader> inactive = Sets.difference(ImmutableSet.copyOf(sstables), currentView.compacting);
- if (inactive.size() < sstables.size())
+ if (inactive.size() < Iterables.size(sstables))
return false;
View newView = currentView.markCompacting(inactive);
@@ -203,7 +203,7 @@ public boolean markCompacting(Collection<SSTableReader> sstables)
* Removes files from compacting status: this is different from 'markCompacted'
* because it should be run regardless of whether a compaction succeeded.
*/
- public void unmarkCompacting(Collection<SSTableReader> unmark)
+ public void unmarkCompacting(Iterable<SSTableReader> unmark)
{
if (!cfstore.isValid())
{
@@ -533,7 +533,7 @@ public View markCompacting(Collection<SSTableReader> tomark)
return new View(memtable, memtablesPendingFlush, sstables, compactingNew, intervalTree);
}
- public View unmarkCompacting(Collection<SSTableReader> tounmark)
+ public View unmarkCompacting(Iterable<SSTableReader> tounmark)
{
Set<SSTableReader> compactingNew = ImmutableSet.copyOf(Sets.difference(compacting, ImmutableSet.copyOf(tounmark)));
return new View(memtable, memtablesPendingFlush, sstables, compactingNew, intervalTree);
@@ -17,27 +17,26 @@
*/
package org.apache.cassandra.db.compaction;
-import java.util.Collection;
import java.util.Set;
-import org.apache.cassandra.db.Directories;
-import org.apache.cassandra.io.sstable.SSTableReader;
import org.apache.cassandra.db.ColumnFamilyStore;
+import org.apache.cassandra.db.Directories;
import org.apache.cassandra.db.compaction.CompactionManager.CompactionExecutorStatsCollector;
+import org.apache.cassandra.io.sstable.SSTableReader;
import org.apache.cassandra.io.util.DiskAwareRunnable;
public abstract class AbstractCompactionTask extends DiskAwareRunnable
{
protected final ColumnFamilyStore cfs;
- protected Collection<SSTableReader> sstables;
+ protected Iterable<SSTableReader> sstables;
protected boolean isUserDefined;
protected OperationType compactionType;
/**
* @param cfs
* @param sstables must be marked compacting
*/
- public AbstractCompactionTask(ColumnFamilyStore cfs, Collection<SSTableReader> sstables)
+ public AbstractCompactionTask(ColumnFamilyStore cfs, Iterable<SSTableReader> sstables)
{
this.cfs = cfs;
this.sstables = sstables;
@@ -177,12 +177,12 @@ public void run()
private static interface AllSSTablesOperation
{
- public void perform(ColumnFamilyStore store, Collection<SSTableReader> sstables) throws IOException;
+ public void perform(ColumnFamilyStore store, Iterable<SSTableReader> sstables) throws IOException;
}
private void performAllSSTableOperation(final ColumnFamilyStore cfs, final AllSSTablesOperation operation) throws InterruptedException, ExecutionException
{
- final Collection<SSTableReader> sstables = cfs.markAllCompacting();
+ final Iterable<SSTableReader> sstables = cfs.markAllCompacting();
if (sstables == null)
return;
@@ -202,7 +202,7 @@ public void performScrub(ColumnFamilyStore cfStore) throws InterruptedException,
{
performAllSSTableOperation(cfStore, new AllSSTablesOperation()
{
- public void perform(ColumnFamilyStore store, Collection<SSTableReader> sstables) throws IOException
+ public void perform(ColumnFamilyStore store, Iterable<SSTableReader> sstables) throws IOException
{
doScrub(store, sstables);
}
@@ -213,7 +213,7 @@ public void performSSTableRewrite(ColumnFamilyStore cfStore, final boolean exclu
{
performAllSSTableOperation(cfStore, new AllSSTablesOperation()
{
- public void perform(ColumnFamilyStore cfs, Collection<SSTableReader> sstables)
+ public void perform(ColumnFamilyStore cfs, Iterable<SSTableReader> sstables)
{
for (final SSTableReader sstable : sstables)
{
@@ -235,11 +235,11 @@ public void performCleanup(ColumnFamilyStore cfStore, final CounterId.OneShotRen
{
performAllSSTableOperation(cfStore, new AllSSTablesOperation()
{
- public void perform(ColumnFamilyStore store, Collection<SSTableReader> sstables) throws IOException
+ public void perform(ColumnFamilyStore store, Iterable<SSTableReader> sstables) throws IOException
{
// Sort the column families in order of SSTable size, so cleanup of smaller CFs
// can free up space for larger ones
- List<SSTableReader> sortedSSTables = new ArrayList<SSTableReader>(sstables);
+ List<SSTableReader> sortedSSTables = Lists.newArrayList(sstables);
Collections.sort(sortedSSTables, new SSTableReader.SizeComparator());
doCleanupCompaction(store, sortedSSTables, renewer);
@@ -385,7 +385,7 @@ public void disableAutoCompaction()
*
* @throws IOException
*/
- private void doScrub(ColumnFamilyStore cfs, Collection<SSTableReader> sstables) throws IOException
+ private void doScrub(ColumnFamilyStore cfs, Iterable<SSTableReader> sstables) throws IOException
{
assert !cfs.isIndex();
for (final SSTableReader sstable : sstables)
@@ -41,11 +41,11 @@
private Set<SSTableReader> toCompact;
private CompactionExecutorStatsCollector collector;
- public CompactionTask(ColumnFamilyStore cfs, Collection<SSTableReader> sstables, final int gcBefore)
+ public CompactionTask(ColumnFamilyStore cfs, Iterable<SSTableReader> sstables, final int gcBefore)
{
super(cfs, sstables);
this.gcBefore = gcBefore;
- toCompact = new HashSet<SSTableReader>(sstables);
+ toCompact = Sets.newHashSet(sstables);
}
public static synchronized long addToTotalBytesCompacted(long bytesCompacted)
@@ -152,7 +152,7 @@ public synchronized AbstractCompactionTask getNextBackgroundTask(int gcBefore)
public AbstractCompactionTask getMaximalTask(final int gcBefore)
{
- Collection<SSTableReader> sstables = cfs.markAllCompacting();
+ Iterable<SSTableReader> sstables = cfs.markAllCompacting();
if (sstables == null)
return null;

0 comments on commit 4902bdc

Please sign in to comment.