lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoss Man (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SOLR-4733) Rollback does not work correctly with tlog and optimistic concurrency updates
Date Fri, 19 Apr 2013 02:21:17 GMT

     [ https://issues.apache.org/jira/browse/SOLR-4733?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Hoss Man updated SOLR-4733:
---------------------------

    Description: When using the updateLog, attempting to rollback atomic updates still causes
post-rollback atomic updates to still report a conflict with the version assigned to the update
posted prior to the rollback  (was: I wrote a simple test that seems to reproduce the unexpected
behaviour. See the below test case "addBeanThenRollbackThenAddBeanThenRollbackTest()".

It seems on rollback the bean is not written to Solr system, though I think the client remembers
the bean which then creates a version conflict SolrException.


* *The test case:*
{code:java}
@Test
public void addBeanThenRollbackThenAddBeanThenRollbackTest() throws Exception {

	MyTestBean myTestBean = createTestBean("addBeanTest");
	UpdateResponse updateResponseOne = server.addBean(myTestBean);
	Assert.assertEquals(0, updateResponseOne.getStatus());

	rollback();
	Thread.sleep(1000);

	// No Bean Found
	{
		MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
		Assert.assertNull(myTestBeanStored);
	}

	UpdateResponse updateResponseTwo = server.addBean(myTestBean);
	Assert.assertEquals(0, updateResponseTwo.getStatus());

	rollback();
	Thread.sleep(1000);

	// No Bean Found
	{
		MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
		Assert.assertNull(myTestBeanStored);
	}

}
{code}

* *The stack trace:*
{code}
org.apache.solr.common.SolrException: version conflict for 154ff2e0-621b-4eb0-a1d3-4bbe7ea01573
expected=-1 actual=1432619355523252224
	at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:404)
	at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
	at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)
	at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:116)
	at org.apache.solr.client.solrj.SolrServer.addBean(SolrServer.java:136)
	at org.apache.solr.client.solrj.SolrServer.addBean(SolrServer.java:125)
	at test.SolrJBeanTest.addBeanThenRollbackThenAddBeanThenRollbackTest(SolrJBeanTest.java:157)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
{code}


* *The test class:*
{code:java}
package test;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.UUID;

import junit.framework.Assert;

