[
https://issues.apache.org/jira/browse/LUCENE-5981?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Muir updated LUCENE-5981:
--------------------------------
Attachment: LUCENE-5981.patch
Here's one patch:
* makes CheckIndex take boolean readOnly (disallows modifications if this is
true, otherwise obtains write.lock).
* makes CheckIndex Closeable to release any lock.
* fixed CheckIndex main() to actually call close() on the Directory always.
* and moves main() logic to doMain() so its easier to test without it shutting
down the JVM.
* adds a simple test.
Its a little complicated (yeah the stupid readOnly param) because I thought it
was overkill to require it to obtain write.lock in the "typical" case where you
are not going to let it drop segments. But when you are, its important to make
sure nothing is changing stuff out from under you.
> CheckIndex modifies index without write.lock
> --------------------------------------------
>
> Key: LUCENE-5981
> URL: https://issues.apache.org/jira/browse/LUCENE-5981
> Project: Lucene - Core
> Issue Type: Bug
> Reporter: Robert Muir
> Attachments: LUCENE-5981.patch
>
>
> Instead it asks you nicely to "not do that".
> Due to the way this is implemented, if you choose to drop corrupt segments,
> it should obtain the lock before actually doing any reads too, or it might
> lose more than you think or do other strange stuff.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]