From: <tho...@us...> - 2010-11-11 14:07:29
|
Revision: 3934 http://bigdata.svn.sourceforge.net/bigdata/?rev=3934&view=rev Author: thompsonbry Date: 2010-11-11 14:07:22 +0000 (Thu, 11 Nov 2010) Log Message: ----------- Made a few things in AllocBlock private or final. Removed the WriteCacheServiceReference from AllocBlock and FixedAllocator as it was not used. Updated RWStore to reflect the change to the FixedAllocator ctor. Modified Paths: -------------- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/AllocBlock.java branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/AllocBlock.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/AllocBlock.java 2010-11-11 13:46:38 UTC (rev 3933) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/AllocBlock.java 2010-11-11 14:07:22 UTC (rev 3934) @@ -26,7 +26,6 @@ import java.util.ArrayList; -import com.bigdata.io.writecache.WriteCacheService; import com.bigdata.rwstore.RWStore.AllocationStats; /** @@ -37,6 +36,10 @@ * to use {@link System#arraycopy(Object, int, Object, int, int)} to copy * the data rather than cloning it. * + * @todo Review the locks held during reads against {@link AllocBlock}. Is it + * possible that we could have updates which are not being made visible to + * readers? + * * @todo change to use long[]s. */ public class AllocBlock { @@ -67,20 +70,20 @@ * Just the newly allocated bits. This will be copied onto {@link #m_commit} * when the current native transaction commits. */ - int m_bits[]; + final int m_bits[]; /** * All of the bits from the commit point on entry to the current native * transaction plus any newly allocated bits. */ int m_transients[]; - /** - * Used to clear an address on the {@link WriteCacheService} if it has been - * freed. - */ - private final RWWriteCacheService m_writeCache; +// /** +// * Used to clear an address on the {@link WriteCacheService} if it has been +// * freed. +// */ +// private final RWWriteCacheService m_writeCache; - AllocBlock(final int addrIsUnused, final int bitSize, final RWWriteCacheService cache) { - m_writeCache = cache; + AllocBlock(final int addrIsUnused, final int bitSize) {//, final RWWriteCacheService cache) { +// m_writeCache = cache; m_ints = bitSize; m_commit = new int[bitSize]; m_bits = new int[bitSize]; @@ -116,16 +119,16 @@ if (!RWStore.tstBit(m_bits, bit)) { throw new IllegalArgumentException("Freeing bit not set"); } - - // Allocation optimization - if bit NOT set in committed memory then - // clear - // the transient bit to permit reallocation within this transaction. - // - // Note that with buffered IO there is also an opportunity to avoid - // output to - // the file by removing any pending write to the now freed address. On - // large - // transaction scopes this may be significant. + + /* + * Allocation optimization - if bit NOT set in committed memory then + * clear the transient bit to permit reallocation within this + * transaction. + * + * Note that with buffered IO there is also an opportunity to avoid + * output to the file by removing any pending write to the now freed + * address. On large transaction scopes this may be significant. + */ RWStore.clrBit(m_bits, bit); if (!RWStore.tstBit(m_commit, bit)) { @@ -190,7 +193,7 @@ return allocBits; } - public String getStats(AllocationStats stats) { + public String getStats(final AllocationStats stats) { final int total = m_ints * 32; final int allocBits = getAllocBits(); Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java 2010-11-11 13:46:38 UTC (rev 3933) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/FixedAllocator.java 2010-11-11 14:07:22 UTC (rev 3934) @@ -42,7 +42,7 @@ private static final Logger log = Logger.getLogger(FixedAllocator.class); - final private RWWriteCacheService m_writeCache; +// final private RWWriteCacheService m_writeCache; volatile private int m_freeBits; volatile private int m_freeTransients; @@ -298,7 +298,7 @@ * @param preserveSessionData * @param cache */ - FixedAllocator(final RWStore store, final int size, final RWWriteCacheService cache) { + FixedAllocator(final RWStore store, final int size) {//, final RWWriteCacheService cache) { m_diskAddr = 0; m_store = store; @@ -323,7 +323,7 @@ m_bitSize = 32; } - m_writeCache = cache; +// m_writeCache = cache; // number of blocks in this allocator, bitSize plus 1 for start address final int numBlocks = 255 / (m_bitSize + 1); @@ -335,7 +335,7 @@ */ m_allocBlocks = new ArrayList<AllocBlock>(numBlocks); for (int i = 0; i < numBlocks; i++) { - m_allocBlocks.add(new AllocBlock(0, m_bitSize, m_writeCache)); + m_allocBlocks.add(new AllocBlock(0, m_bitSize));//, cache)); } m_freeTransients = 0; 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-11 13:46:38 UTC (rev 3933) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java 2010-11-11 14:07:22 UTC (rev 3934) @@ -915,7 +915,7 @@ while (fixedSize < allocSize) fixedSize = 64 * m_allocSizes[++index]; - allocator = new FixedAllocator(this, allocSize, m_writeCache); + allocator = new FixedAllocator(this, allocSize);//, m_writeCache); freeList = m_freeFixed[index]; } else { @@ -969,7 +969,7 @@ final int allocSize = 64 * m_allocSizes[block]; final FixedAllocator allocator = new FixedAllocator(this, - allocSize, m_writeCache); + allocSize);//, m_writeCache); allocator.setIndex(m_allocs.size()); @@ -1480,7 +1480,7 @@ final ArrayList<FixedAllocator> list = m_freeFixed[i]; if (list.size() == 0) { - allocator = new FixedAllocator(this, block, m_writeCache); + allocator = new FixedAllocator(this, block);//, m_writeCache); allocator.setFreeList(list); allocator.setIndex(m_allocs.size()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |