merge from 1.2
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1dcf18ca Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1dcf18ca Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1dcf18ca Branch: refs/heads/trunk Commit: 1dcf18caa343fa1086482f5b1dfbbb00d2498d1c Parents: d216b0d 1c79426 Author: Jonathan Ellis <[email protected]> Authored: Tue Feb 5 15:41:52 2013 +0100 Committer: Jonathan Ellis <[email protected]> Committed: Tue Feb 5 15:41:52 2013 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/cassandra/db/RowMutation.java | 36 +-------------- .../cassandra/db/commitlog/CommitLogSegment.java | 3 +- 3 files changed, 4 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/1dcf18ca/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index c282047,5e661ae..bf95ae1 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,11 -1,5 +1,12 @@@ +1.3 + * make index_interval configurable per columnfamily (CASSANDRA-3961) + * add default_tim_to_live (CASSANDRA-3974) + * add memtable_flush_period_in_ms (CASSANDRA-4237) + * replace supercolumns internally by composites (CASSANDRA-3237, 5123) + * upgrade thrift to 0.9.0 (CASSANDRA-3719) + 1.2.2 + * avoid no-op caching of byte[] on commitlog append (CASSANDRA-5199) * more robust solution to incomplete compactions + counters (CASSANDRA-5151) * fix symlinks under data dir not working (CASSANDRA-5185) * fix bug in compact storage metadata handling (CASSANDRA-5189) http://git-wip-us.apache.org/repos/asf/cassandra/blob/1dcf18ca/src/java/org/apache/cassandra/db/RowMutation.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/RowMutation.java index 7ad3100,5064c65..0fc4da8 --- a/src/java/org/apache/cassandra/db/RowMutation.java +++ b/src/java/org/apache/cassandra/db/RowMutation.java @@@ -29,9 -28,10 +28,8 @@@ import org.apache.commons.lang.StringUt import org.apache.cassandra.config.CFMetaData; import org.apache.cassandra.config.KSMetaData; import org.apache.cassandra.config.Schema; -import org.apache.cassandra.db.filter.QueryPath; import org.apache.cassandra.db.marshal.UUIDType; -import org.apache.cassandra.io.IColumnSerializer; import org.apache.cassandra.io.IVersionedSerializer; - import org.apache.cassandra.io.util.FastByteArrayInputStream; import org.apache.cassandra.net.MessageOut; import org.apache.cassandra.net.MessagingService; import org.apache.cassandra.thrift.ColumnOrSuperColumn; @@@ -113,9 -111,8 +109,9 @@@ public class RowMutation implements IMu ttl = Math.min(ttl, cf.metadata().getGcGraceSeconds()); // serialize the hint with id and version as a composite column name - QueryPath path = new QueryPath(SystemTable.HINTS_CF, null, HintedHandOffManager.comparator.decompose(hintId, MessagingService.current_version)); - rm.add(path, ByteBuffer.wrap(FBUtilities.serialize(mutation, serializer, MessagingService.current_version)), System.currentTimeMillis(), ttl); + ByteBuffer name = HintedHandOffManager.comparator.decompose(hintId, MessagingService.current_version); - ByteBuffer value = ByteBuffer.wrap(mutation.getSerializedBuffer(MessagingService.current_version)); ++ ByteBuffer value = ByteBuffer.wrap(FBUtilities.serialize(mutation, serializer, MessagingService.current_version)); + rm.add(SystemTable.HINTS_CF, name, value, System.currentTimeMillis(), ttl); return rm; } @@@ -269,26 -299,50 +254,7 @@@ return buff.append("])").toString(); } - public void addColumnOrSuperColumn(String cfName, ColumnOrSuperColumn cosc) - { - if (cosc.super_column != null) - { - for (org.apache.cassandra.thrift.Column column : cosc.super_column.columns) - { - add(new QueryPath(cfName, cosc.super_column.name, column.name), column.value, column.timestamp, column.ttl); - } - } - else if (cosc.column != null) - { - add(new QueryPath(cfName, null, cosc.column.name), cosc.column.value, cosc.column.timestamp, cosc.column.ttl); - } - else if (cosc.counter_super_column != null) - { - for (org.apache.cassandra.thrift.CounterColumn column : cosc.counter_super_column.columns) - { - addCounter(new QueryPath(cfName, cosc.counter_super_column.name, column.name), column.value); - } - } - else // cosc.counter_column != null - { - addCounter(new QueryPath(cfName, null, cosc.counter_column.name), cosc.counter_column.value); - } - } - - public void deleteColumnOrSuperColumn(String cfName, Deletion del) - { - if (del.predicate != null && del.predicate.column_names != null) - { - for(ByteBuffer c : del.predicate.column_names) - { - if (del.super_column == null && Schema.instance.getColumnFamilyType(table, cfName) == ColumnFamilyType.Super) - delete(new QueryPath(cfName, c), del.timestamp); - else - delete(new QueryPath(cfName, del.super_column, c), del.timestamp); - } - } - else - { - delete(new QueryPath(cfName, del.super_column), del.timestamp); - } - } - public static RowMutation fromBytes(byte[] raw, int version) throws IOException - { - RowMutation rm = serializer.deserialize(new DataInputStream(new FastByteArrayInputStream(raw)), version); - boolean hasCounters = false; - for (Map.Entry<UUID, ColumnFamily> entry : rm.modifications.entrySet()) - { - if (entry.getValue().metadata().getDefaultValidator().isCommutative()) - { - hasCounters = true; - break; - } - } - - // We need to deserialize at least once for counters to cleanup the delta - if (!hasCounters && version == MessagingService.current_version) - rm.preserializedBuffers.put(version, raw); - return rm; - } - public static class RowMutationSerializer implements IVersionedSerializer<RowMutation> { public void serialize(RowMutation rm, DataOutput dos, int version) throws IOException
