Merge branch 'cassandra-3.11' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e79e50b0 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e79e50b0 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e79e50b0 Branch: refs/heads/trunk Commit: e79e50b0a784e5f6e7abebfcbfed5a49c7b2ab82 Parents: 0d70789 c169d49 Author: Jeff Jirsa <jji...@apple.com> Authored: Wed Dec 6 21:43:13 2017 -0800 Committer: Jeff Jirsa <jji...@apple.com> Committed: Wed Dec 6 21:45:48 2017 -0800 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../db/compaction/CompactionManager.java | 24 +++--- .../org/apache/cassandra/db/CleanupTest.java | 81 ++++++++++++++++++++ 3 files changed, 94 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e79e50b0/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index cfec6d3,3c6565c..ea4ab0b --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -178,7 -8,8 +178,8 @@@ * Avoid locks when checking LCS fanout and if we should defrag (CASSANDRA-13930) Merged from 3.0: 3.0.16 + * Fix cleanup on keyspace with no replicas (CASSANDRA-13526) - * Fix updating base table rows with TTL not removing view entries (CASSANDRA-14071) + * Fix updating base table rows with TTL not removing materialized view entries (CASSANDRA-14071) * Reduce garbage created by DynamicSnitch (CASSANDRA-14091) * More frequent commitlog chained markers (CASSANDRA-13987) * Fix serialized size of DataLimits (CASSANDRA-14057) http://git-wip-us.apache.org/repos/asf/cassandra/blob/e79e50b0/src/java/org/apache/cassandra/db/compaction/CompactionManager.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e79e50b0/test/unit/org/apache/cassandra/db/CleanupTest.java ---------------------------------------------------------------------- diff --cc test/unit/org/apache/cassandra/db/CleanupTest.java index f576290,80e9b37..044a49e --- a/test/unit/org/apache/cassandra/db/CleanupTest.java +++ b/test/unit/org/apache/cassandra/db/CleanupTest.java @@@ -35,7 -37,9 +37,9 @@@ import org.junit.Test import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.Util; -import org.apache.cassandra.config.ColumnDefinition; + import org.apache.cassandra.config.DatabaseDescriptor; +import org.apache.cassandra.schema.ColumnMetadata; + import org.apache.cassandra.schema.KeyspaceMetadata; import org.apache.cassandra.cql3.Operator; import org.apache.cassandra.db.compaction.CompactionManager; import org.apache.cassandra.db.filter.RowFilter; @@@ -172,8 -204,55 +204,56 @@@ public class CleanupTes assertEquals(0, Util.getAll(Util.cmd(cfs).build()).size()); } + @Test + public void testCleanupWithNoTokenRange() throws Exception + { + testCleanupWithNoTokenRange(false); + } + + @Test + public void testUserDefinedCleanupWithNoTokenRange() throws Exception + { + testCleanupWithNoTokenRange(true); + } + + private void testCleanupWithNoTokenRange(boolean isUserDefined) throws Exception + { + + TokenMetadata tmd = StorageService.instance.getTokenMetadata(); + tmd.clearUnsafe(); + tmd.updateHostId(UUID.randomUUID(), InetAddress.getByName("127.0.0.1")); + byte[] tk1 = {2}; + tmd.updateNormalToken(new BytesToken(tk1), InetAddress.getByName("127.0.0.1")); + + + Keyspace keyspace = Keyspace.open(KEYSPACE2); + keyspace.setMetadata(KeyspaceMetadata.create(KEYSPACE2, KeyspaceParams.nts("DC1", 1))); + ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF_STANDARD2); + + // insert data and verify we get it back w/ range query + fillCF(cfs, "val", LOOPS); + assertEquals(LOOPS, Util.getAll(Util.cmd(cfs).build()).size()); + + // remove replication on DC1 + keyspace.setMetadata(KeyspaceMetadata.create(KEYSPACE2, KeyspaceParams.nts("DC1", 0))); + + // clear token range for localhost on DC1 + if (isUserDefined) + { + for (SSTableReader r : cfs.getLiveSSTables()) + CompactionManager.instance.forceUserDefinedCleanup(r.getFilename()); + } + else + { + CompactionManager.instance.performCleanup(cfs, 2); + } + assertEquals(0, Util.getAll(Util.cmd(cfs).build()).size()); + assertTrue(cfs.getLiveSSTables().isEmpty()); + } + + + @Test public void testuserDefinedCleanupWithNewToken() throws ExecutionException, InterruptedException, UnknownHostException { StorageService.instance.getTokenMetadata().clearUnsafe(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org