OPENDJ-1116 Introduce abstraction for the changelog DB
Fixed a few bugs (introduced in the previous commits?):
- All code must check that the result of calling ChangeNumberIndexDB.getFirstCNIndexData() and ChangeNumberIndexDB.getLastCNIndexData() are not null (if the DB is empty, or closed, etc.).
- In ReplicationServer.clearGenerationId(), the code could have a side effect if the last entry in the DB was cleared by this method: the lastGeneratedChangeNumber would be allowed to go back!
ChangeNumberIndexDB.java:
Removed getLastChangeNumber().
DraftCNDbHandler.java:
Inlined getLastChangeNumber() to the only remaining method caller ReplicationServer.getChangeNumberIndexDB().
Finally changed the implementation of isEmpty() to something less costly.
DraftCNDbHandlerTest.java:
Inlined getFirstChangeNumber() and getLastChangeNumber().
ReplicationServer.java:
In clearGenerationId(), removed the code changing the value of lastGeneratedChangeNumber: lastGeneratedChangeNumber is not allowed to go backward.
In getChangeNumberIndexDB(), inlined here the code of DraftCNDbHandler.getLastChangeNumber() + removed useless use of MessageBuilder.
In getECLChangeNumberLimits(), added a null check for the result of getLastCNIndexData().
replication.properties:
Added a new error message.
Changed MILD_ERR_DRAFT_CHANGENUMBER_DATABASE_173 to MILD_ERR_CHANGENUMBER_DATABASE_173.
ECLServerHandler.java:
In findCookie(), replaced the DB empty checks by null checks on the return of getFirstCNIndexData() and getLastCNIndexData() since this is purely equivalent.