You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Alex Karasulu <ak...@nextury.com> on 2009/05/13 01:34:50 UTC

Re: Performance issue when deleting entries

On Tue, May 12, 2009 at 2:23 PM, Kiran Ayyagari wrote:

>
> Hi Emmanuel,
>
> The below fix would avoid building of a global cursor on a table and moving
> it to appropriate position and at the same time avoiding iterating on all
> the values.
>
>
>  Index:
> src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
> ===================================================================
> ---
> src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
> (revision 766843)
> +++
> src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
> (working copy)
> @@ -475,9 +475,8 @@
>       */
>      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() )
>          {
>
>
> P.S :- thanks to Seelmann and Emmanuel without their identification of
> problem and
>          fix I wouldn't have got this idea.
>

That's an elegant fix !!!

FYI: We should keep things like this on the dev ML.

-- 
Alex Karasulu
My Blog :: http://www.jroller.com/akarasulu/
Apache Directory Server :: http://directory.apache.org
Apache MINA :: http://mina.apache.org

Re: Performance issue when deleting entries

Posted by Emmanuel Lecharny <el...@apache.org>.
Alex Karasulu wrote:
> On Tue, May 12, 2009 at 2:23 PM, Kiran Ayyagari wrote:
>
>   
>> Hi Emmanuel,
>>
>> The below fix would avoid building of a global cursor on a table and moving
>> it to appropriate position and at the same time avoiding iterating on all
>> the values.
>>
>>
>>  Index:
>> src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
>> ===================================================================
>> ---
>> src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
>> (revision 766843)
>> +++
>> src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
>> (working copy)
>> @@ -475,9 +475,8 @@
>>       */
>>      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() )
>>          {
>>
>>
>> P.S :- thanks to Seelmann and Emmanuel without their identification of
>> problem and
>>          fix I wouldn't have got this idea.
>>
>>     
>
> That's an elegant fix !!!
>   

I applied it yesturday.

I will create a JIRA in order to have it in the release note.

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org