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 A69ED1783A for ; Mon, 9 Mar 2015 06:30:50 +0000 (UTC) Received: (qmail 76760 invoked by uid 500); 9 Mar 2015 06:30:50 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 76713 invoked by uid 500); 9 Mar 2015 06:30:50 -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 76704 invoked by uid 99); 9 Mar 2015 06:30:50 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Mar 2015 06:30:50 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 1D7E1AC006E for ; Mon, 9 Mar 2015 06:30:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1665131 - /directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java Date: Mon, 09 Mar 2015 06:30:49 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150309063050.1D7E1AC006E@hades.apache.org> Author: elecharny Date: Mon Mar 9 06:30:49 2015 New Revision: 1665131 URL: http://svn.apache.org/r1665131 Log: Speedup: we don't write the recordManager everytime a btree is modified, we do that when a full transaction is committed. Otherwise, we had this page written twice, once when the B-tree was updated, and another one when the BoB B-tree was updated. Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java?rev=1665131&r1=1665130&r2=1665131&view=diff ============================================================================== --- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java (original) +++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/RecordManager.java Mon Mar 9 06:30:49 2015 @@ -2020,8 +2020,15 @@ public class RecordManager extends Abstr try { - writeCounter.put( 0L, writeCounter.containsKey( 0L ) ? writeCounter.get( 0L ) + 1 : 1 ); - fileChannel.write( RECORD_MANAGER_HEADER_BUFFER, 0 ); + + Integer nbTxnStarted = context.get(); + + if ( ( nbTxnStarted == null ) || ( nbTxnStarted <= 1 ) ) + { + //System.out.println( "Writing page at 0000" ); + writeCounter.put( 0L, writeCounter.containsKey( 0L ) ? writeCounter.get( 0L ) + 1 : 1 ); + fileChannel.write( RECORD_MANAGER_HEADER_BUFFER, 0 ); + } } catch ( IOException ioe ) { @@ -2523,6 +2530,7 @@ public class RecordManager extends Abstr //fileChannel.force( false ); } + //System.out.println( "Writing page at " + Long.toHexString( pos ) ); writeCounter.put( pos, writeCounter.containsKey( pos ) ? writeCounter.get( pos ) + 1 : 1 ); nbUpdatePageIOs.incrementAndGet(); @@ -3060,6 +3068,7 @@ public class RecordManager extends Abstr */ private PageIO fetchNewPage() throws IOException { + //System.out.println( "Fetching new page" ); if ( firstFreePage == NO_PAGE ) { nbCreatedPages.incrementAndGet(); @@ -3950,6 +3959,8 @@ public class RecordManager extends Abstr private void checkFreePages() throws EndOfFileExceededException, IOException { + //System.out.println( "Checking the free pages, starting from " + Long.toHexString( firstFreePage ) ); + // read all the free pages, add them into a set, to be sure we don't have a cycle Set freePageOffsets = new HashSet(); @@ -3957,6 +3968,8 @@ public class RecordManager extends Abstr while ( currentFreePageOffset != NO_PAGE ) { + //System.out.println( "Next page offset :" + Long.toHexString( currentFreePageOffset ) ); + if ( ( currentFreePageOffset % pageSize ) != 0 ) { throw new InvalidOffsetException( "Wrong offset : " + Long.toHexString( currentFreePageOffset ) );