oracle / opengrok

OpenGrok is a fast and usable source code search and cross reference engine, written in Java
http://oracle.github.io/opengrok/
Other
4.3k stars 739 forks source link

tidy IndexCheck and improve its testing #4442

Closed vladak closed 9 months ago

vladak commented 9 months ago

This change primarily converts the IndexCheck class from static/utility class to plain class. This allowed to use Mockito for testing normally. While there, I folded the parallelized project checking done previously in WebappListener to the class. This resulted in reworking the way how errors are propagated. For index check errors, the result is single exception carrying the list of source root paths corresponding to the indexes that failed the test. For I/O exceptions, just one is propagated.

There are 2 main use cases for the index check:

  1. done per project in the Docker image
  2. done for all indexes (projects enabled or not) during webapp startup

The thread handling in IndexCheck uses common per-class-instance pool for the project parallel processing. There is another pool used when index check is done for definitions. The latter pool comes from IndexParallelizer so even though multiple projects are checked in parallel, the CPU utilization will be bounded by that.