Mitch Pronschinske is the Lead Research Analyst at DZone. Researching and compiling content for DZone's research guides is his primary job. He likes to make his own ringtones, watches cartoons/anime, enjoys card and board games, and plays the accordion. Mitch is a DZone Zone Leader and has posted 2577 posts at DZone. You can read more from them at their website. View Full User Profile

New Solr 3.6, 4.x Feature: Checking Index Locks at Startup

  • submit to reddit
An issue related to index locks in Solr during startups was patched for the 3.6 branch and 4.x trunk.  In current versions of Apache Solr, when you didn't use an option called "unlockOnStartup," you wouldn't know if your index was locked until a user tried adding a document to it.  

SOLR-3156 was recently given a patch by Luca Cavanna, which was committed by Martijn van Groningen:  

When using simple or native lockType and the application server is not shutdown properly (kill -9), you don't notice problems until someone tries to add or delete a document. In fact, you get errors every time Solr opens a new IndexWriter on the "locked" index. I'm aware of the unlockOnStartup option, but I'd prefer to know and act properly when there's a lock, and I think it would be better to know on startup, since Solr is not going to work properly.

So, you can still use that unlockOnStartup option to make sure that your index is automatically unlocked, but in 3.6 and 4x you won't have to fly blind on startup if you don't have that option enabled.  If the new patch notifies you that your index is locked, you will have to make sure that you unlock the index manually so that Solr will start correctly.