From: Bryan T. <tho...@us...> - 2007-02-19 19:00:58
|
Update of /cvsroot/cweb/bigdata/src/java/com/bigdata/isolation In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv30034/src/java/com/bigdata/isolation Modified Files: IsolatedBTree.java Log Message: Some more work on transaction support, including an api change that makes ITx an internal api and presents just a timestamp to clients. This removes the potential for misuse of prepare/commit by the clients and sets us up for an ITransactionManager api. Index: IsolatedBTree.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/java/com/bigdata/isolation/IsolatedBTree.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IsolatedBTree.java 19 Feb 2007 01:05:39 -0000 1.5 --- IsolatedBTree.java 19 Feb 2007 19:00:20 -0000 1.6 *************** *** 115,118 **** --- 115,121 ---- * slick way to realize the proper semantics for this interface on a fused * view of the write set and the immutable index isolated by this class? + * + * FIXME I have not finished working through the fused view support for this + * class. */ public class IsolatedBTree extends UnisolatedBTree implements IIsolatableIndex, *************** *** 188,192 **** throw new IllegalArgumentException(); ! Value value = (Value) super.lookup(key); if (value == null) { --- 191,195 ---- throw new IllegalArgumentException(); ! Value value = super.getValue(key); if (value == null) { *************** *** 218,222 **** throw new IllegalArgumentException(); ! Value value = (Value) super.getValue((byte[])key); if (value == null) { --- 221,225 ---- throw new IllegalArgumentException(); ! Value value = super.getValue((byte[])key); if (value == null) { *************** *** 237,245 **** /** ! * Remove the key from the write set (does not write through to the isolated ! * index). */ public Object remove(Object key) { return super.remove(key); --- 240,283 ---- /** ! * Remove the key from the write set (does not write through to the ! * unisolated index). If the key is not in the write set, then we check the ! * unisolated index. If the key is found there, then we add a delete marker ! * to the isolated index. */ public Object remove(Object key) { + if (key == null) + throw new IllegalArgumentException(); + + // check the isolated index. + Value value = super.getValue((byte[])key); + + if (value == null) { + + /* + * The key does not exist in the isolated index, so now we test to + * see if the key exists in the unisolated index. if it does then we + * need to write a delete marker in the isolated index. + */ + value = src.getValue((byte[]) key); + + if(value==null||value.deleted) return null; + + super.remove(key); + + /* + * return the value from the unisolated index since that is what was + * deleted. + */ + return value.datum; + + } + + if (value.deleted) { + + return null; + + } + return super.remove(key); *************** *** 536,551 **** /* * IFF there was a pre-existing version in the global scope then ! * we clear the 'currentVersionSlots' in the entry in the global ! * scope and mark the index entry as dirty. The global scope ! * will now recognized the persistent identifier as 'deleted'. */ if (globalScope.contains(key)) { - /* - * Mark the entry in the unisolated index as deleted. - */ - // globalScope.insert(key, new Value( - // entry.nextVersionCounter(), true, null)); globalScope.remove(key); --- 574,583 ---- /* * IFF there was a pre-existing version in the global scope then ! * we remove the key from the global scope so that it will now ! * have a "delete marker" for this key. */ if (globalScope.contains(key)) { globalScope.remove(key); *************** *** 564,569 **** * Copy the entry down onto the global scope. */ ! // globalScope.insert(key, new Value(entry.nextVersionCounter(), ! // false, entry.datum)); globalScope.insert(key,entry.datum); --- 596,600 ---- * Copy the entry down onto the global scope. */ ! globalScope.insert(key,entry.datum); |