From: <mar...@us...> - 2011-04-20 11:54:05
|
Revision: 4422 http://bigdata.svn.sourceforge.net/bigdata/?rev=4422&view=rev Author: martyncutcher Date: 2011-04-20 11:53:59 +0000 (Wed, 20 Apr 2011) Log Message: ----------- Fix transient reallocation logic related to AllocationContexts Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/journal/StressTestConcurrentUnisolatedIndices.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/rwstore/TestRWJournal.java Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java 2011-04-19 20:28:57 UTC (rev 4421) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java 2011-04-20 11:53:59 UTC (rev 4422) @@ -114,7 +114,7 @@ final int bit = offset % allocBlockRange; // if (RWStore.tstBit(block.m_live, bit) -// || (m_sessionActive && RWStore.tstBit(block.m_transients, bit))) +// || (m_sessionActive && RWStore.tstBit(block.m_transients, bit))) { /* * Just check transients since there are case (eg CommitRecordIndex) * where committed data is accessed even if has been marked as ready to @@ -147,7 +147,7 @@ public void setFreeList(ArrayList list) { m_freeList = list; - if (hasFree()) { + if (!m_pendingContextCommit && hasFree()) { m_freeList.add(this); m_freeWaiting = false; } @@ -165,6 +165,9 @@ private boolean m_pendingContextCommit = false; public void setAllocationContext(final IAllocationContext context) { + if (m_pendingContextCommit) { + throw new IllegalStateException("Already pending commit"); + } if (context == null && m_context != null) { // restore commit bits in AllocBlocks for (AllocBlock allocBlock : m_allocBlocks) { @@ -193,6 +196,10 @@ * @param writeCacheService */ public void abortAllocationContext(final IAllocationContext context, RWWriteCacheService writeCacheService) { + if (m_pendingContextCommit) { + throw new IllegalStateException("Already pending commit"); + } + if (m_context != null) { // restore commit bits in AllocBlocks for (AllocBlock allocBlock : m_allocBlocks) { @@ -568,7 +575,7 @@ } private void checkFreeList() { - if (m_freeWaiting) { + if (m_freeWaiting && !m_pendingContextCommit) { if (m_freeBits > 0 && this instanceof DirectFixedAllocator) { m_freeWaiting = false; m_freeList.add(0, this); @@ -812,10 +819,12 @@ */ public boolean canImmediatelyFree(final int addr, final int size, final IAllocationContext context) { - if (context == m_context) { + if (context == m_context && !m_pendingContextCommit) { final int offset = ((-addr) & RWStore.OFFSET_BITS_MASK); // bit adjust - return !isCommitted(offset); + final boolean ret = !isCommitted(offset); + + return ret; } else { return false; } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java 2011-04-19 20:28:57 UTC (rev 4421) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java 2011-04-20 11:53:59 UTC (rev 4422) @@ -1755,7 +1755,7 @@ if (alloc.isAllocated(addrOffset)) throw new IllegalStateException("Reallocation problem with WriteCache"); - if (alloc.m_context != null && !m_commitList.contains(alloc)) { + if (!m_commitList.contains(alloc)) { m_commitList.add(alloc); } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/journal/StressTestConcurrentUnisolatedIndices.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/journal/StressTestConcurrentUnisolatedIndices.java 2011-04-19 20:28:57 UTC (rev 4421) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/journal/StressTestConcurrentUnisolatedIndices.java 2011-04-20 11:53:59 UTC (rev 4422) @@ -138,7 +138,7 @@ 20,// nresources 1, // minLocks 3, // maxLocks - 100,//100, // ntrials + 300,//100, // ntrials 3, // keyLen 1000, // nops .05//0.02d // failureRate Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/rwstore/TestRWJournal.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/rwstore/TestRWJournal.java 2011-04-19 20:28:57 UTC (rev 4421) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/rwstore/TestRWJournal.java 2011-04-20 11:53:59 UTC (rev 4422) @@ -710,7 +710,7 @@ bufferStrategy = (RWStrategy) store.getBufferStrategy(); rw = bufferStrategy.getRWStore(); - reallocBatch(rw, 1000, 100, 10000); + reallocBatch(rw, 1000, 100, 1000); store.commit(); store.close(); @@ -718,7 +718,7 @@ bufferStrategy = (RWStrategy) store.getBufferStrategy(); rw = bufferStrategy.getRWStore(); - reallocBatch(rw, 1000, 100, 10000); + reallocBatch(rw, 1000, 100, 1000); store.commit(); store.close(); @@ -902,7 +902,7 @@ try { - final int tcount = 20000; // increase to ramp up stress levels + final int tcount = 1000; // increase to ramp up stress levels RWStrategy bufferStrategy = (RWStrategy) store.getBufferStrategy(); @@ -1518,7 +1518,7 @@ RWStore rw = bs.getRWStore(); long realAddr = 0; // allocBatch(store, 1, 32, 650, 100000000); - pureAllocBatch(store, 1, 32, rw.m_maxFixedAlloc - 4, 300000); // cover + pureAllocBatch(store, 1, 32, rw.m_maxFixedAlloc - 4, 30000); // cover // wider // range // of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |