Tomcat 8 supports parallel deployment which means two versions of the same application can be active and Tomcat handles connections: users having a session are redirected to old app version and new users with no session are redirected to new app version. Once all sessions from old app are closed / expired, that version can be removed.
Doing deploy that way you’re able to have zero downtime but… Here comes Lucene with lock files making it impossible.
I did a setup on my Ubuntu server on Virtual Box and what happens is that first application (old) creates lock file for Lucene.
When new version is deployed, it tries to open Lucene indexes and it finds lock file and this is the end of the story with parallel deploy (for me).
I use Hibernate for almost any query I have on my project except for autocomplete which is pretty complex and I implemented it as a stored procedure to be able to use LIKE operators in a complex query that is used by my custom autocomplete.
Is there any other way to use parallel deploy with Hibernate Search / Lucene?
The idea that comes to my mind is to add some admin option (API REST endpoint) to put old application into read only mode which would disable any writes to DB & Lucene index and that would release lock file (my knowledge of Lucene is not good enough to be sure if this is possible) - after that lock, the deploy should be possible and Lucene could be used by new app.
And thoughts on this?
Thanks!