|
[
Permlink
| « Hide
]
Michael McCandless added a comment - 27/Jul/06 12:34 AM
TAR file containing sources as first cut at implementation. I've also included patch files off revision 425918.
This patch contains the same source changes as my July 26 patch, but this one is done "correctly" as the output of a single top-level "svn diff" command (ie, I ran "svn add ..." locall for the new files). I also added an entry to CHANGES.txt, and corrected newlines on one of the sources.
Has anyone had a chance to look at this patch? This should be fully backwards compatible: old APIs have not changed. This change passes all unit tests, and I added a new test (with 9 test The above I took a look at it a few weeks back. If nobody takes care of it, I'll look at it again and hopefully commit it after I return from vacation in September.
Awesome, thanks Otis! Have a great vacation!
Very nice job Michael... very thorough.
In general, locking & synchronization is something that requires hard review since it's hard to test for correctness, but the thouroughness of your tests increases my confidence. Super-minor improvement while I'm looking at it: could the following + public boolean obtain() throws IOException { As far as backward compatibility, could you speak to Thank you! I agree, locking is sneaky and requires very thorough
review & testing. Nice, I definitely like that more compact version of On FSDirectory.disableLocks, which is a private static boolean set by OOH I do see one difference: in the current code, if you call On SimpleFSLock.obtain, you are correct: I lost the creation of the Thanks for reviewing this! Yeah... those were the slight differences in external behavior I saw.
That doesn't mean it's wrong, but it does mean we should examine if it's OK to change it (or just defer the changes to a later patch...). OK, does anyone have a strong opinion one way or another on these I would lean towards keeping the small change to "setDisabledLocks()". On the second one, I agree we should keep the current behaviour of > I would lean towards keeping the small change to "setDisabledLocks()".
> Meaning, it's only when you create a FSDirectory that the static > "disableLocks" value is checked. I think this is probably OK. In addition to being a little-used method, If one truely wanted locking disabled (for read-only media for example) they would be calling setDisableLocks() before opening an IndexReader anyway. OK, I agree. I've updated the CHANGES.txt to state this small change.
And I've fixed SimpleFSLockFactory to move directory existence checking & creation back into the obtain() method. New patch attached! While updating my patch for 665 according the changes here, I noticed something - I may be wrong here - but it seems to me that until this change, all the actual FS access operations where performed by FSDirectory, using the Directory API.
The new SimpleFSLock and SimpleFSLockFactory also access the FS directly, not through FSDirectory API. That Directory abstraction in Lucene allows to develop Lucene-in-RAM, Lucene-in-DB, etc. It is a nice feature. Guess we can say: "well, now the abstraction is made of two interfaces - Lock and Directory, just make sure you use 'matching' implementations of them." This seems weaker than before. Or, can limit all file access to go through FSDirectory -
With this change, "Directory on DB", "Directory on RAM", etc., still
work correctly. In fact you can completely override the LockFactory behavior by implementing your own "makeLock" in a subclass of Directory if you want to. This change just opens up the freedom to allow you to separately This also opens up the chance for people to work around locking issues I'm working on a LockFactory implementation that uses native OS locks We could (as you're suggesting) indeed extend FSDirectory so that it > We could (as you're suggesting) indeed extend FSDirectory so that it
> provided the low level methods required by a locking implementation, > and then alter SimpleFSLockFactory/NativeFSLockFactory (or make a new > LockFactory) so that all underlying IO is through the FSDirectory instead. Yes, this is exactly (and only) what I am suggesting to consider - to include a Directory member within the LockFactory so that it is clear that any LockFactory implementation operates in the realm of a directory (implementation) and is using it for any actual store accesses. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||