directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1538153 - in /directory/apacheds/trunk: mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/ mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/ server-in...
Date Sat, 02 Nov 2013 08:36:55 GMT
Author: elecharny
Date: Sat Nov  2 08:36:54 2013
New Revision: 1538153

URL: http://svn.apache.org/r1538153
Log:
o The DnSerializer was not returning the right type, leading to the impossibility to allocate
an array of RDN values
o Removed the size which was stored before the serialized entry
o Totally refactored the MavibotParentIdAndRdnSerializer class to use the new RDN/AVA/StringValue
serializer (major speedup)
o Don't decrement the counter on MavibotTable when we remove a value, do it only when we remove
a key
o Many fixes in tests

Modified:
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/DnSerializer.java
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotEntrySerializer.java
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotParentIdAndRdnSerializer.java
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java
    directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndexTest.java
    directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java

Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/DnSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/DnSerializer.java?rev=1538153&r1=1538152&r2=1538153&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/DnSerializer.java
(original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/DnSerializer.java
Sat Nov  2 08:36:54 2013
@@ -201,6 +201,6 @@ public class DnSerializer extends Abstra
     @Override
     public Class<?> getType()
     {
-        return DnSerializer.class;
+        return Dn.class;
     }
 }

Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotEntrySerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotEntrySerializer.java?rev=1538153&r1=1538152&r2=1538153&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotEntrySerializer.java
(original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotEntrySerializer.java
Sat Nov  2 08:36:54 2013
@@ -129,13 +129,6 @@ public class MavibotEntrySerializer exte
         {
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
-            int totalBytes = 0;
-            // write dummy length for preserving the space for 'length' to be filled later
-            baos.write( 0 );
-            baos.write( 0 );
-            baos.write( 0 );
-            baos.write( 0 );
-
             ObjectOutput out = new ObjectOutputStream( baos );
 
             // First, the Dn
@@ -187,14 +180,6 @@ public class MavibotEntrySerializer exte
 
             byte[] bytes = baos.toByteArray();
 
-            totalBytes = bytes.length - 4; //subtract the first 4 dummy bytes
-
-            // replace the dummy length with the actual length
-            bytes[0] = ( byte ) ( totalBytes >>> 24 );
-            bytes[1] = ( byte ) ( totalBytes >>> 16 );
-            bytes[2] = ( byte ) ( totalBytes >>> 8 );
-            bytes[3] = ( byte ) ( totalBytes );
-
             return bytes;
         }
         catch ( Exception e )
@@ -214,7 +199,7 @@ public class MavibotEntrySerializer exte
     public Entry deserialize( ByteBuffer buffer ) throws IOException
     {
         // read the length
-        int len = buffer.getInt();
+        int len = buffer.limit();
 
         ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( buffer.array(),
buffer.position(), len ) );
 

Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotParentIdAndRdnSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotParentIdAndRdnSerializer.java?rev=1538153&r1=1538152&r2=1538153&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotParentIdAndRdnSerializer.java
(original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotParentIdAndRdnSerializer.java
Sat Nov  2 08:36:54 2013
@@ -20,19 +20,17 @@
 package org.apache.directory.server.core.partition.impl.btree.mavibot;
 
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
 import java.nio.ByteBuffer;
 import java.util.Comparator;
 
+import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.api.ldap.model.name.Rdn;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.api.util.Serialize;
 import org.apache.directory.mavibot.btree.serializer.AbstractElementSerializer;
 import org.apache.directory.mavibot.btree.serializer.BufferHandler;
+import org.apache.directory.mavibot.btree.util.Strings;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.xdbm.ParentIdAndRdn;
 import org.slf4j.Logger;
@@ -85,82 +83,94 @@ public class MavibotParentIdAndRdnSerial
 
 
     /**
-     * <p>
-     * 
-     * This is the place where we serialize ParentIdAndRdn
-     * <p>
+     * This is the place where we serialize ParentIdAndRdn. The format is the following :<br/>
+     * <ul>
+     * <li>length</li>
+     * <li>the RDN</li>
+     * <li>the parent ID</li>
+     * <li>Number of children</li>
+     * <li>Number of descendant</li>
+     * <li></li>
+     * <li></li>
+     * <li></li>
+     * </ul>
      */
     public byte[] serialize( ParentIdAndRdn parentIdAndRdn )
     {
         try
         {
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            int bufferSize = 1024;
 
-            int totalBytes = 0;
-            // write dummy length for preserving the space for 'length' to be filled later
-            baos.write( 0 );
-            baos.write( 0 );
-            baos.write( 0 );
-            baos.write( 0 );
-
-            ObjectOutput out = new ObjectOutputStream( baos );
-
-            // First, the Dn
-            Rdn[] rdns;
-
-            try
-            {
-                rdns = parentIdAndRdn.getRdns();
-            }
-            catch ( NullPointerException npe )
+            while ( bufferSize < Integer.MAX_VALUE )
             {
-                throw npe;
-            }
+                // allocate a big enough buffer for most of the cases
+                byte[] buffer = new byte[bufferSize];
 
-            // Write the Rdn of the Dn
-            if ( ( rdns == null ) || ( rdns.length == 0 ) )
-            {
-                out.writeByte( 0 );
-            }
-            else
-            {
-                out.writeByte( rdns.length );
-
-                for ( Rdn rdn : rdns )
+                try
                 {
-                    rdn.writeExternal( out );
-                }
-            }
+                    // The current position. Start at 4, as we will add the length at pos
0
+                    int pos = 0;
 
-            // Then the parentId.
-            out.writeUTF( parentIdAndRdn.getParentId() );
+                    // First, the Dn
+                    Rdn[] rdns;
 
-            // The number of children
-            out.writeInt( parentIdAndRdn.getNbChildren() );
+                    try
+                    {
+                        rdns = parentIdAndRdn.getRdns();
+                    }
+                    catch ( NullPointerException npe )
+                    {
+                        throw npe;
+                    }
+
+                    // Write the Rdn of the Dn
+                    // The number of RDN (we may have more than one)
+                    if ( ( rdns == null ) || ( rdns.length == 0 ) )
+                    {
+                        pos = Serialize.serialize( 0, buffer, pos );
+                    }
+                    else
+                    {
+                        pos = Serialize.serialize( rdns.length, buffer, pos );
+
+                        for ( Rdn rdn : rdns )
+                        {
+                            pos = rdn.serialize( buffer, pos );
+                        }
+                    }
+
+                    // Then the parentId.
+                    String parentId = parentIdAndRdn.getParentId();
+                    byte[] parentIdBytes = Strings.getBytesUtf8( parentId );
+                    pos = Serialize.serialize( parentIdBytes, buffer, pos );
+
+                    // The number of children
+                    pos = Serialize.serialize( parentIdAndRdn.getNbChildren(), buffer, pos
);
+
+                    // The number of descendants
+                    pos = Serialize.serialize( parentIdAndRdn.getNbDescendants(), buffer,
pos );
+
+                    if ( IS_DEBUG )
+                    {
+                        LOG.debug( ">------------------------------------------------"
);
+                        LOG.debug( "Serialize " + parentIdAndRdn );
+                    }
 
-            // The number of descendants
-            out.writeInt( parentIdAndRdn.getNbDescendants() );
 
-            out.flush();
+                    byte[] result = new byte[pos];
+                    System.arraycopy( buffer, 0, result, 0, pos );
 
-            if ( IS_DEBUG )
-            {
-                LOG.debug( ">------------------------------------------------" );
-                LOG.debug( "Serialize " + parentIdAndRdn );
+                    return result;
+                }
+                catch ( ArrayIndexOutOfBoundsException aioobe )
+                {
+                    // Bad luck, try with a bigger buffer
+                    bufferSize += bufferSize;
+                }
             }
 
-            byte[] bytes = baos.toByteArray();
-            baos.close();
-
-            totalBytes = bytes.length - 4; //subtract the first 4 dummy bytes
-
-            // replace the dummy length with the actual length
-            bytes[0] = ( byte ) ( totalBytes >>> 24 );
-            bytes[1] = ( byte ) ( totalBytes >>> 16 );
-            bytes[2] = ( byte ) ( totalBytes >>> 8 );
-            bytes[3] = ( byte ) ( totalBytes );
-
-            return bytes;
+            // No reason we should reach this point
+            throw new RuntimeException();
         }
         catch ( Exception e )
         {
@@ -187,54 +197,11 @@ public class MavibotParentIdAndRdnSerial
     {
         int len = buffer.getInt();
 
-        ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( buffer.array(),
buffer.position(), len ) );
-
-        try
-        {
-            ParentIdAndRdn parentIdAndRdn = new ParentIdAndRdn();
-
-            // Read the number of rdns, if any
-            byte nbRdns = in.readByte();
-
-            if ( nbRdns == 0 )
-            {
-                parentIdAndRdn.setRdns( new Rdn[0] );
-            }
-            else
-            {
-                Rdn[] rdns = new Rdn[nbRdns];
-
-                for ( int i = 0; i < nbRdns; i++ )
-                {
-                    Rdn rdn = new Rdn( schemaManager );
-                    rdn.readExternal( in );
-                    rdns[i] = rdn;
-                }
-
-                parentIdAndRdn.setRdns( rdns );
-            }
-
-            // Read the parent ID
-            String uuid = in.readUTF();
-
-            parentIdAndRdn.setParentId( uuid );
-
-            // Read the nulber of children and descendants
-            int nbChildren = in.readInt();
-            int nbDescendants = in.readInt();
-
-            parentIdAndRdn.setNbChildren( nbChildren );
-            parentIdAndRdn.setNbDescendants( nbDescendants );
+        ParentIdAndRdn parentIdAndRdn = fromBytes( buffer.array(), buffer.position() );
 
-            buffer.position( buffer.position() + len );
+        buffer.position( buffer.position() + len );
 
-            return parentIdAndRdn;
-        }
-        catch ( ClassNotFoundException cnfe )
-        {
-            LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
-            throw new IOException( cnfe.getLocalizedMessage() );
-        }
+        return parentIdAndRdn;
     }
 
 
@@ -264,7 +231,7 @@ public class MavibotParentIdAndRdnSerial
     @Override
     public ParentIdAndRdn fromBytes( byte[] buffer ) throws IOException
     {
-        return fromBytes( buffer, 4 );
+        return fromBytes( buffer, 0 );
     }
 
 
@@ -274,16 +241,13 @@ public class MavibotParentIdAndRdnSerial
     @Override
     public ParentIdAndRdn fromBytes( byte[] buffer, int pos ) throws IOException
     {
-        int len = buffer.length - pos;
-
-        ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( buffer, pos,
len ) );
-
         try
         {
             ParentIdAndRdn parentIdAndRdn = new ParentIdAndRdn();
 
             // Read the number of rdns, if any
-            byte nbRdns = in.readByte();
+            int nbRdns = Serialize.deserializeInt( buffer, pos );
+            pos += 4;
 
             if ( nbRdns == 0 )
             {
@@ -296,7 +260,7 @@ public class MavibotParentIdAndRdnSerial
                 for ( int i = 0; i < nbRdns; i++ )
                 {
                     Rdn rdn = new Rdn( schemaManager );
-                    rdn.readExternal( in );
+                    pos = rdn.deserialize( buffer, pos );
                     rdns[i] = rdn;
                 }
 
@@ -304,20 +268,25 @@ public class MavibotParentIdAndRdnSerial
             }
 
             // Read the parent ID
-            String uuid = in.readUTF();
+            byte[] uuidBytes = Serialize.deserializeBytes( buffer, pos );
+            pos += 4 + uuidBytes.length;
+            String uuid = Strings.utf8ToString( uuidBytes );
 
             parentIdAndRdn.setParentId( uuid );
 
-            // Read the nulber of children and descendants
-            int nbChildren = in.readInt();
-            int nbDescendants = in.readInt();
+            // Read the number of children and descendants
+            int nbChildren = Serialize.deserializeInt( buffer, pos );
+            pos += 4;
+
+            int nbDescendants = Serialize.deserializeInt( buffer, pos );
+            pos += 4;
 
             parentIdAndRdn.setNbChildren( nbChildren );
             parentIdAndRdn.setNbDescendants( nbDescendants );
 
             return parentIdAndRdn;
         }
-        catch ( ClassNotFoundException cnfe )
+        catch ( LdapInvalidAttributeValueException cnfe )
         {
             LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
             throw new IOException( cnfe.getLocalizedMessage() );

Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java?rev=1538153&r1=1538152&r2=1538153&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java
(original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java
Sat Nov  2 08:36:54 2013
@@ -216,9 +216,9 @@ public class MavibotTable<K, V> extends 
                 return false;
             }
 
-            ValueCursor<V> dupHolder = bt.getValues( key );
+            ValueCursor<V> valueCursor = bt.getValues( key );
 
-            int equal = bt.getValueSerializer().compare( val, dupHolder.next() );
+            int equal = bt.getValueSerializer().compare( val, valueCursor.next() );
 
             return ( equal == 0 );
         }
@@ -351,7 +351,8 @@ public class MavibotTable<K, V> extends 
 
             org.apache.directory.mavibot.btree.Tuple<K, V> t = bt.delete( key, value
);
 
-            if ( t != null )
+            // We decrement the counter only when the key was found and when it has no more
values
+            if ( ( t != null ) && ( t.getValue() == null ) )
             {
                 count--;
             }

Modified: directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndexTest.java?rev=1538153&r1=1538152&r2=1538153&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndexTest.java
(original)
+++ directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndexTest.java
Sat Nov  2 08:36:54 2013
@@ -273,10 +273,10 @@ public class MavibotIndexTest
         assertEquals( 1, idx.count() );
 
         idx.add( "foo", Strings.getUUID( 333L ) );
-        assertEquals( 2, idx.count() );
+        assertEquals( 1, idx.count() );
 
         idx.add( "bar", Strings.getUUID( 555L ) );
-        assertEquals( 3, idx.count() );
+        assertEquals( 2, idx.count() );
     }
 
 
@@ -473,16 +473,16 @@ public class MavibotIndexTest
         assertEquals( 1, idx.count() );
 
         idx.add( "foo", Strings.getUUID( 333L ) );
-        assertEquals( 2, idx.count() );
+        assertEquals( 1, idx.count() );
 
         idx.add( "bar", Strings.getUUID( 555L ) );
-        assertEquals( 3, idx.count() );
+        assertEquals( 2, idx.count() );
 
         // use forward index's cursor
         Cursor<IndexEntry<String, String>> cursor = idx.forwardCursor();
         cursor.beforeFirst();
 
-        assertEquals( 3, idx.count() );
+        assertEquals( 2, idx.count() );
 
         cursor.next();
         IndexEntry<String, String> e1 = cursor.get();
@@ -492,6 +492,7 @@ public class MavibotIndexTest
         cursor.next();
         IndexEntry<String, String> e2 = cursor.get();
         assertEquals( Strings.getUUID( 333L ), e2.getId() );
+        //assertEquals( Strings.getUUID( 1234L ), e3.getId() );
         assertEquals( "foo", e2.getKey() );
 
         cursor.next();

Modified: directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java?rev=1538153&r1=1538152&r2=1538153&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
(original)
+++ directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
Sat Nov  2 08:36:54 2013
@@ -201,7 +201,7 @@ public class MavibotStoreTest
         if ( store != null )
         {
             // make sure all files are closed so that they can be deleted on Windows.
-            store.destroy();
+            //store.destroy();
         }
 
         store = null;
@@ -248,7 +248,7 @@ public class MavibotStoreTest
         assertEquals( 2, lookup.getDn().size() );
 
         // make sure all files are closed so that they can be deleted on Windows.
-        store2.destroy();
+        //store2.destroy();
         FileUtils.deleteDirectory( wkdir2 );
     }
 
