lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cristian Lorenzetto <>
Subject Re: ThreadLocal Transaction
Date Thu, 18 Aug 2016 14:04:12 GMT
it seams more complex the problem. I m trying to reasoning aload :)

if i create a transaction using addDocuments... i suppose all the docs to
persist inside transaction are before in memory. Not always is so.
In addition for a complete isolation inside transaction , there is a aspect
not working.

Isolation might be not only for other transactions but also the current
transaction :

1) the others transactions cannot see the modifications inside until commit
(it is OK)
2) the current transaction can see the modifications before the commit (it
is not working if i suppose the code transaction is not a singularity ).

however for semplicity i consider your solution OK.
incremental modification it is ok using addDocuments, but remains
update/delete commands out these solutions.

Anyway i m trying to go back in the analisys , maybe i didnt undestand
completely transaction in lucene.

Lucene apis seams all thread-safe , so i suppose when i call
commit/rollback,prepareCommit it is associated to actions done by current
Thread else concurrent actions could is right ?
If it is right my reasoning,

if i use


these 4 changes are commited atomically inside a transaction-like and in
the while another thread dont see them until commit.

2016-08-18 13:26 GMT+02:00 Adrien Grand <>:

> What you are suggesting sounds like something that can already be done with
> IndexWriter.addDocuments? (note the final "s") This API ensures that all
> provided documents will become visible at the same time (and with adjacent
> doc ids moreover).
> Le jeu. 18 août 2016 à 10:52, Cristian Lorenzetto <
>> a écrit :
> > I d like to create a class for creating a classical transaction.
> > Overviewing lucene api , i can see commit/rollback/prepareCommit are just
> > for the entire index not for partial modifications.
> >
> > So i thought i could to use api writer.addIndexes as support:
> > when i open a transaction i could
> > create a temporary lucene directory ....
> > make all persistent operation on it.
> >
> > reading operation inside transaction using a special reader using 2
> indexes
> > (main+temporary). If i remember correctly there is in lucene this special
> > wrapper.
> > when there is a threadlocal commit i copy directory (addIndexes api) to
> > main directory , and i delete the temporary dir.
> >
> > What do you think? can it work?
> > lucene api are thread safe?
> >

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message