directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1541206 - in /directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server: core/partition/impl/btree/AbstractBTreePartition.java xdbm/search/evaluator/SubtreeScopeEvaluator.java xdbm/search/impl/DefaultSearchEngine.java
Date Tue, 12 Nov 2013 19:34:32 GMT
Author: elecharny
Date: Tue Nov 12 19:34:32 2013
New Revision: 1541206

URL: http://svn.apache.org/r1541206
Log:
Reverted some changes with the alias cache, it's breaking some tests

Modified:
    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
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java

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=1541206&r1=1541205&r2=1541206&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 Nov 12 19:34:32 2013
@@ -34,7 +34,6 @@ 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;
@@ -875,6 +874,8 @@ public abstract class AbstractBTreeParti
             Entry deletedEntry = delete( id );
 
             updateCache( deleteContext );
+            
+            Entry found = fetch( id );
 
             return deletedEntry;
         }
@@ -976,7 +977,14 @@ public abstract class AbstractBTreeParti
             // Update the ObjectClass index
             for ( Value<?> value : objectClass )
             {
-                objectClassIdx.drop( value.getString(), id );
+                String valueStr = ( String ) value.getNormValue();
+
+                if ( valueStr.equals( SchemaConstants.TOP_OC ) )
+                {
+                    continue;
+                }
+                
+                objectClassIdx.drop( valueStr, id );
             }
 
             // Update the parent's nbChildren and nbDescendants values
@@ -1303,7 +1311,14 @@ public abstract class AbstractBTreeParti
         {
             for ( Value<?> value : mods )
             {
-                objectClassIdx.add( ( String ) value.getNormValue(), id );
+                String valueStr = ( String ) value.getNormValue();
+
+                if ( valueStr.equals( SchemaConstants.TOP_OC ) )
+                {
+                    continue;
+                }
+                
+                objectClassIdx.add( valueStr, id );
             }
         }
         else if ( hasUserIndexOn( attributeType ) )
@@ -1404,17 +1419,26 @@ public abstract class AbstractBTreeParti
             // value index entries and add new ones
             for ( Value<?> value : entry.get( OBJECT_CLASS_AT ) )
             {
-                objectClassIdx.drop( ( String ) value.getNormValue(), id );
+                String valueStr = ( String ) value.getNormValue();
+
+                if ( valueStr.equals( SchemaConstants.TOP_OC ) )
+                {
+                    continue;
+                }
+
+                objectClassIdx.drop( valueStr, id );
             }
 
             for ( Value<?> value : mods )
             {
-                if ( value.equals( SchemaConstants.TOP_OC ) )
+                String valueStr = ( String ) value.getNormValue();
+
+                if ( valueStr.equals( SchemaConstants.TOP_OC ) )
                 {
                     continue;
                 }
 
-                objectClassIdx.add( ( String ) value.getNormValue(), id );
+                objectClassIdx.add( valueStr, id );
             }
         }
         else if ( hasUserIndexOn( attributeType ) )
@@ -1452,13 +1476,27 @@ public abstract class AbstractBTreeParti
             // Remove the previous values
             for ( Value<?> value : entry.get( ADMINISTRATIVE_ROLE_AT ) )
             {
-                objectClassIdx.drop( ( String ) value.getNormValue(), id );
+                String valueStr = ( String ) value.getNormValue();
+
+                if ( valueStr.equals( SchemaConstants.TOP_OC ) )
+                {
+                    continue;
+                }
+                
+                objectClassIdx.drop( valueStr, id );
             }
 
             // And add the new ones 
             for ( Value<?> value : mods )
             {
-                adminRoleIdx.add( ( String ) value.getNormValue(), id );
+                String valueStr = ( String ) value.getNormValue();
+
+                if ( valueStr.equals( SchemaConstants.TOP_OC ) )
+                {
+                    continue;
+                }
+                
+                adminRoleIdx.add( valueStr, id );
             }
         }
 
@@ -1523,16 +1561,30 @@ public abstract class AbstractBTreeParti
              */
             if ( mods.size() == 0 )
             {
-                for ( Value<?> objectClass : entry.get( OBJECT_CLASS_AT ) )
+                for ( Value<?> value : entry.get( OBJECT_CLASS_AT ) )
                 {
-                    objectClassIdx.drop( ( String ) objectClass.getNormValue(), id );
+                    String valueStr = ( String ) value.getNormValue();
+
+                    if ( valueStr.equals( SchemaConstants.TOP_OC ) )
+                    {
+                        continue;
+                    }
+
+                    objectClassIdx.drop( valueStr, id );
                 }
             }
             else
             {
                 for ( Value<?> value : mods )
                 {
-                    objectClassIdx.drop( ( String ) value.getNormValue(), id );
+                    String valueStr = ( String ) value.getNormValue();
+
+                    if ( valueStr.equals( SchemaConstants.TOP_OC ) )
+                    {
+                        continue;
+                    }
+
+                    objectClassIdx.drop( valueStr, id );
                 }
             }
         }
@@ -2701,11 +2753,6 @@ 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
@@ -2799,11 +2846,6 @@ 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 );
-        }
     }
 
 

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=1541206&r1=1541205&r2=1541206&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 Nov 12 19:34:32 2013
@@ -201,8 +201,7 @@ public class SubtreeScopeEvaluator imple
          * candidate id is an alias, if so we reject it since aliases should
          * not be returned.
          */
-//        if ( null != db.getAliasIndex().reverseLookup( id ) )
-        if ( ( ( db.getAliasCache() != null ) && ( db.getAliasCache().get( id ) !=
null ) ) || ( null != db.getAliasIndex().reverseLookup( id ) ) )
+        if ( null != db.getAliasIndex().reverseLookup( id ) )
         {
             return false;
         }

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java?rev=1541206&r1=1541205&r2=1541206&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
Tue Nov 12 19:34:32 2013
@@ -146,30 +146,7 @@ public class DefaultSearchEngine impleme
         // --------------------------------------------------------------------
         // Determine the effective base with aliases
         // --------------------------------------------------------------------
-//        Dn aliasedBase = db.getAliasIndex().reverseLookup( baseId );
-        Element element = null;
-        
-        if ( db.getAliasCache() != null )
-        {
-            element = db.getAliasCache().get( baseId );
-        }
-        
-        Dn aliasedBase = null;
-        
-        if ( element != null )
-        {
-            aliasedBase = (Dn)element.getObjectValue();
-        }
-        else
-        {
-            aliasedBase = db.getAliasIndex().reverseLookup( baseId );
-            
-            if ( db.getAliasCache() != null )
-            {
-                db.getAliasCache().put( new Element( baseId, aliasedBase ) );
-            }
-        }
-        
+        Dn aliasedBase = db.getAliasIndex().reverseLookup( baseId );
         Dn effectiveBase = baseDn;
         String effectiveBaseId = baseId;
 



Mime
View raw message