cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject git commit: cleanup
Date Mon, 04 Jun 2012 20:52:22 GMT
Updated Branches:
  refs/heads/trunk 47f0cc5d3 -> 76d97db02


cleanup


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

Branch: refs/heads/trunk
Commit: 76d97db020fac50223f5e292d79dc9df77d351ba
Parents: 47f0cc5
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Thu May 31 18:00:54 2012 +0200
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Mon Jun 4 15:50:50 2012 -0500

----------------------------------------------------------------------
 .../apache/cassandra/cache/AutoSavingCache.java    |   14 ++++----
 .../org/apache/cassandra/db/ColumnFamilyStore.java |    6 ---
 src/java/org/apache/cassandra/db/DataTracker.java  |    2 +-
 src/java/org/apache/cassandra/db/Directories.java  |    2 +-
 .../cassandra/db/index/keys/KeysSearcher.java      |    4 +-
 .../apache/cassandra/io/sstable/SSTableReader.java |   10 +++--
 .../org/apache/cassandra/service/CacheService.java |   26 +++++++-------
 7 files changed, 30 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/76d97db0/src/java/org/apache/cassandra/cache/AutoSavingCache.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cache/AutoSavingCache.java b/src/java/org/apache/cassandra/cache/AutoSavingCache.java
index 570ffbb..e6ee7c6 100644
--- a/src/java/org/apache/cassandra/cache/AutoSavingCache.java
+++ b/src/java/org/apache/cassandra/cache/AutoSavingCache.java
@@ -95,11 +95,11 @@ public class AutoSavingCache<K extends CacheKey, V> extends InstrumentingCache<K
         }
     }
 
-    public int loadSaved(ColumnFamilyStore store)
+    public int loadSaved(ColumnFamilyStore cfs)
     {
         int count = 0;
         long start = System.currentTimeMillis();
-        File path = getCachePath(store.table.name, store.columnFamily, null);
+        File path = getCachePath(cfs.table.name, cfs.columnFamily, null);
         if (path.exists())
         {
             DataInputStream in = null;
@@ -113,7 +113,7 @@ public class AutoSavingCache<K extends CacheKey, V> extends InstrumentingCache<K
                     keys.add(ByteBufferUtil.readWithLength(in));
                     count++;
                 }
-                cacheLoader.load(keys, store);
+                cacheLoader.load(keys, cfs);
             }
             catch (Exception e)
             {
@@ -126,7 +126,7 @@ public class AutoSavingCache<K extends CacheKey, V> extends InstrumentingCache<K
             }
         }
 
