You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Dawid Weiss (JIRA)" <ji...@apache.org> on 2018/07/20 10:15:00 UTC
[jira] [Commented] (LUCENE-8415) Clean up Directory contracts
(write-once, no reads-before-write-completed)
[ https://issues.apache.org/jira/browse/LUCENE-8415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16550614#comment-16550614 ]
Dawid Weiss commented on LUCENE-8415:
-------------------------------------
Ensuring {{testReadFileOpenForWrites}} works would require moving some bookkeeping to Directory classes (and IndexOutput implementations). A concurrent hash map of open outputs and an update on IndexOutput.close(), essentially.
We have a few options.
Make it a contractual requirement (then we have to implement this bookkeeping for true filesystems since they allow readers over a writer for the same process). Make this an assertion-mode only check (implement book keeping, but don't run it except for assertion-enabled runs). Finally, don't make any checks at all, but give the contractual liberty for Directory implementations to throw AccessDeniedException in {{openInput}} if a file is still open.
The offending directory implementations right now are:
{code}
- org.apache.lucene.store.TestTrackingDirectoryWrapper.testReadFileOpenForWrites
[junit4] - org.apache.lucene.store.TestMmapDirectory.testReadFileOpenForWrites
[junit4] - org.apache.lucene.store.TestSimpleFSDirectory.testReadFileOpenForWrites
[junit4] - org.apache.lucene.store.TestNRTCachingDirectory.testReadFileOpenForWrites
[junit4] - org.apache.lucene.store.TestFileSwitchDirectory.testReadFileOpenForWrites
[junit4] - org.apache.lucene.store.TestRAMDirectory.testReadFileOpenForWrites
[junit4] - org.apache.lucene.store.TestNIOFSDirectory.testReadFileOpenForWrites
[junit4] - org.apache.lucene.store.TestMultiMMap.testReadFileOpenForWrites
[junit4] - org.apache.lucene.store.TestFilterDirectory.testReadFileOpenForWrites
{code}
> Clean up Directory contracts (write-once, no reads-before-write-completed)
> --------------------------------------------------------------------------
>
> Key: LUCENE-8415
> URL: https://issues.apache.org/jira/browse/LUCENE-8415
> Project: Lucene - Core
> Issue Type: Improvement
> Reporter: Dawid Weiss
> Assignee: Dawid Weiss
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Created a PR here for early review.
> https://github.com/apache/lucene-solr/pull/424
> I changed:
> * the wording in Directory documentation to be a bit more formalized about what rules a Directory should obey (and users expect).
> * modified the test framework to verify the above in mock classes.
> Currently a number of Directory implementations fail the {{testReadFileOpenForWrites}} test that I added, so I'll keep working on that.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org