cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject git commit: remove vestigal Table.indexLocks
Date Wed, 10 Apr 2013 14:53:22 GMT
Updated Branches:
  refs/heads/trunk 3852085a6 -> b31f48d30


remove vestigal Table.indexLocks


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

Branch: refs/heads/trunk
Commit: b31f48d30e1b667c657bd0d5faf907a171073231
Parents: 3852085
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Wed Apr 10 09:53:22 2013 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Wed Apr 10 09:53:22 2013 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/Table.java |   33 ++++++---------------
 1 files changed, 10 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b31f48d3/src/java/org/apache/cassandra/db/Table.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Table.java b/src/java/org/apache/cassandra/db/Table.java
index 551b20a..f158e4c 100644
--- a/src/java/org/apache/cassandra/db/Table.java
+++ b/src/java/org/apache/cassandra/db/Table.java
@@ -19,7 +19,6 @@ package org.apache.cassandra.db;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.ByteBuffer;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -31,7 +30,10 @@ import com.google.common.collect.Iterables;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.cassandra.config.*;
+import org.apache.cassandra.config.CFMetaData;
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.config.KSMetaData;
+import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.db.commitlog.CommitLog;
 import org.apache.cassandra.db.filter.ColumnSlice;
 import org.apache.cassandra.db.filter.QueryFilter;
@@ -71,7 +73,6 @@ public class Table
 
     /* ColumnFamilyStore per column family */
     private final ConcurrentMap<UUID, ColumnFamilyStore> columnFamilyStores = new ConcurrentHashMap<UUID,
ColumnFamilyStore>();
-    private final Object[] indexLocks;
     private volatile AbstractReplicationStrategy replicationStrategy;
     public static final Function<String,Table> tableTransformer = new Function<String,
Table>()
     {
@@ -260,10 +261,6 @@ public class Table
         assert metadata != null : "Unknown keyspace " + table;
         createReplicationStrategy(metadata);
 
-        indexLocks = new Object[DatabaseDescriptor.getConcurrentWriters() * 128];
-        for (int i = 0; i < indexLocks.length; i++)
-            indexLocks[i] = new Object();
-
         for (CFMetaData cfm : new ArrayList<CFMetaData>(metadata.cfMetaData().values()))
         {
             logger.debug("Initializing {}.{}", getName(), cfm.cfName);
@@ -403,22 +400,17 @@ public class Table
         switchLock.readLock().lock();
         try
         {
-            // Our index lock is per-row, but we don't want to hold writes for too long,
so for large rows
-            // we release the lock between pages
             SliceQueryPager pager = new SliceQueryPager(cfs, key, ColumnSlice.ALL_COLUMNS_ARRAY);
             while (pager.hasNext())
             {
-                synchronized (cfs.table.indexLockFor(key.key))
+                ColumnFamily cf = pager.next();
+                ColumnFamily cf2 = cf.cloneMeShallow();
+                for (Column column : cf)
                 {
-                    ColumnFamily cf = pager.next();
-                    ColumnFamily cf2 = cf.cloneMeShallow();
-                    for (Column column : cf)
-                    {
-                        if (cfs.indexManager.indexes(column.name(), indexes))
-                            cf2.addColumn(column);
-                    }
-                    cfs.indexManager.indexRow(key.key, cf2);
+                    if (cfs.indexManager.indexes(column.name(), indexes))
+                        cf2.addColumn(column);
                 }
+                cfs.indexManager.indexRow(key.key, cf2);
             }
         }
         finally
@@ -427,11 +419,6 @@ public class Table
         }
     }
 
-    private Object indexLockFor(ByteBuffer key)
-    {
-        return indexLocks[Math.abs(key.hashCode() % indexLocks.length)];
-    }
-
     public List<Future<?>> flush()
     {
         List<Future<?>> futures = new ArrayList<Future<?>>();


Mime
View raw message