From: <tho...@us...> - 2010-11-18 18:33:37
|
Revision: 3966 http://bigdata.svn.sourceforge.net/bigdata/?rev=3966&view=rev Author: thompsonbry Date: 2010-11-18 18:33:30 +0000 (Thu, 18 Nov 2010) Log Message: ----------- Found a fence post in RWStore#checkDeferredFrees(). It needed to add a total of (2) to the release time. +1 since we want to read the delete blocks for the first commit record which we MAY NOT release. +1 for the inclusive upper bound semantics for the range scan of the index. Modified Paths: -------------- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/ITransactionService.java branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/JournalTransactionService.java branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/service/AbstractTransactionService.java Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/ITransactionService.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/ITransactionService.java 2010-11-18 18:17:22 UTC (rev 3965) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/ITransactionService.java 2010-11-18 18:33:30 UTC (rev 3966) @@ -247,8 +247,9 @@ * derived from the timestamp of the earliest running transaction MINUS the * minimum release age and is updated whenever the earliest running * transaction terminates. This value is monotonically increasing. It will - * never be GT the last commit time. It will never be negative. It MAY be - * ZERO (0L) and will be ZERO (0L) on startup. + * always be LT the last non-zero last commit time. It will never be + * negative. It MAY be ZERO (0L) and will be ZERO (0L) on startup (unless + * explicitly set by the database to the last known commit time). */ public long getReleaseTime() throws IOException; Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/JournalTransactionService.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/JournalTransactionService.java 2010-11-18 18:17:22 UTC (rev 3965) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/JournalTransactionService.java 2010-11-18 18:33:30 UTC (rev 3966) @@ -31,9 +31,7 @@ import java.io.IOException; import java.util.Properties; import java.util.UUID; -import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; import com.bigdata.service.AbstractFederation; import com.bigdata.service.AbstractTransactionService; @@ -444,15 +442,18 @@ } - /** - * Ignored since the {@link Journal} records the last commit time - * in its root blocks. + /* @todo This is only true for the WORM. For the RWStore, the release time + * will advance normally and things can get aged out of the store. */ - public void notifyCommit(long commitTime) { - - // NOP - - } +// /** +// * Ignored since the {@link Journal} records the last commit time +// * in its root blocks. +// */ +// public void notifyCommit(long commitTime) { +// +// // NOP +// +// } /* @todo This is only true for the WORM. For the RWStore, the release time * will advance normally and things can get aged out of the store. @@ -501,42 +502,42 @@ } - /** - * Invoke a method with the {@link AbstractTransactionService}'s lock held. - * - * @param <T> - * @param callable - * @return - * @throws Exception - */ - public <T> T callWithLock(final Callable<T> callable) throws Exception { - lock.lock(); - try { - return callable.call(); - } finally { - lock.unlock(); - } - } +// /** +// * Invoke a method with the {@link AbstractTransactionService}'s lock held. +// * +// * @param <T> +// * @param callable +// * @return +// * @throws Exception +// */ +// public <T> T callWithLock(final Callable<T> callable) throws Exception { +// lock.lock(); +// try { +// return callable.call(); +// } finally { +// lock.unlock(); +// } +// } +// +// /** +// * Invoke a method with the {@link AbstractTransactionService}'s lock held. +// * +// * But throw immediate exception if try fails. +// * +// * @param <T> +// * @param callable +// * @return +// * @throws Exception +// */ +// public <T> T tryCallWithLock(final Callable<T> callable, long waitFor, TimeUnit unit) throws Exception { +// if (!lock.tryLock(waitFor,unit)) { +// throw new RuntimeException("Lock not available"); +// } +// try { +// return callable.call(); +// } finally { +// lock.unlock(); +// } +// } - /** - * Invoke a method with the {@link AbstractTransactionService}'s lock held. - * - * But throw immediate exception if try fails. - * - * @param <T> - * @param callable - * @return - * @throws Exception - */ - public <T> T tryCallWithLock(final Callable<T> callable, long waitFor, TimeUnit unit) throws Exception { - if (!lock.tryLock(waitFor,unit)) { - throw new RuntimeException("Lock not available"); - } - try { - return callable.call(); - } finally { - lock.unlock(); - } - } - } Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java 2010-11-18 18:17:22 UTC (rev 3965) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java 2010-11-18 18:33:30 UTC (rev 3966) @@ -216,6 +216,9 @@ * (but not yet committed). * <p> * Read-only mode. + * <p> + * Unit tests looking for persistent memory leaks (e.g., all allocated + * space can be reclaimed). */ public class RWStore implements IStore { @@ -2051,10 +2054,20 @@ // the effective release time. long latestReleasableTime = transactionService.getReleaseTime(); - // add one to give this inclusive upper bound semantics. + /* + * add one because we want to read the delete blocks for all commit + * points up to and including the first commit point that we may not + * release. + */ latestReleasableTime++; /* + * add one to give this inclusive upper bound semantics to the range + * scan. + */ + latestReleasableTime++; + + /* * Free deferrals. * * Note: This adds one to the lastDeferredReleaseTime to give Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/service/AbstractTransactionService.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/service/AbstractTransactionService.java 2010-11-18 18:17:22 UTC (rev 3965) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/service/AbstractTransactionService.java 2010-11-18 18:33:30 UTC (rev 3966) @@ -1120,7 +1120,7 @@ * (commitTime-1) then compute and set the new releaseTime. * <p> * Note: This method was historically part of {@link #notifyCommit(long)}. - * It was moved into its own method so it can be overriden for some unit + * It was moved into its own method so it can be overridden for some unit * tests. * * @throws IllegalMonitorStateException This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |