1 Reply Latest reply on Dec 9, 2015 9:02 AM by Horia Chiorean

    Avoiding indexing problems after non-planned shutdown

    Guillem Folch Newbie



      We are using Modeshape 4.4.0 embeded in our Application (Web Application instaled in an Application Server like TomEE, Websphere or Weblogic) and we've observed some problems with the index after a non-planned shutdown.

      The process is the following:

      1. Start a clean system with empty repository. We have some indexes defined for documents.
      2. Add Document 1. We can search for Document 1.
      3. Add Document 2. We can search for Document 1 and Document 2.
      4. Modify document 2. No problem.
      5. Do a non-planned shutdown (if we use TomEE, just close the window where JVM is executing).
      6. After restarting TomEE and our application we still can search for Document 1 and Document 2.
      7. Add Document 3. Document 1 has disapear. We only can see Document 2 and Document 3.


      The problem disapear if we do a proper shutdown of TomEE in step 5. So I guess that something is corrupted in the Index when we don't do a proper shutdown.

      Of course, we have to avoid non-planned shutdowns closing directly TomEE, however my question is, can we do something to minimize the probablity that this error happens? Currently happens always, even if the system is not doing anything (I mean, the system finished all operations and nobody is accessing the repository).




      Note: If we reindex, the error also disapears.

        • 1. Re: Avoiding indexing problems after non-planned shutdown
          Horia Chiorean Master

          In 4.4.0 the only index provider you have if MapDB based. This in turn, if there's an unexpected failure and the VM is terminated abruptly has a very high chance of corrupting the indexes.


          There are several changes in ModeShape 4.5.0.Final (http://docs.jboss.org/modeshape/4.5.0.Final/release.html) which can help mitigate this problem:

          • use Lucene instead of MapDB (which should have better fault tolerance) and/or
          • enable the local event journal and use incremental re-indexing (see release notes). Since the journal is also MapDB based, in case of an unexpected shutdown it may be corrupted as well, but none-the-less it's an option worth investigating.

          4.5.0.Final also has some improvements to the LocalIndexProvider by adding VM shutdown hooks which commit the in-memory index information (however depending on how abrupt your termination is, shutdown hooks may not be invoked at all).


          So my suggestion is first simply using 4.5.0.Final and see whether the shutdown hooks are enough for your case. If they're not, you should try one of the above options.

          1 of 1 people found this helpful