Merge branch 'cassandra-3.0' into cassandra-3.X

This commit is contained in:
Stefania Alborghetti 2016-10-19 09:46:11 +08:00
commit 1f19d1a7bf
2 changed files with 11 additions and 2 deletions

View File

@ -86,6 +86,7 @@
* Restore resumable hints delivery (CASSANDRA-11960)
* Properly report LWT contention (CASSANDRA-12626)
Merged from 3.0:
* Fix ViewTest.testCompaction (CASSANDRA-12789)
* Improve avg aggregate functions (CASSANDRA-12417)
* Preserve quoted reserved keyword column names in MV creation (CASSANDRA-11803)
* nodetool stopdaemon errors out (CASSANDRA-12646)

View File

@ -86,7 +86,7 @@ public class ViewTest
public void testCompaction()
{
ColumnFamilyStore cfs = MockSchema.newCFS();
View initialView = fakeView(0, 5, cfs);
View initialView = fakeView(0, 5, cfs, true);
View cur = initialView;
List<SSTableReader> readers = ImmutableList.copyOf(initialView.sstables);
Assert.assertTrue(View.permitCompacting(readers).apply(cur));
@ -136,6 +136,9 @@ public class ViewTest
Assert.assertTrue(nonCompacting.containsAll(readers.subList(2, 5)));
Assert.assertTrue(nonCompacting.containsAll(readers.subList(0, 1)));
Assert.assertEquals(4, nonCompacting.size());
for (SSTableReader sstable : initialView.sstables)
sstable.selfRef().release();
}
private static void testFailure(Function<View, ?> function, View view)
@ -207,13 +210,18 @@ public class ViewTest
}
static View fakeView(int memtableCount, int sstableCount, ColumnFamilyStore cfs)
{
return fakeView(memtableCount, sstableCount, cfs, false);
}
static View fakeView(int memtableCount, int sstableCount, ColumnFamilyStore cfs, boolean keepRef)
{
List<Memtable> memtables = new ArrayList<>();
List<SSTableReader> sstables = new ArrayList<>();
for (int i = 0 ; i < memtableCount ; i++)
memtables.add(MockSchema.memtable(cfs));
for (int i = 0 ; i < sstableCount ; i++)
sstables.add(MockSchema.sstable(i, cfs));
sstables.add(MockSchema.sstable(i, keepRef, cfs));
return new View(ImmutableList.copyOf(memtables), Collections.<Memtable>emptyList(), Helpers.identityMap(sstables),
Collections.<SSTableReader, SSTableReader>emptyMap(), SSTableIntervalTree.build(sstables));
}