Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1A3A8831E for ; Thu, 1 Sep 2011 17:34:41 +0000 (UTC) Received: (qmail 4431 invoked by uid 500); 1 Sep 2011 17:34:41 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 4394 invoked by uid 500); 1 Sep 2011 17:34:40 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 4385 invoked by uid 99); 1 Sep 2011 17:34:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Sep 2011 17:34:40 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Sep 2011 17:34:30 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5E2BD23889B3 for ; Thu, 1 Sep 2011 17:34:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1164182 [1/2] - in /directory/apacheds/trunk: core-annotations/ core-api/ core-avl/ core-constants/ core-integ/ core-integ/src/test/java/org/apache/directory/server/core/collective/ core-jndi/ core/ core/src/main/java/org/apache/directory/... Date: Thu, 01 Sep 2011 17:34:05 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110901173407.5E2BD23889B3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Thu Sep 1 17:34:03 2011 New Revision: 1164182 URL: http://svn.apache.org/viewvc?rev=1164182&view=rev Log: o Merged back the apacheds-jdbm branch into trunks Added: directory/apacheds/trunk/jdbm/src/main/java/jdbm/ActionRecordManager.java - copied unchanged from r1164076, directory/apacheds/branches/apacheds-jdbm/jdbm/src/main/java/jdbm/ActionRecordManager.java directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/ActionContext.java - copied unchanged from r1164076, directory/apacheds/branches/apacheds-jdbm/jdbm/src/main/java/jdbm/helper/ActionContext.java directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/ActionVersioning.java - copied unchanged from r1164076, directory/apacheds/branches/apacheds-jdbm/jdbm/src/main/java/jdbm/helper/ActionVersioning.java directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/EntryIO.java - copied unchanged from r1164076, directory/apacheds/branches/apacheds-jdbm/jdbm/src/main/java/jdbm/helper/EntryIO.java directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/ExplicitList.java - copied unchanged from r1164076, directory/apacheds/branches/apacheds-jdbm/jdbm/src/main/java/jdbm/helper/ExplicitList.java directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/LRUCache.java - copied unchanged from r1164076, directory/apacheds/branches/apacheds-jdbm/jdbm/src/main/java/jdbm/helper/LRUCache.java directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/SnapshotRecordManager.java - copied unchanged from r1164076, directory/apacheds/branches/apacheds-jdbm/jdbm/src/main/java/jdbm/recman/SnapshotRecordManager.java directory/apacheds/trunk/jdbm/src/test/java/jdbm/btree/SnapshotBTree.java - copied unchanged from r1164076, directory/apacheds/branches/apacheds-jdbm/jdbm/src/test/java/jdbm/btree/SnapshotBTree.java directory/apacheds/trunk/jdbm/src/test/java/jdbm/helper/ - copied from r1164076, directory/apacheds/branches/apacheds-jdbm/jdbm/src/test/java/jdbm/helper/ directory/apacheds/trunk/jdbm/src/test/java/jdbm/helper/TestActionVersioning.java - copied unchanged from r1164076, directory/apacheds/branches/apacheds-jdbm/jdbm/src/test/java/jdbm/helper/TestActionVersioning.java directory/apacheds/trunk/jdbm/src/test/java/jdbm/helper/TestVersionedCache.java - copied unchanged from r1164076, directory/apacheds/branches/apacheds-jdbm/jdbm/src/test/java/jdbm/helper/TestVersionedCache.java Modified: directory/apacheds/trunk/core/ (props changed) directory/apacheds/trunk/core-annotations/ (props changed) directory/apacheds/trunk/core-api/ (props changed) directory/apacheds/trunk/core-avl/ (props changed) directory/apacheds/trunk/core-constants/ (props changed) directory/apacheds/trunk/core-integ/ (props changed) directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java (props changed) directory/apacheds/trunk/core-jndi/ (props changed) directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyConfiguration.java (props changed) directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java directory/apacheds/trunk/jdbm/ (props changed) directory/apacheds/trunk/jdbm-partition/ (props changed) directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/ (props changed) directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java (props changed) directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/ (props changed) directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java (props changed) directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BPage.java directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java directory/apacheds/trunk/jdbm/src/main/java/jdbm/helper/TupleBrowser.java directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/BaseRecordManager.java directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/BlockIo.java directory/apacheds/trunk/ldap-client-test/ (props changed) directory/apacheds/trunk/ldif-partition/ (props changed) directory/apacheds/trunk/protocol-ldap/ (props changed) directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java (props changed) directory/apacheds/trunk/protocol-shared/ (props changed) directory/apacheds/trunk/server-annotations/ (props changed) directory/apacheds/trunk/server-config/ (props changed) directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java (props changed) directory/apacheds/trunk/server-config/src/main/resources/ (props changed) directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java (props changed) directory/apacheds/trunk/server-integ/ (props changed) directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/StoredProcedureIT.java directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/replication/ClientServerReplicationIT.java directory/apacheds/trunk/server-jndi/ (props changed) directory/apacheds/trunk/service/ (props changed) directory/apacheds/trunk/xdbm-partition/ (props changed) directory/apacheds/trunk/xdbm-tools/ (props changed) Propchange: directory/apacheds/trunk/core/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -2,6 +2,7 @@ /directory/apacheds/branches/apacheds-codec-merge/core:982369-987590 /directory/apacheds/branches/apacheds-config/core:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/core:980138-980934 +/directory/apacheds/branches/apacheds-jdbm/core:1160768-1164072 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/core:1040956-1043765 /directory/apacheds/branches/milestones/core:1072812-1075328 /directory/apacheds/trunk/core:1066126-1067785,1068026-1072718,1072800-1075329 Propchange: directory/apacheds/trunk/core-annotations/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -2,6 +2,7 @@ /directory/apacheds/branches/apacheds-codec-merge/core-annotations:982369-987590 /directory/apacheds/branches/apacheds-config/core-annotations:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/core-annotations:980138-980934 +/directory/apacheds/branches/apacheds-jdbm/core-annotations:1160768-1164073 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/core-annotations:1040956-1043765 /directory/apacheds/branches/milestones/core-annotations:1072812-1075328 /directory/apacheds/trunk/core-annotations:1066126-1067785,1068026-1072718,1072800-1075329 Propchange: directory/apacheds/trunk/core-api/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -1,6 +1,7 @@ /directory/apacheds/branches/apacheds-codec-merge/core-api:982369-987590 /directory/apacheds/branches/apacheds-config/core-api:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/core-api:980138-980934 +/directory/apacheds/branches/apacheds-jdbm/core-api:1160768-1164073 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/core-api:1040956-1043765 /directory/apacheds/branches/milestones/core-api:1072812-1075328 /directory/apacheds/trunk/core-api:1066126-1067785,1068026-1072718,1072800-1075329 Propchange: directory/apacheds/trunk/core-avl/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -1,6 +1,7 @@ /directory/apacheds/branches/apacheds-codec-merge/core-avl:982369-987590 /directory/apacheds/branches/apacheds-config/core-avl:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/core-avl:980138-980934 +/directory/apacheds/branches/apacheds-jdbm/core-avl:1160768-1164073 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/core-avl:1040956-1043765 /directory/apacheds/branches/milestones/core-avl:1072812-1075328 /directory/apacheds/trunk/core-avl:1066126-1067785,1068026-1072718,1072800-1075329 Propchange: directory/apacheds/trunk/core-constants/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -1,6 +1,7 @@ /directory/apacheds/branches/apacheds-codec-merge/core-constants:982369-987590 /directory/apacheds/branches/apacheds-config/core-constants:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/core-constants:980138-980934 +/directory/apacheds/branches/apacheds-jdbm/core-constants:1160768-1164075 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/core-constants:1040956-1043765 /directory/apacheds/branches/milestones/core-constants:1072812-1075328 /directory/apacheds/trunk/core-constants:1066126-1067785,1068026-1072718,1072800-1075329 Propchange: directory/apacheds/trunk/core-integ/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -1,6 +1,7 @@ /directory/apacheds/branches/apacheds-codec-merge/core-integ:982369-987590 /directory/apacheds/branches/apacheds-config/core-integ:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/core-integ:980138-980934 +/directory/apacheds/branches/apacheds-jdbm/core-integ:1160768-1164075 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/core-integ:1040956-1043765 /directory/apacheds/branches/milestones/core-integ:1072812-1075328 /directory/apacheds/trunk/core-integ:1066126-1067785,1068026-1072718,1072800-1075329 Propchange: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -1,6 +1,7 @@ /directory/apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java:982369-987590 /directory/apacheds/branches/apacheds-config/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java:980138-980934 +/directory/apacheds/branches/apacheds-jdbm/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java:1160768-1164075 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java:1040956-1043765 /directory/apacheds/branches/apacheds-replication/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java:749790-764110 /directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java:806623-896441 Propchange: directory/apacheds/trunk/core-jndi/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -1,6 +1,7 @@ /directory/apacheds/branches/apacheds-codec-merge/core-jndi:982369-987590 /directory/apacheds/branches/apacheds-config/core-jndi:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/core-jndi:980138-980935 +/directory/apacheds/branches/apacheds-jdbm/core-jndi:1160768-1164075 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/core-jndi:1040956-1043765 /directory/apacheds/branches/milestones/core-jndi:1072812-1075328 /directory/apacheds/trunk/core-jndi:1066126-1067785,1068026-1072718,1072800-1075329 Propchange: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyConfiguration.java ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -1,6 +1,7 @@ /directory/apacheds/branches/apacheds-codec-merge/core/src/main/java/org/apache/directory/server/core/authn/PasswordPolicyConfiguration.java:982369-987590 /directory/apacheds/branches/apacheds-config/core-api/src/main/java/org/apache/directory/server/core/PasswordPolicyConfiguration.java:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/core/src/main/java/org/apache/directory/server/core/authn/PasswordPolicyConfiguration.java:980138-980934 +/directory/apacheds/branches/apacheds-jdbm/core/src/main/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyConfiguration.java:1160768-1164072 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/core-api/src/main/java/org/apache/directory/server/core/PasswordPolicyConfiguration.java:1040956-1043765 /directory/apacheds/branches/apacheds-replication/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyConfiguration.java:749790-764110 /directory/apacheds/branches/apacheds-schema/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyConfiguration.java:806623-896441 Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=1164182&r1=1164181&r2=1164182&view=diff ============================================================================== --- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original) +++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Thu Sep 1 17:34:03 2011 @@ -245,13 +245,22 @@ public class SubentryInterceptor extends subentryCache.addSubentry( subentryDn, newSubentry ); } - - subentries.close(); } catch ( Exception e ) { throw new LdapOperationException( e.getMessage(), e ); } + finally + { + try + { + subentries.close(); + } + catch ( Exception e ) + { + LOG.error( I18n.err( I18n.ERR_168 ), e ); + } + } } } @@ -371,11 +380,23 @@ public class SubentryInterceptor extends nexus.modify( new ModifyOperationContext( session, candidateDn, modifications ) ); } } + subentries.close(); } catch ( Exception e ) { throw new LdapOtherException( e.getMessage(), e ); } + finally + { + try + { + subentries.close(); + } + catch ( Exception e ) + { + LOG.error( I18n.err( I18n.ERR_168 ), e ); + } + } } @@ -1085,11 +1106,24 @@ public class SubentryInterceptor extends getOperationalModsForRemove( dn, candidate ) ) ); } } + + subentries.close(); } catch ( Exception e ) { throw new LdapOperationErrorException( e.getMessage(), e ); } + finally + { + try + { + subentries.close(); + } + catch ( Exception e ) + { + LOG.error( I18n.err( I18n.ERR_168 ), e ); + } + } // search for all selected entries by the new SS and add references to subentry subentry = subentryCache.getSubentry( dn ); @@ -1115,11 +1149,23 @@ public class SubentryInterceptor extends getOperationalModsForAdd( candidate, operationalAttributes ) ) ); } } + subentries.close(); } catch ( Exception e ) { throw new LdapOperationErrorException( e.getMessage(), e ); } + finally + { + try + { + subentries.close(); + } + catch ( Exception e ) + { + LOG.error( I18n.err( I18n.ERR_168 ), e ); + } + } } else { @@ -1228,13 +1274,22 @@ public class SubentryInterceptor extends oldDn, newName, subentry, candidate ) ) ); } } - - subentries.close(); } catch ( Exception e ) { throw new LdapOperationException( e.getMessage(), e ); } + finally + { + try + { + subentries.close(); + } + catch ( Exception e ) + { + LOG.error( I18n.err( I18n.ERR_168 ), e ); + } + } } else { @@ -1319,13 +1374,22 @@ public class SubentryInterceptor extends oldDn, newName, subentry, candidate ) ) ); } } - - subentries.close(); } catch ( Exception e ) { throw new LdapOperationException( e.getMessage(), e ); } + finally + { + try + { + subentries.close(); + } + catch ( Exception e ) + { + LOG.error( I18n.err( I18n.ERR_168 ), e ); + } + } } else { @@ -1400,13 +1464,22 @@ public class SubentryInterceptor extends oldDn, newName, subentry, candidate ) ) ); } } - - subentries.close(); } catch ( Exception e ) { throw new LdapOperationException( e.getMessage(), e ); } + finally + { + try + { + subentries.close(); + } + catch ( Exception e ) + { + LOG.error( I18n.err( I18n.ERR_168 ), e ); + } + } } else { Propchange: directory/apacheds/trunk/jdbm/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -1,6 +1,7 @@ /directory/apacheds/branches/apacheds-codec-merge/jdbm:982369-987590 /directory/apacheds/branches/apacheds-config/jdbm:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/jdbm:980138-980935 +/directory/apacheds/branches/apacheds-jdbm/jdbm:1160768-1164076 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/jdbm:1040956-1043765 /directory/apacheds/branches/milestones/jdbm:1072812-1075328 /directory/apacheds/trunk/jdbm:1066126-1067785,1068026-1072718,1072800-1075329 Propchange: directory/apacheds/trunk/jdbm-partition/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -1,6 +1,7 @@ /directory/apacheds/branches/apacheds-codec-merge/jdbm-partition:982369-987590 /directory/apacheds/branches/apacheds-config/jdbm-partition:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/jdbm-partition:980138-980935 +/directory/apacheds/branches/apacheds-jdbm/jdbm-partition:1160768-1164080 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/jdbm-partition:1040956-1043765 /directory/apacheds/branches/milestones/jdbm-partition:1072812-1075328 /directory/apacheds/trunk/jdbm-partition:1066126-1067785,1068026-1072718,1072800-1075329 Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java?rev=1164182&r1=1164181&r2=1164182&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java Thu Sep 1 17:34:03 2011 @@ -106,7 +106,7 @@ public class DupsContainerCursor ex public void beforeKey( K key ) throws Exception { checkNotClosed( "beforeKey()" ); - + this.closeBrowser( browser ); browser = ((BTree)table.getBTree()).browse( key ); forwardDirection = null; clearValue(); @@ -121,6 +121,7 @@ public class DupsContainerCursor ex { checkNotClosed( "afterKey()" ); + this.closeBrowser( browser ); browser = ((BTree)table.getBTree()).browse( key ); forwardDirection = null; @@ -203,7 +204,7 @@ public class DupsContainerCursor ex public void beforeFirst() throws Exception { checkNotClosed( "beforeFirst()" ); - + this.closeBrowser( browser ); browser = table.getBTree().browse(); forwardDirection = null; clearValue(); @@ -217,7 +218,7 @@ public class DupsContainerCursor ex public void afterLast() throws Exception { checkNotClosed( "afterLast()" ); - + this.closeBrowser( browser ); browser = table.getBTree().browse( null ); forwardDirection = null; clearValue(); @@ -367,4 +368,33 @@ public class DupsContainerCursor ex throw new InvalidCursorPositionException(); } + + /** + * {@inheritDoc} + */ + @Override + public void close() throws Exception + { + super.close(); + this.closeBrowser( browser ); + } + + + /** + * {@inheritDoc} + */ + @Override + public void close( Exception cause ) throws Exception + { + super.close( cause ); + this.closeBrowser( browser ); + } + + private void closeBrowser(TupleBrowser browser) + { + if ( browser != null ) + { + browser.close(); + } + } } Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java?rev=1164182&r1=1164181&r2=1164182&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java Thu Sep 1 17:34:03 2011 @@ -456,4 +456,26 @@ class DupsCursor extends AbstractTu return returnedTuple; } + + + /** + * {@inheritDoc} + */ + @Override + public void close() throws Exception + { + super.close(); + containerCursor.close(); + } + + + /** + * {@inheritDoc} + */ + @Override + public void close( Exception cause ) throws Exception + { + super.close( cause ); + containerCursor.close( cause ); + } } Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=1164182&r1=1164181&r2=1164182&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Thu Sep 1 17:34:03 2011 @@ -26,9 +26,8 @@ import java.io.IOException; import java.net.URI; import jdbm.RecordManager; -import jdbm.helper.MRU; import jdbm.recman.BaseRecordManager; -import jdbm.recman.CacheRecordManager; +import jdbm.recman.SnapshotRecordManager; import org.apache.directory.server.core.partition.impl.btree.IndexCursorAdaptor; import org.apache.directory.server.core.partition.impl.btree.LongComparator; @@ -176,7 +175,7 @@ public class JdbmIndex extends Abs BaseRecordManager base = new BaseRecordManager( path ); base.disableTransactions(); - this.recMan = new CacheRecordManager( base, new MRU( DEFAULT_INDEX_CACHE_SIZE ) ); + this.recMan = new SnapshotRecordManager( base, DEFAULT_INDEX_CACHE_SIZE ); try { Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=1164182&r1=1164181&r2=1164182&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Thu Sep 1 17:34:03 2011 @@ -27,9 +27,8 @@ import java.util.Arrays; import java.util.List; import jdbm.RecordManager; -import jdbm.helper.MRU; import jdbm.recman.BaseRecordManager; -import jdbm.recman.CacheRecordManager; +import jdbm.recman.SnapshotRecordManager; import org.apache.directory.server.constants.ApacheSchemaConstants; import org.apache.directory.server.core.partition.Partition; @@ -141,7 +140,7 @@ public class JdbmPartition extends Abstr } // Now, create the entry cache for this partition - recMan = new CacheRecordManager( baseRecordManager, new MRU( cacheSize ) ); + recMan = new SnapshotRecordManager( baseRecordManager, cacheSize ); // Create the master table (the table containing all the entries) master = new JdbmMasterTable( recMan, schemaManager ); Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java?rev=1164182&r1=1164181&r2=1164182&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java Thu Sep 1 17:34:03 2011 @@ -27,9 +27,8 @@ import java.io.IOException; import javax.naming.NamingException; -import jdbm.helper.MRU; import jdbm.recman.BaseRecordManager; -import jdbm.recman.CacheRecordManager; +import jdbm.recman.SnapshotRecordManager; import org.apache.directory.server.core.partition.impl.btree.LongComparator; import org.apache.directory.server.i18n.I18n; @@ -95,7 +94,7 @@ public class JdbmRdnIndex extends Jdb //System.out.println( "IDX Created index " + path ); BaseRecordManager base = new BaseRecordManager( path ); base.disableTransactions(); - this.recMan = new CacheRecordManager( base, new MRU( cacheSize ) ); + this.recMan = new SnapshotRecordManager( base, cacheSize ); try { Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=1164182&r1=1164181&r2=1164182&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java Thu Sep 1 17:34:03 2011 @@ -312,7 +312,7 @@ public class JdbmTable extends Abst if ( ! allowsDuplicates ) { return ( V ) bt.find( key ); - } + } DupsContainer values = getDupsContainer( ( byte[] ) bt.find( key ) ); @@ -332,7 +332,9 @@ public class JdbmTable extends Abst BTree tree = getBTree( values.getBTreeRedirect() ); jdbm.helper.Tuple tuple = new jdbm.helper.Tuple(); - tree.browse().getNext( tuple ); + TupleBrowser browser = tree.browse(); + browser.getNext( tuple ); + this.closeBrowser( browser ); //noinspection unchecked return ( V ) tuple.getKey(); @@ -468,8 +470,11 @@ public class JdbmTable extends Abst if ( browser.getPrevious( tuple ) ) { + this.closeBrowser( browser ); return true; } + + this.closeBrowser( browser ); } return false; @@ -563,6 +568,7 @@ public class JdbmTable extends Abst { return; } + if ( set.size() > numDupLimit ) { BTree tree = convertToBTree( set ); @@ -629,6 +635,7 @@ public class JdbmTable extends Abst { LOG.debug( "<--- Remove NULL key " + name ); } + return; } @@ -670,6 +677,7 @@ public class JdbmTable extends Abst { bt.insert( key, (V)marshaller.serialize( set ), true ); } + count--; if ( LOG.isDebugEnabled() ) @@ -771,6 +779,7 @@ public class JdbmTable extends Abst recMan.delete( tree.getRecordId() ); duplicateBtrees.remove( tree.getRecordId() ); + return; } else @@ -838,6 +847,7 @@ public class JdbmTable extends Abst } ArrayTree set = marshaller.deserialize( serialized ); + return new KeyTupleArrayCursor( set, key ); } @@ -863,6 +873,7 @@ public class JdbmTable extends Abst } byte[] serialized = ( byte[] ) raw; + if ( BTreeRedirectMarshaller.isRedirect( serialized ) ) { BTree tree = getBTree( BTreeRedirectMarshaller.INSTANCE.deserialize( serialized ) ); @@ -927,6 +938,7 @@ public class JdbmTable extends Abst } DupsContainer values = getDupsContainer( ( byte[] ) bt.find( key ) ); + if ( values.isBTreeRedirect() ) { return true; @@ -973,6 +985,7 @@ public class JdbmTable extends Abst BTree tree = new BTree().load( recMan, redirect.getRecId() ); ((SerializableComparator)tree.getComparator()).setSchemaManager( schemaManager ); duplicateBtrees.put( redirect.getRecId(), tree ); + return tree; } @@ -983,34 +996,43 @@ public class JdbmTable extends Abst jdbm.helper.Tuple tuple = new jdbm.helper.Tuple(); TupleBrowser browser = tree.browse( key ); - if ( isGreaterThan ) - { - return browser.getNext( tuple ); - } - else + + try { - if ( browser.getPrevious( tuple ) ) - { - return true; + if ( isGreaterThan ) + { + return browser.getNext( tuple ); } else { - /* - * getPrevious() above fails which means the browser has is - * before the first Tuple of the btree. A call to getNext() - * should work every time. - */ - browser.getNext( tuple ); - - /* - * Since the browser is positioned now on the Tuple with the - * smallest key we just need to check if it equals this key - * which is the only chance for returning true. - */ - V firstKey = ( V ) tuple.getKey(); - return valueComparator.compare( key, firstKey ) == 0; + if ( browser.getPrevious( tuple ) ) + { + return true; + } + else + { + /* + * getPrevious() above fails which means the browser has is + * before the first Tuple of the btree. A call to getNext() + * should work every time. + */ + browser.getNext( tuple ); + + /* + * Since the browser is positioned now on the Tuple with the + * smallest key we just need to check if it equals this key + * which is the only chance for returning true. + */ + V firstKey = ( V ) tuple.getKey(); + + return valueComparator.compare( key, firstKey ) == 0; + } } } + finally + { + this.closeBrowser( browser ); + } } @@ -1026,6 +1048,8 @@ public class JdbmTable extends Abst avlTree.insert( ( V ) tuple.getKey() ); } + this.closeBrowser( browser ); + return avlTree; } @@ -1053,4 +1077,12 @@ public class JdbmTable extends Abst return bTree; } + + private void closeBrowser(TupleBrowser browser) + { + if ( browser != null ) + { + browser.close(); + } + } } Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java?rev=1164182&r1=1164181&r2=1164182&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java Thu Sep 1 17:34:03 2011 @@ -76,6 +76,7 @@ public class KeyBTreeCursor extends A public void before( E element ) throws Exception { checkNotClosed( "before()" ); + this.closeBrowser( browser ); browser = btree.browse( element ); clearValue(); } @@ -84,6 +85,7 @@ public class KeyBTreeCursor extends A @SuppressWarnings("unchecked") public void after( E element ) throws Exception { + this.closeBrowser( browser ); browser = btree.browse( element ); /* @@ -125,6 +127,7 @@ public class KeyBTreeCursor extends A public void beforeFirst() throws Exception { checkNotClosed( "beforeFirst()" ); + this.closeBrowser( browser ); browser = btree.browse(); clearValue(); } @@ -133,6 +136,7 @@ public class KeyBTreeCursor extends A public void afterLast() throws Exception { checkNotClosed( "afterLast()" ); + this.closeBrowser( browser ); browser = btree.browse( null ); } @@ -154,6 +158,7 @@ public class KeyBTreeCursor extends A public boolean previous() throws Exception { checkNotClosed( "previous()" ); + if ( browser == null ) { browser = btree.browse( null ); @@ -174,6 +179,7 @@ public class KeyBTreeCursor extends A public boolean next() throws Exception { checkNotClosed( "next()" ); + if ( browser == null ) { browser = btree.browse(); @@ -186,6 +192,7 @@ public class KeyBTreeCursor extends A else { clearValue(); + return false; } } @@ -195,6 +202,7 @@ public class KeyBTreeCursor extends A public E get() throws Exception { checkNotClosed( "get()" ); + if ( valueAvailable ) { return ( E ) tuple.getKey(); @@ -202,4 +210,34 @@ public class KeyBTreeCursor extends A throw new InvalidCursorPositionException(); } + + /** + * {@inheritDoc} + */ + @Override + public void close() throws Exception + { + super.close(); + this.closeBrowser( browser ); + } + + + /** + * {@inheritDoc} + */ + @Override + public void close( Exception cause ) throws Exception + { + super.close( cause ); + this.closeBrowser( browser ); + } + + + private void closeBrowser(TupleBrowser browser) + { + if ( browser != null ) + { + browser.close(); + } + } } Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java?rev=1164182&r1=1164181&r2=1164182&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java Thu Sep 1 17:34:03 2011 @@ -108,7 +108,7 @@ public class KeyTupleBTreeCursor ex { throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) ); } - + this.closeBrowser( browser ); browser = btree.browse( value ); clearValue(); } @@ -125,6 +125,7 @@ public class KeyTupleBTreeCursor ex throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) ); } + this.closeBrowser( browser ); browser = btree.browse( value ); /* @@ -152,6 +153,7 @@ public class KeyTupleBTreeCursor ex */ if ( !browser.getPrevious( valueTuple ) ) { + this.closeBrowser( browser ); browser = btree.browse( this.key ); } @@ -176,6 +178,7 @@ public class KeyTupleBTreeCursor ex public void before( Tuple element ) throws Exception { checkNotClosed( "before()" ); + this.closeBrowser( browser ); browser = btree.browse( element.getValue() ); clearValue(); } @@ -196,6 +199,7 @@ public class KeyTupleBTreeCursor ex public void beforeFirst() throws Exception { checkNotClosed( "beforeFirst()" ); + this.closeBrowser( browser ); browser = btree.browse(); clearValue(); } @@ -207,6 +211,7 @@ public class KeyTupleBTreeCursor ex public void afterLast() throws Exception { checkNotClosed( "afterLast()" ); + this.closeBrowser( browser ); browser = btree.browse( null ); } @@ -308,4 +313,34 @@ public class KeyTupleBTreeCursor ex throw new InvalidCursorPositionException(); } + + /** + * {@inheritDoc} + */ + @Override + public void close() throws Exception + { + super.close(); + this.closeBrowser( browser ); + } + + + /** + * {@inheritDoc} + */ + @Override + public void close( Exception cause ) throws Exception + { + super.close( cause ); + this.closeBrowser( browser ); + } + + + private void closeBrowser(TupleBrowser browser) + { + if ( browser != null ) + { + browser.close(); + } + } } Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java?rev=1164182&r1=1164181&r2=1164182&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java (original) +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java Thu Sep 1 17:34:03 2011 @@ -78,6 +78,7 @@ class NoDupsCursor extends Abstract public void beforeKey( K key ) throws Exception { checkNotClosed( "beforeKey()" ); + this.closeBrowser( browser ); browser = table.getBTree().browse( key ); clearValue(); } @@ -86,6 +87,7 @@ class NoDupsCursor extends Abstract @SuppressWarnings("unchecked") public void afterKey( K key ) throws Exception { + this.closeBrowser( browser ); browser = table.getBTree().browse( key ); /* @@ -147,6 +149,7 @@ class NoDupsCursor extends Abstract public void beforeFirst() throws Exception { checkNotClosed( "beforeFirst()" ); + this.closeBrowser( browser ); browser = table.getBTree().browse(); clearValue(); } @@ -155,6 +158,7 @@ class NoDupsCursor extends Abstract public void afterLast() throws Exception { checkNotClosed( "afterLast()" ); + this.closeBrowser( browser ); browser = table.getBTree().browse( null ); clearValue(); } @@ -242,4 +246,33 @@ class NoDupsCursor extends Abstract throw new InvalidCursorPositionException(); } + + /** + * {@inheritDoc} + */ + @Override + public void close() throws Exception + { + super.close(); + this.closeBrowser( browser ); + } + + + /** + * {@inheritDoc} + */ + @Override + public void close( Exception cause ) throws Exception + { + super.close( cause ); + this.closeBrowser( browser ); + } + + private void closeBrowser(TupleBrowser browser) + { + if ( browser != null ) + { + browser.close(); + } + } } Propchange: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -1,6 +1,7 @@ /directory/apacheds/branches/apacheds-codec-merge/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree:982369-987590 /directory/apacheds/branches/apacheds-config/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree:980138-980935 +/directory/apacheds/branches/apacheds-jdbm/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree:1160768-1164080 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree:1040956-1043765 /directory/apacheds/branches/apacheds-replication/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree:749790-764110 /directory/apacheds/branches/apacheds-schema/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree:806623-810034 Propchange: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -1,6 +1,7 @@ /directory/apacheds/branches/apacheds-codec-merge/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java:982369-987590 /directory/apacheds/branches/apacheds-config/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java:980138-980935 +/directory/apacheds/branches/apacheds-jdbm/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java:1160768-1164080 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java:1040956-1043765 /directory/apacheds/branches/apacheds-replication/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java:749790-764110 /directory/apacheds/branches/apacheds-schema/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java:809853-810034 Propchange: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -1,6 +1,7 @@ /directory/apacheds/branches/apacheds-codec-merge/jdbm-partition/src/test/java/org/apache/directory/server/core/schema:982369-987590 /directory/apacheds/branches/apacheds-config/jdbm-partition/src/test/java/org/apache/directory/server/core/schema:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/jdbm-partition/src/test/java/org/apache/directory/server/core/schema:980138-980935 +/directory/apacheds/branches/apacheds-jdbm/jdbm-partition/src/test/java/org/apache/directory/server/core/schema:1160768-1164080 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/jdbm-partition/src/test/java/org/apache/directory/server/core/schema:1040956-1043765 /directory/apacheds/branches/apacheds-replication/jdbm-partition/src/test/java/org/apache/directory/server/core/schema:749790-764110 /directory/apacheds/branches/apacheds-schema/jdbm-partition/src/test/java/org/apache/directory/server/core/schema:806623-810034 Propchange: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Sep 1 17:34:03 2011 @@ -1,6 +1,7 @@ /directory/apacheds/branches/apacheds-codec-merge/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java:982369-987590 /directory/apacheds/branches/apacheds-config/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java:1023442-1029077 /directory/apacheds/branches/apacheds-dnfactory-experiment/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java:980138-980935 +/directory/apacheds/branches/apacheds-jdbm/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java:1160768-1164080 /directory/apacheds/branches/apacheds-kerberos-codec-2.0/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java:1040956-1043765 /directory/apacheds/branches/apacheds-replication/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java:749790-764110 /directory/apacheds/branches/apacheds-schema/jdbm-partition/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java:806623-810034 Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BPage.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BPage.java?rev=1164182&r1=1164181&r2=1164182&view=diff ============================================================================== --- directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BPage.java (original) +++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BPage.java Thu Sep 1 17:34:03 2011 @@ -47,17 +47,19 @@ package jdbm.btree; -import jdbm.helper.Serializer; -import jdbm.helper.Tuple; -import jdbm.helper.TupleBrowser; - -import java.io.IOException; -import java.io.ByteArrayOutputStream; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.ObjectInput; -import java.io.ObjectOutput; import java.io.ObjectInputStream; +import java.io.ObjectOutput; import java.io.ObjectOutputStream; +import java.util.concurrent.atomic.AtomicInteger; + +import jdbm.helper.ActionContext; +import jdbm.helper.Serializer; +import jdbm.helper.Tuple; +import jdbm.helper.TupleBrowser; import org.apache.directory.server.i18n.I18n; @@ -80,7 +82,7 @@ import org.apache.directory.server.i18n. * @author Alex Boisvert */ public class BPage implements Serializer -{ +{ private static final boolean DEBUG = false; /** Version id for serialization. */ @@ -112,6 +114,8 @@ public class BPage implements Seri /** Next leaf BPage (only if this BPage is a leaf) */ protected long next; + + public static AtomicInteger outstandingBrowsers = new AtomicInteger(0); /** @@ -127,7 +131,7 @@ public class BPage implements Seri * Root page overflow constructor */ @SuppressWarnings("unchecked") - BPage( BTree btree, BPage root, BPage overflow ) throws IOException + BPage( BTree btree, BPage root, BPage overflow ) throws IOException { this.btree = btree; @@ -151,7 +155,7 @@ public class BPage implements Seri * Root page (first insert) constructor. */ @SuppressWarnings("unchecked") // Cannot create an array of generic objects - BPage( BTree btree, K key, V value ) throws IOException + BPage( BTree btree, K key, V value ) throws IOException { this.btree = btree; @@ -164,7 +168,7 @@ public class BPage implements Seri keys[btree.pageSize - 1] = null; // I am the root BPage for now values = (V[])new Object[btree.pageSize]; - values[btree.pageSize - 2] = value; + values[btree.pageSize - 2] = btree.copyValue( value ); values[btree.pageSize - 1] = null; // I am the root BPage for now recordId = btree.recordManager.insert( this, this ); @@ -197,6 +201,33 @@ public class BPage implements Seri recordId = btree.recordManager.insert( this, this ); } + + @SuppressWarnings("unchecked") // Cannot create an array of generic objects + BPage copyOnWrite() + { + BPage newPage = new BPage(); + + newPage.btree = this.btree; + newPage.isLeaf = this.isLeaf; + + newPage.first = this.first; + newPage.previous = this.previous; + newPage.next = this.next; + + newPage.keys = (K[])new Object[btree.pageSize]; + newPage.values = (V[])new Object[btree.pageSize]; + newPage.children = new long[btree.pageSize]; + + newPage.recordId = this.recordId; + + if ( this.children != null ) + this.copyChildren( this, 0, newPage, 0, btree.pageSize ); // this copies keys as well + + if (this.values != null ) + this.copyEntries( this, 0, newPage, 0, btree.pageSize ); // this copies keys as well + + return newPage; + } /** @@ -259,10 +290,11 @@ public class BPage implements Seri * * @param height Height of the current BPage (zero is leaf page) * @param key The key + * @param context action context in case of action capable record manager * @return TupleBrowser positionned just before the given key, or before * next greater key if key isn't found. */ - TupleBrowser find( int height, K key ) throws IOException + TupleBrowser find( int height, K key, ActionContext context) throws IOException { int index = this.findChildren( key ); @@ -285,26 +317,26 @@ public class BPage implements Seri } } - return new Browser( child, index ); + return new Browser( child, index, context); } /** * Find first entry and return a browser positioned before it. - * + *@param context Action Context in case of * @return TupleBrowser positionned just before the first entry. */ - TupleBrowser findFirst() throws IOException + TupleBrowser findFirst( ActionContext context ) throws IOException { if ( isLeaf ) { - return new Browser( this, first ); + return new Browser( this, first, context ); } else { BPage child = childBPage( first ); - return child.findFirst(); + return child.findFirst( context ); } } @@ -337,9 +369,13 @@ public class BPage implements Seri height -= 1; + BPage pageNewCopy = null; + if ( height == 0 ) { + pageNewCopy = btree.copyOnWrite( this ); result = new InsertResult(); + result.pageNewCopy = pageNewCopy; // inserting on a leaf BPage overflow = -1; @@ -365,8 +401,8 @@ public class BPage implements Seri if ( replace ) { - values[index] = value; - btree.recordManager.update( recordId, this, this ); + pageNewCopy.values[index] = value; + btree.recordManager.update( recordId, pageNewCopy, this ); } // return the existing key @@ -378,6 +414,12 @@ public class BPage implements Seri // non-leaf BPage BPage child = childBPage( index ); result = child.insert( height, key, value, replace ); + + if( result.pageNewCopy != null) + { + child = result.pageNewCopy; + result.pageNewCopy = null; + } if ( result.existing != null ) { @@ -393,6 +435,9 @@ public class BPage implements Seri // there was an overflow, we need to insert the overflow page // on this BPage + pageNewCopy = btree.copyOnWrite( this ); + result.pageNewCopy = pageNewCopy; + if ( DEBUG ) { System.out.println( "BPage.insert() Overflow page: " + result.overflow.recordId ); @@ -402,7 +447,7 @@ public class BPage implements Seri overflow = result.overflow.recordId; // update child's largest key - keys[index] = child.getLargestKey(); + pageNewCopy.keys[index] = child.getLargestKey(); // clean result so we can reuse it result.overflow = null; @@ -410,24 +455,25 @@ public class BPage implements Seri // if we get here, we need to insert a new entry on the BPage // before children[ index ] - if ( !isFull() ) - { + if ( !pageNewCopy.isFull() ) + { if ( height == 0 ) { - insertEntry( this, index - 1, key, value ); + insertEntry( pageNewCopy, index - 1, key, value ); } else { - insertChild( this, index - 1, key, overflow ); + insertChild( pageNewCopy, index - 1, key, overflow ); } - btree.recordManager.update( recordId, this, this ); + btree.recordManager.update( recordId, pageNewCopy, this ); + return result; } // page is full, we must divide the page int half = btree.pageSize >> 1; - BPage newPage = new BPage( btree, isLeaf ); + BPage newPage = new BPage( btree, pageNewCopy.isLeaf ); if ( index < half ) { @@ -441,15 +487,15 @@ public class BPage implements Seri if ( height == 0 ) { - copyEntries( this, 0, newPage, half, index ); + copyEntries( pageNewCopy, 0, newPage, half, index ); setEntry( newPage, half + index, key, value ); - copyEntries( this, index, newPage, half + index + 1, half - index - 1 ); + copyEntries( pageNewCopy, index, newPage, half + index + 1, half - index - 1 ); } else { - copyChildren( this, 0, newPage, half, index ); + copyChildren( pageNewCopy, 0, newPage, half, index ); setChild( newPage, half + index, key, overflow ); - copyChildren( this, index, newPage, half + index + 1, half - index - 1 ); + copyChildren( pageNewCopy, index, newPage, half + index + 1, half - index - 1 ); } } else @@ -463,50 +509,51 @@ public class BPage implements Seri if ( height == 0 ) { - copyEntries( this, 0, newPage, half, half ); - copyEntries( this, half, this, half - 1, index - half ); - setEntry( this, index - 1, key, value ); + copyEntries( pageNewCopy, 0, newPage, half, half ); + copyEntries( pageNewCopy, half, pageNewCopy, half - 1, index - half ); + setEntry( pageNewCopy, index - 1, key, value ); } else { - copyChildren( this, 0, newPage, half, half ); - copyChildren( this, half, this, half - 1, index - half ); - setChild( this, index - 1, key, overflow ); + copyChildren( pageNewCopy, 0, newPage, half, half ); + copyChildren( pageNewCopy, half, pageNewCopy, half - 1, index - half ); + setChild( pageNewCopy, index - 1, key, overflow ); } } - first = half - 1; + pageNewCopy.first = half - 1; // nullify lower half of entries - for ( int i = 0; i < first; i++ ) + for ( int i = 0; i < pageNewCopy.first; i++ ) { if ( height == 0 ) { - setEntry( this, i, null, null ); + setEntry( pageNewCopy, i, null, null ); } else { - setChild( this, i, null, -1 ); + setChild( pageNewCopy, i, null, -1 ); } } - if ( isLeaf ) + if ( pageNewCopy.isLeaf ) { // link newly created BPage - newPage.previous = previous; - newPage.next = recordId; + newPage.previous = pageNewCopy.previous; + newPage.next = pageNewCopy.recordId; - if ( previous != 0 ) + if ( pageNewCopy.previous != 0 ) { - BPage previousBPage = loadBPage( previous ); + BPage previousBPage = loadBPage( pageNewCopy.previous ); + previousBPage = btree.copyOnWrite( previousBPage ); previousBPage.next = newPage.recordId; - btree.recordManager.update( previous, previousBPage, this ); + btree.recordManager.update( pageNewCopy.previous, previousBPage, this ); } - previous = newPage.recordId; + pageNewCopy.previous = newPage.recordId; } - btree.recordManager.update( recordId, this, this ); + btree.recordManager.update( recordId, pageNewCopy, this ); btree.recordManager.update( newPage.recordId, newPage, this ); result.overflow = newPage; @@ -521,9 +568,9 @@ public class BPage implements Seri * @param key Removal key * @return Remove result object */ - RemoveResult remove( int height, K key ) throws IOException + RemoveResult remove( int height, K key ) throws IOException { - RemoveResult result; + RemoveResult result; int half = btree.pageSize / 2; int index = findChildren( key ); @@ -536,6 +583,8 @@ public class BPage implements Seri height -= 1; + BPage pageNewCopy = btree.copyOnWrite( this ); + if ( height == 0 ) { // remove leaf entry @@ -544,22 +593,32 @@ public class BPage implements Seri throw new IllegalArgumentException( I18n.err( I18n.ERR_514, key ) ); } - result = new RemoveResult(); - result.value = values[index]; - removeEntry( this, index ); + result = new RemoveResult(); + result.value = pageNewCopy.values[index]; + removeEntry( pageNewCopy, index ); // update this BPage - btree.recordManager.update( recordId, this, this ); + btree.recordManager.update( recordId, pageNewCopy, this ); } else { // recurse into Btree to remove entry on a children page BPage child = childBPage( index ); result = child.remove( height, key ); + + if ( result.pageNewCopy != null ) + { + child = result.pageNewCopy; + result.pageNewCopy = null; + } + else + { + child = btree.copyOnWrite( child ); + } // update children - keys[index] = child.getLargestKey(); - btree.recordManager.update( recordId, this, this ); + pageNewCopy.keys[index] = child.getLargestKey(); + btree.recordManager.update( recordId, pageNewCopy, this ); if ( result.underflow ) { @@ -569,10 +628,11 @@ public class BPage implements Seri throw new IllegalStateException( I18n.err( I18n.ERR_513, "1" ) ); } - if ( index < children.length - 1 ) + if ( index < pageNewCopy.children.length - 1 ) { // exists greater brother page - BPage brother = childBPage( index + 1 ); + BPage brother = pageNewCopy.childBPage( index + 1 ); + brother = btree.copyOnWrite( brother ); int bfirst = brother.first; if ( bfirst < half ) @@ -606,12 +666,12 @@ public class BPage implements Seri } // update child's largest key - keys[index] = child.getLargestKey(); + pageNewCopy.keys[index] = child.getLargestKey(); // no change in previous/next BPage // update BPages - btree.recordManager.update( recordId, this, this ); + btree.recordManager.update( recordId, pageNewCopy, this ); btree.recordManager.update( brother.recordId, brother, this ); btree.recordManager.update( child.recordId, child, this ); @@ -638,24 +698,25 @@ public class BPage implements Seri btree.recordManager.update( brother.recordId, brother, this ); // remove "child" from current BPage - if ( isLeaf ) + if ( pageNewCopy.isLeaf ) { - copyEntries( this, first, this, first + 1, index - first ); - setEntry( this, first, null, null ); + copyEntries( pageNewCopy, pageNewCopy.first, pageNewCopy, pageNewCopy.first + 1, index - pageNewCopy.first ); + setEntry( pageNewCopy, pageNewCopy.first, null, null ); } else { - copyChildren( this, first, this, first + 1, index - first ); - setChild( this, first, null, -1 ); + copyChildren( pageNewCopy, pageNewCopy.first, pageNewCopy, pageNewCopy.first + 1, index - pageNewCopy.first ); + setChild( pageNewCopy, pageNewCopy.first, null, -1 ); } - first += 1; - btree.recordManager.update( recordId, this, this ); + pageNewCopy.first += 1; + btree.recordManager.update( recordId, pageNewCopy, this ); // re-link previous and next BPages if ( child.previous != 0 ) { BPage prev = loadBPage( child.previous ); + prev = btree.copyOnWrite( prev ); prev.next = child.next; btree.recordManager.update( prev.recordId, prev, this ); } @@ -663,6 +724,7 @@ public class BPage implements Seri if ( child.next != 0 ) { BPage next = loadBPage( child.next ); + next = btree.copyOnWrite( next ); next.previous = child.previous; btree.recordManager.update( next.recordId, next, this ); } @@ -674,7 +736,8 @@ public class BPage implements Seri else { // page "brother" is before "child" - BPage brother = childBPage( index - 1 ); + BPage brother = pageNewCopy.childBPage( index - 1 ); + brother = btree.copyOnWrite( brother ); int bfirst = brother.first; if ( bfirst < half ) @@ -708,12 +771,12 @@ public class BPage implements Seri } // update brother's largest key - keys[index - 1] = brother.getLargestKey(); + pageNewCopy.keys[index - 1] = brother.getLargestKey(); // no change in previous/next BPage // update BPages - btree.recordManager.update( recordId, this, this ); + btree.recordManager.update( recordId, pageNewCopy, this ); btree.recordManager.update( brother.recordId, brother, this ); btree.recordManager.update( child.recordId, child, this ); @@ -740,24 +803,25 @@ public class BPage implements Seri btree.recordManager.update( child.recordId, child, this ); // remove "brother" from current BPage - if ( isLeaf ) + if ( pageNewCopy.isLeaf ) { - copyEntries( this, first, this, first + 1, index - 1 - first ); - setEntry( this, first, null, null ); + copyEntries( pageNewCopy, pageNewCopy.first, pageNewCopy, pageNewCopy.first + 1, index - 1 - pageNewCopy.first ); + setEntry( pageNewCopy, pageNewCopy.first, null, null ); } else { - copyChildren( this, first, this, first + 1, index - 1 - first ); - setChild( this, first, null, -1 ); + copyChildren( pageNewCopy, pageNewCopy.first, pageNewCopy, pageNewCopy.first + 1, index - 1 - pageNewCopy.first ); + setChild( pageNewCopy, pageNewCopy.first, null, -1 ); } - first += 1; - btree.recordManager.update( recordId, this, this ); + pageNewCopy.first += 1; + btree.recordManager.update( recordId, pageNewCopy, this ); // re-link previous and next BPages if ( brother.previous != 0 ) { BPage prev = loadBPage( brother.previous ); + prev = btree.copyOnWrite( prev ); prev.next = brother.next; btree.recordManager.update( prev.recordId, prev, this ); } @@ -765,6 +829,7 @@ public class BPage implements Seri if ( brother.next != 0 ) { BPage next = loadBPage( brother.next ); + next = btree.copyOnWrite( next ); next.previous = brother.previous; btree.recordManager.update( next.recordId, next, this ); } @@ -777,7 +842,8 @@ public class BPage implements Seri } // underflow if page is more than half-empty - result.underflow = first > half; + result.underflow = pageNewCopy.first > half; + result.pageNewCopy = pageNewCopy; return result; } @@ -834,7 +900,7 @@ public class BPage implements Seri /** * Insert entry at given position. */ - private void insertEntry( BPage page, int index, K key, V value ) + private void insertEntry( BPage page, int index, K key, V value ) throws IOException { K[] keys = page.keys; V[] values = page.values; @@ -846,7 +912,7 @@ public class BPage implements Seri System.arraycopy( values, start, values, start - 1, count ); page.first -= 1; keys[index] = key; - values[index] = value; + values[index] = btree.copyValue( value ); } @@ -1295,6 +1361,7 @@ public class BPage implements Seri data = baos.toByteArray(); oos.close(); baos.close(); + return data; } @@ -1316,13 +1383,18 @@ public class BPage implements Seri * Existing value for the insertion key. */ V existing; + + /** + * New version of the page doing the insert + */ + BPage pageNewCopy; } /** STATIC INNER CLASS * Result from remove() method call. If we had to removed a BPage, * it will be stored into the underflow field. */ - static class RemoveResult + static class RemoveResult { /** * Set to true if underlying pages underflowed @@ -1333,6 +1405,12 @@ public class BPage implements Seri * Removed entry value */ V value; + + /** + * New version of the page doing the remove + */ + BPage pageNewCopy; + } /** PRIVATE INNER CLASS @@ -1342,7 +1420,10 @@ public class BPage implements Seri { /** Current page. */ private BPage page; - + + /** context used to track browsing action */ + ActionContext context; + /** * Current index in the page. The index positionned on the next * tuple to return. @@ -1354,12 +1435,16 @@ public class BPage implements Seri * Create a browser. * * @param page Current page + * @param context context in case of action capable record manager * @param index Position of the next tuple to return. */ - Browser( BPage page, int index ) + Browser( BPage page, int index, ActionContext context) { this.page = page; this.index = index; + this.context = context; + + outstandingBrowsers.incrementAndGet(); } @@ -1373,55 +1458,106 @@ public class BPage implements Seri */ public boolean getNext( Tuple tuple ) throws IOException { - // First, check that we are within a page - if ( index < page.btree.pageSize ) + btree.setAsCurrentAction( context ); + try { - // We are. Now check that we have a Tuple - if ( page.keys[index] == null ) + // First, check that we are within a page + if ( index < page.btree.pageSize ) { - // no : reached end of the tree. - return false; + // We are. Now check that we have a Tuple + if ( page.keys[index] == null ) + { + // no : reached end of the tree. + return false; + } + } + // all the tuple for this page has been read. Move to the + // next page, if we have one. + else if ( page.next != 0 ) + { + // move to next page + page = page.loadBPage( page.next ); + index = page.first; } + + tuple.setKey( page.keys[index] ); + tuple.setValue( btree.copyValue( page.values[index] ) ); + index++; } - // all the tuple for this page has been read. Move to the - // next page, if we have one. - else if ( page.next != 0 ) + catch( IOException e ) { - // move to next page - page = page.loadBPage( page.next ); - index = page.first; + btree.abortAction( context ); + context = null; + this.close(); + throw e; } - - tuple.setKey( page.keys[index] ); - tuple.setValue( page.values[index] ); - index++; - + finally + { + if ( context != null ) + btree.unsetAsCurrentAction( context ); + } + return true; } - public boolean getPrevious( Tuple tuple ) throws IOException { - if ( index == page.first ) + btree.setAsCurrentAction( context ); + try { - if ( page.previous != 0 ) + if ( index == page.first ) { - page = page.loadBPage( page.previous ); - index = page.btree.pageSize; - } - else - { - // reached beginning of the tree - return false; + if ( page.previous != 0 ) + { + page = page.loadBPage( page.previous ); + index = page.btree.pageSize; + } + else + { + // reached beginning of the tree + return false; + } } - } + + index--; + tuple.setKey( page.keys[index] ); + tuple.setValue( btree.copyValue( page.values[index] ) ); + } + catch( IOException e ) + { + btree.abortAction( context ); + context = null; + this.close(); + throw e; + } + finally + { + if ( context != null ) + btree.unsetAsCurrentAction( context ); + } + + return true; + } + + @Override + public void close() + { + super.close(); - index--; - tuple.setKey( page.keys[index] ); - tuple.setValue( page.values[index] ); + if ( context!= null ) + { + btree.setAsCurrentAction( context ); + btree.endAction( context ); + context = null; + } - return true; + int browserCount = outstandingBrowsers.decrementAndGet(); + if ( browserCount > 0 ) + { + //System.out.println( "JDBM btree browsers are outstanding after close: " + browserCount ); + } } + } @@ -1469,7 +1605,6 @@ public class BPage implements Seri else { boolean isFirst = true; - //int index = 0; for ( K key : keys ) { @@ -1484,8 +1619,6 @@ public class BPage implements Seri sb.append( "<" ); sb.append( key ); - //sb.append( "/" ); - //sb.append( values[index] ); sb.append( ">" ); } }