rzezeski/yokozuna — pull request #14 by coderoshi (2013-01-29 21:18:51+00:00)
Title: Files Overwritten on Core Failure

If a Solr Core fails to initialize, or is not up for any reason, and a
ring event comes in then Yokozuna will try to create it because
`yz_index:exists` returns `false` if the Core is not running. In most
cases this is harmless because the index data will not be lost. But
in the case where modifications have been made to files living under
the `instanceDir` they will be lost. This is because Yokozuna will
re-copy the configuration files overwriting any modifications made to
those local to the instance.

## Reproduce

* Run against Yokozuna commit `448fe02b1691b7943dcbdc87df4074d1b1fbde4a`

* Build a Riak rel, `make stage`, and start it

* Create a new index `yz_index:create("foo")`

* Stop Riak

* Edit `rel/riak/data/yz/foo/conf/config.xml` and remove the
`startup="lazy"` from the `ExtractingRequestHandler`.

* Start Riak and tail -f `rel/riak/log/solr-0.log`

* You'll see a failure to load the class and then shortly after a
successful creation of the core

* Reopen `rel/riak/data/yz/foo/conf/config.xml` and you'll see the
`startup="lazy"` is there again.

## Potential Solutions

* Have `yz_index:exists` distinguish between a downed Solr Core and
one that doesn't exist at all. Take different actions depending on
the situation.

* During file copy only overwrite files that don't already exist.

* Same as previous but only overwrite if the source file is newer.