Permalink
Browse files

remove vestigal Table.indexLocks

  • Loading branch information...
1 parent 3852085 commit b31f48d30e1b667c657bd0d5faf907a171073231 @jbellis jbellis committed Apr 10, 2013
Showing with 10 additions and 23 deletions.
  1. +10 −23 src/java/org/apache/cassandra/db/Table.java
@@ -19,7 +19,6 @@
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 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 @@
/* 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 @@ private Table(String table, boolean loadSSTables)
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 static void indexRow(DecoratedKey key, ColumnFamilyStore cfs, Set<String>
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 static void indexRow(DecoratedKey key, ColumnFamilyStore cfs, Set<String>
}
}
- private Object indexLockFor(ByteBuffer key)
- {
- return indexLocks[Math.abs(key.hashCode() % indexLocks.length)];
- }
-
public List<Future<?>> flush()
{
List<Future<?>> futures = new ArrayList<Future<?>>();

0 comments on commit b31f48d

Please sign in to comment.