Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASSANDRA-18131 Fix LongBTreeTest test timeout #2178

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 5 additions & 6 deletions test/burn/org/apache/cassandra/utils/LongBTreeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
public class LongBTreeTest
{
private static final boolean DEBUG = false;
private static int perThreadTrees = 10000;
private static int perThreadTrees = 100;
private static int minTreeSize = 4;
private static int maxTreeSize = 10000; // TODO randomise this for each test
private static int threads = DEBUG ? 1 : Runtime.getRuntime().availableProcessors() * 8;
Expand Down Expand Up @@ -339,7 +339,6 @@ private void testRandomSelection(long seed, int perThreadTrees, int perTreeSelec
private void testRandomSelection(long seed, int perThreadTrees, int perTreeSelections, boolean narrow, boolean mixInNotPresentItems, boolean permitReversal, Consumer<RandomSelection> testRun) throws InterruptedException
{
final Random outerSeedGenerator = new Random(seed);
int threads = Runtime.getRuntime().availableProcessors();
final CountDownLatch latch = new CountDownLatch(threads);
final AtomicLong errors = new AtomicLong();
final AtomicLong count = new AtomicLong();
Expand Down Expand Up @@ -785,7 +784,7 @@ public void testBatchesSmallOverlappingRange() throws ExecutionException, Interr
@Test
public void testIndividualInsertsMediumSparseRange() throws ExecutionException, InterruptedException
{
testInsertions(randomSeed(), perThreadTrees / 10, 500, 10, 1, true);
testInsertions(randomSeed(), 500, 10, 1, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default value of this tests parameter is perThreadTrees * threads, so we could be replacing values of 1000 with 25600 (where there are 32 availableProcessors). Note in ant we limit this to 2 processors here so a value of 1600 (which is still an increase).

is this what you intended @Mmuzaf ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, I think we can safely increase the number of local runs for testLargeBatchesLargeRange, and testIndividualInsertsMediumSparseRange while still maintaining a reasonable execution time for the LongBTreeTest as a whole.

For the tests that fire testInsertions with parameters the main concern we have is - we perform different numbers of test attempts to check tree insertions for variations of ranges and batches, but the same equal number of tests should be used for all of them. I think perThreadTrees * threads is the better choice for us since increasing the perThreadTrees (for testInsertions it's not exactly trees per thread as it says, it's just a multiplier) will give us the ability to find patterns e.g. for a heap consumption during a particular run.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is also possible to just set the perThreadTrees for 10000 back to 100 as an easy fix, I guess. I just wanted to fix the problem wider and maybe I overdid it :-)

}

@Test
Expand All @@ -797,17 +796,17 @@ public void testBatchesMediumSparseRange() throws ExecutionException, Interrupte
@Test
public void testLargeBatchesLargeRange() throws ExecutionException, InterruptedException
{
testInsertions(randomSeed(), perThreadTrees / 10, Math.max(maxTreeSize, 5000), 3, 100, true);
testInsertions(randomSeed(), Math.max(maxTreeSize, 5000), 3, 100, true);
}

@Test
public void testRandomRangeAndBatches() throws ExecutionException, InterruptedException
{
Random seedGenerator = new Random(randomSeed());
for (int i = 0 ; i < perThreadTrees / 10 ; i++)
for (int i = 0 ; i < 10 ; i++)
{
int treeSize = nextInt(seedGenerator, maxTreeSize / 10, maxTreeSize * 10);
testInsertions(seedGenerator.nextLong(), threads * 10, treeSize, nextInt(seedGenerator, 1, 100) / 10f, treeSize / 100, true);
testInsertions(seedGenerator.nextLong(), treeSize, nextInt(seedGenerator, 1, 100) / 10f, treeSize / 100, true);
}
}

Expand Down