You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/12/12 09:53:26 UTC

[GitHub] [lucene] romseygeek commented on issue #11913: lucene-replicator PrimaryNode unsafely publishes reference during construction

romseygeek commented on issue #11913:
URL: https://github.com/apache/lucene/issues/11913#issuecomment-1346186792

   This isn't an area of the code I know well, but I think part of the problem here is that the IndexWriter lifecycle is entirely under the management of the PrimaryNode (e.g. calling `close` on the PrimaryNode also closes the IndexWriter), but PrimaryNode takes the writer as a constructor parameter rather than building it itself, which means it's available to outside classes before construction is finished.  So maybe we should instead change the PrimaryNode constructor to take a Directory and IndexWriterConfig, and build the IndexWriter inside the constructor method? And then the IndexWriter can be exposed on a method on the PrimaryNode but it won't be available to outside consumers until PrimaryNode has finished building.
   
   cc @mikemccand who actually understands this thing :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org