@@ -676,7 +676,7 @@ public class MavibotStoreTest
 
         store.move( childDn, parentDn, newDn, childEntry );
 
-        assertEquals( 4, store.getSubAliasIndex().count() );
+        assertEquals( 3, store.getSubAliasIndex().count() );
     }
 
 

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java?rev=1538153&r1=1538152&r2=1538153&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
Sat Nov  2 08:36:54 2013
@@ -83,6 +83,7 @@ import org.junit.runner.RunWith;
     },
     enableChangeLog = false)
 @CreateLdapServer(transports =
+    //{ @CreateTransport(address = "192.168.1.1", port = 10389, protocol = "LDAP") })
     { @CreateTransport(protocol = "LDAP") })
 public class SearchPerfIT extends AbstractLdapTestUnit
 {
@@ -187,7 +188,8 @@ public class SearchPerfIT extends Abstra
             long t1 = System.currentTimeMillis();
 
             Long deltaWarmed = ( t1 - t00 );
-            System.out.println( "OBJECT level - Delta : " + deltaWarmed + "( " + ( ( ( nbIterations
- 50000 ) * 1000 ) / deltaWarmed )
+            System.out.println( "OBJECT level - Delta : " + deltaWarmed + "( "
+                + ( ( ( nbIterations - 50000 ) * 1000 ) / deltaWarmed )
                 + " per s ) /" + ( t1 - t0 ) + ", count : " + count );
 
             System.out.println( "DeltaSearch : " + ( deltaSearch / nbIterations ) );
@@ -293,7 +295,8 @@ public class SearchPerfIT extends Abstra
             long t1 = System.currentTimeMillis();
 
             Long deltaWarmed = ( t1 - t00 );
-            System.out.println( "ONE level - Delta : " + deltaWarmed + "( " + ( ( ( nbIterations
- 50000 ) * 1000 ) / deltaWarmed ) * 5
+            System.out.println( "ONE level - Delta : " + deltaWarmed + "( "
+                + ( ( ( nbIterations - 50000 ) * 1000 ) / deltaWarmed ) * 5
                 + " per s ) /" + ( t1 - t0 ) + ", count : " + count );
         }
         catch ( LdapException e )
@@ -396,7 +399,8 @@ public class SearchPerfIT extends Abstra
             long t1 = System.currentTimeMillis();
 
             Long deltaWarmed = ( t1 - t00 );
-            System.out.println( "SUB level - Delta : " + deltaWarmed + "( " + ( ( ( nbIterations
- 50000 ) * 1000 ) / deltaWarmed )
+            System.out.println( "SUB level - Delta : " + deltaWarmed + "( "
+                + ( ( ( nbIterations - 50000 ) * 1000 ) / deltaWarmed )
                 * 10
                 + " per s ) /" + ( t1 - t0 ) + ", count : " + count );
         }
@@ -414,7 +418,7 @@ public class SearchPerfIT extends Abstra
 
 
     @Test
-    public void testSearch100kUsers() throws LdapException, CursorException
+    public void testSearch100kUsers() throws LdapException, CursorException, InterruptedException
     {
         LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort()
);
         connection.bind( "uid=admin,ou=system", "secret" );
@@ -428,7 +432,7 @@ public class SearchPerfIT extends Abstra
         connection.add( rootPeople );
 
         long tadd0 = System.currentTimeMillis();
-        for ( int i = 0; i < 10000; i++ )
+        for ( int i = 0; i < 100000; i++ )
         {
             Entry user = new DefaultEntry(
                 "uid=user." + i + ",ou=People,dc=example,dc=com",
@@ -465,6 +469,9 @@ public class SearchPerfIT extends Abstra
 
         System.out.println( "Time to inject 100k entries : " + ( ( tadd1 - tadd0 ) / 1000
) + "s" );
 
+        // Sleep forever
+        //Thread.sleep( 3600000L );
+
         // Now do a random search
         SearchRequest searchRequest = new SearchRequestImpl();
 
@@ -495,7 +502,7 @@ public class SearchPerfIT extends Abstra
                 t00 = System.currentTimeMillis();
             }
 
-            searchRequest.setFilter( "(cn=user" + random.nextInt( 10000 ) + ")" );
+            searchRequest.setFilter( "(cn=user" + random.nextInt( 100000 ) + ")" );
 
             SearchCursor cursor = connection.search( searchRequest );
 

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=1538153&r1=1538152&r2=1538153&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
Sat Nov  2 08:36:54 2013
@@ -1353,7 +1353,7 @@ public abstract class AbstractBTreeParti
             // Special cases for null values
             if ( mods.getAttributeType().getSyntax().isHumanReadable() )
             {
-                entry.add( mods.getAttributeType(), new StringValue( null ) );
+                entry.add( mods.getAttributeType(), new StringValue( ( String ) null ) );
             }
             else
             {



Mime
View raw message