import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.beans.Field;
import org.apache.solr.client.solrj.impl.BinaryRequestWriter;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.client.solrj.response.UpdateResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class SolrJBeanTest {

    private static HttpSolrServer server;

    static {

        String url = "http://localhost:8080/solr/collection1";

        server = new HttpSolrServer(url);

         server.setRequestWriter(new BinaryRequestWriter());
//         server.setParser(new XMLResponseParser()); // binary parser is used by default

        server.setSoTimeout(5000); // socket read timeout
        server.setConnectionTimeout(30000);
        server.setDefaultMaxConnectionsPerHost(100);
        server.setMaxTotalConnections(100);
        server.setFollowRedirects(false); // defaults to false
        // allowCompression defaults to false.
        // Server side must support gzip or deflate for this to have any effect.
        server.setAllowCompression(true);
        server.setMaxRetries(1); // defaults to 0.  > 1 not recommended.

    }

    @Before
    public void setUp() throws Exception {

        UpdateResponse updateResponse = server.deleteByQuery("type_s:" + "MyTestBean");
        Assert.assertEquals(0, updateResponse.getStatus());

        commit();

    }


    @After
    public void tearDown() throws Exception {

        UpdateResponse updateResponse = server.deleteByQuery("type_s:" + "MyTestBean");
        Assert.assertEquals(0, updateResponse.getStatus());

        commit();

        List<MyTestBean> beans = getTestBeans();
        Assert.assertEquals(0, beans.size());

    }

    private static void commit() throws Exception {
        UpdateResponse updateResponseForCommit = server.commit();
        Assert.assertEquals(0, updateResponseForCommit.getStatus());
    }

    private static void rollback() throws Exception {
        UpdateResponse updateResponseForCommit = server.rollback();
        Assert.assertEquals(0, updateResponseForCommit.getStatus());
    }

    @Test
    public void addBeanTest() throws Exception {

        MyTestBean myTestBean = createTestBean("addBeanTest");
        UpdateResponse updateResponse = server.addBean(myTestBean);
        Assert.assertEquals(0, updateResponse.getStatus());

        Thread.sleep(1000);

        // No Bean Found
        {
            MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
            Assert.assertNull(myTestBeanStored);
        }

        UpdateResponse updateResponseForCommit = server.commit();
        Assert.assertEquals(0, updateResponseForCommit.getStatus());

        // Bean Found
        {
            MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
            Assert.assertNotNull(myTestBeanStored);

            Assert.assertEquals(myTestBean.getId(), myTestBeanStored.getId());
            Assert.assertEquals(myTestBean.getType(), myTestBeanStored.getType());
            Assert.assertEquals(myTestBean.getValue(), myTestBeanStored.getValue());
            Assert.assertEquals(myTestBean.getCreatedDate(), myTestBeanStored.getCreatedDate());

            Assert.assertEquals(-1L, myTestBean.get_version_().longValue());
            Assert.assertTrue(myTestBeanStored.get_version_() > 0);
        }

    }

    @Test
    public void addBeanThenRollbackTest() throws Exception {

        MyTestBean myTestBean = createTestBean("addBeanTest");
        UpdateResponse updateResponse = server.addBean(myTestBean);
        Assert.assertEquals(0, updateResponse.getStatus());

        Thread.sleep(1000);

        // No Bean Found
        {
            MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
            Assert.assertNull(myTestBeanStored);
        }

        UpdateResponse updateResponseForCommit = server.rollback();
        Assert.assertEquals(0, updateResponseForCommit.getStatus());

        // No Bean Found
        {
            MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
            Assert.assertNull(myTestBeanStored);
        }

    }

    @Test
    public void addBeanThenRollbackThenAddBeanThenRollbackTest() throws Exception {

        MyTestBean myTestBean = createTestBean("addBeanTest");
        UpdateResponse updateResponseOne = server.addBean(myTestBean);
        Assert.assertEquals(0, updateResponseOne.getStatus());

        rollback();
        Thread.sleep(1000);

        // No Bean Found
        {
            MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
            Assert.assertNull(myTestBeanStored);
        }

        UpdateResponse updateResponseTwo = server.addBean(myTestBean);
        Assert.assertEquals(0, updateResponseTwo.getStatus());

        rollback();
        Thread.sleep(1000);

        // No Bean Found
        {
            MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
            Assert.assertNull(myTestBeanStored);
        }

    }

    private MyTestBean createTestBean(String value) {
        MyTestBean myTestBean = new MyTestBean();
        myTestBean.setId(UUID.randomUUID().toString().toLowerCase(Locale.ENGLISH));
        myTestBean.setType("MyTestBean");
        myTestBean.setCreatedDate(new Date());
        myTestBean.setValue(value);
        myTestBean.set_version_(-1L);
        return myTestBean;
    }

    private static List<MyTestBean> getTestBeans() throws Exception {
        return getTestBeans(null, null);
    }

    private static MyTestBean getTestBean(String id) throws Exception {
        List<MyTestBean> beans = getTestBeans(id, null);

        if (beans == null || beans.size() == 0) {
            return null;
        }

        return beans.get(0);
    }

    private static List<MyTestBean> getTestBeans(String id, String value) throws Exception
{

        SolrQuery solrQuery = new SolrQuery();
        solrQuery.setQuery("*:*");
        if (id != null) {
            solrQuery.addFilterQuery("id:" + id);
        }
        solrQuery.addFilterQuery("type_s:" + "MyTestBean");
        if (value != null) {
            solrQuery.addFilterQuery("value:" + value);
        }

        QueryResponse queryResponse = server.query(solrQuery);

        List<MyTestBean> beans = queryResponse.getBeans(MyTestBean.class);

        return beans;

    }


    public static class MyTestBean implements Serializable {

        private static final long serialVersionUID = 1L;

        @Field("id")
        private String id;

        @Field("type_s")
        private String type;

        @Field("value_s")
        private String value;

        @Field("created_dt")
        private Date createdDate;

        @Field("_version_")
        private Long _version_;

        public MyTestBean() {

        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public Date getCreatedDate() {
            return createdDate;
        }

        public void setCreatedDate(Date createdDate) {
            this.createdDate = createdDate;
        }

        public Long get_version_() {
            return _version_;
        }

        public void set_version_(Long _version_) {
            this._version_ = _version_;
        }

        @Override
        public String toString() {
            return "MyTestBean [id=" + id + ", type=" + type + ", value=" + value + ", createdDate="
+ createdDate
                    + ", _version_=" + _version_ + "]";
        }

    }

}
{code})
        Summary: Rollback does not work correctly with tlog and optimistic concurrency updates
 (was: Rollback does not work correctly)

Mark: thank you very much for your detailed bug report and test case, a few comments for your
future reference:

1) please try to keep the description short, as it is included in all emails sent (to all
devs!) any time someone posts a comment. It's best to post a comment with long details after
creating your issue, or use attachments.  I've moved your initial description into a comment
below.

