this is mostly revert of my last year commit 101e4e4 from 27.03.13 because the change introduced deadlock (IDEA-118827) since clearing stub index needs write lock and we can have read lock already from processingStubs.  The reverted change introduced better handling of index corruption: do clearIndex at checkRebuild directly. In current code we only advance index version from checkRebuild and proceed with clear index later on edt (with progress) as it was before.