You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by bl...@apache.org on 2017/03/30 11:39:58 UTC
[1/3] cassandra git commit: Fix testLimitSSTables flake caused by
concurrent flush
Repository: cassandra
Updated Branches:
refs/heads/cassandra-3.11 0b1675d43 -> 81b889515
refs/heads/trunk b3465f937 -> bb4c5c3c4
Fix testLimitSSTables flake caused by concurrent flush
Patch by Branimir Lambov; reviewed by Stefania Alborghetti for
CASSANDRA-12820
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/81b88951
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/81b88951
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/81b88951
Branch: refs/heads/cassandra-3.11
Commit: 81b8895151742668ff5035960612d8c4325a1761
Parents: 0b1675d
Author: Branimir Lambov <br...@datastax.com>
Authored: Mon Jan 23 17:20:43 2017 +0200
Committer: Branimir Lambov <br...@datastax.com>
Committed: Thu Mar 30 14:36:07 2017 +0300
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/db/KeyspaceTest.java | 74 ++++++++++++--------
2 files changed, 46 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/81b88951/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 9cde2d8..3ead1d1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.11.0
+ * Fix testLimitSSTables flake caused by concurrent flush (CASSANDRA-12820)
* cdc column addition strikes again (CASSANDRA-13382)
* Fix static column indexes (CASSANDRA-13277)
* DataOutputBuffer.asNewBuffer broken (CASSANDRA-13298)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/81b88951/test/unit/org/apache/cassandra/db/KeyspaceTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/KeyspaceTest.java b/test/unit/org/apache/cassandra/db/KeyspaceTest.java
index 5036749..f2a9984 100644
--- a/test/unit/org/apache/cassandra/db/KeyspaceTest.java
+++ b/test/unit/org/apache/cassandra/db/KeyspaceTest.java
@@ -24,6 +24,7 @@ import java.util.*;
import org.apache.cassandra.Util;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.ColumnIdentifier;
+import org.apache.cassandra.cql3.UntypedResultSet;
import org.apache.cassandra.db.rows.Cell;
import org.apache.cassandra.db.rows.Row;
import org.apache.cassandra.db.rows.RowIterator;
@@ -41,14 +42,34 @@ import static org.junit.Assert.*;
public class KeyspaceTest extends CQLTester
{
+ // Test needs synchronous table drop to avoid flushes causing flaky failures of testLimitSSTables
+
+ @Override
+ protected String createTable(String query)
+ {
+ return super.createTable(KEYSPACE_PER_TEST, query);
+ }
+
+ @Override
+ protected UntypedResultSet execute(String query, Object... values) throws Throwable
+ {
+ return executeFormattedQuery(formatQuery(KEYSPACE_PER_TEST, query), values);
+ }
+
+ @Override
+ public ColumnFamilyStore getCurrentColumnFamilyStore()
+ {
+ return super.getCurrentColumnFamilyStore(KEYSPACE_PER_TEST);
+ }
+
@Test
public void testGetRowNoColumns() throws Throwable
{
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", 0, 0);
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
for (int round = 0; round < 2; round++)
{
@@ -69,12 +90,12 @@ public class KeyspaceTest extends CQLTester
@Test
public void testGetRowSingleColumn() throws Throwable
{
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
for (int i = 0; i < 2; i++)
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", i, i);
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
for (int round = 0; round < 2; round++)
{
@@ -104,11 +125,11 @@ public class KeyspaceTest extends CQLTester
@Test
public void testGetSliceBloomFilterFalsePositive() throws Throwable
{
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "1", 1, 1);
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
// check empty reads on the partitions before and after the existing one
for (String key : new String[]{"0", "2"})
@@ -166,14 +187,13 @@ public class KeyspaceTest extends CQLTester
@Test
public void testGetSliceWithCutoff() throws Throwable
{
- // tests slicing against data from one row in a memtable and then flushed to an sstable
- String tableName = createTable("CREATE TABLE %s (a text, b int, c text, PRIMARY KEY (a, b))");
+ createTable("CREATE TABLE %s (a text, b int, c text, PRIMARY KEY (a, b))");
String prefix = "omg!thisisthevalue!";
for (int i = 0; i < 300; i++)
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", i, prefix + i);
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
for (int round = 0; round < 2; round++)
{
@@ -194,8 +214,8 @@ public class KeyspaceTest extends CQLTester
@Test
public void testReversedWithFlushing() throws Throwable
{
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b)) WITH CLUSTERING ORDER BY (b DESC)");
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b)) WITH CLUSTERING ORDER BY (b DESC)");
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
for (int i = 0; i < 10; i++)
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", i, i);
@@ -206,7 +226,7 @@ public class KeyspaceTest extends CQLTester
{
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", i, i);
- PartitionColumns columns = PartitionColumns.of(cfs.metadata.getColumnDefinition(new ColumnIdentifier("c", false)));
+ PartitionColumns.of(cfs.metadata.getColumnDefinition(new ColumnIdentifier("c", false)));
ClusteringIndexSliceFilter filter = new ClusteringIndexSliceFilter(Slices.ALL, false);
SinglePartitionReadCommand command = singlePartitionSlice(cfs, "0", filter, null);
try (ReadExecutionController executionController = command.executionController();
@@ -273,9 +293,8 @@ public class KeyspaceTest extends CQLTester
@Test
public void testGetSliceFromBasic() throws Throwable
{
- // tests slicing against data from one row in a memtable and then flushed to an sstable
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
for (int i = 1; i < 10; i++)
{
@@ -322,9 +341,8 @@ public class KeyspaceTest extends CQLTester
@Test
public void testGetSliceWithExpiration() throws Throwable
{
- // tests slicing against data from one row with expiring column in a memtable and then flushed to an sstable
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", 0, 0);
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?) USING TTL 60", "0", 1, 1);
@@ -346,9 +364,8 @@ public class KeyspaceTest extends CQLTester
@Test
public void testGetSliceFromAdvanced() throws Throwable
{
- // tests slicing against data from one row spread across two sstables
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
for (int i = 1; i < 7; i++)
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", i, i);
@@ -372,9 +389,8 @@ public class KeyspaceTest extends CQLTester
@Test
public void testGetSliceFromLarge() throws Throwable
{
- // tests slicing against 1000 rows in an sstable
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
for (int i = 1000; i < 2000; i++)
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", i, i);
@@ -389,7 +405,7 @@ public class KeyspaceTest extends CQLTester
// verify that we do indeed have multiple index entries
SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
- RowIndexEntry indexEntry = sstable.getPosition(Util.dk("0"), SSTableReader.Operator.EQ);
+ RowIndexEntry<?> indexEntry = sstable.getPosition(Util.dk("0"), SSTableReader.Operator.EQ);
assert indexEntry.columnsIndexCount() > 2;
validateSliceLarge(cfs);
@@ -398,8 +414,8 @@ public class KeyspaceTest extends CQLTester
@Test
public void testLimitSSTables() throws Throwable
{
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
cfs.disableAutoCompaction();
for (int j = 0; j < 10; j++)
@@ -451,8 +467,8 @@ public class KeyspaceTest extends CQLTester
// k |a0:90|a1:91|..|a9:99
// ---------------------
// then we slice out col1 = a5 and col2 > 85 -> which should let us just check 2 sstables and get 2 columns
- String tableName = createTable("CREATE TABLE %s (a text, b text, c int, d int, PRIMARY KEY (a, b, c))");
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ createTable("CREATE TABLE %s (a text, b text, c int, d int, PRIMARY KEY (a, b, c))");
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
cfs.disableAutoCompaction();
for (int j = 0; j < 10; j++)
[3/3] cassandra git commit: Merge branch 'cassandra-3.11' into trunk
Posted by bl...@apache.org.
Merge branch 'cassandra-3.11' into trunk
# Conflicts:
# test/unit/org/apache/cassandra/db/KeyspaceTest.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/bb4c5c3c
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/bb4c5c3c
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/bb4c5c3c
Branch: refs/heads/trunk
Commit: bb4c5c3c4adf4c76e53fed297036489cee1a2768
Parents: b3465f9 81b8895
Author: Branimir Lambov <br...@datastax.com>
Authored: Thu Mar 30 14:38:23 2017 +0300
Committer: Branimir Lambov <br...@datastax.com>
Committed: Thu Mar 30 14:38:23 2017 +0300
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/db/KeyspaceTest.java | 72 ++++++++++++--------
2 files changed, 45 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/bb4c5c3c/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 2040524,3ead1d1..6a164ee
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,52 -1,5 +1,53 @@@
+4.0
+ * Outbound TCP connections ignore internode authenticator (CASSANDRA-13324)
+ * Upgrade junit from 4.6 to 4.12 (CASSANDRA-13360)
+ * Cleanup ParentRepairSession after repairs (CASSANDRA-13359)
+ * Incremental repair not streaming correct sstables (CASSANDRA-13328)
+ * Upgrade the jna version to 4.3.0 (CASSANDRA-13300)
+ * Add the currentTimestamp, currentDate, currentTime and currentTimeUUID functions (CASSANDRA-13132)
+ * Remove config option index_interval (CASSANDRA-10671)
+ * Reduce lock contention for collection types and serializers (CASSANDRA-13271)
+ * Make it possible to override MessagingService.Verb ids (CASSANDRA-13283)
+ * Avoid synchronized on prepareForRepair in ActiveRepairService (CASSANDRA-9292)
+ * Adds the ability to use uncompressed chunks in compressed files (CASSANDRA-10520)
+ * Don't flush sstables when streaming for incremental repair (CASSANDRA-13226)
+ * Remove unused method (CASSANDRA-13227)
+ * Fix minor bugs related to #9143 (CASSANDRA-13217)
+ * Output warning if user increases RF (CASSANDRA-13079)
+ * Remove pre-3.0 streaming compatibility code for 4.0 (CASSANDRA-13081)
+ * Add support for + and - operations on dates (CASSANDRA-11936)
+ * Fix consistency of incrementally repaired data (CASSANDRA-9143)
+ * Increase commitlog version (CASSANDRA-13161)
+ * Make TableMetadata immutable, optimize Schema (CASSANDRA-9425)
+ * Refactor ColumnCondition (CASSANDRA-12981)
+ * Parallelize streaming of different keyspaces (CASSANDRA-4663)
+ * Improved compactions metrics (CASSANDRA-13015)
+ * Speed-up start-up sequence by avoiding un-needed flushes (CASSANDRA-13031)
+ * Use Caffeine (W-TinyLFU) for on-heap caches (CASSANDRA-10855)
+ * Thrift removal (CASSANDRA-11115)
+ * Remove pre-3.0 compatibility code for 4.0 (CASSANDRA-12716)
+ * Add column definition kind to dropped columns in schema (CASSANDRA-12705)
+ * Add (automate) Nodetool Documentation (CASSANDRA-12672)
+ * Update bundled cqlsh python driver to 3.7.0 (CASSANDRA-12736)
+ * Reject invalid replication settings when creating or altering a keyspace (CASSANDRA-12681)
+ * Clean up the SSTableReader#getScanner API wrt removal of RateLimiter (CASSANDRA-12422)
+ * Use new token allocation for non bootstrap case as well (CASSANDRA-13080)
+ * Avoid byte-array copy when key cache is disabled (CASSANDRA-13084)
+ * Require forceful decommission if number of nodes is less than replication factor (CASSANDRA-12510)
+ * Allow IN restrictions on column families with collections (CASSANDRA-12654)
+ * Log message size in trace message in OutboundTcpConnection (CASSANDRA-13028)
+ * Add timeUnit Days for cassandra-stress (CASSANDRA-13029)
+ * Add mutation size and batch metrics (CASSANDRA-12649)
+ * Add method to get size of endpoints to TokenMetadata (CASSANDRA-12999)
+ * Expose time spent waiting in thread pool queue (CASSANDRA-8398)
+ * Conditionally update index built status to avoid unnecessary flushes (CASSANDRA-12969)
+ * cqlsh auto completion: refactor definition of compaction strategy options (CASSANDRA-12946)
+ * Add support for arithmetic operators (CASSANDRA-11935)
+ * Add histogram for delay to deliver hints (CASSANDRA-13234)
+
+
3.11.0
+ * Fix testLimitSSTables flake caused by concurrent flush (CASSANDRA-12820)
* cdc column addition strikes again (CASSANDRA-13382)
* Fix static column indexes (CASSANDRA-13277)
* DataOutputBuffer.asNewBuffer broken (CASSANDRA-13298)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/bb4c5c3c/test/unit/org/apache/cassandra/db/KeyspaceTest.java
----------------------------------------------------------------------
[2/3] cassandra git commit: Fix testLimitSSTables flake caused by
concurrent flush
Posted by bl...@apache.org.
Fix testLimitSSTables flake caused by concurrent flush
Patch by Branimir Lambov; reviewed by Stefania Alborghetti for
CASSANDRA-12820
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/81b88951
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/81b88951
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/81b88951
Branch: refs/heads/trunk
Commit: 81b8895151742668ff5035960612d8c4325a1761
Parents: 0b1675d
Author: Branimir Lambov <br...@datastax.com>
Authored: Mon Jan 23 17:20:43 2017 +0200
Committer: Branimir Lambov <br...@datastax.com>
Committed: Thu Mar 30 14:36:07 2017 +0300
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../org/apache/cassandra/db/KeyspaceTest.java | 74 ++++++++++++--------
2 files changed, 46 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/81b88951/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 9cde2d8..3ead1d1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.11.0
+ * Fix testLimitSSTables flake caused by concurrent flush (CASSANDRA-12820)
* cdc column addition strikes again (CASSANDRA-13382)
* Fix static column indexes (CASSANDRA-13277)
* DataOutputBuffer.asNewBuffer broken (CASSANDRA-13298)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/81b88951/test/unit/org/apache/cassandra/db/KeyspaceTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/KeyspaceTest.java b/test/unit/org/apache/cassandra/db/KeyspaceTest.java
index 5036749..f2a9984 100644
--- a/test/unit/org/apache/cassandra/db/KeyspaceTest.java
+++ b/test/unit/org/apache/cassandra/db/KeyspaceTest.java
@@ -24,6 +24,7 @@ import java.util.*;
import org.apache.cassandra.Util;
import org.apache.cassandra.cql3.CQLTester;
import org.apache.cassandra.cql3.ColumnIdentifier;
+import org.apache.cassandra.cql3.UntypedResultSet;
import org.apache.cassandra.db.rows.Cell;
import org.apache.cassandra.db.rows.Row;
import org.apache.cassandra.db.rows.RowIterator;
@@ -41,14 +42,34 @@ import static org.junit.Assert.*;
public class KeyspaceTest extends CQLTester
{
+ // Test needs synchronous table drop to avoid flushes causing flaky failures of testLimitSSTables
+
+ @Override
+ protected String createTable(String query)
+ {
+ return super.createTable(KEYSPACE_PER_TEST, query);
+ }
+
+ @Override
+ protected UntypedResultSet execute(String query, Object... values) throws Throwable
+ {
+ return executeFormattedQuery(formatQuery(KEYSPACE_PER_TEST, query), values);
+ }
+
+ @Override
+ public ColumnFamilyStore getCurrentColumnFamilyStore()
+ {
+ return super.getCurrentColumnFamilyStore(KEYSPACE_PER_TEST);
+ }
+
@Test
public void testGetRowNoColumns() throws Throwable
{
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", 0, 0);
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
for (int round = 0; round < 2; round++)
{
@@ -69,12 +90,12 @@ public class KeyspaceTest extends CQLTester
@Test
public void testGetRowSingleColumn() throws Throwable
{
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
for (int i = 0; i < 2; i++)
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", i, i);
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
for (int round = 0; round < 2; round++)
{
@@ -104,11 +125,11 @@ public class KeyspaceTest extends CQLTester
@Test
public void testGetSliceBloomFilterFalsePositive() throws Throwable
{
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "1", 1, 1);
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
// check empty reads on the partitions before and after the existing one
for (String key : new String[]{"0", "2"})
@@ -166,14 +187,13 @@ public class KeyspaceTest extends CQLTester
@Test
public void testGetSliceWithCutoff() throws Throwable
{
- // tests slicing against data from one row in a memtable and then flushed to an sstable
- String tableName = createTable("CREATE TABLE %s (a text, b int, c text, PRIMARY KEY (a, b))");
+ createTable("CREATE TABLE %s (a text, b int, c text, PRIMARY KEY (a, b))");
String prefix = "omg!thisisthevalue!";
for (int i = 0; i < 300; i++)
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", i, prefix + i);
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
for (int round = 0; round < 2; round++)
{
@@ -194,8 +214,8 @@ public class KeyspaceTest extends CQLTester
@Test
public void testReversedWithFlushing() throws Throwable
{
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b)) WITH CLUSTERING ORDER BY (b DESC)");
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b)) WITH CLUSTERING ORDER BY (b DESC)");
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
for (int i = 0; i < 10; i++)
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", i, i);
@@ -206,7 +226,7 @@ public class KeyspaceTest extends CQLTester
{
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", i, i);
- PartitionColumns columns = PartitionColumns.of(cfs.metadata.getColumnDefinition(new ColumnIdentifier("c", false)));
+ PartitionColumns.of(cfs.metadata.getColumnDefinition(new ColumnIdentifier("c", false)));
ClusteringIndexSliceFilter filter = new ClusteringIndexSliceFilter(Slices.ALL, false);
SinglePartitionReadCommand command = singlePartitionSlice(cfs, "0", filter, null);
try (ReadExecutionController executionController = command.executionController();
@@ -273,9 +293,8 @@ public class KeyspaceTest extends CQLTester
@Test
public void testGetSliceFromBasic() throws Throwable
{
- // tests slicing against data from one row in a memtable and then flushed to an sstable
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
for (int i = 1; i < 10; i++)
{
@@ -322,9 +341,8 @@ public class KeyspaceTest extends CQLTester
@Test
public void testGetSliceWithExpiration() throws Throwable
{
- // tests slicing against data from one row with expiring column in a memtable and then flushed to an sstable
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", 0, 0);
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?) USING TTL 60", "0", 1, 1);
@@ -346,9 +364,8 @@ public class KeyspaceTest extends CQLTester
@Test
public void testGetSliceFromAdvanced() throws Throwable
{
- // tests slicing against data from one row spread across two sstables
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
for (int i = 1; i < 7; i++)
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", i, i);
@@ -372,9 +389,8 @@ public class KeyspaceTest extends CQLTester
@Test
public void testGetSliceFromLarge() throws Throwable
{
- // tests slicing against 1000 rows in an sstable
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
for (int i = 1000; i < 2000; i++)
execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", "0", i, i);
@@ -389,7 +405,7 @@ public class KeyspaceTest extends CQLTester
// verify that we do indeed have multiple index entries
SSTableReader sstable = cfs.getLiveSSTables().iterator().next();
- RowIndexEntry indexEntry = sstable.getPosition(Util.dk("0"), SSTableReader.Operator.EQ);
+ RowIndexEntry<?> indexEntry = sstable.getPosition(Util.dk("0"), SSTableReader.Operator.EQ);
assert indexEntry.columnsIndexCount() > 2;
validateSliceLarge(cfs);
@@ -398,8 +414,8 @@ public class KeyspaceTest extends CQLTester
@Test
public void testLimitSSTables() throws Throwable
{
- String tableName = createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ createTable("CREATE TABLE %s (a text, b int, c int, PRIMARY KEY (a, b))");
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
cfs.disableAutoCompaction();
for (int j = 0; j < 10; j++)
@@ -451,8 +467,8 @@ public class KeyspaceTest extends CQLTester
// k |a0:90|a1:91|..|a9:99
// ---------------------
// then we slice out col1 = a5 and col2 > 85 -> which should let us just check 2 sstables and get 2 columns
- String tableName = createTable("CREATE TABLE %s (a text, b text, c int, d int, PRIMARY KEY (a, b, c))");
- final ColumnFamilyStore cfs = Keyspace.open(KEYSPACE).getColumnFamilyStore(tableName);
+ createTable("CREATE TABLE %s (a text, b text, c int, d int, PRIMARY KEY (a, b, c))");
+ final ColumnFamilyStore cfs = getCurrentColumnFamilyStore();
cfs.disableAutoCompaction();
for (int j = 0; j < 10; j++)