From: <tho...@us...> - 2010-09-01 20:03:04
|
Revision: 3491 http://bigdata.svn.sourceforge.net/bigdata/?rev=3491&view=rev Author: thompsonbry Date: 2010-09-01 20:02:58 +0000 (Wed, 01 Sep 2010) Log Message: ----------- Added comments related to https://sourceforge.net/apps/trac/bigdata/ticket/151 and https://sourceforge.net/apps/trac/bigdata/ticket/152. Reconciled edits from Martyn in RWStrategy. Made freeImmediately() private. Modified Paths: -------------- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/IRootBlockView.java branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/RWStrategy.java branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/RootBlockCommitter.java branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/IRootBlockView.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/IRootBlockView.java 2010-09-01 18:43:58 UTC (rev 3490) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/IRootBlockView.java 2010-09-01 20:02:58 UTC (rev 3491) @@ -112,9 +112,17 @@ * The root block version number. */ public int getVersion(); - + /** * The next offset at which a data item would be written on the store. + * + * FIXME The RWStore has different semantics for this field. Document those + * semantics and modify {@link AbstractJournal} so we can directly decide + * how many bytes were "written" (for the WORM) or were "allocated" (for the + * RWStore, in which case it should probably be the net of the bytes + * allocated and released). Update all the locations in the code which rely + * on {@link #getNextOffset()} to compute the #of bytes written onto the + * store. */ public long getNextOffset(); Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/RWStrategy.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/RWStrategy.java 2010-09-01 18:43:58 UTC (rev 3490) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/RWStrategy.java 2010-09-01 20:02:58 UTC (rev 3491) @@ -253,11 +253,12 @@ throw new IllegalArgumentException(); } - try { - long rwaddr = m_store.alloc(data.array(), nbytes, context); + try { /* FIXME [data] is not always backed by an array, the array may not be visible (read-only), the array offset may not be zero, etc. Try to drive the ByteBuffer into the RWStore.alloc() method instead. */ + if(data.hasArray()&&data.arrayOffset()!=0)throw new AssertionError(); + final long rwaddr = m_store.alloc(data.array(), nbytes, context); data.position(nbytes); // update position to end of buffer - long retaddr = encodeAddr(rwaddr, nbytes); + final long retaddr = encodeAddr(rwaddr, nbytes); return retaddr; } catch (RuntimeException re) { @@ -305,7 +306,7 @@ } public void delete(long addr) { - if (true) delete(addr, null); + delete(addr, null); } /** Modified: branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/RootBlockCommitter.java =================================================================== --- branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/RootBlockCommitter.java 2010-09-01 18:43:58 UTC (rev 3490) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/journal/RootBlockCommitter.java 2010-09-01 20:02:58 UTC (rev 3491) @@ -38,7 +38,7 @@ public class RootBlockCommitter implements ICommitter { final AbstractJournal journal; - public RootBlockCommitter(AbstractJournal journal) { + public RootBlockCommitter(final AbstractJournal journal) { this.journal = journal; } @@ -46,9 +46,16 @@ * Write the current root block to the Journal and return its address * to be stored in the CommitRecord. */ - public long handleCommit(long commitTime) { - ByteBuffer rbv = journal.getRootBlockView().asReadOnlyBuffer(); - + public long handleCommit(final long commitTime) { + final ByteBuffer rbv = journal.getRootBlockView().asReadOnlyBuffer(); + /* + * FIXME There is an API issue with the RWStore which does not allow + * us to pass in a read-only buffer. Write unit tests for this on + * the core IRawStore test suite and fix the RWStore. Also write + * unit tests when the array backing the ByteBuffer can be accessed + * but has a non-zero array offset (a mutable slice of a ByteBuffer). + */ +// return journal.write(rbv); ByteBuffer bb = ByteBuffer.allocate(rbv.capacity()); for (int i = 0; i < rbv.capacity(); i++) { bb.put(rbv.get()); 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-09-01 18:43:58 UTC (rev 3490) +++ branches/JOURNAL_HA_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java 2010-09-01 20:02:58 UTC (rev 3491) @@ -1084,6 +1084,7 @@ * @param sze */ public void free(final long laddr, final int sze, final IAllocationContext context) { +// if (true) return; final int addr = (int) laddr; switch (addr) { @@ -1118,7 +1119,7 @@ } - public void immediateFree(final int addr, final int sze) { + private void immediateFree(final int addr, final int sze) { switch (addr) { case 0: case -1: @@ -2621,7 +2622,7 @@ if (m_transactionService.getActiveCount() == 0) { return aged; - } else { + } else { return aged < earliest ? aged : earliest; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |