*/
private boolean solveNamingConflict(DeleteOperation op,
LDAPUpdateMsg msg)
{
ResultCode result = op.getResultCode();
DeleteContext ctx = (DeleteContext) op.getAttachment(SYNCHROCONTEXT);
String entryUid = ctx.getEntryUid();
if (result == ResultCode.NO_SUCH_OBJECT)
{
/*
* Find if the entry is still in the database.
*/
DN currentDn = findEntryDN(entryUid);
if (currentDn == null)
{
/*
* The entry has already been deleted, either because this delete
* has already been replayed or because another concurrent delete
* has already done the job.
* In any case, there is is nothing more to do.
*/
numResolvedNamingConflicts.incrementAndGet();
return true;
}
else
{
/*
* This entry has been renamed, replay the delete using its new DN.
*/
msg.setDn(currentDn.toString());
numResolvedNamingConflicts.incrementAndGet();
return false;
}
}
else if (result == ResultCode.NOT_ALLOWED_ON_NONLEAF)
{
/*
* This may happen when we replay a DELETE done on a master
* but children of this entry have been added on another master.
*
* Rename all the children by adding entryuuid in dn and delete this entry.
*
* The action taken here must be consistent with the actions
* done in the solveNamingConflict(AddOperation) method
* when we are adding an entry whose parent entry has already been deleted.
*
*/
if (findAndRenameChild(entryUid, op.getEntryDN(), op))
numUnresolvedNamingConflicts.incrementAndGet();
return false;
}
else
{
// The other type of errors can not be caused by naming conflicts.
// Log a message for the repair tool.
Message message = ERR_ERROR_REPLAYING_OPERATION.get(
op.toString(), ctx.getChangeNumber().toString(),
result.toString(), op.getErrorMessage().toString());
logError(message);
return true;
}
}