Author: jbellis
Date: Wed Mar 24 01:35:54 2010
New Revision: 926902
URL: http://svn.apache.org/viewvc?rev=926902&view=rev
Log:
merge from 0.6
Modified:
cassandra/trunk/ (props changed)
cassandra/trunk/CHANGES.txt
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
(props changed)
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
(props changed)
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
(props changed)
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
(props changed)
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
(props changed)
cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java
cassandra/trunk/src/java/org/apache/cassandra/io/sstable/IndexSummary.java
cassandra/trunk/src/java/org/apache/cassandra/utils/UUIDGen.java
cassandra/trunk/test/system/test_thrift_server.py
cassandra/trunk/test/unit/org/apache/cassandra/utils/UUIDTests.java
Propchange: cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Mar 24 01:35:54 2010
@@ -1,4 +1,4 @@
-/cassandra/branches/cassandra-0.6:922689-925514
+/cassandra/branches/cassandra-0.6:922689-926622
/incubator/cassandra/branches/cassandra-0.3:774578-796573
/incubator/cassandra/branches/cassandra-0.4:810145-834239,834349-834350
/incubator/cassandra/branches/cassandra-0.5:888872-915439
Modified: cassandra/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=926902&r1=926901&r2=926902&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Wed Mar 24 01:35:54 2010
@@ -15,6 +15,9 @@ dev
(CASSANDRA-907)
* bound read, mutation, and response stages to fix possible OOM
during log replay (CASSANDRA-885)
+ * Use microseconds-since-epoch (UTC) in cli, instead of milliseconds
+ * Treat batch_mutate Deletion with null supercolumn as "apply this predicate
+ to top level supercolumns" (CASSANDRA-834)
0.6.0-beta3
Propchange:
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Mar 24 01:35:54 2010
@@ -1,4 +1,4 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-925514
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-926622
/incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/Cassandra.java:774578-796573
/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Cassandra.java:810145-834239,834349-834350
/incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/Cassandra.java:888872-903502
Propchange:
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Mar 24 01:35:54 2010
@@ -1,4 +1,4 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-925514
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-926622
/incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/column_t.java:774578-792198
/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Column.java:810145-834239,834349-834350
/incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/Column.java:888872-903502
Propchange:
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Mar 24 01:35:54 2010
@@ -1,4 +1,4 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-925514
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-926622
/incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:774578-796573
/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:810145-834239,834349-834350
/incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:888872-903502
Propchange:
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Mar 24 01:35:54 2010
@@ -1,4 +1,4 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-925514
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-926622
/incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:774578-796573
/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:810145-834239,834349-834350
/incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:888872-903502
Propchange:
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Mar 24 01:35:54 2010
@@ -1,4 +1,4 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-925514
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-926622
/incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/superColumn_t.java:774578-792198
/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:810145-834239,834349-834350
/incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:888872-903502
Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
URL:
http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java?rev=926902&r1=926901&r2=926902&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Wed Mar 24
01:35:54 2010
@@ -232,10 +232,17 @@ public class CliClient
}
thriftClient_.remove(tableName, key, new
ColumnPath(columnFamily).setSuper_column(superColumnName).setColumn(columnName),
- System.currentTimeMillis(), ConsistencyLevel.ONE);
+ timestampMicros(), ConsistencyLevel.ONE);
css_.out.println(String.format("%s removed.", (columnSpecCnt == 0) ?
"row" : "column"));
- }
-
+ }
+
+ private static long timestampMicros()
+ {
+ // we use microsecond resolution for compatibility with other client
libraries, even though
+ // we can't actually get microsecond precision.
+ return System.currentTimeMillis() * 1000;
+ }
+
private void doSlice(String keyspace, String key, String columnFamily,
byte[] superColumnName)
throws InvalidRequestException, UnavailableException,
TimedOutException, TException, UnsupportedEncodingException,
IllegalAccessException, NotFoundException, InstantiationException,
ClassNotFoundException
{
@@ -409,7 +416,7 @@ public class CliClient
// do the insert
thriftClient_.insert(tableName, key, new
ColumnPath(columnFamily).setSuper_column(superColumnName).setColumn(columnName),
- value.getBytes(), System.currentTimeMillis(),
ConsistencyLevel.ONE);
+ value.getBytes(), timestampMicros(),
ConsistencyLevel.ONE);
css_.out.println("Value inserted.");
}
@@ -421,7 +428,6 @@ public class CliClient
String propertyValue = thriftClient_.get_string_property(propertyName);
css_.out.println(propertyValue);
- return;
}
// process "show tables" statement
@@ -473,8 +479,6 @@ public class CliClient
} catch (NotFoundException e) {
css_.out.println("Keyspace " + tableName + " could not be found.");
}
-
- return;
}
// process a statement of the form: connect hostname/port
Modified: cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java
URL:
http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java?rev=926902&r1=926901&r2=926902&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/RowMutation.java Wed Mar
24 01:35:54 2010
@@ -306,12 +306,15 @@ public class RowMutation
{
for(byte[] c : del.predicate.column_names)
{
- rm.delete(new QueryPath(cfName, del.super_column, c),
del.timestamp);
+ if (del.super_column == null &&
DatabaseDescriptor.getColumnFamilyType(rm.table_, cfName).equals("Super"))
+ rm.delete(new QueryPath(cfName, c), del.timestamp);
+ else
+ rm.delete(new QueryPath(cfName, del.super_column, c),
del.timestamp);
}
}
else
{
- rm.delete(new QueryPath(cfName, del.super_column, null),
del.timestamp);
+ rm.delete(new QueryPath(cfName, del.super_column), del.timestamp);
}
}
}
Modified:
cassandra/trunk/src/java/org/apache/cassandra/io/sstable/IndexSummary.java
URL:
http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/sstable/IndexSummary.java?rev=926902&r1=926901&r2=926902&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/io/sstable/IndexSummary.java
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/io/sstable/IndexSummary.java
Wed Mar 24 01:35:54 2010
@@ -1,101 +1,122 @@
-package org.apache.cassandra.io.sstable;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cassandra.db.DecoratedKey;
-
-public class IndexSummary
-{
- /** Every 128th index entry is loaded into memory so we know where to
start looking for the actual key w/o seeking */
- public static final int INDEX_INTERVAL = 128;/* Required extension for
temporary files created during compactions. */
-
- private ArrayList<KeyPosition> indexPositions;
- private Map<KeyPosition, SSTable.PositionSize> spannedIndexDataPositions;
- private Map<Long, KeyPosition> spannedIndexPositions;
- int keysWritten = 0;
-
- public void maybeAddEntry(DecoratedKey decoratedKey, long dataPosition,
long dataSize, long indexPosition, long nextIndexPosition)
- {
- boolean spannedIndexEntry =
RowIndexedReader.bufferIndex(indexPosition) !=
RowIndexedReader.bufferIndex(nextIndexPosition);
- if (keysWritten++ % INDEX_INTERVAL == 0 || spannedIndexEntry)
- {
- if (indexPositions == null)
- {
- indexPositions = new ArrayList<KeyPosition>();
- }
- KeyPosition info = new KeyPosition(decoratedKey, indexPosition);
- indexPositions.add(info);
-
- if (spannedIndexEntry)
- {
- if (spannedIndexDataPositions == null)
- {
- spannedIndexDataPositions = new HashMap<KeyPosition,
SSTable.PositionSize>();
- spannedIndexPositions = new HashMap<Long, KeyPosition>();
- }
- spannedIndexDataPositions.put(info, new
SSTable.PositionSize(dataPosition, dataSize));
- spannedIndexPositions.put(info.indexPosition, info);
- }
- }
- }
-
- public List<KeyPosition> getIndexPositions()
- {
- return indexPositions;
- }
-
- public void complete()
- {
- indexPositions.trimToSize();
- }
-
- public SSTable.PositionSize getSpannedPosition(KeyPosition sampledPosition)
- {
- if (spannedIndexDataPositions == null)
- return null;
- return spannedIndexDataPositions.get(sampledPosition);
- }
-
- public SSTable.PositionSize getSpannedPosition(long nextIndexPosition)
- {
- if (spannedIndexDataPositions == null)
- return null;
-
- KeyPosition info = spannedIndexPositions.get(nextIndexPosition);
- if (info == null)
- return null;
-
- return spannedIndexDataPositions.get(info);
- }
-
- /**
- * This is a simple container for the index Key and its corresponding
position
- * in the index file. Binary search is performed on a list of these objects
- * to find where to start looking for the index entry containing the data
position
- * (which will be turned into a PositionSize object)
- */
- public static class KeyPosition implements Comparable<KeyPosition>
- {
- public final DecoratedKey key;
- public final long indexPosition;
-
- public KeyPosition(DecoratedKey key, long indexPosition)
- {
- this.key = key;
- this.indexPosition = indexPosition;
- }
-
- public int compareTo(KeyPosition kp)
- {
- return key.compareTo(kp.key);
- }
-
- public String toString()
- {
- return key + ":" + indexPosition;
- }
- }
-}
\ No newline at end of file
+package org.apache.cassandra.io.sstable;
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cassandra.db.DecoratedKey;
+
+public class IndexSummary
+{
+ /** Every 128th index entry is loaded into memory so we know where to
start looking for the actual key w/o seeking */
+ public static final int INDEX_INTERVAL = 128;/* Required extension for
temporary files created during compactions. */
+
+ private ArrayList<KeyPosition> indexPositions;
+ private Map<KeyPosition, SSTable.PositionSize> spannedIndexDataPositions;
+ private Map<Long, KeyPosition> spannedIndexPositions;
+ int keysWritten = 0;
+
+ public void maybeAddEntry(DecoratedKey decoratedKey, long dataPosition,
long dataSize, long indexPosition, long nextIndexPosition)
+ {
+ boolean spannedIndexEntry =
RowIndexedReader.bufferIndex(indexPosition) !=
RowIndexedReader.bufferIndex(nextIndexPosition);
+ if (keysWritten++ % INDEX_INTERVAL == 0 || spannedIndexEntry)
+ {
+ if (indexPositions == null)
+ {
+ indexPositions = new ArrayList<KeyPosition>();
+ }
+ KeyPosition info = new KeyPosition(decoratedKey, indexPosition);
+ indexPositions.add(info);
+
+ if (spannedIndexEntry)
+ {
+ if (spannedIndexDataPositions == null)
+ {
+ spannedIndexDataPositions = new HashMap<KeyPosition,
SSTable.PositionSize>();
+ spannedIndexPositions = new HashMap<Long, KeyPosition>();
+ }
+ spannedIndexDataPositions.put(info, new
SSTable.PositionSize(dataPosition, dataSize));
+ spannedIndexPositions.put(info.indexPosition, info);
+ }
+ }
+ }
+
+ public List<KeyPosition> getIndexPositions()
+ {
+ return indexPositions;
+ }
+
+ public void complete()
+ {
+ indexPositions.trimToSize();
+ }
+
+ public SSTable.PositionSize getSpannedPosition(KeyPosition sampledPosition)
+ {
+ if (spannedIndexDataPositions == null)
+ return null;
+ return spannedIndexDataPositions.get(sampledPosition);
+ }
+
+ public SSTable.PositionSize getSpannedPosition(long nextIndexPosition)
+ {
+ if (spannedIndexDataPositions == null)
+ return null;
+
+ KeyPosition info = spannedIndexPositions.get(nextIndexPosition);
+ if (info == null)
+ return null;
+
+ return spannedIndexDataPositions.get(info);
+ }
+
+ /**
+ * This is a simple container for the index Key and its corresponding
position
+ * in the index file. Binary search is performed on a list of these objects
+ * to find where to start looking for the index entry containing the data
position
+ * (which will be turned into a PositionSize object)
+ */
+ public static class KeyPosition implements Comparable<KeyPosition>
+ {
+ public final DecoratedKey key;
+ public final long indexPosition;
+
+ public KeyPosition(DecoratedKey key, long indexPosition)
+ {
+ this.key = key;
+ this.indexPosition = indexPosition;
+ }
+
+ public int compareTo(KeyPosition kp)
+ {
+ return key.compareTo(kp.key);
+ }
+
+ public String toString()
+ {
+ return key + ":" + indexPosition;
+ }
+ }
+}
Modified: cassandra/trunk/src/java/org/apache/cassandra/utils/UUIDGen.java
URL:
http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/utils/UUIDGen.java?rev=926902&r1=926901&r2=926902&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/utils/UUIDGen.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/utils/UUIDGen.java Wed Mar 24
01:35:54 2010
@@ -1,4 +1,25 @@
package org.apache.cassandra.utils;
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
import org.safehaus.uuid.EthernetAddress;
import org.safehaus.uuid.UUIDGenerator;
Modified: cassandra/trunk/test/system/test_thrift_server.py
URL:
http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_thrift_server.py?rev=926902&r1=926901&r2=926902&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_thrift_server.py (original)
+++ cassandra/trunk/test/system/test_thrift_server.py Wed Mar 24 01:35:54 2010
@@ -889,6 +889,14 @@ class TestMutations(ThriftTester):
assert rows.has_key(key) == True
assert columns == rows[key]
+ def test_batch_mutate_super_deletion(self):
+ _insert_super('test')
+ d = Deletion(1, predicate=SlicePredicate(column_names=['sc1']))
+ cfmap = {'Super1': [Mutation(deletion=d)]}
+ mutation_map = {'test': cfmap}
+ client.batch_mutate('Keyspace1', mutation_map, ConsistencyLevel.ONE)
+ _expect_missing(lambda: client.get('Keyspace1', 'key1',
ColumnPath('Super1', 'sc1'), ConsistencyLevel.ONE))
+
def test_describe_keyspace(self):
""" Test keyspace description """
kspaces = client.describe_keyspaces()
Modified: cassandra/trunk/test/unit/org/apache/cassandra/utils/UUIDTests.java
URL:
http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/utils/UUIDTests.java?rev=926902&r1=926901&r2=926902&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/utils/UUIDTests.java
(original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/utils/UUIDTests.java Wed Mar
24 01:35:54 2010
@@ -1,4 +1,25 @@
package org.apache.cassandra.utils;
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
import org.apache.cassandra.db.marshal.TimeUUIDType;
import org.junit.Test;