directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1448167 - /directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
Date Wed, 20 Feb 2013 13:46:27 GMT
Author: elecharny
Date: Wed Feb 20 13:46:27 2013
New Revision: 1448167

URL: http://svn.apache.org/r1448167
Log:
o Fix the update of the presence index when deleting a value of an indexed AT (DIRSERVER-1799)

Modified:
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.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=1448167&r1=1448166&r2=1448167&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
Wed Feb 20 13:46:27 2013
@@ -1459,6 +1459,14 @@ public abstract class AbstractBTreeParti
         {
             Index<?, Entry, String> index = getUserIndex( attributeType );
 
+            Attribute attribute = entry.get( attributeType ).clone();
+            int nbValues = 0;
+
+            if ( attribute != null )
+            {
+                nbValues = attribute.size();
+            }
+
             /*
              * If there are no attribute values in the modifications then this
              * implies the complete removal of the attribute from the index. Else
@@ -1467,11 +1475,18 @@ public abstract class AbstractBTreeParti
             if ( mods.size() == 0 )
             {
                 ( ( Index ) index ).drop( id );
+                nbValues = 0;
             }
             else
             {
                 for ( Value<?> value : mods )
                 {
+                    if ( attribute.contains( value ) )
+                    {
+                        nbValues--;
+                        attribute.remove( value );
+                    }
+
                     ( ( Index ) index ).drop( value.getNormValue(), id );
                 }
             }
@@ -1480,7 +1495,7 @@ public abstract class AbstractBTreeParti
              * If no attribute values exist for this entryId in the index then
              * we remove the presence index entry for the removed attribute.
              */
-            if ( null == index.reverseLookup( id ) )
+            if ( nbValues == 0 )
             {
                 presenceIdx.drop( modsOid, id );
             }
@@ -1504,8 +1519,6 @@ public abstract class AbstractBTreeParti
             }
         }
 
-        AttributeType attrType = schemaManager.lookupAttributeTypeRegistry( modsOid );
-
         /*
          * If there are no attribute values in the modifications then this
          * implies the complete removal of the attribute from the entry. Else



Mime
View raw message