You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Thomas Egense <th...@gmail.com> on 2013/10/23 11:59:20 UTC

Minor bug with CloudSolrServer and collection-alias.

I found this bug in both 4.4 and 4.5

Using cloudSolrServer.setDefaultCollection(collectionId) does not work as
intended for an alias spanning more than 1 collection.
The virtual collection-alias collectionID is recoqnized as a existing
collection, but it does only query one of the collections it is mapped to.

You can confirm this easy in AliasIntegrationTest.

The test-class AliasIntegrationTest creates to cores with 2 and 3 different
documents. And then creates an alias pointing to both of them.

Line 153:
    // search with new cloud client
    CloudSolrServer cloudSolrServer = new
CloudSolrServer(zkServer.getZkAddress(), random().nextBoolean());
    cloudSolrServer.setParallelUpdates(random().nextBoolean());
    query = new SolrQuery("*:*");
    query.set("collection", "testalias");
    res = cloudSolrServer.query(query);
    cloudSolrServer.shutdown();
    assertEquals(5, res.getResults().getNumFound());

No unit-test bug here, however if you change it from setting the
collectionid on the query but on CloudSolrServer instead,it will produce
the bug:

    // search with new cloud client
    CloudSolrServer cloudSolrServer = new
    CloudSolrServer(zkServer.getZkAddress(), random().nextBoolean());
    cloudSolrServer.setDefaultCollection("testalias");
    cloudSolrServer.setParallelUpdates(random().nextBoolean());
    query = new SolrQuery("*:*");
    //query.set("collection", "testalias");
    res = cloudSolrServer.query(query);
    cloudSolrServer.shutdown();
    assertEquals(5, res.getResults().getNumFound());  <-- Assertion failure

Should I create a Jira issue for this?

From,
Thomas Egense

Re: Minor bug with CloudSolrServer and collection-alias.

Posted by Thomas Egense <th...@gmail.com>.
Thanks to both of you for fixing the bug. Impressive response time for the
fix (7 hours).

Thomas Egense


On Wed, Oct 23, 2013 at 7:16 PM, Mark Miller <ma...@gmail.com> wrote:

> I filed https://issues.apache.org/jira/browse/SOLR-5380 and just
> committed a fix.
>
> - Mark
>
> On Oct 23, 2013, at 11:15 AM, Shawn Heisey <so...@elyograg.org> wrote:
>
> > On 10/23/2013 3:59 AM, Thomas Egense wrote:
> >> Using cloudSolrServer.setDefaultCollection(collectionId) does not work
> as
> >> intended for an alias spanning more than 1 collection.
> >> The virtual collection-alias collectionID is recoqnized as a existing
> >> collection, but it does only query one of the collections it is mapped
> to.
> >>
> >> You can confirm this easy in AliasIntegrationTest.
> >>
> >> The test-class AliasIntegrationTest creates to cores with 2 and 3
> different
> >> documents. And then creates an alias pointing to both of them.
> >>
> >> Line 153:
> >>    // search with new cloud client
> >>    CloudSolrServer cloudSolrServer = new
> >> CloudSolrServer(zkServer.getZkAddress(), random().nextBoolean());
> >>    cloudSolrServer.setParallelUpdates(random().nextBoolean());
> >>    query = new SolrQuery("*:*");
> >>    query.set("collection", "testalias");
> >>    res = cloudSolrServer.query(query);
> >>    cloudSolrServer.shutdown();
> >>    assertEquals(5, res.getResults().getNumFound());
> >>
> >> No unit-test bug here, however if you change it from setting the
> >> collectionid on the query but on CloudSolrServer instead,it will produce
> >> the bug:
> >>
> >>    // search with new cloud client
> >>    CloudSolrServer cloudSolrServer = new
> >>    CloudSolrServer(zkServer.getZkAddress(), random().nextBoolean());
> >>    cloudSolrServer.setDefaultCollection("testalias");
> >>    cloudSolrServer.setParallelUpdates(random().nextBoolean());
> >>    query = new SolrQuery("*:*");
> >>    //query.set("collection", "testalias");
> >>    res = cloudSolrServer.query(query);
> >>    cloudSolrServer.shutdown();
> >>    assertEquals(5, res.getResults().getNumFound());  <-- Assertion
> failure
> >>
> >> Should I create a Jira issue for this?
> >
> > Thomas,
> >
> > I have confirmed this with the following test patch, which adds to the
> > test rather than changing what's already there:
> >
> > http://apaste.info/9ke5
> >
> > I'm about to head off to the train station to start my commute, so I
> > will be unavailable for a little while.  If you haven't gotten the jira
> > filed by the time I get to another computer, I will create it.
> >
> > Thanks,
> > Shawn
> >
>
>