-        path = getCachePath(store.table.name, store.columnFamily, CURRENT_VERSION);
+        path = getCachePath(cfs.table.name, cfs.columnFamily, CURRENT_VERSION);
         if (path.exists())
         {
             DataInputStream in = null;
@@ -136,7 +136,7 @@ public class AutoSavingCache<K extends CacheKey, V> extends InstrumentingCache<K
                 in = new DataInputStream(new BufferedInputStream(new FileInputStream(path)));
                 while (in.available() > 0)
                 {
-                    Pair<K, V> entry = cacheLoader.deserialize(in, store);
+                    Pair<K, V> entry = cacheLoader.deserialize(in, cfs);
                     put(entry.left, entry.right);
                     count++;
                 }
@@ -293,9 +293,9 @@ public class AutoSavingCache<K extends CacheKey, V> extends InstrumentingCache<K
     {
         void serialize(K key, DataOutput out) throws IOException;
 
-        Pair<K, V> deserialize(DataInputStream in, ColumnFamilyStore store) throws
IOException;
+        Pair<K, V> deserialize(DataInputStream in, ColumnFamilyStore cfs) throws IOException;
 
         @Deprecated
-        void load(Set<ByteBuffer> buffer, ColumnFamilyStore store);
+        void load(Set<ByteBuffer> buffer, ColumnFamilyStore cfs);
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/76d97db0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index 8ad657d..16c2145 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -1887,12 +1887,6 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
         return partitioner instanceof LocalPartitioner;
     }
 
-    private String getParentColumnfamily()
-    {
-        assert isIndex();
-        return columnFamily.split("\\.")[0];
-    }
-
     private ByteBuffer intern(ByteBuffer name)
     {
         ByteBuffer internedName = internedNames.get(name);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/76d97db0/src/java/org/apache/cassandra/db/DataTracker.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/DataTracker.java b/src/java/org/apache/cassandra/db/DataTracker.java
index 023657d..ee034ae 100644
--- a/src/java/org/apache/cassandra/db/DataTracker.java
+++ b/src/java/org/apache/cassandra/db/DataTracker.java
@@ -569,7 +569,7 @@ public class DataTracker
         {
             return EMPTY;
         }
-    };
+    }
 
     /**
      * An immutable structure holding the current memtable, the memtables pending

http://git-wip-us.apache.org/repos/asf/cassandra/blob/76d97db0/src/java/org/apache/cassandra/db/Directories.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Directories.java b/src/java/org/apache/cassandra/db/Directories.java
index 7b2feab..e8d61c9 100644
--- a/src/java/org/apache/cassandra/db/Directories.java
+++ b/src/java/org/apache/cassandra/db/Directories.java
@@ -63,7 +63,7 @@ public class Directories
 
     public static final String BACKUPS_SUBDIR = "backups";
     public static final String SNAPSHOT_SUBDIR = "snapshots";
-    public static final char SECONDARY_INDEX_NAME_SEPARATOR = '.';
+    public static final String SECONDARY_INDEX_NAME_SEPARATOR = ".";
 
     public static final File[] dataFileLocations;
     static

http://git-wip-us.apache.org/repos/asf/cassandra/blob/76d97db0/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java b/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
index bb1916b..b95fdd5 100644
--- a/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
+++ b/src/java/org/apache/cassandra/db/index/keys/KeysSearcher.java
@@ -132,8 +132,8 @@ public class KeysSearcher extends SecondaryIndexSearcher
                         }
 
                         if (logger.isDebugEnabled())
-                            logger.debug(String.format("Scanning index %s starting with %s",
-                                                       expressionString(primary), index.getBaseCfs().metadata.getKeyValidator().getString(startKey)));
+                            logger.debug("Scanning index {} starting with {}",
+                                         expressionString(primary), index.getBaseCfs().metadata.getKeyValidator().getString(startKey));
 
                         QueryFilter indexFilter = QueryFilter.getSliceFilter(indexKey,
                                                                              new QueryPath(index.getIndexCfs().getColumnFamilyName()),

http://git-wip-us.apache.org/repos/asf/cassandra/blob/76d97db0/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
index 71526e3..5edd287 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
@@ -50,6 +50,8 @@ import org.apache.cassandra.io.util.*;
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.*;
 
+import static org.apache.cassandra.db.Directories.SECONDARY_INDEX_NAME_SEPARATOR;
+
 /**
  * SSTableReaders are open()ed by Table.onStart; after that they are created by SSTableWriter.renameAndOpen.
  * Do not re-call open() on existing SSTable files; use the references kept by ColumnFamilyStore
post-start instead.
@@ -113,9 +115,9 @@ public class SSTableReader extends SSTable
     public static SSTableReader open(Descriptor descriptor) throws IOException
     {
         CFMetaData metadata;
-        if (descriptor.cfname.contains("."))
+        if (descriptor.cfname.contains(SECONDARY_INDEX_NAME_SEPARATOR))
         {
-            int i = descriptor.cfname.indexOf(".");
+            int i = descriptor.cfname.indexOf(SECONDARY_INDEX_NAME_SEPARATOR);
             String parentName = descriptor.cfname.substring(0, i);
             CFMetaData parent = Schema.instance.getCFMetaData(descriptor.ksname, parentName);
             ColumnDefinition def = parent.getColumnDefinitionForIndex(descriptor.cfname.substring(i
+ 1));
@@ -130,7 +132,7 @@ public class SSTableReader extends SSTable
 
     public static SSTableReader open(Descriptor desc, CFMetaData metadata) throws IOException
     {
-        IPartitioner p = desc.cfname.contains(".")
+        IPartitioner p = desc.cfname.contains(SECONDARY_INDEX_NAME_SEPARATOR)
                        ? new LocalPartitioner(metadata.getKeyValidator())
                        : StorageService.getPartitioner();
         return open(desc, componentsFor(desc), metadata, p);
@@ -360,7 +362,7 @@ public class SSTableReader extends SSTable
                 ByteBuffer key = ByteBufferUtil.readWithShortLength(primaryIndex);
                 RowIndexEntry indexEntry = RowIndexEntry.serializer.deserialize(primaryIndex,
descriptor.version);
                 DecoratedKey decoratedKey = decodeKey(partitioner, descriptor, key);
-                if(null == first)
+                if (first == null)
                     first = decoratedKey;
                 last = decoratedKey;
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/76d97db0/src/java/org/apache/cassandra/service/CacheService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/CacheService.java b/src/java/org/apache/cassandra/service/CacheService.java
index deda078..77f8349 100644
--- a/src/java/org/apache/cassandra/service/CacheService.java
+++ b/src/java/org/apache/cassandra/service/CacheService.java
@@ -306,22 +306,22 @@ public class CacheService implements CacheServiceMBean
             ByteBufferUtil.writeWithLength(key.key, out);
         }
 
-        public Pair<RowCacheKey, IRowCacheEntry> deserialize(DataInputStream in, ColumnFamilyStore
store) throws IOException
+        public Pair<RowCacheKey, IRowCacheEntry> deserialize(DataInputStream in, ColumnFamilyStore
cfs) throws IOException
         {
             ByteBuffer buffer = ByteBufferUtil.readWithLength(in);
-            DecoratedKey key = store.partitioner.decorateKey(buffer);
-            ColumnFamily data = store.getTopLevelColumns(QueryFilter.getIdentityFilter(key,
new QueryPath(store.columnFamily)), Integer.MIN_VALUE, true);
-            return new Pair<RowCacheKey, IRowCacheEntry>(new RowCacheKey(store.metadata.cfId,
key), data);
+            DecoratedKey key = cfs.partitioner.decorateKey(buffer);
+            ColumnFamily data = cfs.getTopLevelColumns(QueryFilter.getIdentityFilter(key,
new QueryPath(cfs.columnFamily)), Integer.MIN_VALUE, true);
+            return new Pair<RowCacheKey, IRowCacheEntry>(new RowCacheKey(cfs.metadata.cfId,
key), data);
         }
 
         @Override
-        public void load(Set<ByteBuffer> buffers, ColumnFamilyStore store)
+        public void load(Set<ByteBuffer> buffers, ColumnFamilyStore cfs)
         {
             for (ByteBuffer key : buffers)
             {
-                DecoratedKey dk = store.partitioner.decorateKey(key);
-                ColumnFamily data = store.getTopLevelColumns(QueryFilter.getIdentityFilter(dk,
new QueryPath(store.columnFamily)), Integer.MIN_VALUE, true);
-                rowCache.put(new RowCacheKey(store.metadata.cfId, dk), data);
+                DecoratedKey dk = cfs.partitioner.decorateKey(key);
+                ColumnFamily data = cfs.getTopLevelColumns(QueryFilter.getIdentityFilter(dk,
new QueryPath(cfs.columnFamily)), Integer.MIN_VALUE, true);
+                rowCache.put(new RowCacheKey(cfs.metadata.cfId, dk), data);
             }
         }
     }
@@ -342,11 +342,11 @@ public class CacheService implements CacheServiceMBean
             RowIndexEntry.serializer.serialize(entry, out);
         }
 
-        public Pair<KeyCacheKey, RowIndexEntry> deserialize(DataInputStream input,
ColumnFamilyStore store) throws IOException
+        public Pair<KeyCacheKey, RowIndexEntry> deserialize(DataInputStream input,
ColumnFamilyStore cfs) throws IOException
         {
             ByteBuffer key = ByteBufferUtil.readWithLength(input);
             int generation = input.readInt();
-            SSTableReader reader = findDesc(generation, store.getSSTables());
+            SSTableReader reader = findDesc(generation, cfs.getSSTables());
             if (reader == null)
             {
                 RowIndexEntry.serializer.skipPromotedIndex(input);
@@ -371,13 +371,13 @@ public class CacheService implements CacheServiceMBean
         }
 
         @Override
-        public void load(Set<ByteBuffer> buffers, ColumnFamilyStore store)
+        public void load(Set<ByteBuffer> buffers, ColumnFamilyStore cfs)
         {
             for (ByteBuffer key : buffers)
             {
-                DecoratedKey dk = store.partitioner.decorateKey(key);
+                DecoratedKey dk = cfs.partitioner.decorateKey(key);
 
-                for (SSTableReader sstable : store.getSSTables())
+                for (SSTableReader sstable : cfs.getSSTables())
                 {
                     RowIndexEntry entry = sstable.getPosition(dk, Operator.EQ);
                     if (entry != null)


Mime
View raw message