Resolve several issues with the External Changelog with regards to Cookies and changes with updates and purging.
More specifically these changes are resolving the following issues :
OPENDJ-57 - ECL: lastChangeNumber and firstChangeNumber reset to zero when the changelog is purged to empty
OPENDJ-172 - External ChangeLog Cookie varies when searching with an empty cookie. Cookie should be reproducible.
OPENDJ-173 - External ChangeLog cookies content is altered by Change purging and prevents from continuing search with a previous returned cookie.
The changes are multiples and interdependant, hence a single commit.
But :
- The DraftCNDB is now purged but always keep the last record. The firstKey value is updated accordingly.
- The ReplicationDB is purged but always keep the last record before the trimdate.
- If no cookie is specified, the initial cookie is computed from the ReplicationDomain StartState, but keeping only change numbers older than the trimdate.
- Fix a possible issue when searching a ChangeNumber, and a Count record is found, the changeNumber value was not correct.
These changes mostly revert revision 6406 which meant to fix the same issue (cookies would become obsolete and a search using them returns an Unwilling To Perform), but only managed to hide the root cause of the issue.