<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">+1<div><br><div><div>On 24 sept. 09, at 17:49, Manik Surtani wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Minorly off topic, but rather than working with patches, do we want this Directory impl in source control somewhere?<div><br></div><div>Being dependent on LGPL, it won't be accepted into Lucene's contribs. If it doesn't depend on any Hibernate Search code, I could host it in Infinispan's SVN repo... </div><div><br></div><div><br></div><div><div>On 23 Sep 2009, at 13:58, Łukasz Moreń wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">I agree that Infinispan case is not much different from RamDirectory. The major difference is that in RD (also FileDirectory) changes are not batched like in ID. If I do not wrap changes in InfinispanDirectory(simple remove tx.begin() from obtain() method and tx.commit() from release() in InfinispanLock), and immediately commit every change made by IW it works well. Hovewer it makes indexing really slower, because of frequent replication to other nodes.<br> Sanne it's good remark that IW commit is kind of flush.<br><br>I've attached patch with InfinispanDirectory, failing test is testDirectoryWithMultipleThreads in InfinispanDirectoryTest class. It fails randomly. I think problem is Infinispan commit on lockRelease() in org.apache.lucene.index.IndexWriter (line 1658) is after IW commit() (line 1654).<br> <br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">Is it because, the IndexWriter only clean files if no indexReaders are reading them (how would that be detected)?<br> </blockquote><div>It can happen if IndexWriter clean file, and IndexReader try to access that cleaned file. <br></div><br><div class="gmail_quote">2009/9/23 Sanne Grinovero <span dir="ltr"><<a href="mailto:sanne.grinovero@gmail.com">sanne.grinovero@gmail.com</a>></span><br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I agree It should work the same way; The IndexWriter cleans files<br> whenever it likes to, it doesn't try to detect readers, and this<br> shouldn't have any effect on the working of readers.<br> The IndexReader opens the "SegmentsInfo" first, and immediately<br> after** gets a reference to the segments listed in this SegmentsInfo.<br> No IndexWriter will ever change an existing segment, only add new<br> files or eventually delete old ones (segments merge,optimize).<br> The deletion of segments is the interesting subject: when using Files<br> it uses "delete at last close", which works because the IR needing it<br> have it opened already**; when using the RAMDirectory they have a<br> reference preventing garbage collection.<br> <br> ( the two "**" are assuming the same event occurred correctly,<br> otherwise an exception is thrown at opening)<br> <br> When using Infinispan it shouldn't be much different than the<br> RAMDirectory? so even if the needed segment is deleted, the IR holds a<br> reference to the Java object locally since it was opened.<br> <br> Łukcasz, do you have some failing test?<br> <br> Sanne<br> <br> 2009/9/23 Emmanuel Bernard <<a href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>>:<br> <div><div></div><div class="h5">> Conceptually I don't understand why it does work in a pure file system<br> > directory (ie IndexReader can go and process queries with the IndexWriter<br> > goes about its business) and not when using Infinispan.<br> > Is it because, the IndexWriter only clean files if no indexReaders are<br> > reading them (how would that be detected)?<br> > On 22 sept. 09, at 20:46, Łukasz Moreń wrote:<br> ><br> > I need to provide this same lifecycle for IndexWriter as for Infinispan tx -<br> > IW is created: tx is started, IW is commited: tx is commited. It assures<br> > that IndexReader doesn't read old data from directory.<br> > Infinispan transaction can be started when IW acquires the lock, but its<br> > commit on IW lock release, as it is done so far, causes a problem:<br> ><br> > index writer close {<br> > index writer commit(); //changes are visible for IndexReaders<br> ><br> > //Index reader starts reading here, i.e. tries to access file "A"<br> ><br> > index writer lockRelease(); //changes in Infinispan directory are<br> > commited, file "A" was removed, IndexReader cannot find it and crashes<br> > }<br> ><br> > I think Infinispan tx have to be commited just before IW commit, and the<br> > problem is where to put in code.<br> ><br> > W dniu 22 września 2009 18:24 użytkownik Emmanuel Bernard<br> > <<a href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>> napisał:<br> >><br> >> Can you explain in more details what is going on.<br> >> Aside from that Workspace has been Sanne's baby lately so he will be the<br> >> best to see what design will work in HSearch. That being said, I don't like<br> >> the idea of subclassing / overriding very much. In my experience, it has<br> >> lead to more bad and unmaintainable code than anything else.<br> >> On 22 sept. 09, at 02:16, Łukasz Moreń wrote:<br> >><br> >> Hi,<br> >><br> >> Thanks for explanation.<br> >> Maybe better I will concentrate on the first release and postpone<br> >> distributed writing.<br> >><br> >> There is already LockStrategy that uses Infinispan. With using it I was<br> >> wrapping changes made by IndexWriter in Infinispan transaction, because of<br> >> performance reasons -<br> >> on lock obtaining transaction was started, on lock release transaction was<br> >> commited. Hovewer Ispn transaction commit on lock release is not good idea<br> >> since IndexWriter calls index commit before lock is released(and ispn<br> >> transaction is committed).<br> >> I was thinking to override Workspace class and getIndexWriter(start<br> >> infinispan tx), commitIndexWriter (commit tx) methods to wrap IndexWrite<br> >> lifecycle, but this needs few other changes. Some other ideas?<br> >><br> >> Cheers,<br> >> Lukasz<br> >><br> >> 2009/9/21 Sanne Grinovero <<a href="mailto:sanne.grinovero@gmail.com">sanne.grinovero@gmail.com</a>><br> >>><br> >>> Hi Łukasz,<br> >>> you've rightful concerns, because the way the IndexWriter tries to<br> >>> achieve the lock<br> >>> that will bring some trouble; As far as I remember we decided in this<br> >>> first release<br> >>> to avoid multiple writer nodes because of this reasons<br> >>> (that's written in your docs?)<br> >>><br> >>> Actually it shouldn't be very hard to do, as the LockStrategy is<br> >>> pluggable (see changes from HSEARCH-345)<br> >>> and you could implement one delegating to an Infinispan eager lock on<br> >>> some key,<br> >>> like the default LockStrategy takes a file lock in the index directory.<br> >>><br> >>> Maybe it's simpler to support this distributed writing instead of<br> >>> sending the queue to some single<br> >>> (elected) node? Would be cool, as the Document Analysis effort would<br> >>> be distributed,<br> >>> but I have no idea if this would be more or less efficient than a<br> >>> single node writing; it could<br> >>> bring some huge data transfers along the wire during segments merging<br> >>> (basically fetching<br> >>> the whole index data at each node performing a segment merge); maybe<br> >>> you'll need to<br> >>> play with IndexWriter settings (<br> >>><br> >>> <a href="http://docs.jboss.org/hibernate/stable/search/reference/en/html_single/#lucene-indexing-performance" target="_blank">http://docs.jboss.org/hibernate/stable/search/reference/en/html_single/#lucene-indexing-performance</a><br> >>> )<br> >>> probably need to find the sweet spot for "merge_factor".<br> >>> I just saw now that MergePolicy is now re-implementable, but I hope<br> >>> that won't be needed.<br> >>><br> >>> Sanne<br> >>><br> >>> 2009/9/21 Łukasz Moreń <<a href="mailto:lukasz.moren@gmail.com">lukasz.moren@gmail.com</a>>:<br> >>> > Hi,<br> >>> ><br> >>> > I'm wondering if it is reasonable to have multiple threads/nodes that<br> >>> > modifies indexes in Lucene Directory based on Infinispan? Let's assume<br> >>> > that<br> >>> > two nodes try to update index in this same time. First one creates<br> >>> > IndexWriter and obtains<br> >>> > write lock. There is high propability that second node throws<br> >>> > LockObtainFailedException (as one IndexWriter is allowed on single<br> >>> > index)<br> >>> > and index is not modified. How is that? Should be always only one node<br> >>> > that<br> >>> > makes changes in<br> >>> > the index?<br> >>> ><br> >>> > Cheers,<br> >>> > Lukasz<br> >>> ><br> >>> > W dniu 15 września 2009 01:39 użytkownik Łukasz Moreń<br> >>> > <<a href="mailto:lukasz.moren@gmail.com">lukasz.moren@gmail.com</a>> napisał:<br> >>> >><br> >>> >> Hi,<br> >>> >><br> >>> >> With using JMeter I wanted to check if Infinispan dir does not crash<br> >>> >> under<br> >>> >> heavy load in "real" use and check performance in comparison with<br> >>> >> none/other<br> >>> >> directories.<br> >>> >> However appeared problem when multiple IndexWriters tries to modify<br> >>> >> index<br> >>> >> (test InfinispanDirectoryTest) - random deadlocks, and Lucene<br> >>> >> exceptions.<br> >>> >> IndexWriter tries to access files in index that were removed before.<br> >>> >> I'm<br> >>> >> looking into it, but not having good idea.<br> >>> >><br> >>> >> Concerning the last part, I think similar thing is done in<br> >>> >> InfinispanDirectoryProviderTest. Many threads are making changes and<br> >>> >> searching (not checking if db is in sync with index).<br> >>> >> If threads finish their work, with Lucene query I'm checking if index<br> >>> >> contains as many results as expected. Maybe you meant something else?<br> >>> >> Would be good to run each node in different VM.<br> >>> >><br> >>> >>> Great ! Looking forward to it. What state are things in at the moment<br> >>> >>> if I want to play around with it ?<br> >>> >><br> >>> >> Should work with with one master(updates index) and one many slave<br> >>> >> nodes<br> >>> >> (sends changes to master). I tried with one master and one slave (both<br> >>> >> with<br> >>> >> jms and jgroups backend) and worked ok. Still fails if multiple nodes<br> >>> >> want<br> >>> >> to modify index.<br> >>> >><br> >>> >> I've attached patch with current version.<br> >>> >><br> >>> >> Cheers,<br> >>> >> Łukasz<br> >>> >><br> >>> >> 2009/9/13 Michael Neale <<a href="mailto:michael.neale@gmail.com">michael.neale@gmail.com</a>><br> >>> >>><br> >>> >>> Great ! Looking forward to it. What state are things in at the moment<br> >>> >>> if I want to play around with it ?<br> >>> >>><br> >>> >>> Sent from my phone.<br> >>> >>><br> >>> >>> On 13/09/2009, at 7:26 PM, Sanne Grinovero<br> >>> >>> <<a href="mailto:sanne.grinovero@gmail.com">sanne.grinovero@gmail.com</a>><br> >>> >>> wrote:<br> >>> >>><br> >>> >>> > 2009/9/12 Michael Neale <<a href="mailto:michael.neale@gmail.com">michael.neale@gmail.com</a>>:<br> >>> >>> >> That does sounds pretty cool. Would be nice if the lucene indexes<br> >>> >>> >> could scale along with how people will want to use infinispan.<br> >>> >>> >> Probably worth playing with.<br> >>> >>> ><br> >>> >>> > Sure, this is the goal of Łukasz's work; We know compass has<br> >>> >>> > some good Directories, but we're building our own as one based<br> >>> >>> > on Infinispan is not yet available.<br> >>> >>> ><br> >>> >>> >><br> >>> >>> >> Sent from my phone.<br> >>> >>> >><br> >>> >>> >> On 13/09/2009, at 8:37 AM, Jeff Ramsdale <<a href="mailto:jeff.ramsdale@gmail.com">jeff.ramsdale@gmail.com</a>><br> >>> >>> >> wrote:<br> >>> >>> >><br> >>> >>> >>> I'm afraid I haven't followed the Infinispan-Lucene<br> >>> >>> >>> implementation<br> >>> >>> >>> closely, but have you looked at the Compass Project?<br> >>> >>> >>> (<a href="http://www.compass-project.org/overview.html" target="_blank">http://www.compass-project.org/overview.html</a>) It provides a<br> >>> >>> >>> simplified interface to Lucene (optional) as well as Directory<br> >>> >>> >>> implementations built on Terracotta, Gigaspaces and Coherence.<br> >>> >>> >>> The<br> >>> >>> >>> latter, in particular, might be a useful guide for the Infinispan<br> >>> >>> >>> implementation. I believe it's mature enough to have solved many<br> >>> >>> >>> of<br> >>> >>> >>> the most difficult problems of implementing Directory on a<br> >>> >>> >>> distributed<br> >>> >>> >>> Map.<br> >>> >>> >>><br> >>> >>> >>> If someone has any experience with Compass (particularly it's<br> >>> >>> >>> Directory implementations) I'd be interested in hearing about<br> >>> >>> >>> it...<br> >>> >>> >>> It's Apache 2.0 licensed, btw.<br> >>> >>> >>><br> >>> >>> >>> -jeff<br> >>> >>> >>> _______________________________________________<br> >>> >>> >>> infinispan-dev mailing list<br> >>> >>> >>> <a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br> >>> >>> >>> <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br> >>> >>> >> _______________________________________________<br> >>> >>> >> infinispan-dev mailing list<br> >>> >>> >> <a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br> >>> >>> >> <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br> >>> >>> >><br> >>> >>> ><br> >>> >>> > _______________________________________________<br> >>> >>> > infinispan-dev mailing list<br> >>> >>> > <a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br> >>> >>> > <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br> >>> >>><br> >>> >>> _______________________________________________<br> >>> >>> infinispan-dev mailing list<br> >>> >>> <a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br> >>> >>> <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br> >>> ><br> >>> ><br> >><br> >><br> ><br> ><br> ><br> </div></div></blockquote></div><br> <span><InfinispanDirectoryProvider_22_09_2009.patch></span>_______________________________________________<br>infinispan-dev mailing list<br><a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a></blockquote></div><br><div> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>--</div><div>Manik Surtani</div><div><a href="mailto:manik@jboss.org">manik@jboss.org</a></div><div>Lead, Infinispan</div><div>Lead, JBoss Cache</div><div><a href="http://www.infinispan.org">http://www.infinispan.org</a></div><div><a href="http://www.jbosscache.org">http://www.jbosscache.org</a></div><div><br></div></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline"> </div> <br></div>_______________________________________________<br>infinispan-dev mailing list<br><a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/infinispan-dev</blockquote></div><br></div></body></html>