You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sa...@apache.org on 2011/11/30 10:41:36 UTC

svn commit: r1208348 [2/2] - in /directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server: core/partition/impl/btree/ xdbm/ xdbm/impl/avl/ xdbm/search/impl/

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java?rev=1208348&r1=1208347&r2=1208348&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java Wed Nov 30 09:41:34 2011
@@ -25,8 +25,10 @@ import java.util.UUID;
 
 import org.apache.directory.server.core.partition.impl.btree.LongComparator;
 import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.server.core.api.partition.index.ForwardIndexComparator;
 import org.apache.directory.server.core.api.partition.index.ParentIdAndRdn;
 import org.apache.directory.server.core.api.partition.index.ParentIdAndRdnComparator;
+import org.apache.directory.server.core.api.partition.index.ReverseIndexComparator;
 import org.apache.directory.server.core.api.partition.index.UUIDComparator;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
 import org.apache.directory.shared.ldap.model.schema.MatchingRule;
@@ -88,6 +90,9 @@ public class AvlRdnIndex extends AvlInde
             false );
         reverse = new AvlTable<UUID, ParentIdAndRdn>( attributeType.getName(), UUIDComparator.INSTANCE, comp,
             false );
+        
+        fIndexEntryComparator = new ForwardIndexComparator( comp );
+        rIndexEntryComparator = new ReverseIndexComparator( comp );
     }
 
 

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java?rev=1208348&r1=1208347&r2=1208348&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java Wed Nov 30 09:41:34 2011
@@ -147,7 +147,7 @@ public class DefaultSearchEngine impleme
         // --------------------------------------------------------------------
         // Determine the effective base with aliases
         // --------------------------------------------------------------------
-
+        
         /*
          * If the base is not an alias or if alias dereferencing does not
          * occur on finding the base then we set the effective base to the
@@ -156,6 +156,9 @@ public class DefaultSearchEngine impleme
         if ( ( null == aliasedBase ) || !aliasDerefMode.isDerefFindingBase() )
         {
             effectiveBase = base;
+            
+            // We depend on the provided base with the given scope
+            txnLogManager.addRead( base, SearchScope.values()[ searchCtls.getSearchScope() ] );
         }
 
         /*
@@ -166,6 +169,13 @@ public class DefaultSearchEngine impleme
         else
         {
             effectiveBase = new Dn( aliasedBase );
+            
+            // Add dependency on the effective base with the given scope
+            txnLogManager.addRead( effectiveBase, SearchScope.values()[ searchCtls.getSearchScope() ] );
+            
+            // We also depend on the base as we are routed through it.
+            txnLogManager.addRead( base, SearchScope.OBJECT );
+            
         }
 
         // --------------------------------------------------------------------

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java?rev=1208348&r1=1208347&r2=1208348&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java Wed Nov 30 09:41:34 2011
@@ -30,11 +30,14 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
 import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
 import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.entry.Entry;
+import org.apache.directory.shared.ldap.model.message.SearchScope;
+import org.apache.directory.shared.ldap.model.name.Dn;
 
 
 /**
@@ -66,7 +69,7 @@ public class OneLevelScopeCursor extends
     
     /** Alias idx set if dereferencing aliases */
     private Index<String> aliasIdx;
-
+ 
 
     /**
      * Creates a Cursor over entries satisfying one level scope criteria.
@@ -291,7 +294,20 @@ public class OneLevelScopeCursor extends
         
         if ( available() )
         {
-            return cursor.get();
+            IndexEntry<UUID> indexEntry = cursor.get();
+            
+            /*
+             *  If the entry is coming from the alias index, then search scope is enlarged
+             *  to include the returned entry.
+             */
+            
+            if ( cursor == dereferencedCursor )
+            {
+                Dn aliasTargetDn = OperationExecutionManagerFactory.instance().buildEntryDn( db, indexEntry.getId() );
+                TxnManagerFactory.txnLogManagerInstance().addRead( aliasTargetDn, SearchScope.OBJECT );
+            }
+            
+            return indexEntry;
         }
 
         throw new InvalidCursorPositionException( I18n.err( I18n.ERR_708 ) );

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java?rev=1208348&r1=1208347&r2=1208348&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java Wed Nov 30 09:41:34 2011
@@ -36,6 +36,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.entry.Entry;
+import org.apache.directory.shared.ldap.model.message.SearchScope;
+import org.apache.directory.shared.ldap.model.name.Dn;
 
 
 /**
@@ -326,7 +328,20 @@ public class SubtreeScopeCursor extends 
         
         if ( available() )
         {
-            return cursor.get();
+           IndexEntry<UUID> indexEntry = cursor.get();
+            
+            /*
+             *  If the entry is coming from the alias index, then search scope is enlarged
+             *  to include the returned entry.
+             */
+            
+            if ( cursor == dereferencedCursor )
+            {
+                Dn aliasTargetDn = OperationExecutionManagerFactory.instance().buildEntryDn( db, indexEntry.getId() );
+                TxnManagerFactory.txnLogManagerInstance().addRead( aliasTargetDn, SearchScope.OBJECT );
+            }
+            
+            return indexEntry;
         }
 
         throw new InvalidCursorPositionException( I18n.err( I18n.ERR_708 ) );