Merge branch 'cassandra-1.2' into cassandra-2.0 Conflicts: test/unit/org/apache/cassandra/db/ScrubTest.java test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6b1fb2ce Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6b1fb2ce Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6b1fb2ce Branch: refs/heads/cassandra-2.0 Commit: 6b1fb2ce76f72d57ad93c933d21a31f6bda817b9 Parents: 47724e6 39e3a5e Author: Sylvain Lebresne <sylv...@datastax.com> Authored: Tue Nov 19 18:26:38 2013 +0100 Committer: Sylvain Lebresne <sylv...@datastax.com> Committed: Tue Nov 19 18:26:38 2013 +0100 ---------------------------------------------------------------------- .../apache/cassandra/locator/TokenMetadata.java | 22 +++++++++----- .../unit/org/apache/cassandra/db/ScrubTest.java | 4 +++ .../cassandra/locator/TokenMetadataTest.java | 30 ++++++++++---------- .../service/LeaveAndBootstrapTest.java | 6 ++++ 4 files changed, 40 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/6b1fb2ce/src/java/org/apache/cassandra/locator/TokenMetadata.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/6b1fb2ce/test/unit/org/apache/cassandra/db/ScrubTest.java ---------------------------------------------------------------------- diff --cc test/unit/org/apache/cassandra/db/ScrubTest.java index f09aab3,68d1f5e..a83d3c6 --- a/test/unit/org/apache/cassandra/db/ScrubTest.java +++ b/test/unit/org/apache/cassandra/db/ScrubTest.java @@@ -57,8 -83,9 +57,9 @@@ public class ScrubTest extends SchemaLo public void testScrubOneRow() throws IOException, ExecutionException, InterruptedException, ConfigurationException { CompactionManager.instance.disableAutoCompaction(); - Table table = Table.open(TABLE); - ColumnFamilyStore cfs = table.getColumnFamilyStore(CF); + Keyspace keyspace = Keyspace.open(KEYSPACE); + ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF); + cfs.clearUnsafe(); List<Row> rows; @@@ -78,12 -105,15 +79,13 @@@ public void testScrubDeletedRow() throws IOException, ExecutionException, InterruptedException, ConfigurationException { CompactionManager.instance.disableAutoCompaction(); - Table table = Table.open(TABLE); - ColumnFamilyStore cfs = table.getColumnFamilyStore(CF3); + Keyspace keyspace = Keyspace.open(KEYSPACE); + ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF3); + cfs.clearUnsafe(); - RowMutation rm; - rm = new RowMutation(TABLE, ByteBufferUtil.bytes(1)); - ColumnFamily cf = ColumnFamily.create(TABLE, CF3); + ColumnFamily cf = TreeMapBackedSortedColumns.factory.create(KEYSPACE, CF3); cf.delete(new DeletionInfo(0, 1)); // expired tombstone - rm.add(cf); + RowMutation rm = new RowMutation(KEYSPACE, ByteBufferUtil.bytes(1), cf); rm.applyUnsafe(); cfs.forceBlockingFlush(); @@@ -95,8 -125,9 +97,9 @@@ public void testScrubMultiRow() throws IOException, ExecutionException, InterruptedException, ConfigurationException { CompactionManager.instance.disableAutoCompaction(); - Table table = Table.open(TABLE); - ColumnFamilyStore cfs = table.getColumnFamilyStore(CF); + Keyspace keyspace = Keyspace.open(KEYSPACE); + ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF); + cfs.clearUnsafe(); List<Row> rows; @@@ -113,12 -144,13 +116,13 @@@ } @Test - public void testScubOutOfOrder() throws Exception + public void testScrubOutOfOrder() throws Exception { - CompactionManager.instance.disableAutoCompaction(); - Table table = Table.open(TABLE); - String columnFamily = "Standard3"; - ColumnFamilyStore cfs = table.getColumnFamilyStore(columnFamily); - cfs.clearUnsafe(); + CompactionManager.instance.disableAutoCompaction(); + Keyspace keyspace = Keyspace.open(KEYSPACE); + String columnFamily = "Standard3"; + ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(columnFamily); ++ cfs.clearUnsafe(); /* * Code used to generate an outOfOrder sstable. The test for out-of-order key in SSTableWriter must also be commented out. http://git-wip-us.apache.org/repos/asf/cassandra/blob/6b1fb2ce/test/unit/org/apache/cassandra/locator/TokenMetadataTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/6b1fb2ce/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java ---------------------------------------------------------------------- diff --cc test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java index ef7b800,d385b11..44b3400 --- a/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java +++ b/test/unit/org/apache/cassandra/service/LeaveAndBootstrapTest.java @@@ -107,10 -107,12 +107,12 @@@ public class LeaveAndBootstrapTes valueFactory.leaving(Collections.singleton(endpointTokens.get(LEAVING_NODE)))); assertTrue(tmd.isLeaving(hosts.get(LEAVING_NODE))); + PendingRangeCalculatorService.instance.blockUntilFinished(); + AbstractReplicationStrategy strategy; - for (String table : Schema.instance.getNonSystemTables()) + for (String keyspaceName : Schema.instance.getNonSystemKeyspaces()) { - strategy = getStrategy(table, tmd); + strategy = getStrategy(keyspaceName, tmd); for (Token token : keyTokens) { int replicationFactor = strategy.getReplicationFactor(); @@@ -232,10 -234,12 +234,12 @@@ expectedEndpoints.get("Keyspace4").putAll(new BigIntegerToken("85"), makeAddrs("127.0.0.10", "127.0.0.1", "127.0.0.2", "127.0.0.3")); expectedEndpoints.get("Keyspace4").putAll(new BigIntegerToken("95"), makeAddrs("127.0.0.1", "127.0.0.2", "127.0.0.3")); + PendingRangeCalculatorService.instance.blockUntilFinished(); + - for (Map.Entry<String, AbstractReplicationStrategy> tableStrategy : tableStrategyMap.entrySet()) + for (Map.Entry<String, AbstractReplicationStrategy> keyspaceStrategy : keyspaceStrategyMap.entrySet()) { - String table = tableStrategy.getKey(); - AbstractReplicationStrategy strategy = tableStrategy.getValue(); + String keyspaceName = keyspaceStrategy.getKey(); + AbstractReplicationStrategy strategy = keyspaceStrategy.getValue(); for (int i = 0; i < keyTokens.size(); i++) { @@@ -352,10 -356,12 +356,12 @@@ expectedEndpoints.get("Keyspace4").get(new BigIntegerToken("75")).removeAll(makeAddrs("127.0.0.10")); expectedEndpoints.get("Keyspace4").get(new BigIntegerToken("85")).removeAll(makeAddrs("127.0.0.10")); + PendingRangeCalculatorService.instance.blockUntilFinished(); + - for (Map.Entry<String, AbstractReplicationStrategy> tableStrategy : tableStrategyMap.entrySet()) + for (Map.Entry<String, AbstractReplicationStrategy> keyspaceStrategy : keyspaceStrategyMap.entrySet()) { - String table = tableStrategy.getKey(); - AbstractReplicationStrategy strategy = tableStrategy.getValue(); + String keyspaceName = keyspaceStrategy.getKey(); + AbstractReplicationStrategy strategy = keyspaceStrategy.getValue(); for (int i = 0; i < keyTokens.size(); i++) {