Skip to content

Commit

Permalink
Suppress warnings in SeekCursorTest
Browse files Browse the repository at this point in the history
  • Loading branch information
burqen committed Jan 16, 2018
1 parent cbfc8e4 commit 33aa4f9
Showing 1 changed file with 13 additions and 6 deletions.
Expand Up @@ -49,6 +49,7 @@
import static org.neo4j.index.internal.gbptree.TreeNode.Type.LEAF;
import static org.neo4j.index.internal.gbptree.ValueMergers.overwrite;

@SuppressWarnings( "UnnecessaryLocalVariable" )
public class SeekCursorTest
{
private static final int PAGE_SIZE = 256;
Expand Down Expand Up @@ -305,7 +306,6 @@ public boolean next( long pageId ) throws IOException

// GIVEN
long i = fullLeaf();
long left = createRightSibling( pageCursorSpy );
long j = fullLeaf( i );

long fromInclusive = j - 1;
Expand Down Expand Up @@ -772,7 +772,7 @@ public void mustContinueToNextLeafWhenRangeIsSplitIntoRightLeafAndPosToLeft() th
}

// Seeker pauses and writer insert new key which causes a split
expected.add( (long) maxKeyCount );
expected.add( maxKeyCount );
insert( maxKeyCount );

seekCursor.forceRetry();
Expand Down Expand Up @@ -853,7 +853,7 @@ public void mustContinueToNextLeafWhenRangeIsSplitIntoRightLeafAndPosToRight() t
}

// Seeker pauses and writer insert new key which causes a split
expected.add( (long) maxKeyCount );
expected.add( maxKeyCount );
insert( maxKeyCount );
seekCursor.forceRetry();

Expand Down Expand Up @@ -1524,6 +1524,7 @@ public void shouldRereadSiblingIfReadFailureCausedByConcurrentCheckpoint() throw

// then
// we should not fail to read right sibling
//noinspection StatementWithEmptyBody
while ( seek.next() )
{
// ignore
Expand Down Expand Up @@ -1559,6 +1560,7 @@ public void shouldFailOnSiblingReadFailureIfNotCausedByConcurrentCheckpoint() th
// we should fail to read right sibling
try
{
//noinspection StatementWithEmptyBody
while ( seek.next() )
{
// ignore
Expand Down Expand Up @@ -1631,6 +1633,7 @@ public void shouldFailSuccessorIfReadFailureNotCausedByCheckpointInLeaf() throws
// then
try
{
//noinspection StatementWithEmptyBody
while ( seek.next() )
{
}
Expand Down Expand Up @@ -1679,6 +1682,7 @@ public void shouldRereadSuccessorIfReadFailureCausedByCheckpointInInternal() thr
try ( SeekCursor<MutableLong,MutableLong> seek = seekCursor(
i, i + 1, breadcrumbCursor, oldStableGeneration, oldUnstableGeneration ) )
{
//noinspection StatementWithEmptyBody
while ( seek.next() )
{
}
Expand Down Expand Up @@ -1736,7 +1740,7 @@ public void shouldFailSuccessorIfReadFailureNotCausedByCheckpointInInternal() th
// starting a seek on the old root with generation that is not up to date, simulating a concurrent checkpoint
PageAwareByteArrayCursor pageCursorForSeeker = cursor.duplicate( rootId );
pageCursorForSeeker.next();
try ( SeekCursor<MutableLong,MutableLong> seek = seekCursor(
try ( SeekCursor<MutableLong,MutableLong> ignored = seekCursor(
i, i + 1, pageCursorForSeeker, oldStableGeneration, oldUnstableGeneration ) )
{
fail( "Expected throw" );
Expand Down Expand Up @@ -1778,6 +1782,7 @@ public void shouldRereadChildPointerIfReadFailureCausedByCheckpoint() throws Exc
try ( SeekCursor<MutableLong,MutableLong> seek = seekCursor(
i, i + 1, breadcrumbCursor, oldStableGeneration, oldUnstableGeneration ) )
{
//noinspection StatementWithEmptyBody
while ( seek.next() )
{
}
Expand Down Expand Up @@ -1816,7 +1821,7 @@ public void shouldFailChildPointerIfReadFailureNotCausedByCheckpoint() throws Ex
// starting a seek on the old root with generation that is not up to date, simulating a concurrent checkpoint
PageAwareByteArrayCursor pageCursorForSeeker = cursor.duplicate( rootId );
pageCursorForSeeker.next();
try ( SeekCursor<MutableLong,MutableLong> seek = seekCursor(
try ( SeekCursor<MutableLong,MutableLong> ignored = seekCursor(
i, i + 1, pageCursorForSeeker, oldStableGeneration, oldUnstableGeneration ) )
{
fail( "Expected throw" );
Expand All @@ -1842,7 +1847,8 @@ public void shouldCatchupRootWhenRootNodeHasTooNewGeneration() throws Exception
};

// when
try ( SeekCursor<MutableLong,MutableLong> seek = new SeekCursor<>( cursor, node, from, to, layout,
//noinspection EmptyTryBlock
try ( SeekCursor<MutableLong,MutableLong> ignored = new SeekCursor<>( cursor, node, from, to, layout,
stableGeneration, unstableGeneration, generationSupplier, rootCatchup, generation - 1,
exceptionDecorator ) )
{
Expand Down Expand Up @@ -2291,6 +2297,7 @@ private long keyAt( PageCursor cursor, int pos, TreeNode.Type type )
}

// KEEP even if unused
@SuppressWarnings( "unused" )
private void printTree() throws IOException
{
long currentPageId = cursor.getCurrentPageId();
Expand Down

0 comments on commit 33aa4f9

Please sign in to comment.