-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Versioning writes to Elasticsearch
PostPosted: Thu Mar 09, 2017 9:17 am 
Newbie

Joined: Wed Mar 08, 2017 5:31 am
Posts: 11
Hello,

I could find no mention of version control when using the Elasticsearch backend. Does Hibernate Search use any version checks when indexing documents? If there is version control, how are conflicts resolved? Elasticsearch supports the 'version' and 'version_type' parameter when indexing to either use optimistic concurrency control or rely on an external version number.

I am asking because I am a little worried that concurrent threads updating the same document in separate transactions can easily overwrite each other, leading to missing updates to the index.
Also, if in a single transaction there are multiple updates performed on a document, are those updates merged into one update request when building the batch request to Elasticsearch?

Keep in mind that I aim to use asynchronous worker execution to minimise performance impact.

Thank you in advance!


Top
 Profile  
 
 Post subject: Re: Versioning writes to Elasticsearch
PostPosted: Tue Mar 14, 2017 8:24 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hibernate Search doesn't use versions.

Concurrent threads updating the same entities will benefit from the Transaction and Hibernate Session: updates to Elasticsearch will be applied in the same order as operations get committed on your database.

Essentially the problems you highlight could theoretically happen but only if you allow weak locking semantics on your database; you should be fine when relying on correct isolation levels from the database.

The asynchronous worker should be safe against reorederings as while the operations are "async" relatively to the transaction commit, the event queue which handles them is handled by a single thread which will batch them all periodically, yet still maintaining the same order of operations.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Versioning writes to Elasticsearch
PostPosted: Mon Mar 20, 2017 9:30 am 
Newbie

Joined: Wed Mar 08, 2017 5:31 am
Posts: 11
All right, if I understand correctly since I use the default READ_COMMITTED isolation level, I should be fine. Thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.