2) when posting test cases, please try to make your test case entirely self contained -- ideally
as a patch that can be applied to the existing solr code base, but if you do provide a completely
new standalone test case we at least need all of the configs you use in the solr server you
run your test against in order to be able to reproduce.  Specifically in regards to this issue
and SOLR-4605 (where you provided what appears to be the same test before), had you provided
a fully reproducible test case in SOLR-4605  along with your configs, mark miller might have
noticed at the time that beyond re-opening the IndexWriter, there is an additional problem
involved when using the updateLog -- the test mark added as part of SOLR-4605 demonstrated
the same error as your initial bug report, but if it had been easy for him to try/apply your
exact testcase with configs the second problem would have been obvious.

----

The crux of the issue seems to be when mixing optimistic concurrency with both the transaction
log and rollback.  I've updated the description accordingly and i have a patch with test cases
i'll attach shortly (FWIW: i have no idea what the cause is)

{panel:title=Original Bug Report}
I wrote a simple test that seems to reproduce the unexpected behaviour. See the below test
case "addBeanThenRollbackThenAddBeanThenRollbackTest()".

It seems on rollback the bean is not written to Solr system, though I think the client remembers
the bean which then creates a version conflict SolrException.


* *The test case:*
{code:java}
@Test
public void addBeanThenRollbackThenAddBeanThenRollbackTest() throws Exception {

	MyTestBean myTestBean = createTestBean("addBeanTest");
	UpdateResponse updateResponseOne = server.addBean(myTestBean);
	Assert.assertEquals(0, updateResponseOne.getStatus());

	rollback();
	Thread.sleep(1000);

	// No Bean Found
	{
		MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
		Assert.assertNull(myTestBeanStored);
	}

	UpdateResponse updateResponseTwo = server.addBean(myTestBean);
	Assert.assertEquals(0, updateResponseTwo.getStatus());

	rollback();
	Thread.sleep(1000);

	// No Bean Found
	{
		MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
		Assert.assertNull(myTestBeanStored);
	}

}
{code}

* *The stack trace:*
{code}
org.apache.solr.common.SolrException: version conflict for 154ff2e0-621b-4eb0-a1d3-4bbe7ea01573
expected=-1 actual=1432619355523252224
	at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:404)
	at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
	at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)
	at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:116)
	at org.apache.solr.client.solrj.SolrServer.addBean(SolrServer.java:136)
	at org.apache.solr.client.solrj.SolrServer.addBean(SolrServer.java:125)
	at test.SolrJBeanTest.addBeanThenRollbackThenAddBeanThenRollbackTest(SolrJBeanTest.java:157)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
{code}


* *The test class:*
{code:java}
package test;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.UUID;

import junit.framework.Assert;

