From: <mar...@us...> - 2010-12-20 12:06:14
|
Revision: 4024 http://bigdata.svn.sourceforge.net/bigdata/?rev=4024&view=rev Author: martyncutcher Date: 2010-12-20 12:06:07 +0000 (Mon, 20 Dec 2010) Log Message: ----------- Ensure deletions trigger RWStore commit required, and remove unnecessary transaction bracketing from concurrency tests. Modified Paths: -------------- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java branches/JOURNAL_HA_BRANCH/bigdata/src/test/com/bigdata/journal/StressTestConcurrentUnisolatedIndices.java branches/JOURNAL_HA_BRANCH/bigdata/src/test/com/bigdata/journal/TestConcurrentJournal.java branches/JOURNAL_HA_BRANCH/bigdata/src/test/com/bigdata/rwstore/TestRWJournal.java 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-12-20 08:57:44 UTC (rev 4023) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java 2010-12-20 12:06:07 UTC (rev 4024) @@ -1589,7 +1589,7 @@ * FIXME We need unit test when MIN_RELEASE_AGE is ZERO AND * there are open read-only transactions. */ - if (false&&m_minReleaseAge == 0) { + if (m_minReleaseAge == 0) { /* * The session protection is complicated by the mix of * transaction protection and isolated AllocationContexts. @@ -1737,6 +1737,8 @@ if (!m_commitList.contains(alloc)) { m_commitList.add(alloc); + + m_recentAlloc = true; } } finally { m_allocationLock.unlock(); Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/test/com/bigdata/journal/StressTestConcurrentUnisolatedIndices.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/test/com/bigdata/journal/StressTestConcurrentUnisolatedIndices.java 2010-12-20 08:57:44 UTC (rev 4023) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/test/com/bigdata/journal/StressTestConcurrentUnisolatedIndices.java 2010-12-20 12:06:07 UTC (rev 4024) @@ -103,10 +103,10 @@ final Journal journal = new Journal(properties); - final IBufferStrategy bufferStrategy = journal.getBufferStrategy(); - if (bufferStrategy instanceof RWStrategy) { - ((RWStrategy)bufferStrategy).getRWStore().activateTx(); - } +// final IBufferStrategy bufferStrategy = journal.getBufferStrategy(); +// if (bufferStrategy instanceof RWStrategy) { +// ((RWStrategy)bufferStrategy).getRWStore().activateTx(); +// } try { @@ -134,9 +134,9 @@ ); } finally { - if (bufferStrategy instanceof RWStrategy) { - ((RWStrategy)bufferStrategy).getRWStore().deactivateTx(); - } +// if (bufferStrategy instanceof RWStrategy) { +// ((RWStrategy)bufferStrategy).getRWStore().deactivateTx(); +// } journal.destroy(); Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/test/com/bigdata/journal/TestConcurrentJournal.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/test/com/bigdata/journal/TestConcurrentJournal.java 2010-12-20 08:57:44 UTC (rev 4023) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/test/com/bigdata/journal/TestConcurrentJournal.java 2010-12-20 12:06:07 UTC (rev 4024) @@ -1653,10 +1653,10 @@ properties.setProperty(Options.WRITE_SERVICE_MAXIMUM_POOL_SIZE, "1"); final Journal journal = new Journal(properties); - final IBufferStrategy bufferStrategy = journal.getBufferStrategy(); - if (bufferStrategy instanceof RWStrategy) { - ((RWStrategy)bufferStrategy).getRWStore().activateTx(); - } +// final IBufferStrategy bufferStrategy = journal.getBufferStrategy(); +// if (bufferStrategy instanceof RWStrategy) { +// ((RWStrategy)bufferStrategy).getRWStore().activateTx(); +// } try { @@ -1805,9 +1805,9 @@ } finally { - if (bufferStrategy instanceof RWStrategy) { - ((RWStrategy)bufferStrategy).getRWStore().deactivateTx(); - } +// if (bufferStrategy instanceof RWStrategy) { +// ((RWStrategy)bufferStrategy).getRWStore().deactivateTx(); +// } journal.destroy(); Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/test/com/bigdata/rwstore/TestRWJournal.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/test/com/bigdata/rwstore/TestRWJournal.java 2010-12-20 08:57:44 UTC (rev 4023) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/test/com/bigdata/rwstore/TestRWJournal.java 2010-12-20 12:06:07 UTC (rev 4024) @@ -997,26 +997,35 @@ bs.delete(faddr); // Must not have been immediately freed if history is retained. - if (rw.getHistoryRetention() != 0) + if (rw.getHistoryRetention() != 0) { assertEquals(pa, bs.getPhysicalAddress(faddr)); - else - assertEquals(0L, bs.getPhysicalAddress(faddr)); - /* - * Commit before testing for deferred frees. Since there is a - * prior commit point, we are not allowed to immediately free - * any record from that commit point in order to preserve the - * consistency of the last commit point, so we have to commit - * first then test for deferred frees. - */ - System.out.println("Now commit to disk (2)"); + /* + * Commit before testing for deferred frees. Since there is a + * prior commit point, we are not allowed to immediately free + * any record from that commit point in order to preserve the + * consistency of the last commit point, so we have to commit + * first then test for deferred frees. + */ + System.out.println("Now commit to disk (2)"); - store.commit(); + store.commit(); - Thread.currentThread().sleep(10); + Thread.currentThread().sleep(10); // to force deferredFrees - // Request release of deferred frees. - rw.checkDeferredFrees(true/* freeNow */, store); + // Request release of deferred frees. + rw.checkDeferredFrees(true/* freeNow */, store); + + // Now commit() to ensure the deferrals can be recycled + store.commit(); + } else { + // The address is deleted, but will still return a valid + // address since it is committed + assertEquals(pa, bs.getPhysicalAddress(faddr)); + + // Now commit() to ensure the deferrals can be recycled + store.commit(); + } assertEquals(0L, bs.getPhysicalAddress(faddr)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |