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

Ludovic Poitou
01.57.2011 54e325583550faebe58840aa6a82395209de4fed
Fix for defect OPENDJ-80: Draft change log DB handler thread spins constantly when the draft change log is big
The clear method was iterating through all changes regardless the age of changeNumber and the ServerState.
Now it'll stop cleaning when reaching the first changeNumber younger.
2 files modified
22 ■■■■ changed files
opends/src/server/org/opends/server/replication/server/DraftCNDbHandler.java 20 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationIterator.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/DraftCNDbHandler.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 */
package org.opends.server.replication.server;
import static org.opends.messages.ReplicationMessages.*;
@@ -384,21 +385,22 @@
            }
            else
            {
              // let's get the eligible part of the domain
              ServerState startSS = domain.getStartState();
              ServerState endSS= domain.getEligibleState(crossDomainEligibleCN,
                  true);
              ServerState startState = domain.getStartState();
              // We don't use the endState but it's updating CN as reading
              ServerState endState= domain.getEligibleState(crossDomainEligibleCN,
                  false);
              ChangeNumber fcn = startSS.getMaxChangeNumber(cn.getServerId());
              ChangeNumber lcn = endSS.getMaxChangeNumber(cn.getServerId());
              ChangeNumber fcn = startState.getMaxChangeNumber(cn.getServerId());
              // if the draftCNDb change record, is out of the eligible part
              //  of the domain, then it can be removed.
              if (cn.older(fcn)||cn.newer(lcn))
              if (cn.older(fcn))
              {
                size++;
                cursor.delete();
              }
              else
              {
                finished = true;
              }
            }
          }
        }
opends/src/server/org/opends/server/replication/server/ReplicationIterator.java
@@ -128,7 +128,7 @@
        try
        {
          cursor = db.openReadCursor(lastNonNullCurrentCN);
          currentChange = cursor.next(); // can return null
          currentChange = cursor.next();
          if (currentChange != null)
          {
            lastNonNullCurrentCN = currentChange.getChangeNumber();