directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1547057 - in /directory/apacheds/trunk: core-integ/src/test/java/org/apache/directory/server/core/operations/search/ mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/ xdbm-partition/src/main/jav...
Date Mon, 02 Dec 2013 15:24:38 GMT
Author: elecharny
Date: Mon Dec  2 15:24:37 2013
New Revision: 1547057

URL: http://svn.apache.org/r1547057
Log:
o Set the correct size for the entryCache and aliasCache
o Added a ParentIdAndRdn cache
o Added a test in SearchIT

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.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

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java?rev=1547057&r1=1547056&r2=1547057&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
Mon Dec  2 15:24:37 2013
@@ -2028,6 +2028,32 @@ public class SearchIT extends AbstractLd
 
         assertNotNull( rootDse );
     }
+
+
+    @Test
+    public void testSearchOrGidNumber() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+        controls.setDerefLinkFlag( false );
+        controls.setReturningAttributes( new String[]
+            { "*", "+" } );
+
+        LdapContext nullRootCtx = getRootContext( getService() );
+
+        NamingEnumeration<SearchResult> list = nullRootCtx.search( "", "(|(&(objectclass=posixGroup)(|(gidnumber=1)(gidnumber=1)))(objectClass=posixGroupp))",
controls );
+        Attributes rootDse = null;
+
+        while ( list.hasMore() )
+        {
+            SearchResult result = list.next();
+            rootDse = result.getAttributes();
+        }
+
+        list.close();
+
+        assertNotNull( rootDse );
+    }
     
     
     /**
@@ -2050,5 +2076,4 @@ public class SearchIT extends AbstractLd
         
         assertEquals( 5, count );
     }
-    
 }

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=1547057&r1=1547056&r2=1547057&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
Mon Dec  2 15:24:37 2013
@@ -72,12 +72,11 @@ import org.slf4j.LoggerFactory;
  */
 public class MavibotPartition extends AbstractBTreePartition
 {
-
     /** static logger */
     private static final Logger LOG = LoggerFactory.getLogger( MavibotPartition.class );
 
     private static final String MAVIBOT_DB_FILE_EXTN = ".data";
-
+    
     private static final FilenameFilter DB_FILTER = new FilenameFilter()
     {
 
@@ -209,7 +208,31 @@ public class MavibotPartition extends Ab
             if ( cacheService != null )
             {
                 entryCache = cacheService.getCache( getId() );
+                
+                int cacheSizeConfig = entryCache.getCacheConfiguration().getMaxElementsInMemory();
+
+                if ( cacheSizeConfig < cacheSize )
+                {
+                    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=1547057&r1=1547056&r2=1547057&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
Mon Dec  2 15:24:37 2013
@@ -34,6 +34,7 @@ import java.util.concurrent.locks.ReadWr
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import net.sf.ehcache.Cache;
+import net.sf.ehcache.Element;
 
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.cursor.Cursor;
@@ -122,6 +123,9 @@ public abstract class AbstractBTreeParti
     /** The alias cache */
     protected Cache aliasCache;
 
+    /** The ParentIdAndRdn cache */
+    protected Cache piarCache;
+
     /** true if we sync disks on every write operation */
     protected AtomicBoolean isSyncOnWrite = new AtomicBoolean( true );
 
@@ -2244,11 +2248,24 @@ public abstract class AbstractBTreeParti
 
             do
             {
-                ParentIdAndRdn cur = rdnIdx.reverseLookup( parentId );
-
-                if ( cur == null )
+                ParentIdAndRdn cur = null;
+            
+                Element piar = piarCache.get( parentId );
+                
+                if ( piar != null )
                 {
-                    return null;
+                    cur = (ParentIdAndRdn)piar.getValue();
+                }
+                else
+                {
+                    cur = rdnIdx.reverseLookup( parentId );
+                    
+                    if ( cur == null )
+                    {
+                        return null;
+                    }
+                    
+                    piarCache.put( new Element( parentId, cur) );
                 }
 
                 Rdn[] rdns = cur.getRdns();



Mime
View raw message