mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Ludovic Poitou
09.24.2011 aba87ac47f81475c93ab6f439f247176334b1ef0
opends/src/server/org/opends/server/replication/server/DraftCNDbHandler.java
@@ -50,6 +50,8 @@
import org.opends.server.types.InitializationException;
import com.sleepycat.je.DatabaseException;
import java.util.HashMap;
import org.opends.server.replication.common.MultiDomainServerState;
/**
 * This class is used for managing the replicationServer database for each
@@ -385,14 +387,45 @@
          int currentKey = cursor.currentKey();
          // Do not delete the lastKey. This should allow us to
          // preserve last change number over time.
          if ((currentKey != lastkey) && (cn.older(fcn)))
          if (cn.older(fcn))
          {
            cursor.delete();
            continue;
          }
          ServerState cnVector = null;
          try
          {
            HashMap<String,ServerState> cnStartStates =
                MultiDomainServerState.splitGenStateToServerStates(
                        cursor.currentValue());
            cnVector = cnStartStates.get(serviceID);
            if (debugEnabled())
              TRACER.debugInfo("DraftCNDBHandler:clear() - ChangeVector:"+
                      cnVector.toString()+
                      " -- StartState:"+startState.toString());
            // cnVector.update(cn);
          }
          catch(Exception e)
          {
            // We couldn't parse the mdss from the DraftCNData Value
            assert(false);
            cursor.delete();
            continue;
          }
          if ((cnVector == null)
                  || ((cnVector.getMaxChangeNumber(cn.getServerId()) != null)
                      && !cnVector.cover(startState)))
          {
            cursor.delete();
            if (debugEnabled())
              TRACER.debugInfo("DraftCNDBHandler:clear() - deleted "+
                      cn.toString()+"Not covering startState");
            continue;
          }
          firstkey = currentKey;
          cursor.close();
          return;