// b/ : changelog is late .. let's traverse the changelogDb
// The following loop allows to loop until being on the same cn
// in the 2 dbs
// replogcn : the oldest change from the changelog db
ChangeNumber cnFromChangelogDb =
oldestChange.getUpdateMsg().getChangeNumber();
String dnFromChangelogDb = domainCtxts[iDom].rsd.getBaseDn();
while (true)
{
if (!isEndOfDraftCNReached)
{
// we did not reach yet the end of the DraftCNdb
// the next change from the DraftCN db
ChangeNumber cnFromDraftCNDb = draftCNDbIter.getChangeNumber();
String dnFromDraftCNDb = draftCNDbIter.getServiceID();
// are replogcn and DraftCNcn should be the same change ?
int areCNEqual = cnFromChangelogDb.compareTo(cnFromDraftCNDb);
int areDNEqual = dnFromChangelogDb.compareTo(dnFromDraftCNDb);
if (debugEnabled())
TRACER.debugInfo("getNextECLUpdate generating draftCN "
+ " comparing the 2 db DNs :"
+ dnFromChangelogDb + "?=" + cnFromChangelogDb
+ " timestamps:" + new Date(cnFromChangelogDb.getTime())
+ " ?older" + new Date(cnFromDraftCNDb.getTime()));
if ((areDNEqual==0) && (areCNEqual==0))
{
// same domain and same CN => same change
// assign the DraftCN found to the change from the changelogdb
if (debugEnabled())
TRACER.debugInfo("getNextECLUpdate generating draftCN "
+ " assigning draftCN=" + draftCNDbIter.getDraftCN()
+ " to change=" + oldestChange);
oldestChange.setDraftChangeNumber(
draftCNDbIter.getDraftCN());
break;
}
else
{
// replogcn and DraftCNcn are NOT on the same change
if (cnFromDraftCNDb.older(cnFromChangelogDb))
{
// the change from the DraftCNDb is older
// that means that the change has been purged from the
// changelogDb (and DraftCNdb not yet been trimed)