From: <tho...@us...> - 2013-04-19 14:53:39
|
Revision: 7062 http://bigdata.svn.sourceforge.net/bigdata/?rev=7062&view=rev Author: thompsonbry Date: 2013-04-19 14:53:33 +0000 (Fri, 19 Apr 2013) Log Message: ----------- javadoc and formatting only. Modified Paths: -------------- branches/READ_CACHE/bigdata/src/java/com/bigdata/journal/WORMStrategy.java Modified: branches/READ_CACHE/bigdata/src/java/com/bigdata/journal/WORMStrategy.java =================================================================== --- branches/READ_CACHE/bigdata/src/java/com/bigdata/journal/WORMStrategy.java 2013-04-19 14:51:49 UTC (rev 7061) +++ branches/READ_CACHE/bigdata/src/java/com/bigdata/journal/WORMStrategy.java 2013-04-19 14:53:33 UTC (rev 7062) @@ -1170,6 +1170,19 @@ } + /** + * The sequence number for the last {@link WriteCache} block written in the + * current commit. This is set in {@link #commit()} when we flush the + * {@link WriteCacheService}. This is used to prepare the new + * {@link IRootBlockView}. The value of this field is NOT incremented as + * writes are made, but only after they have been flushed. + * + * TODO This pattern arose because {@link WriteCacheService#resetSequence()} + * is called from {@link #commit()}. It might be more pleasant to call that + * from {@link AbstractJournal#commitNow(long)} so we could consolidate this + * logic. That requires us to expose the {@link WriteCacheService} to the + * {@link AbstractJournal} through the {@link IHABufferStrategy}. + */ private long lastBlockSequence = 0; @Override @@ -2437,12 +2450,9 @@ private final void releaseWriteCache() { if (writeCacheService != null) { -// try { - // FIXME: just reset to preserve read cache? - writeCacheService.close(); -// } catch (InterruptedException e) { -// throw new RuntimeException(e); -// } + + writeCacheService.close(); + } } @@ -2452,11 +2462,16 @@ * of this method are ignored. */ @Override - public void delete(long addr) { - if (writeCacheService != null) - writeCacheService.clearWrite(addr, 0); - } + public void delete(final long addr) { + if (writeCacheService != null) { + + writeCacheService.clearWrite(addr, 0); + + } + + } + @Override public void writeRawBuffer(final IHAWriteMessage msg, final IBufferAccess b) throws IOException, InterruptedException { @@ -2710,13 +2725,19 @@ // Note: Potentially updated (if root blocks were reinstalled). storeUUIDRef.set(rootBlock.getUUID()); - + } @Override public Object snapshotAllocators() { - // TODO Auto-generated method stub - throw new UnsupportedOperationException(); + + /* + * Note: The WORM does not have a concept of allocators. There is + * nothing that we need to snapshot since there is no state that is + * overwritten. + */ + return null; + } @Override @@ -2746,6 +2767,17 @@ // The capacity of that buffer (typically 1MB). final int bufferCapacity = b.capacity(); + /* + * FIXME computeDigest(): This probably should be userExtent + + * header, not fileExtent. By choosing userExtent, we are + * effectively snapshotting the region on which we will compute the + * digest. However, there might be bytes not yet written onto the + * backing file (e.g., in the write cache service). Those bytes + * would not show up in a read from the file so we would need to do + * more work to make this digest computation safe for concurrent + * writes. What is safe is to compute the digest from the last + * commit point. That "snapshop" is always valid for the WORM. + */ // The size of the file at the moment we begin. final long fileExtent = getExtent(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tho...@us...> - 2013-05-03 12:11:55
|
Revision: 7099 http://bigdata.svn.sourceforge.net/bigdata/?rev=7099&view=rev Author: thompsonbry Date: 2013-05-03 12:11:49 +0000 (Fri, 03 May 2013) Log Message: ----------- javadoc on the extensionLock in the WORMStrategy. Modified Paths: -------------- branches/READ_CACHE/bigdata/src/java/com/bigdata/journal/WORMStrategy.java Modified: branches/READ_CACHE/bigdata/src/java/com/bigdata/journal/WORMStrategy.java =================================================================== --- branches/READ_CACHE/bigdata/src/java/com/bigdata/journal/WORMStrategy.java 2013-05-02 20:56:56 UTC (rev 7098) +++ branches/READ_CACHE/bigdata/src/java/com/bigdata/journal/WORMStrategy.java 2013-05-03 12:11:49 UTC (rev 7099) @@ -39,6 +39,8 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; +import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; import com.bigdata.LRUNexus; import com.bigdata.btree.BTree.Counter; @@ -192,9 +194,11 @@ // private final AtomicReference<Quorum<?,?>> quorumRef; /** - * This lock is used to exclude readers when the extent of the backing file - * is about to be changed. This is a workaround for an old (an unresolved as - * of February 2010) Sun bug. + * This lock is used to exclude readers/writers performing IOs against the + * backing file when the extent of the backing file is about to be changed. + * Readers and writers take the {@link ReadLock}. The {@link WriteLock} is + * taken when the file extent must be changed. This is a workaround for an + * old (an unresolved as of February 2010) Sun bug. * * @see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6371642 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |