From: Bryan T. <tho...@us...> - 2007-03-08 18:14:15
|
Update of /cvsroot/cweb/bigdata/src/java/com/bigdata/journal In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15000/src/java/com/bigdata/journal Modified Files: RunState.java TemporaryStore.java IJournal.java IStore.java CommitRecord.java TransactionServer.java IMROW.java IAtomicStore.java AbstractTx.java Journal.java IIndexManager.java Log Message: Updated the UML model and added a ZIP containing an HTML presentation of the model. Working on partitioned index support. Index: IJournal.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/IJournal.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IJournal.java 22 Feb 2007 16:59:34 -0000 1.7 --- IJournal.java 8 Mar 2007 18:14:06 -0000 1.8 *************** *** 51,55 **** import com.bigdata.objndx.IIndex; - import com.bigdata.rawstore.IRawStore; /** --- 51,54 ---- *************** *** 63,68 **** * @version $Id$ */ ! public interface IJournal extends IMROW, IRawStore, IAtomicStore, ! IIndexManager, ITransactionManager { /** --- 62,67 ---- * @version $Id$ */ ! public interface IJournal extends IMROW, IAtomicStore, IIndexManager, ! ITransactionManager { /** *************** *** 102,127 **** public IIndex getIndex(String name, long startTime); - /** - * Return a read-only view of the current root block. - * - * @return The current root block. - */ - public IRootBlockView getRootBlockView(); - - /** - * Return the {@link ICommitRecord} for the most recent committed state - * whose commit timestamp is less than or equal to <i>timestamp</i>. This - * is used by a {@link Tx transaction} to locate the committed state that is - * the basis for its operations. - * - * @param timestamp - * Typically, the timestamp assigned to a transaction. - * - * @return The {@link ICommitRecord} for the most recent committed state - * whose commit timestamp is less than or equal to <i>timestamp</i> - * -or- <code>null</code> iff there are no {@link ICommitRecord}s - * that satisify the probe. - */ - public ICommitRecord getCommitRecord(long commitTime); - } --- 101,103 ---- Index: CommitRecord.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/CommitRecord.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CommitRecord.java 21 Feb 2007 20:17:21 -0000 1.2 --- CommitRecord.java 8 Mar 2007 18:14:06 -0000 1.3 *************** *** 53,59 **** * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ - * - * @todo can I make the roots named in some less scalable manner? E.g., an array - * list or hash table? */ public class CommitRecord implements ICommitRecord { --- 53,56 ---- Index: IAtomicStore.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/IAtomicStore.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IAtomicStore.java 17 Feb 2007 21:34:17 -0000 1.4 --- IAtomicStore.java 8 Mar 2007 18:14:07 -0000 1.5 *************** *** 97,101 **** * Note: the committers must be reset after restart or whenever * ! * @param rootSlot * The slot in the root block where the {@link Addr address} of * the {@link ICommitter} will be recorded. --- 97,101 ---- * Note: the committers must be reset after restart or whenever * ! * @param index * The slot in the root block where the {@link Addr address} of * the {@link ICommitter} will be recorded. *************** *** 104,108 **** * The commiter. */ ! public void setCommitter(int rootSlot, ICommitter committer); /** --- 104,108 ---- * The commiter. */ ! public void setCommitter(int index, ICommitter committer); /** *************** *** 120,122 **** --- 120,145 ---- public long getRootAddr(int index); + /** + * Return a read-only view of the current root block. + * + * @return The current root block. + */ + public IRootBlockView getRootBlockView(); + + /** + * Return the {@link ICommitRecord} for the most recent committed state + * whose commit timestamp is less than or equal to <i>timestamp</i>. This + * is used by a {@link Tx transaction} to locate the committed state that is + * the basis for its operations. + * + * @param timestamp + * Typically, the timestamp assigned to a transaction. + * + * @return The {@link ICommitRecord} for the most recent committed state + * whose commit timestamp is less than or equal to <i>timestamp</i> + * -or- <code>null</code> iff there are no {@link ICommitRecord}s + * that satisify the probe. + */ + public ICommitRecord getCommitRecord(long commitTime); + } Index: TransactionServer.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/TransactionServer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TransactionServer.java 28 Feb 2007 13:59:10 -0000 1.5 --- TransactionServer.java 8 Mar 2007 18:14:06 -0000 1.6 *************** *** 203,207 **** this.readCommitted = isolationLevel == IsolationEnum.ReadCommitted; ! // runState = RunState.ACTIVE; heartbeat = System.nanoTime(); --- 203,207 ---- this.readCommitted = isolationLevel == IsolationEnum.ReadCommitted; ! // runState = RunState.Active; heartbeat = System.nanoTime(); *************** *** 567,571 **** // * The criteria for deallocating historical versions is that (a) there is // a ! // * more recent version; and (b) there is no ACTIVE (vs PENDING or // COMPLETED) // * transaction which could read from that historical version. The journal --- 567,571 ---- // * The criteria for deallocating historical versions is that (a) there is // a ! // * more recent version; and (b) there is no Active (vs PENDING or // COMPLETED) // * transaction which could read from that historical version. The journal *************** *** 574,579 **** // come // * from a transaction service which has global knowledge of which ! // * transactions have PREPARED or ABORTED and can generate notices when all ! // * transactions before a given timestamp have been PREPARED or ABORTED. // For // * example, a long running transaction can cause notice to be delayed for --- 574,579 ---- // come // * from a transaction service which has global knowledge of which ! // * transactions have Prepared or Aborted and can generate notices when all ! // * transactions before a given timestamp have been Prepared or Aborted. // For // * example, a long running transaction can cause notice to be delayed for Index: Journal.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/Journal.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** Journal.java 6 Mar 2007 20:38:06 -0000 1.58 --- Journal.java 8 Mar 2007 18:14:07 -0000 1.59 *************** *** 62,65 **** --- 62,66 ---- import org.apache.log4j.Logger; + import com.bigdata.isolation.UnisolatedBTree; import com.bigdata.objndx.BTree; import com.bigdata.objndx.BTreeMetadata; *************** *** 1284,1287 **** --- 1285,1301 ---- /** + * Registers an {@link UnisolatedBTree} that will support transactional + * isolation. + * <p> + * Note: You MUST {@link #commit()} before the registered index will be + * either restart-safe or visible to new transactions. + */ + public IIndex registerIndex(String name) { + + return registerIndex( name, new UnisolatedBTree(this)); + + } + + /** * Note: You MUST {@link #commit()} before the registered index will be * either restart-safe or visible to new transactions. Index: TemporaryStore.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/TemporaryStore.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TemporaryStore.java 21 Feb 2007 20:17:21 -0000 1.6 --- TemporaryStore.java 8 Mar 2007 18:14:06 -0000 1.7 *************** *** 48,51 **** --- 48,54 ---- package com.bigdata.journal; + import com.bigdata.objndx.AbstractBTree; + import com.bigdata.objndx.BTree; + import com.bigdata.objndx.ByteArrayValueSerializer; import com.bigdata.objndx.IIndex; import com.bigdata.rawstore.Addr; *************** *** 57,61 **** * @version $Id$ */ ! public class TemporaryStore extends TemporaryRawStore { /** --- 60,64 ---- * @version $Id$ */ ! public class TemporaryStore extends TemporaryRawStore implements IIndexManager { /** *************** *** 100,103 **** --- 103,117 ---- } + + /** + * Registers a {@link BTree} whose values are variable length byte[]s. + */ + public IIndex registerIndex(String name) { + + return registerIndex(name, new BTree(this, + BTree.DEFAULT_BRANCHING_FACTOR, + ByteArrayValueSerializer.INSTANCE)); + + } public IIndex registerIndex(String name, IIndex btree) { Index: AbstractTx.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/AbstractTx.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractTx.java 28 Feb 2007 13:59:10 -0000 1.1 --- AbstractTx.java 8 Mar 2007 18:14:07 -0000 1.2 *************** *** 117,121 **** journal.activateTx(this); ! this.runState = RunState.ACTIVE; } --- 117,121 ---- journal.activateTx(this); ! this.runState = RunState.Active; } *************** *** 157,165 **** switch(runState) { ! case ACTIVE: ! case ABORTED: throw new IllegalStateException(); ! case PREPARED: ! case COMMITTED: if(commitTime == 0L) throw new AssertionError(); return commitTime; --- 157,165 ---- switch(runState) { ! case Active: ! case Aborted: throw new IllegalStateException(); ! case Prepared: ! case Committed: if(commitTime == 0L) throw new AssertionError(); return commitTime; *************** *** 187,191 **** final public boolean isActive() { ! return runState == RunState.ACTIVE; } --- 187,191 ---- final public boolean isActive() { ! return runState == RunState.Active; } *************** *** 193,197 **** final public boolean isPrepared() { ! return runState == RunState.PREPARED; } --- 193,197 ---- final public boolean isPrepared() { ! return runState == RunState.Prepared; } *************** *** 199,203 **** final public boolean isComplete() { ! return runState == RunState.COMMITTED || runState == RunState.ABORTED; } --- 199,203 ---- final public boolean isComplete() { ! return runState == RunState.Committed || runState == RunState.Aborted; } *************** *** 205,209 **** final public boolean isCommitted() { ! return runState == RunState.COMMITTED; } --- 205,209 ---- final public boolean isCommitted() { ! return runState == RunState.Committed; } *************** *** 211,215 **** final public boolean isAborted() { ! return runState == RunState.ABORTED; } --- 211,215 ---- final public boolean isAborted() { ! return runState == RunState.Aborted; } *************** *** 222,226 **** try { ! runState = RunState.ABORTED; journal.completedTx(this); --- 222,226 ---- try { ! runState = RunState.Aborted; journal.completedTx(this); *************** *** 291,295 **** journal.prepared(this); ! runState = RunState.PREPARED; } --- 291,295 ---- journal.prepared(this); ! runState = RunState.Prepared; } *************** *** 340,344 **** } ! runState = RunState.COMMITTED; journal.completedTx(this); --- 340,344 ---- } ! runState = RunState.Committed; journal.completedTx(this); Index: RunState.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/RunState.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RunState.java 8 Nov 2006 15:18:13 -0000 1.1 --- RunState.java 8 Mar 2007 18:14:06 -0000 1.2 *************** *** 9,16 **** public enum RunState { ! ACTIVE("active"), ! PREPARED("prepared"), ! COMMITTED("committed"), ! ABORTED("aborted"); private final String name; --- 9,16 ---- public enum RunState { ! Active("Active"), ! Prepared("Prepared"), ! Committed("Committed"), ! Aborted("Aborted"); private final String name; Index: IStore.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/IStore.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IStore.java 9 Feb 2007 16:13:18 -0000 1.7 --- IStore.java 8 Mar 2007 18:14:06 -0000 1.8 *************** *** 72,76 **** public IIndex getIndex(String name); - // public ITx startTx(long txId); - } --- 72,74 ---- Index: IMROW.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/IMROW.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IMROW.java 21 Feb 2007 20:17:21 -0000 1.1 --- IMROW.java 8 Mar 2007 18:14:06 -0000 1.2 *************** *** 56,60 **** * @version $Id$ */ ! public interface IMROW extends IRawStore { } --- 56,60 ---- * @version $Id$ */ ! public interface IMROW /*extends IRawStore*/ { } Index: IIndexManager.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/journal/IIndexManager.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IIndexManager.java 17 Feb 2007 21:34:18 -0000 1.1 --- IIndexManager.java 8 Mar 2007 18:14:07 -0000 1.2 *************** *** 65,68 **** --- 65,82 ---- * Note: A named index must be registered outside of any transaction before * it may be used inside of a transaction. + * + * @param name + * The name that can be used to recover the index. + * + * @return The object that would be returned by {@link #getIndex(String)}. + */ + public IIndex registerIndex(String name); + + /** + * Register a named index. Once registered the index will participate in + * atomic commits. + * <p> + * Note: A named index must be registered outside of any transaction before + * it may be used inside of a transaction. * <p> * Note: The return object MAY differ from the supplied {@link BTree}. For *************** *** 82,86 **** */ public IIndex registerIndex(String name, IIndex btree); ! /** * Drops the named index (unisolated). The index is removed as a --- 96,100 ---- */ public IIndex registerIndex(String name, IIndex btree); ! /** * Drops the named index (unisolated). The index is removed as a |