[
https://issues.apache.org/jira/browse/LUCENE-2779?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yonik Seeley updated LUCENE-2779:
---------------------------------
Attachment: TestCHM.java
Note: there is an important change of semantics to listAll() - it can now "lie".
Previously, it always gave an accurate listing of files as they existed at some
point in time. Now, you can get back a list of files that never really existed
together at any point in time (i.e. the lie).
I'm OK with these new semantics because we have the same limitation already on
FSDirectory. This issue manifested in LUCENE-2585, so we should keep in mind
that we could now also see this with RAMDirectory.
Here's a test program that demonstrates the issue by having a single writer
adding 5,-5 to a map before removing the old 4,-4, etc. At any point in time,
there will always be a pair of numbers. The single reader looks for this and
spits out an error if not found.
output from my box:
iterations=1000000 errors=4120 minLen=0 maxLen=10
> Use ConcurrentHashMap in RAMDirectory
> -------------------------------------
>
> Key: LUCENE-2779
> URL: https://issues.apache.org/jira/browse/LUCENE-2779
> Project: Lucene - Java
> Issue Type: Improvement
> Components: Store
> Reporter: Shai Erera
> Assignee: Shai Erera
> Priority: Minor
> Fix For: 3.1, 4.0
>
> Attachments: LUCENE-2779.patch, LUCENE-2779.patch, TestCHM.java
>
>
> RAMDirectory synchronizes on its instance in many places to protect access to
> map of RAMFiles, in addition to updating the sizeInBytes member. In many
> places the sync is done for 'read' purposes, while only in few places we need
> 'write' access. This looks like a perfect use case for ConcurrentHashMap
> Also, syncing around sizeInBytes is unnecessary IMO, since it's an AtomicLong
> ...
> I'll post a patch shortly.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]