From: Bryan T. <tho...@us...> - 2007-03-27 17:12:04
|
Update of /cvsroot/cweb/bigdata/src/java/com/bigdata/journal In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv2900/src/java/com/bigdata/journal Modified Files: IBufferStrategy.java AbstractBufferStrategy.java ForceEnum.java AbstractJournal.java Log Message: Corrected problem in the interpretation of maximumExtent for an IBufferStrategy vs an IJournal. Working through use of isolatable indices for the triple store. Index: AbstractBufferStrategy.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/AbstractBufferStrategy.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** AbstractBufferStrategy.java 15 Mar 2007 16:11:12 -0000 1.13 --- AbstractBufferStrategy.java 27 Mar 2007 17:11:41 -0000 1.14 *************** *** 7,14 **** import java.text.NumberFormat; import com.bigdata.rawstore.Addr; import com.bigdata.rawstore.Bytes; - /** * Abstract base class for {@link IBufferStrategy} implementation. --- 7,16 ---- import java.text.NumberFormat; + import org.apache.log4j.Logger; + + import com.bigdata.objndx.AbstractBTree; import com.bigdata.rawstore.Addr; import com.bigdata.rawstore.Bytes; /** * Abstract base class for {@link IBufferStrategy} implementation. *************** *** 19,22 **** --- 21,29 ---- public abstract class AbstractBufferStrategy implements IBufferStrategy { + /** + * Log for btree opeations. + */ + protected static final Logger log = Logger.getLogger(AbstractBufferStrategy.class); + protected final long initialExtent; protected final long maximumExtent; *************** *** 81,84 **** --- 88,95 ---- * (Re-)open a buffer. * + * @param initialExtent - + * as defined by {@link #getInitialExtent()} + * @param maximumExtent - + * as defined by {@link #getMaximumExtent()}. * @param nextOffset * The next offset within the buffer on which a record will be *************** *** 97,101 **** this.initialExtent = initialExtent; ! this.maximumExtent = maximumExtent; this.nextOffset = nextOffset; --- 108,112 ---- this.initialExtent = initialExtent; ! this.maximumExtent = maximumExtent; // MAY be zero! this.nextOffset = nextOffset; *************** *** 129,132 **** --- 140,145 ---- // Would overflow int32 bytes. + + log.error("Would overflow int32 bytes."); return false; *************** *** 134,141 **** } ! if( required > maximumExtent ) { ! ! // Would exceed the maximum extent. return false; --- 147,156 ---- } ! if( maximumExtent != 0L && required > maximumExtent ) { + // Would exceed the maximum extent (iff a hard limit). + + log.error("Would exceed maximumExtent="+maximumExtent); + return false; Index: IBufferStrategy.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/IBufferStrategy.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** IBufferStrategy.java 11 Mar 2007 11:42:45 -0000 1.16 --- IBufferStrategy.java 27 Mar 2007 17:11:41 -0000 1.17 *************** *** 36,41 **** --- 36,63 ---- public BufferMode getBufferMode(); + /** + * The initial extent. + */ public long getInitialExtent(); + /** + * The maximum extent allowable before a buffer overflow operation will be + * rejected. + * <p> + * Note: The semantics here differ from those defined by + * {@link Options#MAXIMUM_EXTENT}. The latter specifies the threshold at + * which a journal will overflow (onto another journal) while this specifies + * the maximum size to which a buffer is allowed to grow. + * <p> + * Note: This is <em>normally</em> zero (0L), which basically means that + * the maximum extent is ignored by the {@link IBufferStrategy} but + * respected by the {@link AbstractJournal}, resulting in a <i>soft limit</i> + * on journal overflow. The primary reason to limit the buffer size is when + * an in-memory buffer will be converted to a disk-based buffer -- see + * {@link TemporaryRawStore} for an example. + * + * @return The maximum extent permitted for the buffer -or- <code>0L</code> + * iff no limit is imposed. + */ public long getMaximumExtent(); Index: AbstractJournal.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/AbstractJournal.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AbstractJournal.java 27 Mar 2007 14:34:23 -0000 1.7 --- AbstractJournal.java 27 Mar 2007 17:11:41 -0000 1.8 *************** *** 608,612 **** _bufferStrategy = new TransientBufferStrategy(initialExtent, ! maximumExtent, useDirectBuffers); /* --- 608,612 ---- _bufferStrategy = new TransientBufferStrategy(initialExtent, ! 0L/* soft limit for maximumExtent */, useDirectBuffers); /* *************** *** 649,654 **** readOnly, forceWrites); ! _bufferStrategy = new DirectBufferStrategy(maximumExtent, ! fileMetadata); this._rootBlock = fileMetadata.rootBlock; --- 649,654 ---- readOnly, forceWrites); ! _bufferStrategy = new DirectBufferStrategy( ! 0L/* soft limit for maximumExtent */, fileMetadata); this._rootBlock = fileMetadata.rootBlock; *************** *** 669,673 **** readOnly, forceWrites); ! _bufferStrategy = new MappedBufferStrategy(maximumExtent, fileMetadata); --- 669,678 ---- readOnly, forceWrites); ! /* ! * Note: the maximumExtent is a hard limit in this case only since ! * resize is not supported for mapped files. ! */ ! _bufferStrategy = new MappedBufferStrategy( ! maximumExtent /* hard limit for maximum extent */, fileMetadata); *************** *** 689,693 **** readOnly, forceWrites); ! _bufferStrategy = new DiskOnlyStrategy(maximumExtent, fileMetadata); this._rootBlock = fileMetadata.rootBlock; --- 694,699 ---- readOnly, forceWrites); ! _bufferStrategy = new DiskOnlyStrategy( ! 0L/* soft limit for maximumExtent */, fileMetadata); this._rootBlock = fileMetadata.rootBlock; Index: ForceEnum.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/ForceEnum.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ForceEnum.java 21 Feb 2007 20:17:21 -0000 1.2 --- ForceEnum.java 27 Mar 2007 17:11:41 -0000 1.3 *************** *** 106,110 **** if( s.equals(Force.name)) return Force; if( s.equals(ForceMetadata.name)) return ForceMetadata; ! throw new IllegalArgumentException(); } --- 106,110 ---- if( s.equals(Force.name)) return Force; if( s.equals(ForceMetadata.name)) return ForceMetadata; ! throw new IllegalArgumentException("Unknown value: "+s); } |