You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/05/13 01:01:42 UTC

svn commit: r774124 - in /directory/apacheds/trunk: jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ xdbm-base/src/main/java/org/apache/directory/server/xdbm/

Author: elecharny
Date: Tue May 12 23:01:42 2009
New Revision: 774124

URL: http://svn.apache.org/viewvc?rev=774124&view=rev
Log:
Partially revert my fix and applied Kiran proposal to improve deletion of elements in index : it's simpler and it works.

Modified:
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
    directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
    directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Table.java

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=774124&r1=774123&r2=774124&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Tue May 12 23:01:42 2009
@@ -475,18 +475,12 @@
      */
     public void drop( Long id ) throws Exception
     {
-        Cursor<Tuple<Long,K>> values = reverse.cursor();
+        Cursor<Tuple<Long,K>> values = reverse.cursor( id );
         Tuple<Long,K> tuple = new Tuple<Long,K>( id, null );
-        values.before( tuple );
 
         while ( values.next() )
         {
-            boolean removed = forward.remove( values.get().getValue(), id );
-            
-            if ( !removed )
-            {
-                break;
-            }
+            forward.remove( values.get().getValue(), id );
         }
 
         reverse.remove( id );

Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=774124&r1=774123&r2=774124&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java Tue May 12 23:01:42 2009
@@ -631,11 +631,11 @@
      * java.lang.Object)
      */
     @SuppressWarnings("unchecked")
-    public boolean remove( K key, V value ) throws IOException
+    public void remove( K key, V value ) throws IOException
     {
         if ( key == null )
         {
-            return false;
+            return;
         }
 
         if ( ! allowsDuplicates )
@@ -647,10 +647,10 @@
             {
                 bt.remove( key );
                 count--;
-                return true;
+                return;
             }
 
-            return false;
+            return;
         }
 
         DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
@@ -671,10 +671,10 @@
                     bt.insert( key, marshaller.serialize( set ), true );
                 }
                 count--;
-                return true ;
+                return;
             }
 
-            return false;
+            return;
         }
 
         // if the number of duplicates falls below the numDupLimit value
@@ -694,34 +694,32 @@
             }
             
             count--;
-            return true;
+            return;
         }
-        
-        return false;
     }
 
 
     /**
      * @see Table#remove(Object)
      */
-    public boolean remove( K key ) throws IOException
+    public void remove( K key ) throws IOException
     {
         if ( key == null )
         {
-            return false;
+            return;
         }
 
         Object returned = bt.remove( key );
 
         if ( null == returned )
         {
-            return false;
+            return;
         }
 
         if ( ! allowsDuplicates )
         {
             this.count--;
-            return true;
+            return;
         }
 
         byte[] serialized = ( byte[] ) returned;
@@ -730,13 +728,13 @@
         {
             BTree tree = getBTree( BTreeRedirectMarshaller.INSTANCE.deserialize( serialized ) );
             this.count -= tree.size();
-            return true;
+            return;
         }
         else
         {
             AvlTree<V> set = marshaller.deserialize( serialized );
             this.count -= set.getSize();
-            return true;
+            return;
         }
     }
 

Modified: directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Table.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Table.java?rev=774124&r1=774123&r2=774124&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Table.java (original)
+++ directory/apacheds/trunk/xdbm-base/src/main/java/org/apache/directory/server/xdbm/Table.java Tue May 12 23:01:42 2009
@@ -227,7 +227,7 @@
      * @throws Exception if there is a failure to read or write to
      * the underlying Db
      */
-    boolean remove( K key ) throws Exception;
+    void remove( K key ) throws Exception;
 
 
     /**
@@ -239,7 +239,7 @@
      * @throws Exception if there is a failure to read or write to
      * the underlying Db
      */
-    boolean remove( K key, V value ) throws Exception;
+    void remove( K key, V value ) throws Exception;
 
 
     /**