You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2014/11/04 19:00:25 UTC
[1/2] git commit: Ninja: update unit tests for CASSANDRA-8206
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.1 764780430 -> 2d4a305c5
Ninja: update unit tests for CASSANDRA-8206
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b3c1e147
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b3c1e147
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b3c1e147
Branch: refs/heads/cassandra-2.1
Commit: b3c1e147b5cdeaba283e082f9091d907cdfdcfee
Parents: c345f81
Author: Tyler Hobbs <ty...@datastax.com>
Authored: Tue Nov 4 11:56:13 2014 -0600
Committer: Tyler Hobbs <ty...@datastax.com>
Committed: Tue Nov 4 11:56:13 2014 -0600
----------------------------------------------------------------------
test/unit/org/apache/cassandra/db/RangeTombstoneTest.java | 3 +++
.../org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java | 5 +++++
2 files changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3c1e147/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
index 4dc7c0b..0df47f6 100644
--- a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
+++ b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
@@ -591,6 +591,9 @@ public class RangeTombstoneTest extends SchemaLoader
deletes.add(col);
}
+ @Override
+ public void deleteForCleanup(ByteBuffer rowKey, Column col) { }
+
public void insert(ByteBuffer rowKey, Column col)
{
inserts.add(col);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3c1e147/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java b/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java
index 51d9ee8..1c0d568 100644
--- a/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java
+++ b/test/unit/org/apache/cassandra/db/SecondaryIndexColumnSizeTest.java
@@ -202,6 +202,11 @@ public class SecondaryIndexColumnSizeTest
}
@Override
+ public void deleteForCleanup(ByteBuffer rowKey, Column col)
+ {
+ }
+
+ @Override
public void insert(ByteBuffer rowKey, Column col)
{
}
[2/2] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Posted by ty...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1
Conflicts:
test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
test/unit/org/apache/cassandra/db/SecondaryIndexCellSizeTest.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2d4a305c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2d4a305c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2d4a305c
Branch: refs/heads/cassandra-2.1
Commit: 2d4a305c5e07504089a35dcc9f676fe26c0973a7
Parents: 7647804 b3c1e14
Author: Tyler Hobbs <ty...@datastax.com>
Authored: Tue Nov 4 12:00:14 2014 -0600
Committer: Tyler Hobbs <ty...@datastax.com>
Committed: Tue Nov 4 12:00:14 2014 -0600
----------------------------------------------------------------------
test/unit/org/apache/cassandra/db/RangeTombstoneTest.java | 3 +++
test/unit/org/apache/cassandra/db/SecondaryIndexCellSizeTest.java | 3 +++
2 files changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2d4a305c/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
index e266bf6,0df47f6..3292422
--- a/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
+++ b/test/unit/org/apache/cassandra/db/RangeTombstoneTest.java
@@@ -679,7 -591,10 +679,10 @@@ public class RangeTombstoneTest extend
deletes.add(col);
}
+ @Override
- public void deleteForCleanup(ByteBuffer rowKey, Column col) { }
++ public void deleteForCleanup(ByteBuffer rowKey, Cell col, OpOrder.Group opGroup) {}
+
- public void insert(ByteBuffer rowKey, Column col)
+ public void insert(ByteBuffer rowKey, Cell col, OpOrder.Group opGroup)
{
inserts.add(col);
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/2d4a305c/test/unit/org/apache/cassandra/db/SecondaryIndexCellSizeTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/db/SecondaryIndexCellSizeTest.java
index 45f9e05,0000000..08dcf24
mode 100644,000000..100644
--- a/test/unit/org/apache/cassandra/db/SecondaryIndexCellSizeTest.java
+++ b/test/unit/org/apache/cassandra/db/SecondaryIndexCellSizeTest.java
@@@ -1,221 -1,0 +1,224 @@@
+/*
+* 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.
+*/
+package org.apache.cassandra.db;
+
+import java.nio.ByteBuffer;
+import java.util.Set;
+
+import org.junit.Test;
+
+import org.apache.cassandra.db.composites.CellName;
+import org.apache.cassandra.db.composites.CellNames;
+import org.apache.cassandra.db.index.PerColumnSecondaryIndex;
+import org.apache.cassandra.db.index.PerRowSecondaryIndex;
+import org.apache.cassandra.db.index.SecondaryIndexSearcher;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.concurrent.OpOrder;
+import org.apache.cassandra.utils.memory.MemtableAllocator;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class SecondaryIndexCellSizeTest
+{
+ @Test
+ public void test64kColumn()
+ {
+ // a byte buffer more than 64k
+ ByteBuffer buffer = ByteBuffer.allocate(1024 * 65);
+ buffer.clear();
+
+ //read more than 64k
+ for (int i=0; i<1024*64/4 + 1; i++)
+ buffer.putInt(0);
+
+ // for read
+ buffer.flip();
+ Cell cell = new BufferCell(CellNames.simpleDense(ByteBufferUtil.bytes("test")), buffer, 0);
+
+ SecondaryIndexCellSizeTest.MockRowIndex mockRowIndex = new SecondaryIndexCellSizeTest.MockRowIndex();
+ SecondaryIndexCellSizeTest.MockColumnIndex mockColumnIndex = new SecondaryIndexCellSizeTest.MockColumnIndex();
+
+ assertTrue(mockRowIndex.validate(cell));
+ assertFalse(mockColumnIndex.validate(cell));
+
+ // test less than 64k value
+ buffer.flip();
+ buffer.clear();
+ buffer.putInt(20);
+ buffer.flip();
+
+ assertTrue(mockRowIndex.validate(cell));
+ assertTrue(mockColumnIndex.validate(cell));
+ }
+
+ private class MockRowIndex extends PerRowSecondaryIndex
+ {
+ public void init()
+ {
+ }
+
+ public void validateOptions() throws ConfigurationException
+ {
+ }
+
+ public String getIndexName()
+ {
+ return null;
+ }
+
+ protected SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns)
+ {
+ return null;
+ }
+
+ public void forceBlockingFlush()
+ {
+ }
+
+ public ColumnFamilyStore getIndexCfs()
+ {
+ return null;
+ }
+
+ public void removeIndex(ByteBuffer columnName)
+ {
+ }
+
+ public void invalidate()
+ {
+ }
+
+ public void truncateBlocking(long truncatedAt)
+ {
+ }
+
+ public void index(ByteBuffer rowKey, ColumnFamily cf)
+ {
+ }
+
+ public void delete(DecoratedKey key, OpOrder.Group opGroup)
+ {
+ }
+
+ public void index(ByteBuffer rowKey)
+ {
+ }
+
+ public void reload()
+ {
+ }
+
+ public boolean indexes(CellName name)
+ {
+ return true;
+ }
+
+ @Override
+ public long estimateResultRows() {
+ return 0;
+ }
+ }
+
+
+ private class MockColumnIndex extends PerColumnSecondaryIndex
+ {
+ @Override
+ public void init()
+ {
+ }
+
+ @Override
+ public void validateOptions() throws ConfigurationException
+ {
+ }
+
+ @Override
+ public String getIndexName()
+ {
+ return null;
+ }
+
+ @Override
+ protected SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns)
+ {
+ return null;
+ }
+
+ @Override
+ public void forceBlockingFlush()
+ {
+ }
+
+ @Override
+ public ColumnFamilyStore getIndexCfs()
+ {
+ return null;
+ }
+
+ @Override
+ public void removeIndex(ByteBuffer columnName)
+ {
+ }
+
+ @Override
+ public void invalidate()
+ {
+ }
+
+ @Override
+ public void truncateBlocking(long truncatedAt)
+ {
+ }
+
+ @Override
+ public void delete(ByteBuffer rowKey, Cell col, OpOrder.Group opGroup)
+ {
+ }
+
+ @Override
++ public void deleteForCleanup(ByteBuffer rowKey, Cell col, OpOrder.Group opGroup) {}
++
++ @Override
+ public void insert(ByteBuffer rowKey, Cell col, OpOrder.Group opGroup)
+ {
+ }
+
+ @Override
+ public void update(ByteBuffer rowKey, Cell oldCol, Cell col, OpOrder.Group opGroup)
+ {
+ }
+
+ @Override
+ public void reload()
+ {
+ }
+
+ public boolean indexes(CellName name)
+ {
+ return true;
+ }
+
+ @Override
+ public long estimateResultRows() {
+ return 0;
+ }
+ }
+}