OPENDJ-1540 (CR-4436) Persistent searches on cn=changelog with changesOnly=true should not return the base changelog entry
I did the following changes:
- Persistent searches on cn=changelog with changesOnly=true no longer return the base changelog entry
- Fixed a functional bug with setting hasSubordinates on the base changelog entry:
-- hasSubordinates must be computed regardless of the search parameters, result can also be cached in memory once and for all
- As a consequence, it means we can immediately return the base changelog entry for initial searches without even looking for any subordinate changelog entries.
- Fixed a race condition when registering persistent searches: first set the cookie in the attachments then register the persistent searches
- implementing numSubordinates() was not required and it might be buggy, so returned -1 instead.
ChangelogBackend.java:
In notifyEntryAdded() (a.k.a. persistent search phase), never return the base changelog entry.
Removed EntrySender and moved all its methods back into ChangelogBackend + stored the MultiDomainServerState cookie as an attachment of the SearchOperation.
Renamed search*() to internalSearch*().
In hasSubordinates(), reimplemented it in a more efficient way + added baseChangelogHasSubordinates() and baseEntryHasSubordinates field to memoize its result.
In numSubordinates(), is not required, so just returned -1 + removed NumSubordinatesSearchOperation.
In registerPersistentSearch(), register the persistent searches after setting the cookie attachment on the search operation
Completed javadocs.
In registerPersistentSearch(), forced changesOnly=true persistent searches to never return the changelog base entry.
Renamed Entry.hasReturnedBaseEntry field to mustReturnBaseEntry to fit the fact the changelog base entry might never be returned + inverted all the boolean expressions related to this field.