apache / lucene

Apache Lucene open-source search software
https://lucene.apache.org/
Apache License 2.0
2.64k stars 1.02k forks source link

DocValuesConsumer should implement closeable and release resource in close instead of during finish / flush [LUCENE-3689] #4763

Open asfimport opened 12 years ago

asfimport commented 12 years ago

DocValuesConsumer currently doesn't have a close method and releases its resources during finish / flush. This is confusing, makes debugging more complex and mixes concerns. DocValuesConsumer should impl. Closeable and users should release resources safely.


Migrated from LUCENE-3689 by Simon Willnauer (@s1monw), updated May 09 2016 Attachments: LUCENE-3689.patch

asfimport commented 12 years ago

Simon Willnauer (@s1monw) (migrated from JIRA)

here is a patch that adds closeable to DocValuesConsumer and cleans up resource / stream management. I also renamed finish to flush since thats what it really is.

asfimport commented 12 years ago

Robert Muir (@rmuir) (migrated from JIRA)

I'm not sure we should rename finish to flush. I havent looked at how docvalues is using this, but I think it should be consistent with the other per-document codec APIs (stored fields and term vectors)

really they should flush on close(). finish is defined as just a hook for verification that you actually wrote the # of docs that the caller thought it wrote:

  /** Called before {`@link` #close()}, passing in the number
   *  of documents that were written. Note that this is 
   *  intentionally redundant (equivalent to the number of
   *  calls to {`@link` #startDocument(int)}, but a Codec should
   *  check that this is the case to detect the JRE bug described 
   *  in #2359. */
asfimport commented 11 years ago

Steven Rowe (@sarowe) (migrated from JIRA)

Bulk move 4.4 issues to 4.5 and 5.0

asfimport commented 10 years ago

Uwe Schindler (@uschindler) (migrated from JIRA)

Move issue to Lucene 4.9.