directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1413769 - in /directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider: ReplConsumerManager.java ReplicaEventLogJanitor.java ReplicaJournalCursor.java SyncReplRequestHandler.java
Date Mon, 26 Nov 2012 18:27:23 GMT
Author: elecharny
Date: Mon Nov 26 18:27:22 2012
New Revision: 1413769

URL: http://svn.apache.org/viewvc?rev=1413769&view=rev
Log:
Minor improvemnts

Modified:
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplConsumerManager.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaEventLogJanitor.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaJournalCursor.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplConsumerManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplConsumerManager.java?rev=1413769&r1=1413768&r2=1413769&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplConsumerManager.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplConsumerManager.java
Mon Nov 26 18:27:22 2012
@@ -117,7 +117,7 @@ public class ReplConsumerManager
 
 
     /**
-     * Initialize the replication Store, creating the ou=consumers,ou=system entry
+     * Initialize the replication Store, creating the ou=consumers,ou=system entry (only
if it does not exist yet)
      */
     private void createConsumersBranch() throws Exception
     {
@@ -231,9 +231,7 @@ public class ReplConsumerManager
 
         if ( mod == null )
         {
-            lastSentCsnAt = new DefaultAttribute( ADS_REPL_LAST_SENT_CSN_AT, replica.getLastSentCsn()
);
-
-            mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, lastSentCsnAt
);
+            mod = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, ADS_REPL_LAST_SENT_CSN_AT,
replica.getLastSentCsn() );
 
             modMap.put( replica.getId(), mod );
         }
@@ -270,7 +268,7 @@ public class ReplConsumerManager
         searchRequest.setBase( REPL_CONSUMER_DN );
         searchRequest.setScope( SearchScope.ONELEVEL );
         searchRequest.setFilter( filter );
-        searchRequest.addAttributes( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
);
+        searchRequest.addAttributes( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
 
         EntryFilteringCursor cursor = adminSession.search( searchRequest );
 

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaEventLogJanitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaEventLogJanitor.java?rev=1413769&r1=1413768&r2=1413769&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaEventLogJanitor.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaEventLogJanitor.java
Mon Nov 26 18:27:22 2012
@@ -29,7 +29,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Deletes old entries from the replication event logs that are
+ * Deletes old entries from the replication event logs that
  * are configured in refreshNPersist mode
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -98,10 +98,12 @@ public class ReplicaEventLogJanitor exte
                         
                         ReplicaJournalCursor cursor = log.getCursor( null ); // pass no CSN
                         cursor.skipQualifyingWhileFetching();
+                        
                         while( cursor.next() )
                         {
                             ReplicaEventMessage message = cursor.get();
                             String csnVal = message.getEntry().get( SchemaConstants.ENTRY_CSN_AT
).getString();
+                            
                             // skip if we reach the lastSentCsn or got past it
                             if( csnVal.compareTo( lastSentCsn ) >= 0 )
                             {
@@ -109,6 +111,7 @@ public class ReplicaEventLogJanitor exte
                             }
                                 
                             Csn csn = new Csn( csnVal );
+                            
                             if( ( now - csn.getTimestamp() ) >= thresholdTime )
                             {
                                 cursor.delete();

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaJournalCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaJournalCursor.java?rev=1413769&r1=1413768&r2=1413769&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaJournalCursor.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaJournalCursor.java
Mon Nov 26 18:27:22 2012
@@ -21,7 +21,6 @@
 package org.apache.directory.server.ldap.replication.provider;
 
 
-import java.io.IOException;
 import java.util.Iterator;
 
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmTable;

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java?rev=1413769&r1=1413768&r2=1413769&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
Mon Nov 26 18:27:22 2012
@@ -31,8 +31,10 @@ import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -151,6 +153,7 @@ public class SyncReplRequestHandler impl
      */
     public void start( LdapServer server )
     {
+        // Check that the handler is not already started : we don't want to start it twice...

         if ( initialized )
         {
             LOG.warn( "syncrepl provider was already initialized" );
@@ -184,6 +187,7 @@ public class SyncReplRequestHandler impl
                 }
             }
 
+            // Create the replication manager 
             replicaUtil = new ReplConsumerManager( dirService );
 
             loadReplicaInfo();
@@ -936,7 +940,7 @@ public class SyncReplRequestHandler impl
         try
         {
             List<ReplicaEventLog> eventLogs = replicaUtil.getReplicaEventLogs();
-            List<String> eventLogNames = new ArrayList<String>();
+            Set<String> eventLogNames = new HashSet<String>();
             
             if ( !eventLogs.isEmpty() )
             {
@@ -961,8 +965,7 @@ public class SyncReplRequestHandler impl
             }
             
             // remove unused logs
-            File[] replicaLogNames = getAllReplJournalNames();
-            for( File f : replicaLogNames )
+            for( File f : getAllReplJournalNames() )
             {
                 if( !eventLogNames.contains( f.getName() ) )
                 {
@@ -990,8 +993,8 @@ public class SyncReplRequestHandler impl
 
             if ( log.getSearchCriteria() != null )
             {
-                LOG.debug( "registering peristent search for the replica {}", log.getId()
);
-                PROVIDER_LOG.debug( "registering peristent search for the replica {}", log.getId()
);
+                LOG.debug( "registering persistent search for the replica {}", log.getId()
);
+                PROVIDER_LOG.debug( "registering persistent search for the replica {}", log.getId()
);
                 SyncReplSearchListener handler = new SyncReplSearchListener( null, null,
log, false );
                 log.setPersistentListener( handler );
 
@@ -999,9 +1002,9 @@ public class SyncReplRequestHandler impl
             }
             else
             {
-                LOG.warn( "invalid peristent search criteria {} for the replica {}", log.getSearchCriteria(),
log
+                LOG.warn( "invalid persistent search criteria {} for the replica {}", log.getSearchCriteria(),
log
                     .getId() );
-                PROVIDER_LOG.warn( "invalid peristent search criteria {} for the replica
{}", log.getSearchCriteria(), log
+                PROVIDER_LOG.warn( "invalid persistent search criteria {} for the replica
{}", log.getSearchCriteria(), log
                     .getId() );
             }
         }



Mime
View raw message