Author: gdusbabek Date: Tue May 25 13:12:57 2010 New Revision: 948032 URL: http://svn.apache.org/viewvc?rev=948032&view=rev Log: use cfid instead of name in CBL. patch by gdusbabek, reviewed by jbellis. CASSANDRA-1121
Modified: cassandra/trunk/contrib/bmt_example/CassandraBulkLoader.java cassandra/trunk/src/java/org/apache/cassandra/db/Table.java Modified: cassandra/trunk/contrib/bmt_example/CassandraBulkLoader.java URL: http://svn.apache.org/viewvc/cassandra/trunk/contrib/bmt_example/CassandraBulkLoader.java?rev=948032&r1=948031&r2=948032&view=diff ============================================================================== --- cassandra/trunk/contrib/bmt_example/CassandraBulkLoader.java (original) +++ cassandra/trunk/contrib/bmt_example/CassandraBulkLoader.java Tue May 25 13:12:57 2010 @@ -66,6 +66,7 @@ import java.net.UnknownHostException; import org.apache.cassandra.net.Message; import org.apache.cassandra.net.MessagingService; import org.apache.cassandra.service.StorageService; +import org.apache.cassandra.utils.FBUtilities; import org.apache.hadoop.filecache.DistributedCache; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.Text; @@ -232,27 +233,19 @@ public class CassandraBulkLoader { Column column; /* Get the first column family from list, this is just to get past validation */ - baseColumnFamily = new ColumnFamily(CFName, - ColumnFamilyType.Standard, + baseColumnFamily = new ColumnFamily(ColumnFamilyType.Standard, DatabaseDescriptor.getComparator(Keyspace, CFName), DatabaseDescriptor.getSubComparator(Keyspace, CFName), CFMetaData.getId(Keyspace, CFName)); for(ColumnFamily cf : ColumnFamiles) { bufOut.reset(); - try - { - ColumnFamily.serializer().serializeWithIndexes(cf, bufOut); - byte[] data = new byte[bufOut.getLength()]; - System.arraycopy(bufOut.getData(), 0, data, 0, bufOut.getLength()); + ColumnFamily.serializer().serializeWithIndexes(cf, bufOut); + byte[] data = new byte[bufOut.getLength()]; + System.arraycopy(bufOut.getData(), 0, data, 0, bufOut.getLength()); - column = new Column(cf.name().getBytes("UTF-8"), data, 0); - baseColumnFamily.addColumn(column); - } - catch (IOException e) - { - throw new RuntimeException(e); - } + column = new Column(FBUtilities.toByteArray(cf.id()), data, 0); + baseColumnFamily.addColumn(column); } rm = new RowMutation(Keyspace, Key); rm.add(baseColumnFamily); Modified: cassandra/trunk/src/java/org/apache/cassandra/db/Table.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java?rev=948032&r1=948031&r2=948032&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/db/Table.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/db/Table.java Tue May 25 13:12:57 2010 @@ -42,6 +42,7 @@ import java.net.InetAddress; import org.apache.cassandra.service.StorageService; import org.apache.cassandra.db.filter.*; +import org.apache.cassandra.utils.FBUtilities; import org.cliffc.high_scale_lib.NonBlockingHashMap; import org.slf4j.Logger; @@ -386,7 +387,7 @@ public class Table Collection<IColumn> columns = columnFamily.getSortedColumns(); for (IColumn column : columns) { - ColumnFamilyStore cfStore = getColumnFamilyStore(new String(column.name(), "UTF-8")); + ColumnFamilyStore cfStore = columnFamilyStores.get(FBUtilities.byteArrayToInt(column.name())); cfStore.applyBinary(key, column.value()); } }