import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.beans.Field;
import org.apache.solr.client.solrj.impl.BinaryRequestWriter;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.client.solrj.response.UpdateResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class SolrJBeanTest {

    private static HttpSolrServer server;

    static {

        String url = "http://localhost:8080/solr/collection1";

        server = new HttpSolrServer(url);

         server.setRequestWriter(new BinaryRequestWriter());
//         server.setParser(new XMLResponseParser()); // binary parser is used by default

        server.setSoTimeout(5000); // socket read timeout
        server.setConnectionTimeout(30000);
        server.setDefaultMaxConnectionsPerHost(100);
        server.setMaxTotalConnections(100);
        server.setFollowRedirects(false); // defaults to false
        // allowCompression defaults to false.
        // Server side must support gzip or deflate for this to have any effect.
        server.setAllowCompression(true);
        server.setMaxRetries(1); // defaults to 0.  > 1 not recommended.

    }

    @Before
    public void setUp() throws Exception {

        UpdateResponse updateResponse = server.deleteByQuery("type_s:" + "MyTestBean");
        Assert.assertEquals(0, updateResponse.getStatus());

        commit();

    }


    @After
    public void tearDown() throws Exception {

        UpdateResponse updateResponse = server.deleteByQuery("type_s:" + "MyTestBean");
        Assert.assertEquals(0, updateResponse.getStatus());

        commit();

        List<MyTestBean> beans = getTestBeans();
        Assert.assertEquals(0, beans.size());

    }

    private static void commit() throws Exception {
        UpdateResponse updateResponseForCommit = server.commit();
        Assert.assertEquals(0, updateResponseForCommit.getStatus());
    }

    private static void rollback() throws Exception {
        UpdateResponse updateResponseForCommit = server.rollback();
        Assert.assertEquals(0, updateResponseForCommit.getStatus());
    }

    @Test
    public void addBeanTest() throws Exception {

        MyTestBean myTestBean = createTestBean("addBeanTest");
        UpdateResponse updateResponse = server.addBean(myTestBean);
        Assert.assertEquals(0, updateResponse.getStatus());

        Thread.sleep(1000);

        // No Bean Found
        {
            MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
            Assert.assertNull(myTestBeanStored);
        }

        UpdateResponse updateResponseForCommit = server.commit();
        Assert.assertEquals(0, updateResponseForCommit.getStatus());

        // Bean Found
        {
            MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
            Assert.assertNotNull(myTestBeanStored);

            Assert.assertEquals(myTestBean.getId(), myTestBeanStored.getId());
            Assert.assertEquals(myTestBean.getType(), myTestBeanStored.getType());
            Assert.assertEquals(myTestBean.getValue(), myTestBeanStored.getValue());
            Assert.assertEquals(myTestBean.getCreatedDate(), myTestBeanStored.getCreatedDate());

            Assert.assertEquals(-1L, myTestBean.get_version_().longValue());
            Assert.assertTrue(myTestBeanStored.get_version_() > 0);
        }

    }

    @Test
    public void addBeanThenRollbackTest() throws Exception {

        MyTestBean myTestBean = createTestBean("addBeanTest");
        UpdateResponse updateResponse = server.addBean(myTestBean);
        Assert.assertEquals(0, updateResponse.getStatus());

        Thread.sleep(1000);

        // No Bean Found
        {
            MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
            Assert.assertNull(myTestBeanStored);
        }

        UpdateResponse updateResponseForCommit = server.rollback();
        Assert.assertEquals(0, updateResponseForCommit.getStatus());

        // No Bean Found
        {
            MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
            Assert.assertNull(myTestBeanStored);
        }

    }

    @Test
    public void addBeanThenRollbackThenAddBeanThenRollbackTest() throws Exception {

        MyTestBean myTestBean = createTestBean("addBeanTest");
        UpdateResponse updateResponseOne = server.addBean(myTestBean);
        Assert.assertEquals(0, updateResponseOne.getStatus());

        rollback();
        Thread.sleep(1000);

        // No Bean Found
        {
            MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
            Assert.assertNull(myTestBeanStored);
        }

        UpdateResponse updateResponseTwo = server.addBean(myTestBean);
        Assert.assertEquals(0, updateResponseTwo.getStatus());

        rollback();
        Thread.sleep(1000);

        // No Bean Found
        {
            MyTestBean myTestBeanStored = getTestBean(myTestBean.getId());
            Assert.assertNull(myTestBeanStored);
        }

    }

    private MyTestBean createTestBean(String value) {
        MyTestBean myTestBean = new MyTestBean();
        myTestBean.setId(UUID.randomUUID().toString().toLowerCase(Locale.ENGLISH));
        myTestBean.setType("MyTestBean");
        myTestBean.setCreatedDate(new Date());
        myTestBean.setValue(value);
        myTestBean.set_version_(-1L);
        return myTestBean;
    }

    private static List<MyTestBean> getTestBeans() throws Exception {
        return getTestBeans(null, null);
    }

    private static MyTestBean getTestBean(String id) throws Exception {
        List<MyTestBean> beans = getTestBeans(id, null);

        if (beans == null || beans.size() == 0) {
            return null;
        }

        return beans.get(0);
    }

    private static List<MyTestBean> getTestBeans(String id, String value) throws Exception
{

        SolrQuery solrQuery = new SolrQuery();
        solrQuery.setQuery("*:*");
        if (id != null) {
            solrQuery.addFilterQuery("id:" + id);
        }
        solrQuery.addFilterQuery("type_s:" + "MyTestBean");
        if (value != null) {
            solrQuery.addFilterQuery("value:" + value);
        }

        QueryResponse queryResponse = server.query(solrQuery);

        List<MyTestBean> beans = queryResponse.getBeans(MyTestBean.class);

        return beans;

    }


    public static class MyTestBean implements Serializable {

        private static final long serialVersionUID = 1L;

        @Field("id")
        private String id;

        @Field("type_s")
        private String type;

        @Field("value_s")
        private String value;

        @Field("created_dt")
        private Date createdDate;

        @Field("_version_")
        private Long _version_;

        public MyTestBean() {

        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public Date getCreatedDate() {
            return createdDate;
        }

        public void setCreatedDate(Date createdDate) {
            this.createdDate = createdDate;
        }

        public Long get_version_() {
            return _version_;
        }

        public void set_version_(Long _version_) {
            this._version_ = _version_;
        }

        @Override
        public String toString() {
            return "MyTestBean [id=" + id + ", type=" + type + ", value=" + value + ", createdDate="
+ createdDate
                    + ", _version_=" + _version_ + "]";
        }

    }

}
{code}
{panel}
                
> Rollback does not work correctly with tlog and optimistic concurrency updates
> -----------------------------------------------------------------------------
>
>                 Key: SOLR-4733
>                 URL: https://issues.apache.org/jira/browse/SOLR-4733
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 4.2.1
>         Environment: Ubuntu 12.04.2 LTS
>            Reporter: Mark S
>              Labels: solrj
>
> When using the updateLog, attempting to rollback atomic updates still causes post-rollback
atomic updates to still report a conflict with the version assigned to the update posted prior
to the rollback

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message