cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [1/5] git commit: merge from 1.1
Date Mon, 26 Mar 2012 21:02:07 GMT
Updated Branches:
  refs/heads/cassandra-1.1 b565fdbdc -> 45af95ab3
  refs/heads/trunk 9f0b09b00 -> 1ba6dc1b0


merge from 1.1


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

Branch: refs/heads/trunk
Commit: 1ba6dc1b0adf492df27a6b2127a888b2014def46
Parents: 9f0b09b 45af95a
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Mon Mar 26 16:01:54 2012 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Mon Mar 26 16:01:54 2012 -0500

----------------------------------------------------------------------
 .../org/apache/cassandra/db/ColumnFamilyStore.java |   34 +++++-----
 src/java/org/apache/cassandra/db/DataTracker.java  |   16 ++--
 .../db/compaction/CompactionController.java        |   51 +++++----------
 .../cassandra/utils/IntervalTree/IntervalTree.java |   23 ++++---
 4 files changed, 54 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ba6dc1b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ba6dc1b/src/java/org/apache/cassandra/db/DataTracker.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ba6dc1b/src/java/org/apache/cassandra/db/compaction/CompactionController.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/compaction/CompactionController.java
index afb2879,1da6f9c..cb4e87a
--- a/src/java/org/apache/cassandra/db/compaction/CompactionController.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionController.java
@@@ -17,31 -19,33 +17,34 @@@
   */
  package org.apache.cassandra.db.compaction;
  
--import java.util.*;
++import java.util.Collection;
++import java.util.Collections;
++import java.util.List;
++import java.util.Set;
  
 -import com.google.common.collect.ImmutableSet;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
  import org.apache.cassandra.config.DatabaseDescriptor;
- import org.apache.cassandra.db.ColumnFamily;
 -import org.apache.cassandra.db.*;
 +import org.apache.cassandra.db.ColumnFamilyStore;
++import org.apache.cassandra.db.DataTracker;
 +import org.apache.cassandra.db.DecoratedKey;
  import org.apache.cassandra.io.sstable.SSTableIdentityIterator;
  import org.apache.cassandra.io.sstable.SSTableReader;
--import org.apache.cassandra.service.CacheService;
+ import org.apache.cassandra.utils.IntervalTree.Interval;
+ import org.apache.cassandra.utils.IntervalTree.IntervalTree;
  
  /**
   * Manage compaction options.
   */
  public class CompactionController
  {
 -    private static Logger logger = LoggerFactory.getLogger(CompactionController.class);
 +    private static final Logger logger = LoggerFactory.getLogger(CompactionController.class);
  
      private final ColumnFamilyStore cfs;
-     private final Set<SSTableReader> sstables;
-     private final boolean forceDeserialize;
 -    private final boolean deserializeRequired;
+     private final IntervalTree<SSTableReader> overlappingTree;
  
      public final int gcBefore;
 -    public boolean keyExistenceIsExpensive;
      public final int mergeShardBefore;
  
      public CompactionController(ColumnFamilyStore cfs, Collection<SSTableReader> sstables,
int gcBefore, boolean forceDeserialize)
@@@ -55,7 -58,10 +57,8 @@@
          // add 5 minutes to be sure we're on the safe side in terms of thread safety (though
we should be fine in our
          // current 'stop all write during memtable switch' situation).
          this.mergeShardBefore = (int) ((cfs.oldestUnflushedMemtable() + 5 * 3600) / 1000);
-         this.forceDeserialize = forceDeserialize;
 -        deserializeRequired = forceDeserialize || !allLatestVersion(sstables);
+         Set<SSTableReader> overlappingSSTables = cfs.getOverlappingSSTables(sstables);
+         overlappingTree = DataTracker.buildIntervalTree(overlappingSSTables);
 -        keyExistenceIsExpensive = cfs.getCompactionStrategy().isKeyExistenceExpensive(ImmutableSet.copyOf(sstables));
      }
  
      public String getKeyspace()
@@@ -74,40 -80,42 +77,20 @@@
       */
      public boolean shouldPurge(DecoratedKey key)
      {
-         return !cfs.isKeyInRemainingSSTables(key, sstables);
-     }
- 
-     public boolean needDeserialize()
-     {
-         if (forceDeserialize)
-             return true;
- 
-         for (SSTableReader sstable : sstables)
-             if (!sstable.descriptor.isLatestVersion)
-                 return true;
- 
-         return false;
+         List<SSTableReader> filteredSSTables = overlappingTree.search(new Interval(key,
key));
+         for (SSTableReader sstable : filteredSSTables)
+         {
+             if (sstable.getBloomFilter().isPresent(key.key))
+                 return false;
+         }
+         return true;
      }
  
 -    private static boolean allLatestVersion(Iterable<SSTableReader> sstables)
 -    {
 -        for (SSTableReader sstable : sstables)
 -            if (!sstable.descriptor.isLatestVersion)
 -                return false;
 -        return true;
 -    }
 -
      public void invalidateCachedRow(DecoratedKey key)
      {
          cfs.invalidateCachedRow(key);
      }
  
--    public void removeDeletedInCache(DecoratedKey key)
--    {
--        // For the copying cache, we'd need to re-serialize the updated cachedRow, which
would be racy
--        // vs other updates.  We'll just ignore it instead, since the next update to this
row will invalidate it
--        // anyway, so the odds of a "tombstones consuming memory indefinitely" problem are
minimal.
--        // See https://issues.apache.org/jira/browse/CASSANDRA-3921 for more discussion.
--        if (CacheService.instance.rowCache.isPutCopying())
--            return;
--
--        ColumnFamily cachedRow = cfs.getRawCachedRow(key);
--        if (cachedRow != null)
--            ColumnFamilyStore.removeDeleted(cachedRow, gcBefore);
--    }
--
      /**
       * @return an AbstractCompactedRow implementation to write the merged rows in question.
       *

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1ba6dc1b/src/java/org/apache/cassandra/utils/IntervalTree/IntervalTree.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/utils/IntervalTree/IntervalTree.java
index 5bc9a5e,954c796..ae73c26
--- a/src/java/org/apache/cassandra/utils/IntervalTree/IntervalTree.java
+++ b/src/java/org/apache/cassandra/utils/IntervalTree/IntervalTree.java
@@@ -7,16 -9,19 +7,17 @@@
   * "License"); you may not use this file except in compliance
   * with the License.  You may obtain a copy of the License at
   *
 - *   http://www.apache.org/licenses/LICENSE-2.0
 - *
 - * Unless required by applicable law or agreed to in writing,
 - * software distributed under the License is distributed on an
 - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 - * KIND, either express or implied.  See the License for the
 - * specific language governing permissions and limitations
 - * under the License.
 + *     http://www.apache.org/licenses/LICENSE-2.0
   *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
   */
 -
 +package org.apache.cassandra.utils.IntervalTree;
  
+ import java.util.ArrayList;
  import java.util.LinkedList;
  import java.util.List;
  


Mime
View raw message