Re: Minor bug with CloudSolrServer and collection-alias.

Posted by Mark Miller <ma...@gmail.com>.
I filed https://issues.apache.org/jira/browse/SOLR-5380 and just committed a fix.

- Mark

On Oct 23, 2013, at 11:15 AM, Shawn Heisey <so...@elyograg.org> wrote:

> On 10/23/2013 3:59 AM, Thomas Egense wrote:
>> Using cloudSolrServer.setDefaultCollection(collectionId) does not work as
>> intended for an alias spanning more than 1 collection.
>> The virtual collection-alias collectionID is recoqnized as a existing
>> collection, but it does only query one of the collections it is mapped to.
>> 
>> You can confirm this easy in AliasIntegrationTest.
>> 
>> The test-class AliasIntegrationTest creates to cores with 2 and 3 different
>> documents. And then creates an alias pointing to both of them.
>> 
>> Line 153:
>>    // search with new cloud client
>>    CloudSolrServer cloudSolrServer = new
>> CloudSolrServer(zkServer.getZkAddress(), random().nextBoolean());
>>    cloudSolrServer.setParallelUpdates(random().nextBoolean());
>>    query = new SolrQuery("*:*");
>>    query.set("collection", "testalias");
>>    res = cloudSolrServer.query(query);
>>    cloudSolrServer.shutdown();
>>    assertEquals(5, res.getResults().getNumFound());
>> 
>> No unit-test bug here, however if you change it from setting the
>> collectionid on the query but on CloudSolrServer instead,it will produce
>> the bug:
>> 
>>    // search with new cloud client
>>    CloudSolrServer cloudSolrServer = new
>>    CloudSolrServer(zkServer.getZkAddress(), random().nextBoolean());
>>    cloudSolrServer.setDefaultCollection("testalias");
>>    cloudSolrServer.setParallelUpdates(random().nextBoolean());
>>    query = new SolrQuery("*:*");
>>    //query.set("collection", "testalias");
>>    res = cloudSolrServer.query(query);
>>    cloudSolrServer.shutdown();
>>    assertEquals(5, res.getResults().getNumFound());  <-- Assertion failure
>> 
>> Should I create a Jira issue for this?
> 
> Thomas,
> 
> I have confirmed this with the following test patch, which adds to the
> test rather than changing what's already there:
> 
> http://apaste.info/9ke5
> 
> I'm about to head off to the train station to start my commute, so I
> will be unavailable for a little while.  If you haven't gotten the jira
> filed by the time I get to another computer, I will create it.
> 
> Thanks,
> Shawn
> 


Re: Minor bug with CloudSolrServer and collection-alias.

Posted by Shawn Heisey <so...@elyograg.org>.
On 10/23/2013 3:59 AM, Thomas Egense wrote:
> Using cloudSolrServer.setDefaultCollection(collectionId) does not work as
> intended for an alias spanning more than 1 collection.
> The virtual collection-alias collectionID is recoqnized as a existing
> collection, but it does only query one of the collections it is mapped to.
> 
> You can confirm this easy in AliasIntegrationTest.
> 
> The test-class AliasIntegrationTest creates to cores with 2 and 3 different
> documents. And then creates an alias pointing to both of them.
> 
> Line 153:
>     // search with new cloud client
>     CloudSolrServer cloudSolrServer = new
> CloudSolrServer(zkServer.getZkAddress(), random().nextBoolean());
>     cloudSolrServer.setParallelUpdates(random().nextBoolean());
>     query = new SolrQuery("*:*");
>     query.set("collection", "testalias");
>     res = cloudSolrServer.query(query);
>     cloudSolrServer.shutdown();
>     assertEquals(5, res.getResults().getNumFound());
> 
> No unit-test bug here, however if you change it from setting the
> collectionid on the query but on CloudSolrServer instead,it will produce
> the bug:
> 
>     // search with new cloud client
>     CloudSolrServer cloudSolrServer = new
>     CloudSolrServer(zkServer.getZkAddress(), random().nextBoolean());
>     cloudSolrServer.setDefaultCollection("testalias");
>     cloudSolrServer.setParallelUpdates(random().nextBoolean());
>     query = new SolrQuery("*:*");
>     //query.set("collection", "testalias");
>     res = cloudSolrServer.query(query);
>     cloudSolrServer.shutdown();
>     assertEquals(5, res.getResults().getNumFound());  <-- Assertion failure
> 
> Should I create a Jira issue for this?

Thomas,

I have confirmed this with the following test patch, which adds to the
test rather than changing what's already there:

http://apaste.info/9ke5

I'm about to head off to the train station to start my commute, so I
will be unavailable for a little while.  If you haven't gotten the jira
filed by the time I get to another computer, I will create it.

Thanks,
Shawn