directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1547278 - in /directory/apacheds/trunk: jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/ xdbm-partition/...
Date Tue, 03 Dec 2013 04:32:39 GMT
Author: elecharny
Date: Tue Dec  3 04:32:38 2013
New Revision: 1547278

URL: http://svn.apache.org/r1547278
Log:
o Initialize the alias and ParentIdAndRdn caches in the AbstractBTreePartition class
o Fixed NPE when those caches are not existing
o Updated the alias cache when some aliases are added/removed
o A small improvement in the dropMovedAliasIndices method = don't do two reverseLookup
o Used the alias cache in the SubtreeScopeEvaluator and the DefaultSearchEngine

Modified:
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=1547278&r1=1547277&r2=1547278&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Tue Dec  3 04:32:38 2013
@@ -268,7 +268,13 @@ public class JdbmPartition extends Abstr
             if ( cacheService != null )
             {
                 entryCache = cacheService.getCache( getId() );
-                aliasCache = cacheService.getCache( "alias" );
+
+                int cacheSizeConfig = entryCache.getCacheConfiguration().getMaxElementsInMemory();
+
+                if ( cacheSizeConfig < cacheSize )
+                {
+                    entryCache.getCacheConfiguration().setMaxElementsInMemory( cacheSize
);
+                }
             }
 
             // We are done !

Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java?rev=1547278&r1=1547277&r2=1547278&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
(original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
Tue Dec  3 04:32:38 2013
@@ -215,24 +215,6 @@ public class MavibotPartition extends Ab
                 {
                     entryCache.getCacheConfiguration().setMaxElementsInMemory( cacheSize
);
                 }
-                
-                aliasCache = cacheService.getCache( "alias" );
-
-                cacheSizeConfig = aliasCache.getCacheConfiguration().getMaxElementsInMemory();
-
-                if ( cacheSizeConfig < cacheSize )
-                {
-                    aliasCache.getCacheConfiguration().setMaxElementsInMemory( cacheSize
);
-                }
-                
-                piarCache = cacheService.getCache( "piar" );
-                
-                cacheSizeConfig = piarCache.getCacheConfiguration().getMaxElementsInMemory();
-
-                if ( cacheSizeConfig < cacheSize )
-                {
-                    piarCache.getCacheConfiguration().setMaxElementsInMemory( cacheSize *
3 );
-                }
             }
 
             // We are done !

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java?rev=1547278&r1=1547277&r2=1547278&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
Tue Dec  3 04:32:38 2013
@@ -555,6 +555,26 @@ public abstract class AbstractBTreeParti
         setupSystemIndices();
         setupUserIndices();
 
+        if ( cacheService != null )
+        {
+            aliasCache = cacheService.getCache( "alias" );
+    
+            int cacheSizeConfig = aliasCache.getCacheConfiguration().getMaxElementsInMemory();
+    
+            if ( cacheSizeConfig < cacheSize )
+            {
+                aliasCache.getCacheConfiguration().setMaxElementsInMemory( cacheSize );
+            }
+            
+            piarCache = cacheService.getCache( "piar" );
+            
+            cacheSizeConfig = piarCache.getCacheConfiguration().getMaxElementsInMemory();
+    
+            if ( cacheSizeConfig < cacheSize )
+            {
+                piarCache.getCacheConfiguration().setMaxElementsInMemory( cacheSize * 3 );
+            }
+        }
     }
 
 
@@ -2250,11 +2270,25 @@ public abstract class AbstractBTreeParti
             {
                 ParentIdAndRdn cur = null;
             
-                Element piar = piarCache.get( parentId );
-                
-                if ( piar != null )
+                if ( piarCache != null )
                 {
-                    cur = (ParentIdAndRdn)piar.getValue();
+                    Element piar = piarCache.get( parentId );
+                    
+                    if ( piar != null )
+                    {
+                        cur = (ParentIdAndRdn)piar.getValue();
+                    }
+                    else
+                    {
+                        cur = rdnIdx.reverseLookup( parentId );
+                        
+                        if ( cur == null )
+                        {
+                            return null;
+                        }
+                        
+                        piarCache.put( new Element( parentId, cur) );
+                    }
                 }
                 else
                 {
@@ -2264,8 +2298,6 @@ public abstract class AbstractBTreeParti
                     {
                         return null;
                     }
-                    
-                    piarCache.put( new Element( parentId, cur) );
                 }
 
                 Rdn[] rdns = cur.getRdns();
@@ -2766,6 +2798,11 @@ public abstract class AbstractBTreeParti
 
         // Add the alias to the simple alias index
         aliasIdx.add( aliasTarget, aliasId );
+        
+        if ( aliasCache != null )
+        {
+            aliasCache.put(  new Element( aliasId, aliasTarget ) );
+        }
 
         /*
          * Handle One Level Scope Alias Index
@@ -2859,6 +2896,11 @@ public abstract class AbstractBTreeParti
 
         // Drops all alias tuples pointing to the id of the alias to be deleted
         aliasIdx.drop( aliasId );
+
+        if ( aliasCache != null )
+        {
+            aliasCache.remove( aliasId );
+        }
     }
 
 
@@ -2874,9 +2916,10 @@ public abstract class AbstractBTreeParti
     {
         String movedBaseId = getEntryId( movedBase );
 
-        if ( aliasIdx.reverseLookup( movedBaseId ) != null )
+        Dn targetDn = aliasIdx.reverseLookup( movedBaseId );
+        
+        if ( targetDn != null )
         {
-            Dn targetDn = aliasIdx.reverseLookup( movedBaseId );
             targetDn.apply( schemaManager );
             String targetId = getEntryId( targetDn );
             Dn aliasDn = getEntryDn( movedBaseId );

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java?rev=1547278&r1=1547277&r2=1547278&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/evaluator/SubtreeScopeEvaluator.java
Tue Dec  3 04:32:38 2013
@@ -20,10 +20,13 @@
 package org.apache.directory.server.xdbm.search.evaluator;
 
 
+import net.sf.ehcache.Element;
+
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.filter.ScopeNode;
 import org.apache.directory.api.ldap.model.message.SearchScope;
+import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.xdbm.IndexEntry;
@@ -201,7 +204,21 @@ public class SubtreeScopeEvaluator imple
          * candidate id is an alias, if so we reject it since aliases should
          * not be returned.
          */
-        if ( db.getAliasCache().get( id ) != null )
+        if ( db.getAliasCache() != null )
+        {
+            Element element = db.getAliasCache().get( id );
+            
+            if ( element != null )
+            {
+                if ( element.getValue() != null )
+                {
+                    Dn dn = (Dn)element.getValue();
+                    
+                    return false;
+                }
+            }
+        }
+        else if ( null != db.getAliasIndex().reverseLookup( id ) )
         {
             return false;
         }



Mime
View raw message