Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update to use clocks in Cassandra 0.7.

  • Loading branch information...
commit 2c0a3fbcca6b18be099d7ddc52bb3d8a367dd113 1 parent a87ab25
@johanoskarsson johanoskarsson authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 db/cassandra-0.7/src/com/yahoo/ycsb/db/CassandraClient7.java
View
12 db/cassandra-0.7/src/com/yahoo/ycsb/db/CassandraClient7.java
@@ -55,6 +55,8 @@
public static final String OPERATION_RETRY_PROPERTY = "cassandra.operationretries";
public static final String OPERATION_RETRY_PROPERTY_DEFAULT = "300";
+ private static final String COLUMN_FAMILY = "data";
+
TTransport tr;
Cassandra.Client client;
@@ -182,7 +184,7 @@ public int read(String table, String key, Set<String> fields, HashMap<String, St
predicate.setColumn_names(fieldlist);
}
- ColumnParent parent = new ColumnParent("data");
+ ColumnParent parent = new ColumnParent(COLUMN_FAMILY);
List<ColumnOrSuperColumn> results = client.get_slice(key.getBytes("UTF-8"), parent, predicate,
ConsistencyLevel.ONE);
@@ -282,7 +284,7 @@ public int scan(String table, String startkey, int recordcount, Set<String> fiel
predicate = new SlicePredicate();
predicate.setColumn_names(fieldlist);
}
- ColumnParent parent = new ColumnParent("data");
+ ColumnParent parent = new ColumnParent(COLUMN_FAMILY);
KeyRange kr = new KeyRange().setStart_key(startkey.getBytes("UTF-8")).setEnd_key(new byte[] {}).setCount(recordcount);
List<KeySlice> results = client.get_range_slices(parent, predicate, kr, ConsistencyLevel.ONE);
@@ -387,13 +389,13 @@ public int insert(String table, String key, HashMap<String, String> values)
Map<byte[], Map<String, List<Mutation>>> batch_mutation = new HashMap<byte[], Map<String, List<Mutation>>>();
ArrayList<Mutation> v = new ArrayList<Mutation>(values.size());
Map<String, List<Mutation>> cfMutationMap = new HashMap<String, List<Mutation>>();
- cfMutationMap.put("data", v);
+ cfMutationMap.put(COLUMN_FAMILY, v);
batch_mutation.put(key.getBytes("UTF-8"), cfMutationMap);
for (String field : values.keySet())
{
String val = values.get(field);
- Column col = new Column(field.getBytes("UTF-8"), val.getBytes("UTF-8"), timestamp);
+ Column col = new Column(field.getBytes("UTF-8"), val.getBytes("UTF-8"), new Clock(timestamp));
ColumnOrSuperColumn c = new ColumnOrSuperColumn();
c.setColumn(col);
@@ -455,7 +457,7 @@ public int delete(String table, String key)
{
try
{
- client.remove(key.getBytes("UTF-8"), new ColumnPath("data"), System.currentTimeMillis(),
+ client.remove(key.getBytes("UTF-8"), new ColumnPath(COLUMN_FAMILY), new Clock(System.currentTimeMillis()),
ConsistencyLevel.ONE);
if (_debug)
Please sign in to comment.
Something went wrong with that request. Please try again.