Skip to content

Ready: Better Search Testing + Bug Fix#594

Merged
alexmoore merged 8 commits intodevelopfrom
better-search-testing
Mar 2, 2016
Merged

Ready: Better Search Testing + Bug Fix#594
alexmoore merged 8 commits intodevelopfrom
better-search-testing

Conversation

@alexmoore
Copy link
Contributor

Refactored search setup into common base class to reduce duplication & make it easier to test search going forward.

Also contains a fix for #547 (CLIENTS-599), and #539 (CLIENTS-557).

@alexmoore alexmoore changed the title Not Ready: Better Search Testing + Bug Fix Ready: Better Search Testing + Bug Fix Feb 9, 2016
}

if (rows > 0)
if (rows >= 0)
Copy link

Choose a reason for hiding this comment

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

I take it that the builderwas not creating anything for zero rows?

Copy link

Choose a reason for hiding this comment

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

I think I see now. You changed the value to be initialized to -1 so now you have to set it to zero explicitly.

@hazen
Copy link

hazen commented Feb 14, 2016

Errors from the builder:

Tests run: 20, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 18.191 sec <<< FAILURE! - in com.basho.riak.client.core.operations.itest.ITestSecondaryIndexQueryOp
testBucketIndexHack(com.basho.riak.client.core.operations.itest.ITestSecondaryIndexQueryOp)  Time elapsed: 1.01 sec  <<< FAILURE!
junit.framework.AssertionFailedError: null
    at junit.framework.Assert.fail(Assert.java:48)
    at junit.framework.Assert.assertTrue(Assert.java:20)
    at junit.framework.Assert.assertTrue(Assert.java:27)
    at com.basho.riak.client.core.operations.itest.ITestSecondaryIndexQueryOp.testBucketIndexHack(ITestSecondaryIndexQueryOp.java:540)

Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.241 sec <<< FAILURE! - in com.basho.riak.client.api.commands.indexes.itest.ITestRawIndexQuery
testBucketIndexHack(com.basho.riak.client.api.commands.indexes.itest.ITestRawIndexQuery)  Time elapsed: 0.787 sec  <<< FAILURE!
java.lang.AssertionError: expected:<100> but was:<103>
    at org.junit.Assert.fail(Assert.java:93)
    at org.junit.Assert.failNotEquals(Assert.java:647)
    at org.junit.Assert.assertEquals(Assert.java:128)
    at org.junit.Assert.assertEquals(Assert.java:472)
    at org.junit.Assert.assertEquals(Assert.java:456)
    at com.basho.riak.client.api.commands.indexes.itest.ITestRawIndexQuery.testBucketIndexHack(ITestRawIndexQuery.java:143)

@alexmoore
Copy link
Contributor Author

@javajolt @lukebakken This one's ready too!

private final String name;
private final String schema;

private volatile Integer nVal;
Copy link
Contributor

Choose a reason for hiding this comment

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

volatile orly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yaRly! We set it with withNVal() a few lines down, and not in the constructor. We typically mark any non-final fields as volatile in these "core" datatype objects, to make them thread-safer with all the setup we do. I also didn't want to add two more constructors :).

Copy link
Contributor

Choose a reason for hiding this comment

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

So this protects against the case where two threads have access to the same YokozunaIndex object and one calls withNVal at the same time as the other calls getNVal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. Since we don't have any synchronizing .build() function, the volatile will force a synchronization of an update across cached copies of the variable in other threads. Atomic vars would be overkill here.

@lukebakken
Copy link
Contributor

Just a couple comments.

@christophermancini
Copy link

👍 Tests passed on the 2nd & 3rd run. The first time, com.basho.riak.client.core.operations.itest.ITestListKeysOperation hung up on me indefinitely. It could have been my local config. Code changes look good.

@alexmoore
Copy link
Contributor Author

@christophermancini What was the error the first time?

@christophermancini
Copy link

@alexmoore no error, just sat there for a good 10+ minutes till I killed it.

@alexmoore
Copy link
Contributor Author

@christophermancini Ok. That's one of those tests that I have suspicions about and want to rewrite at some point so I'll note it in my log.

alexmoore added a commit that referenced this pull request Mar 2, 2016
Ready: Better Search Testing + Bug Fix
@alexmoore alexmoore merged commit 21b501f into develop Mar 2, 2016
@alexmoore alexmoore deleted the better-search-testing branch March 2, 2016 13:27
@christophermancini
Copy link

That was my guess, which is why I noted it but wasn't too concerned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants