| | |
| | | import static org.opends.server.loggers.ErrorLogger.logError; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import static org.opends.server.loggers.debug.DebugLogger.getTracer; |
| | | import static org.opends.server.replication.plugin.Historical.ENTRYUIDNAME; |
| | | import static org.opends.server.replication.plugin.EntryHistorical.ENTRYUIDNAME; |
| | | import static org.opends.server.replication.protocol.OperationContext.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.createEntry; |
| | |
| | | // after startingChangeNumber and before endChangeNumber and |
| | | // add them to the replayOperations list |
| | | Iterable<FakeOperation> updates = |
| | | Historical.generateFakeOperations(searchEntry); |
| | | EntryHistorical.generateFakeOperations(searchEntry); |
| | | |
| | | for (FakeOperation op : updates) |
| | | { |
| | |
| | | * as it was in the original message. |
| | | */ |
| | | String operationEntryUUID = ctx.getEntryUid(); |
| | | String modifiedEntryUUID = Historical.getEntryUuid(deletedEntry); |
| | | String modifiedEntryUUID = EntryHistorical.getEntryUuid(deletedEntry); |
| | | if (!operationEntryUUID.equals(modifiedEntryUUID)) |
| | | { |
| | | /* |
| | |
| | | // There is no replication context attached to the operation |
| | | // so this is not a replication operation. |
| | | ChangeNumber changeNumber = generateChangeNumber(deleteOperation); |
| | | String modifiedEntryUUID = Historical.getEntryUuid(deletedEntry); |
| | | String modifiedEntryUUID = EntryHistorical.getEntryUuid(deletedEntry); |
| | | ctx = new DeleteContext(changeNumber, modifiedEntryUUID); |
| | | deleteOperation.setAttachment(SYNCHROCONTEXT, ctx); |
| | | |
| | |
| | | * as was in the original message. |
| | | */ |
| | | String modifiedEntryUUID = |
| | | Historical.getEntryUuid(modifyDNOperation.getOriginalEntry()); |
| | | EntryHistorical.getEntryUuid(modifyDNOperation.getOriginalEntry()); |
| | | if (!modifiedEntryUUID.equals(ctx.getEntryUid())) |
| | | { |
| | | /* |
| | |
| | | * If the object has been renamed more recently than this |
| | | * operation, cancel the operation. |
| | | */ |
| | | Historical hist = Historical.load(modifyDNOperation.getOriginalEntry()); |
| | | EntryHistorical hist = EntryHistorical.newInstanceFromEntry( |
| | | modifyDNOperation.getOriginalEntry()); |
| | | if (hist.AddedOrRenamedAfter(ctx.getChangeNumber())) |
| | | { |
| | | return new SynchronizationProviderResult.StopProcessing( |
| | |
| | | } |
| | | |
| | | Entry modifiedEntry = modifyDNOperation.getOriginalEntry(); |
| | | String modifiedEntryUUID = Historical.getEntryUuid(modifiedEntry); |
| | | String modifiedEntryUUID = EntryHistorical.getEntryUuid(modifiedEntry); |
| | | ctx = new ModifyDnContext(changeNumber, modifiedEntryUUID, newParentId); |
| | | modifyDNOperation.setAttachment(SYNCHROCONTEXT, ctx); |
| | | } |
| | |
| | | Entry modifiedEntry = modifyOperation.getModifiedEntry(); |
| | | if (ctx == null) |
| | | { |
| | | // There is no replication context attached to the operation |
| | | // so this is not a replication operation. |
| | | // No replication ctxt attached => not a replicated operation |
| | | // - create a ctxt with : changeNumber, entryUUID |
| | | // - attach the context to the op |
| | | |
| | | ChangeNumber changeNumber = generateChangeNumber(modifyOperation); |
| | | String modifiedEntryUUID = Historical.getEntryUuid(modifiedEntry); |
| | | String modifiedEntryUUID = EntryHistorical.getEntryUuid(modifiedEntry); |
| | | if (modifiedEntryUUID == null) |
| | | modifiedEntryUUID = modifyOperation.getEntryDN().toString(); |
| | | ctx = new ModifyContext(changeNumber, modifiedEntryUUID); |
| | | |
| | | modifyOperation.setAttachment(SYNCHROCONTEXT, ctx); |
| | | } |
| | | else |
| | | { |
| | | // This is a replayed operation, it is necessary to |
| | | // Replication ctxt attached => this is a replicated operation being |
| | | // replayed here, it is necessary to |
| | | // - check if the entry has been renamed |
| | | // - check for conflicts |
| | | String modifiedEntryUUID = ctx.getEntryUid(); |
| | | String currentEntryUUID = Historical.getEntryUuid(modifiedEntry); |
| | | String currentEntryUUID = EntryHistorical.getEntryUuid(modifiedEntry); |
| | | if ((currentEntryUUID != null) && |
| | | (!currentEntryUUID.equals(modifiedEntryUUID))) |
| | | { |
| | |
| | | /* |
| | | * Solve the conflicts between modify operations |
| | | */ |
| | | Historical historicalInformation = Historical.load(modifiedEntry); |
| | | modifyOperation.setAttachment(Historical.HISTORICAL, |
| | | EntryHistorical historicalInformation = |
| | | EntryHistorical.newInstanceFromEntry(modifiedEntry); |
| | | modifyOperation.setAttachment(EntryHistorical.HISTORICAL, |
| | | historicalInformation); |
| | | |
| | | if (historicalInformation.replayOperation(modifyOperation, modifiedEntry)) |
| | |
| | | public void doPreOperation(PreOperationAddOperation addOperation) |
| | | { |
| | | AddContext ctx = new AddContext(generateChangeNumber(addOperation), |
| | | Historical.getEntryUuid(addOperation), |
| | | EntryHistorical.getEntryUuid(addOperation), |
| | | findEntryId(addOperation.getEntryDN().getParentDNInSuffix())); |
| | | |
| | | addOperation.setAttachment(SYNCHROCONTEXT, ctx); |
| | |
| | | } |
| | | |
| | | LinkedHashSet<String> attrs = new LinkedHashSet<String>(1); |
| | | attrs.add(Historical.HISTORICALATTRIBUTENAME); |
| | | attrs.add(Historical.ENTRYUIDNAME); |
| | | attrs.add(EntryHistorical.HISTORICALATTRIBUTENAME); |
| | | attrs.add(EntryHistorical.ENTRYUIDNAME); |
| | | attrs.add("*"); |
| | | InternalSearchOperation searchOp = conn.processSearch( |
| | | ByteString.valueOf(baseDn.toString()), |
| | |
| | | ChangeNumber entrytoRenameDate = null; |
| | | for (SearchResultEntry entry : entries) |
| | | { |
| | | Historical history = Historical.load(entry); |
| | | EntryHistorical history = EntryHistorical.newInstanceFromEntry(entry); |
| | | if (entrytoRename == null) |
| | | { |
| | | entrytoRename = entry; |
| | |
| | | SearchResultEntry resultEntry = result.getFirst(); |
| | | if (resultEntry != null) |
| | | { |
| | | return Historical.getEntryUuid(resultEntry); |
| | | return EntryHistorical.getEntryUuid(resultEntry); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | LinkedHashSet<String> attrs = new LinkedHashSet<String>(1); |
| | | attrs.add(ENTRYUIDNAME); |
| | | attrs.add(Historical.HISTORICALATTRIBUTENAME); |
| | | attrs.add(EntryHistorical.HISTORICALATTRIBUTENAME); |
| | | |
| | | SearchFilter ALLMATCH; |
| | | ALLMATCH = SearchFilter.createFilterFromString("(objectClass=*)"); |
| | |
| | | */ |
| | | conflict = true; |
| | | renameConflictEntry(conflictOp, entry.getDN(), |
| | | Historical.getEntryUuid(entry)); |
| | | EntryHistorical.getEntryUuid(entry)); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | LDAPFilter filter = LDAPFilter.decode( |
| | | "(&(" + Historical.HISTORICALATTRIBUTENAME + ">=dummy:" |
| | | + fromChangeNumber + ")(" + Historical.HISTORICALATTRIBUTENAME + |
| | | "(&(" + EntryHistorical.HISTORICALATTRIBUTENAME + ">=dummy:" |
| | | + fromChangeNumber + ")(" + EntryHistorical.HISTORICALATTRIBUTENAME + |
| | | "<=dummy:" + maxValueForId + "))"); |
| | | |
| | | LinkedHashSet<String> attrs = new LinkedHashSet<String>(1); |
| | | attrs.add(Historical.HISTORICALATTRIBUTENAME); |
| | | attrs.add(Historical.ENTRYUIDNAME); |
| | | attrs.add(EntryHistorical.HISTORICALATTRIBUTENAME); |
| | | attrs.add(EntryHistorical.ENTRYUIDNAME); |
| | | attrs.add("*"); |
| | | return conn.processSearch( |
| | | ByteString.valueOf(baseDn.toString()), |