| | |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | |
| | | import org.opends.server.types.operation.PreOperationModifyOperation; |
| | | import org.opends.server.util.TimeThread; |
| | | |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * This class is used to store historical information that is |
| | | * used to resolve modify conflicts |
| | |
| | | * an entry that has no historical attribute and after the last |
| | | * historical has been purged. |
| | | */ |
| | | private CSN oldestCSN = null; |
| | | private CSN oldestCSN; |
| | | |
| | | /** |
| | | * For stats/monitoring purpose, the number of historical values |
| | | * purged the last time a purge has been applied on this entry historical. |
| | | */ |
| | | private int lastPurgedValuesCount = 0; |
| | | private int lastPurgedValuesCount; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | |
| | | /** The date when the entry was added. */ |
| | | private CSN entryADDDate = null; |
| | | private CSN entryADDDate; |
| | | |
| | | /** The date when the entry was last renamed. */ |
| | | private CSN entryMODDNDate = null; |
| | | private CSN entryMODDNDate; |
| | | |
| | | /** |
| | | * Contains Historical information for each attribute sorted by attribute |
| | |
| | | private HashMap<AttributeType,AttrHistoricalWithOptions> attributesHistorical |
| | | = new HashMap<AttributeType,AttrHistoricalWithOptions>(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | |
| | | // (eventually read from the provided modification) |
| | | AttrHistorical attrHist = getOrCreateAttrHistorical(mod); |
| | | if (attrHist != null) |
| | | { |
| | | attrHist.processLocalOrNonConflictModification(csn, mod); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | // the potentially set purge delay. |
| | | this.lastPurgedValuesCount = 0; |
| | | if (purgeDelayInMillisec>0) |
| | | { |
| | | purgeDate = TimeThread.getTime() - purgeDelayInMillisec; |
| | | } |
| | | |
| | | AttributeType historicalAttrType = |
| | | DirectoryServer.getSchema().getAttributeType(HISTORICAL_ATTRIBUTE_NAME); |
| | |
| | | public CSN getDNDate() |
| | | { |
| | | if (entryADDDate == null) |
| | | { |
| | | return entryMODDNDate; |
| | | |
| | | } |
| | | if (entryMODDNDate == null) |
| | | { |
| | | return entryADDDate; |
| | | } |
| | | |
| | | if (entryMODDNDate.isOlderThan(entryADDDate)) |
| | | { |
| | | return entryMODDNDate; |
| | | } |
| | | else |
| | | { |
| | | return entryADDDate; |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | public static boolean isHistoricalAttribute(Attribute attr) |
| | | { |
| | | AttributeType attrType = attr.getAttributeType(); |
| | | return |
| | | attrType.getNameOrOID().equals(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | return EntryHistorical.HISTORICAL_ATTRIBUTE_NAME.equals(attrType.getNameOrOID()); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | if (csn != null |
| | | && (this.oldestCSN == null || csn.isOlderThan(this.oldestCSN))) |
| | | { |
| | | this.oldestCSN = csn; |
| | | } |
| | | } |
| | | |
| | | /** |