cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yu...@apache.org
Subject [1/3] git commit: Merge branch 'cassandra-1.1' into trunk
Date Wed, 30 May 2012 20:06:10 GMT
Updated Branches:
  refs/heads/cassandra-1.1 3fdc86ca0 -> 5cda764a9
  refs/heads/trunk cfe585c2c -> 52e09c100


Merge branch 'cassandra-1.1' into trunk

Conflicts:
	src/java/org/apache/cassandra/db/ColumnFamilyStore.java
	src/java/org/apache/cassandra/io/sstable/SSTableReader.java
	src/java/org/apache/cassandra/tools/NodeCmd.java


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

Branch: refs/heads/trunk
Commit: 52e09c100d716ab92cdd4fb5db1221648c1ed30d
Parents: cfe585c 5cda764
Author: Yuki Morishita <mor.yuki@gmail.com>
Authored: Wed May 30 15:05:27 2012 -0500
Committer: Yuki Morishita <mor.yuki@gmail.com>
Committed: Wed May 30 15:05:27 2012 -0500

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../org/apache/cassandra/db/ColumnFamilyStore.java |   20 ++++++++++++
 .../cassandra/db/ColumnFamilyStoreMBean.java       |    7 ++++
 .../apache/cassandra/io/sstable/SSTableReader.java |   24 ++++++++++----
 src/java/org/apache/cassandra/tools/NodeCmd.java   |   16 ++++++++++
 src/java/org/apache/cassandra/tools/NodeProbe.java |    6 ++++
 6 files changed, 67 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/52e09c10/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index dce45c8,7ecfa9d..1cbd948
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,20 -1,5 +1,21 @@@
 +1.2-dev
 + * Track tombstone expiration and compact when tombstone content is
 +   higher than a configurable threshold, default 20% (CASSANDRA-3442)
 + * update MurmurHash to version 3 (CASSANDRA-2975)
 + * (CLI) track elapsed time for `delete' operation (CASSANDRA-4060)
 + * (CLI) jline version is bumped to 1.0 to properly  support
 +   'delete' key function (CASSANDRA-4132)
 + * Save IndexSummary into new SSTable 'Summary' component (CASSANDRA-2392)
 + * Add support for range tombstones (CASSANDRA-3708)
 + * Improve MessagingService efficiency (CASSANDRA-3617)
 + * Avoid ID conflicts from concurrent schema changes (CASSANDRA-3794)
 + * Set thrift HSHA server thread limit to unlimet by default (CASSANDRA-4277)
 + * Avoids double serialization of CF id in RowMutation messages
 +   (CASSANDRA-4293)
 +
 +
  1.1.1-dev
+  * add getsstables command to nodetool (CASSANDRA-4199)
   * apply parent CF compaction settings to secondary index CFs (CASSANDRA-4280)
   * preserve commitlog size cap when recycling segments at startup
     (CASSANDRA-4201)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/52e09c10/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index 11f9ec9,2ae7e6e..8ad657d
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@@ -1279,7 -1295,27 +1279,27 @@@ public class ColumnFamilyStore implemen
          return new ViewFragment(sstables, Iterables.concat(Collections.singleton(view.memtable),
view.memtablesPendingFlush));
      }
  
+     public List<String> getSSTablesForKey(String key)
+     {
+         DecoratedKey dk = new DecoratedKey(partitioner.getToken(ByteBuffer.wrap(key.getBytes())),
ByteBuffer.wrap(key.getBytes()));
+         ViewFragment view = markReferenced(dk);
+         try
+         {
+             List<String> files = new ArrayList<String>();
+             for (SSTableReader sstr : view.sstables)
+             {
+                 // check if the key actually exists in this sstable, without updating cache
and stats
 -                if (sstr.getPosition(dk, SSTableReader.Operator.EQ, false) > -1)
++                if (sstr.getPosition(dk, SSTableReader.Operator.EQ, false) != null)
+                     files.add(sstr.getFilename());
+             }
+             return files;
+         }
+         finally {
+             SSTableReader.releaseReferences(view.sstables);
+         }
+     }
+ 
 -    private ColumnFamily getTopLevelColumns(QueryFilter filter, int gcBefore, boolean forCache)
 +    public ColumnFamily getTopLevelColumns(QueryFilter filter, int gcBefore, boolean forCache)
      {
          CollationController controller = new CollationController(this, forCache, filter,
gcBefore);
          ColumnFamily columns = controller.getTopLevelColumns();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/52e09c10/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/52e09c10/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/io/sstable/SSTableReader.java
index 9e576dc,7d4d304..362ce3c
--- a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
@@@ -685,12 -648,22 +685,22 @@@ public class SSTableReader extends SSTa
      }
  
      /**
+      * Get position updating key cache and stats.
+      * @see #getPosition(org.apache.cassandra.db.RowPosition, org.apache.cassandra.io.sstable.SSTableReader.Operator,
boolean)
+      */
 -    public long getPosition(RowPosition key, Operator op)
++    public RowIndexEntry getPosition(RowPosition key, Operator op)
+     {
+         return getPosition(key, op, true);
+     }
+ 
+     /**
       * @param key The key to apply as the rhs to the given Operator. A 'fake' key is allowed
to
       * allow key selection by token bounds but only if op != * EQ
       * @param op The Operator defining matching keys: the nearest key to the target matching
the operator wins.
+      * @param updateCacheAndStats true if updating stats and cache
 -     * @return The position in the data file to find the key, or -1 if the key is not present
 +     * @return The index entry corresponding to the key, or null if the key is not present
       */
-     public RowIndexEntry getPosition(RowPosition key, Operator op)
 -    public long getPosition(RowPosition key, Operator op, boolean updateCacheAndStats)
++    public RowIndexEntry getPosition(RowPosition key, Operator op, boolean updateCacheAndStats)
      {
          // first, check bloom filter
          if (op == Operator.EQ)
@@@ -704,7 -677,7 +714,7 @@@
          if ((op == Operator.EQ || op == Operator.GE) && (key instanceof DecoratedKey))
          {
              DecoratedKey decoratedKey = (DecoratedKey)key;
-             RowIndexEntry cachedPosition = getCachedPosition(new KeyCacheKey(descriptor,
decoratedKey.key), true);
 -            Long cachedPosition = getCachedPosition(new KeyCacheKey(descriptor, decoratedKey.key),
updateCacheAndStats);
++            RowIndexEntry cachedPosition = getCachedPosition(new KeyCacheKey(descriptor,
decoratedKey.key), updateCacheAndStats);
              if (cachedPosition != null)
                  return cachedPosition;
          }
@@@ -713,14 -686,10 +723,14 @@@
          long sampledPosition = getIndexScanPosition(key);
          if (sampledPosition == -1)
          {
-             if (op == Operator.EQ)
+             if (op == Operator.EQ && updateCacheAndStats)
                  bloomFilterTracker.addFalsePositive();
 -            // we matched the -1th position: if the operator might match forward, return
the 0th position
 -            return op.apply(1) >= 0 ? 0 : -1;
 +            // we matched the -1th position: if the operator might match forward, we'll
start at the first
 +            // position. We however need to return the correct index entry for that first
position.
 +            if (op.apply(1) >= 0)
 +                sampledPosition = 0;
 +            else
 +                return null;
          }
  
          // scan the on-disk index, starting at the nearest sampled position
@@@ -738,25 -709,23 +748,25 @@@
                      int v = op.apply(comparison);
                      if (v == 0)
                      {
 +                        RowIndexEntry indexEntry = RowIndexEntry.serializer.deserialize(input,
descriptor.version);
-                         if (comparison == 0 && keyCache != null && keyCache.getCapacity()
> 0)
+                         if (comparison == 0 && keyCache != null && keyCache.getCapacity()
> 0 && updateCacheAndStats)
                          {
                              assert key instanceof DecoratedKey; // key can be == to the
index key only if it's a true row key
                              DecoratedKey decoratedKey = (DecoratedKey)key;
                              // store exact match for the key
 -                            cacheKey(decoratedKey, dataPosition);
 +                            cacheKey(decoratedKey, indexEntry);
                          }
-                         if (op == Operator.EQ)
+                         if (op == Operator.EQ && updateCacheAndStats)
                              bloomFilterTracker.addTruePositive();
 -                        return dataPosition;
 +                        return indexEntry;
                      }
                      if (v < 0)
                      {
-                         if (op == Operator.EQ)
+                         if (op == Operator.EQ && updateCacheAndStats)
                              bloomFilterTracker.addFalsePositive();
 -                        return -1;
 +                        return null;
                      }
 +                    RowIndexEntry.serializer.skip(input, descriptor.version);
                  }
              }
              catch (IOException e)
@@@ -770,9 -739,9 +780,9 @@@
              }
          }
  
-         if (op == Operator.EQ)
+         if (op == Operator.EQ && updateCacheAndStats)
              bloomFilterTracker.addFalsePositive();
 -        return -1;
 +        return null;
      }
  
      /**

http://git-wip-us.apache.org/repos/asf/cassandra/blob/52e09c10/src/java/org/apache/cassandra/tools/NodeCmd.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/tools/NodeCmd.java
index 3d9ee29,a8d3f55..705543f
--- a/src/java/org/apache/cassandra/tools/NodeCmd.java
+++ b/src/java/org/apache/cassandra/tools/NodeCmd.java
@@@ -94,8 -99,8 +94,9 @@@ public class NodeCm
          FLUSH,
          GETCOMPACTIONTHRESHOLD,
          GETENDPOINTS,
+         GETSSTABLES,
          GOSSIPINFO,
 +        IDS,
          INFO,
          INVALIDATEKEYCACHE,
          INVALIDATEROWCACHE,
@@@ -867,11 -840,11 +878,16 @@@
                      nodeCmd.printEndPoints(arguments[0], arguments[1], arguments[2], System.out);
                      break;
  
 +                case PROXYHISTOGRAMS :
 +                    if (arguments.length != 0) { badUse("proxyhistograms does not take arguments");
}
 +                    nodeCmd.printProxyHistograms(System.out);
 +                    break;
 +
+                 case GETSSTABLES:
+                     if (arguments.length != 3) { badUse("getsstables requires ks, cf and
key args"); }
+                     nodeCmd.printSSTables(arguments[0], arguments[1], arguments[2], System.out);
+                     break;
+ 
                  case REFRESH:
                      if (arguments.length != 2) { badUse("load_new_sstables requires ks and
cf args"); }
                      probe.loadNewSSTables(arguments[0], arguments[1]);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/52e09c10/src/java/org/apache/cassandra/tools/NodeProbe.java
----------------------------------------------------------------------


Mime
View raw message