OPENDJ-2154 (CR-7325) search on cn=monitor changenumber index database times out
With a very large changelogDb, when issuing queries on cn=monitor, the code counts the number of entries in the changeNumberIndexDb. In order to do the count, it cursors through the changeNumberIndexDb, decoding each and every change in the changeNumberIndexDb.
This is a killer with very large changelogDb.
Any query on cn=monitor with very large file-based changelogDb is now at risk to timeout.
JE has a direct API to count the number of records in a tree.
File based changelog does not have such API, thus, a first implementation was to count the changes by cursoring through the changeNumberIndexDb.
However, since the changeNumberIndexDb purge has been reimplemented, there are no longer "holes" in the changeNumbers. As a consequence, a simple way to count the number of changes is to do "newestChangeNumber - oldestChangeNumber".
FileChangeNumberIndexDB.java:
In DbMonitorProvider.getMonitorData(), changed the code to make a diff between first and last changeNumber.
Introduced ChangeNumberType enum to get rid of unreadable boolean parameter.
Extracted toAttribute() from createChangeNumberAttribute().