ModeShape/modeshape — pull request #737 by hchiorean (2013-03-11 14:54:30+00:00)
Title: MODE-1844 - Improved error handling & recovery during startup, so that an exception does not leave the repository in inconsistent state

The original thought for solving this was to use a start-up transaction which could be easily rolled back in case of an exception. However, this is not feasible since the whole point of the REPOSITORY_INFO_DOC was to notify other members in a potential cluster that one node is doing the initialization.

Therefore, using a long-running start-up transaction would not work, the whole point being that the document gets written to the persistent store ASAP.

The solution was to clean-up/improve exception handling and in the case of an unexpected error, remove the above mentioned document, if the node on which the error occurred was the node which started the initialization process.