Over a million developers have joined DZone.

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

DZone's Guide to

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

· Java Zone ·
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

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.

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}