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 Chetra Tep <ch...@gmail.com> on 2018/10/03 08:33:02 UTC

How to do rollback from solrclient using python

Hi Solr team,
Current I am creating a python application that accesses to solr server.
I have to handle updating document and need a rollback function.
I want to send a rollback request whenever exception occurs.
first I try sth like this from curl command :
curl http://localhost:8983/solr/mysolr/update?command=rollback
and I also try
curl http://localhost:8983/solr/mysolr/update?rollback true

but it doesn't work. whenever there is a commit the request still updates
on the server.

I also try to submit xml document  <rollback/>, but it doesn't work, too.

Could you guide me how to do this?  I haven't found much documentation
about this on the internet.

Thanks you in advance.
Best regards,
Chetra

Re: How to do rollback from solrclient using python

Posted by Emir Arnautović <em...@sematext.com>.
Hi Chetra,
In addition to what Jason explained, rollbacks do not work in Solr Cloud.

Thanks,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 3 Oct 2018, at 14:45, Jason Gerlowski <ge...@gmail.com> wrote:
> 
> Hi Chetra,
> 
> The syntax that you're looking for is "/solr/someCoreName/update?rollback=true".
> 
> But I'm afraid Rollback might not be quite what you think it is.  You
> mentioned: "but it doesn't work, whenever there is a commit the
> request still updates on the server".  Yes, that is the expected
> behavior with rollbacks.  Rollbacks reset your index to the last
> commit point.  If there was a commit right before a rollback, the
> rollback will have no effect.
> 
> One last point is that you should be very careful using rollbacks.
> Rollbacks are going to undo all changes to your index since the last
> commit.  If you have more than one client thread changing documents,
> this can be very dangerous as you will reset a lot of things you
> didn't intend.  Even if you can guarantee that there's only one client
> making changes to your index, and that client is itself
> single-threaded, the result of a rollback is still indeterminate if
> you're using server auto-commit settings.  The client-triggered
> rollback will occasionally race against the server-triggered commit.
> Will your doc changes get rolled back?  They will if the rollback
> happens first, but if the commit happens right before the rollback,
> your rollback won't do anything!  Anyways rollbacks have their place,
> but be very careful when using them!
> 
> Hope that helps,
> 
> Jason
> On Wed, Oct 3, 2018 at 4:41 AM Chetra Tep <ch...@gmail.com> wrote:
>> 
>> Hi Solr team,
>> Current I am creating a python application that accesses to solr server.
>> I have to handle updating document and need a rollback function.
>> I want to send a rollback request whenever exception occurs.
>> first I try sth like this from curl command :
>> curl http://localhost:8983/solr/mysolr/update?command=rollback
>> and I also try
>> curl http://localhost:8983/solr/mysolr/update?rollback true
>> 
>> but it doesn't work. whenever there is a commit the request still updates
>> on the server.
>> 
>> I also try to submit xml document  <rollback/>, but it doesn't work, too.
>> 
>> Could you guide me how to do this?  I haven't found much documentation
>> about this on the internet.
>> 
>> Thanks you in advance.
>> Best regards,
>> Chetra


Re: How to do rollback from solrclient using python

Posted by Jason Gerlowski <ge...@gmail.com>.
Hi Chetra,

The syntax that you're looking for is "/solr/someCoreName/update?rollback=true".

But I'm afraid Rollback might not be quite what you think it is.  You
mentioned: "but it doesn't work, whenever there is a commit the
request still updates on the server".  Yes, that is the expected
behavior with rollbacks.  Rollbacks reset your index to the last
commit point.  If there was a commit right before a rollback, the
rollback will have no effect.

One last point is that you should be very careful using rollbacks.
Rollbacks are going to undo all changes to your index since the last
commit.  If you have more than one client thread changing documents,
this can be very dangerous as you will reset a lot of things you
didn't intend.  Even if you can guarantee that there's only one client
making changes to your index, and that client is itself
single-threaded, the result of a rollback is still indeterminate if
you're using server auto-commit settings.  The client-triggered
rollback will occasionally race against the server-triggered commit.
Will your doc changes get rolled back?  They will if the rollback
happens first, but if the commit happens right before the rollback,
your rollback won't do anything!  Anyways rollbacks have their place,
but be very careful when using them!

Hope that helps,

Jason
On Wed, Oct 3, 2018 at 4:41 AM Chetra Tep <ch...@gmail.com> wrote:
>
> Hi Solr team,
> Current I am creating a python application that accesses to solr server.
> I have to handle updating document and need a rollback function.
> I want to send a rollback request whenever exception occurs.
> first I try sth like this from curl command :
> curl http://localhost:8983/solr/mysolr/update?command=rollback
> and I also try
> curl http://localhost:8983/solr/mysolr/update?rollback true
>
> but it doesn't work. whenever there is a commit the request still updates
> on the server.
>
> I also try to submit xml document  <rollback/>, but it doesn't work, too.
>
> Could you guide me how to do this?  I haven't found much documentation
> about this on the internet.
>
> Thanks you in advance.
> Best regards,
> Chetra