Repository navigation
Conversation
LuceneIndexManager creates .index-inconsistent at startup and deletes it at a clean shutdown, so finding it at the next start means the index may be incomplete and is rebuilt. deleteIndex() removed every file in the index directory, the marker included. Each time startup replaced the index (marker found, missing index, removed fields, unreadable index) the marker was gone for the rest of the run, so if Roller was stopped during the background rebuild, the next start kept the partial index. deleteIndex() now leaves the marker in place. IndexConsistencyMarkerTest starts on an empty index directory, then starts a second manager without a shutdown and checks that it rebuilds again; it also checks that a clean shutdown removes the marker and the next start does not rebuild. The first case fails on master.
|
I saw this happen on real data while rehearsing an upgrade and rollback on a copy of raibledesigns.com (3,553 entries, MySQL 8.4, Tomcat 11).
So in both rebuild cases a crash during or after the rebuild would have gone unnoticed at the next start, which is what this pull request describes. I haven't run this branch against the same data. |
|
I've now run this branch against the same data, with plain master as a control. Each build went through the same sequence, and I looked in the index directory after each step.
So master reproduces the bug: after one rebuild, a second crash goes unnoticed. With this branch the marker survives the rebuild, the second crash is caught, and a clean shutdown still removes the marker so the next start doesn't rebuild. Search returned the same counts throughout on both builds, and neither logged an error. One limit: this index is small (3,553 entries, under 5 MB) and rebuilds in a few seconds, so my kills landed after the rebuild had finished, not during it. I didn't exercise a crash in the middle of a rebuild. |
snoopdave
left a comment
There was a problem hiding this comment.
PR-Review: no issues. All four index-replacing paths now keep the marker, and the test fails on master. Minor: at startup (LuceneIndexManager.java:131-134) the marker isn't recreated, which is correct only because deleteIndex() now keeps it. A one-line comment there would make that dependency clear.
Startup relies on deleteIndex() keeping the consistency marker, so a rebuild interrupted again still starts over next time. Suggested in review.
|
794edc6 adds the comment at startup: |
LuceneIndexManagercreates.index-inconsistentin the index directory at startup and deletes it inshutdown(). If the marker is there at the next start, the last run ended early and the index is rebuilt.deleteIndex()removed every file in the index directory, the marker included. Startup replaces the index in four cases: the marker was found, the index is missing, it holds removed fields, or it can't be opened. In each of them the marker disappeared for the rest of the run. So if Roller was stopped or crashed during the background rebuild that follows, the next start found no marker, opened the partial index, and kept it until someone deleted the directory by hand.deleteIndex()now skips the marker.IndexConsistencyMarkerTest:shutdown()and checks that it schedules a rebuild again. This fails on master.The other search tests still pass. #261 also changes
LuceneIndexManager, ininitialize()'s catch block rather thandeleteIndex(), so the two shouldn't conflict.