You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2011/06/16 14:18:23 UTC

svn commit: r1136395 - in /directory/apacheds/trunk: jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ xdbm-partition/src/main/java/org/apache/directo...

Author: kayyagari
Date: Thu Jun 16 12:18:22 2011
New Revision: 1136395

URL: http://svn.apache.org/viewvc?rev=1136395&view=rev
Log:
o added a new method to reset the master table sequence
  this fixes an issue with the value assigned to 'parentEntryId' attribute when a context entry gets deleted
  (this is crucial for properly building rdn index during recovery)

Modified:
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java?rev=1136395&r1=1136394&r2=1136395&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java Thu Jun 16 12:18:22 2011
@@ -251,4 +251,16 @@ public class JdbmMasterTable<E> extends 
             adminTbl.put( property, value );
         }
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void resetCounter() throws Exception
+    {
+        synchronized ( adminTbl )
+        {
+            adminTbl.put( SEQPROP_KEY, "0" );
+        }
+    }
 }

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java?rev=1136395&r1=1136394&r2=1136395&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java Thu Jun 16 12:18:22 2011
@@ -1158,6 +1158,12 @@ public abstract class AbstractStore<E, I
         }
 
         master.delete( id );
+        
+        // if this is a context entry reset the master table counter
+        if ( id.equals( getDefaultId() ) )
+        {
+            master.resetCounter();
+        }
 
         if ( isSyncOnWrite.get() )
         {

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java?rev=1136395&r1=1136394&r2=1136395&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java Thu Jun 16 12:18:22 2011
@@ -104,4 +104,13 @@ public interface MasterTable<ID, E> exte
      * @throws Exception on failure to write the property
      */
     void setProperty( String property, String value ) throws Exception;
+    
+    
+    /**
+     * Resets the root ID to 0, this method should be called after deleting the
+     * context entry of the partition
+     * 
+     * @throws Exception in case of any failure while resetting the root id value
+     */
+    void resetCounter() throws Exception;
 }
\ No newline at end of file

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java?rev=1136395&r1=1136394&r2=1136395&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java Thu Jun 16 12:18:22 2011
@@ -73,4 +73,13 @@ public class AvlMasterTable<E> extends A
     {
         props.setProperty( property, value );
     }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void resetCounter() throws Exception
+    {
+        counter.set( 0L );
+    }
 }