[jbosscache-commits] JBoss Cache SVN: r6251 - in core/trunk/src/main/java/org/jboss/cache: mvcc and 1 other directory.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Fri Jul 11 13:01:52 EDT 2008
Author: manik.surtani at jboss.com
Date: 2008-07-11 13:01:51 -0400 (Fri, 11 Jul 2008)
New Revision: 6251
Modified:
core/trunk/src/main/java/org/jboss/cache/NodeFactory.java
core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java
core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java
Log:
Do we actualy need data versions with MVCC?
Modified: core/trunk/src/main/java/org/jboss/cache/NodeFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/NodeFactory.java 2008-07-11 15:46:23 UTC (rev 6250)
+++ core/trunk/src/main/java/org/jboss/cache/NodeFactory.java 2008-07-11 17:01:51 UTC (rev 6251)
@@ -125,6 +125,7 @@
*/
public NodeSPI<K, V> createDataNode(Object childName, Fqn fqn, NodeSPI<K, V> parent, Map<K, V> data, boolean mapSafe)
{
+ // TODO: See if data versions are needed with MVCC. Should use cheaper UnversionedNode otherwise.
UnversionedNode un = useVersionedNode ? new VersionedNode<K, V>(fqn, parent, data, cache) : new UnversionedNode<K, V>(childName, fqn, data, cache);
// it is internal nodes that are wrapped in NIDs.
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java 2008-07-11 15:46:23 UTC (rev 6250)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java 2008-07-11 17:01:51 UTC (rev 6251)
@@ -52,6 +52,7 @@
InternalNode backupDelegationTarget = ((NodeReference) backup).getDelegate();
node = backupDelegationTarget.copy();
}
+ // TODO: See if data versions are even needed in the first place!!
// TODO: Make sure this works with custom versions as well!
// DataVersion newVersion = ((DefaultDataVersion) node.getVersion()).increment();
// node.setVersion(newVersion);
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java 2008-07-11 15:46:23 UTC (rev 6250)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java 2008-07-11 17:01:51 UTC (rev 6251)
@@ -8,7 +8,6 @@
import org.jboss.cache.invocation.InvocationContext;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.optimistic.DataVersioningException;
-import org.jboss.cache.optimistic.DefaultDataVersion;
/**
* A node delegate that encapsulates repeatable read semantics when writes are initiated, committed or rolled back.
@@ -36,9 +35,11 @@
// check for write skew.
NodeSPI underlyingNode = container.peek(fqn, false, true); // even check for invalid nodes. we should check tombstones too.
DataVersion underlyingNodeVersion = underlyingNode == null ? null : underlyingNode.getVersion();
- if (!allowWriteSkew && underlyingNode != null && !node.getVersion().equals(underlyingNodeVersion))
+ // TODO: See if data versions are even needed in the first place!!
+ //if (!allowWriteSkew && underlyingNode != null && !node.getVersion().equals(underlyingNodeVersion))
+ if (!allowWriteSkew && underlyingNode != null && underlyingNode != node)
{
- String errormsg = new StringBuilder().append("Detected write skew on Fqn [").append(fqn).append("]. Attempting to overwrite version ").append(node.getVersion()).append(" but current version has progressed to ").append(underlyingNodeVersion).toString();
+ String errormsg = new StringBuilder().append("Detected write skew on Fqn [").append(fqn).append("]. Another process has changed the node since we last read it!").toString();
if (log.isWarnEnabled()) log.warn(errormsg + ". Unable to copy node for update.");
throw new DataVersioningException(errormsg);
}
@@ -46,11 +47,11 @@
// make a backup copy
backup = node;
node = backup.copy();
-
+ // TODO: See if data versions are even needed in the first place!!
// update version on copy
// TODO: Make sure this works with custom versions as well!
- DataVersion newVersion = ((DefaultDataVersion) node.getVersion()).increment();
- node.setVersion(newVersion);
+// DataVersion newVersion = ((DefaultDataVersion) node.getVersion()).increment();
+// node.setVersion(newVersion);
}
@Override
More information about the jbosscache-commits
mailing list