cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [11/12] git commit: merge from 2.0
Date Wed, 19 Feb 2014 16:01:35 GMT
merge from 2.0


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8e101bef
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8e101bef
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8e101bef

Branch: refs/heads/cassandra-2.1
Commit: 8e101bef056eb00173f51ec7fb6e3b6b251d105d
Parents: 5afd2bd 84103bb
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Wed Feb 19 10:01:10 2014 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Wed Feb 19 10:01:10 2014 -0600

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../apache/cassandra/db/ColumnFamilyStore.java  | 30 +++++++-------------
 .../org/apache/cassandra/db/DataTracker.java    | 21 ++++++++------
 .../apache/cassandra/db/marshal/DateType.java   |  2 +-
 4 files changed, 25 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8e101bef/CHANGES.txt
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8e101bef/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index ca4ff0a,f25f934..76160ea
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@@ -1708,43 -1448,7 +1708,33 @@@ public class ColumnFamilyStore implemen
          return markCurrentViewReferenced().sstables;
      }
  
 +    public Set<SSTableReader> getUnrepairedSSTables()
 +    {
 +        Set<SSTableReader> unRepairedSSTables = new HashSet<>(getSSTables());
 +        Iterator<SSTableReader> sstableIterator = unRepairedSSTables.iterator();
 +        while(sstableIterator.hasNext())
 +        {
 +            SSTableReader sstable = sstableIterator.next();
 +            if (sstable.isRepaired())
 +                sstableIterator.remove();
 +        }
 +        return unRepairedSSTables;
 +    }
 +
 +    public Set<SSTableReader> getRepairedSSTables()
 +    {
 +        Set<SSTableReader> repairedSSTables = new HashSet<>(getSSTables());
 +        Iterator<SSTableReader> sstableIterator = repairedSSTables.iterator();
 +        while(sstableIterator.hasNext())
 +        {
 +            SSTableReader sstable = sstableIterator.next();
 +            if (!sstable.isRepaired())
 +                sstableIterator.remove();
 +        }
 +        return repairedSSTables;
 +    }
 +
-     abstract class AbstractViewSSTableFinder
-     {
-         abstract List<SSTableReader> findSSTables(DataTracker.View view);
-         protected List<SSTableReader> sstablesForRowBounds(AbstractBounds<RowPosition>
rowBounds, DataTracker.View view)
-         {
-             RowPosition stopInTree = rowBounds.right.isMinimum() ? view.intervalTree.max()
: rowBounds.right;
-             return view.intervalTree.search(Interval.<RowPosition, SSTableReader>create(rowBounds.left,
stopInTree));
-         }
-     }
- 
-     private ViewFragment markReferenced(AbstractViewSSTableFinder finder)
+     private ViewFragment markReferenced(Function<DataTracker.View, List<SSTableReader>>
filter)
      {
          List<SSTableReader> sstables;
          DataTracker.View view;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8e101bef/src/java/org/apache/cassandra/db/DataTracker.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/DataTracker.java
index e51f380,c1ae00f..30bd360
--- a/src/java/org/apache/cassandra/db/DataTracker.java
+++ b/src/java/org/apache/cassandra/db/DataTracker.java
@@@ -32,12 -29,14 +29,14 @@@ import org.slf4j.LoggerFactory
  
  import org.apache.cassandra.config.DatabaseDescriptor;
  import org.apache.cassandra.db.compaction.OperationType;
+ import org.apache.cassandra.dht.AbstractBounds;
 -import org.apache.cassandra.io.sstable.Descriptor;
  import org.apache.cassandra.io.sstable.SSTableReader;
  import org.apache.cassandra.io.util.FileUtils;
  import org.apache.cassandra.metrics.StorageMetrics;
  import org.apache.cassandra.notifications.*;
  import org.apache.cassandra.utils.Interval;
  import org.apache.cassandra.utils.IntervalTree;
++import org.apache.cassandra.utils.concurrent.OpOrder;
  
  public class DataTracker
  {
@@@ -317,47 -322,11 +316,47 @@@
      /** (Re)initializes the tracker, purging all references. */
      void init()
      {
 -        view.set(new View(new Memtable(cfstore),
 -                          Collections.<Memtable>emptySet(),
 -                          Collections.<SSTableReader>emptySet(),
 -                          Collections.<SSTableReader>emptySet(),
 -                          SSTableIntervalTree.empty()));
 +        view.set(new View(
-                 ImmutableList.of(new Memtable(cfstore)),
-                 ImmutableList.<Memtable>of(),
-                 Collections.<SSTableReader>emptySet(),
-                 Collections.<SSTableReader>emptySet(),
-                 SSTableIntervalTree.empty()));
++                         ImmutableList.of(new Memtable(cfstore)),
++                         ImmutableList.<Memtable>of(),
++                         Collections.<SSTableReader>emptySet(),
++                         Collections.<SSTableReader>emptySet(),
++                         SSTableIntervalTree.empty()));
 +    }
 +
 +    /**
 +     * A special kind of replacement for SSTableReaders that were cloned with a new index
summary sampling level (see
 +     * SSTableReader.cloneWithNewSummarySamplingLevel and CASSANDRA-5519).  This does not
mark the old reader
 +     * as compacted.
 +     * @param oldSSTables replaced readers
 +     * @param newSSTables replacement readers
 +     */
 +    public void replaceReaders(Collection<SSTableReader> oldSSTables, Collection<SSTableReader>
newSSTables)
 +    {
 +        // data component will be unchanged but the index summary will be a different size
 +        // (since we save that to make restart fast)
 +        long sizeIncrease = 0;
 +        for (SSTableReader sstable : oldSSTables)
 +            sizeIncrease -= sstable.bytesOnDisk();
 +        for (SSTableReader sstable : newSSTables)
 +            sizeIncrease += sstable.bytesOnDisk();
 +
 +        View currentView, newView;
 +        do
 +        {
 +            currentView = view.get();
 +            newView = currentView.replace(oldSSTables, newSSTables);
 +        }
 +        while (!view.compareAndSet(currentView, newView));
 +
 +        StorageMetrics.load.inc(sizeIncrease);
 +        cfstore.metric.liveDiskSpaceUsed.inc(sizeIncrease);
 +
 +        for (SSTableReader sstable : newSSTables)
 +            sstable.setTrackedBy(this);
 +
 +        for (SSTableReader sstable : oldSSTables)
 +            sstable.releaseReference();
      }
  
      private void replace(Collection<SSTableReader> oldSSTables, Iterable<SSTableReader>
replacements)
@@@ -690,7 -593,13 +689,13 @@@
          @Override
          public String toString()
          {
 -            return String.format("View(pending_count=%d, sstables=%s, compacting=%s)", memtablesPendingFlush.size(),
sstables, compacting);
 +            return String.format("View(pending_count=%d, sstables=%s, compacting=%s)", liveMemtables.size()
+ flushingMemtables.size() - 1, sstables, compacting);
          }
+ 
+         public List<SSTableReader> sstablesInBounds(AbstractBounds<RowPosition>
rowBounds)
+         {
 -            RowPosition stopInTree = rowBounds.right.isMinimum(memtable.cfs.partitioner)
? intervalTree.max() : rowBounds.right;
++            RowPosition stopInTree = rowBounds.right.isMinimum(liveMemtables.get(0).cfs.partitioner)
? intervalTree.max() : rowBounds.right;
+             return intervalTree.search(Interval.<RowPosition, SSTableReader>create(rowBounds.left,
stopInTree));
+         }
      }
  }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8e101bef/src/java/org/apache/cassandra/db/marshal/DateType.java
----------------------------------------------------------------------


Mime
View raw message