From: <tho...@us...> - 2011-06-23 16:02:44
|
Revision: 4781 http://bigdata.svn.sourceforge.net/bigdata/?rev=4781&view=rev Author: thompsonbry Date: 2011-06-23 16:02:37 +0000 (Thu, 23 Jun 2011) Log Message: ----------- Modified AbstractIV such that the RDF Value cache is sent across the wire for scale-out. See [1] for efficiency concerns relating to when we send the Value cache and what we could do about this. This change has been applied to both the QUADS and the TERMS branches. See https://sourceforge.net/apps/trac/bigdata/ticket/337 (Compact and efficient movement of binding sets between nodes) Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractIV.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/TermId.java branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractIV.java branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/TermId.java Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractIV.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractIV.java 2011-06-23 15:25:56 UTC (rev 4780) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractIV.java 2011-06-23 16:02:37 UTC (rev 4781) @@ -27,6 +27,7 @@ package com.bigdata.rdf.internal; +import java.io.IOException; import java.util.UUID; import org.deri.iris.basics.Literal; @@ -642,12 +643,12 @@ return null; } - /* - * Value cache (transient). + /** + * Value cache (transient, but overridden serialization is used to send this + * anyway for various purposes). * - * Note: TermId overrides serialization to make this non-transient. + * @see https://sourceforge.net/apps/trac/bigdata/ticket/337 */ - private volatile transient V cache = null; final public V getValue() { @@ -700,4 +701,36 @@ } + /** + * Override default serialization to send the cached {@link BigdataValue}. + * + * @see https://sourceforge.net/apps/trac/bigdata/ticket/337 + */ + private void writeObject(java.io.ObjectOutputStream out) throws IOException { + + out.defaultWriteObject(); + + out.writeObject(getValueCache()); + + } + + /** + * Override default serialization to recover the cached {@link BigdataValue} + * . + */ + @SuppressWarnings("unchecked") + private void readObject(java.io.ObjectInputStream in) throws IOException, + ClassNotFoundException { + + in.defaultReadObject(); + + final V v = (V) in.readObject(); + + if (v != null) { + // set the value cache. + setValue(v); + } + + } + } Modified: branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/TermId.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/TermId.java 2011-06-23 15:25:56 UTC (rev 4780) +++ branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/TermId.java 2011-06-23 16:02:37 UTC (rev 4781) @@ -23,8 +23,6 @@ */ package com.bigdata.rdf.internal; -import java.io.IOException; - import com.bigdata.btree.keys.IKeyBuilder; import com.bigdata.rawstore.Bytes; import com.bigdata.rdf.lexicon.LexiconRelation; @@ -214,34 +212,36 @@ } - /** - * Override default serialization to send the cached {@link BigdataValue}. - */ - private void writeObject(java.io.ObjectOutputStream out) throws IOException { +// /** +// * Override default serialization to send the cached {@link BigdataValue}. +// * +// * @see https://sourceforge.net/apps/trac/bigdata/ticket/337 +// */ +// private void writeObject(java.io.ObjectOutputStream out) throws IOException { +// +// out.defaultWriteObject(); +// +// out.writeObject(getValueCache()); +// +// } +// +// /** +// * Override default serialization to recover the cached {@link BigdataValue} +// * . +// */ +// @SuppressWarnings("unchecked") +// private void readObject(java.io.ObjectInputStream in) throws IOException, +// ClassNotFoundException { +// +// in.defaultReadObject(); +// +// final V v = (V) in.readObject(); +// +// if (v != null) { +// // set the value cache. +// setValue(v); +// } +// +// } - out.defaultWriteObject(); - - out.writeObject(getValueCache()); - - } - - /** - * Override default serialization to recover the cached {@link BigdataValue} - * . - */ - @SuppressWarnings("unchecked") - private void readObject(java.io.ObjectInputStream in) throws IOException, - ClassNotFoundException { - - in.defaultReadObject(); - - final V v = (V) in.readObject(); - - if (v != null) { - // set the value cache. - setValue(v); - } - - } - } Modified: branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractIV.java =================================================================== --- branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractIV.java 2011-06-23 15:25:56 UTC (rev 4780) +++ branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/AbstractIV.java 2011-06-23 16:02:37 UTC (rev 4781) @@ -27,6 +27,7 @@ package com.bigdata.rdf.internal; +import java.io.IOException; import java.util.UUID; import org.deri.iris.basics.Literal; @@ -826,12 +827,12 @@ return null; } - /* - * Value cache (transient). + /** + * Value cache (transient, but overridden serialization is used to send this + * anyway for various purposes). * - * Note: TermId overrides serialization to make this non-transient. + * @see https://sourceforge.net/apps/trac/bigdata/ticket/337 */ - private volatile transient V cache = null; final public V getValue() { @@ -884,4 +885,36 @@ } + /** + * Override default serialization to send the cached {@link BigdataValue}. + * + * @see https://sourceforge.net/apps/trac/bigdata/ticket/337 + */ + private void writeObject(java.io.ObjectOutputStream out) throws IOException { + + out.defaultWriteObject(); + + out.writeObject(getValueCache()); + + } + + /** + * Override default serialization to recover the cached {@link BigdataValue} + * . + */ + @SuppressWarnings("unchecked") + private void readObject(java.io.ObjectInputStream in) throws IOException, + ClassNotFoundException { + + in.defaultReadObject(); + + final V v = (V) in.readObject(); + + if (v != null) { + // set the value cache. + setValue(v); + } + + } + } Modified: branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/TermId.java =================================================================== --- branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/TermId.java 2011-06-23 15:25:56 UTC (rev 4780) +++ branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/TermId.java 2011-06-23 16:02:37 UTC (rev 4781) @@ -23,8 +23,6 @@ */ package com.bigdata.rdf.internal; -import java.io.IOException; - import org.openrdf.model.Value; import com.bigdata.btree.keys.IKeyBuilder; @@ -430,37 +428,37 @@ } - /** - * Override default serialization to send the cached {@link BigdataValue}. - */ - private void writeObject(final java.io.ObjectOutputStream out) - throws IOException { +// /** +// * Override default serialization to send the cached {@link BigdataValue}. +// */ +// private void writeObject(final java.io.ObjectOutputStream out) +// throws IOException { +// +// out.defaultWriteObject(); +// +// out.writeObject(getValueCache()); +// +// } +// +// /** +// * Override default serialization to recover the cached {@link BigdataValue} +// * . +// */ +// @SuppressWarnings("unchecked") +// private void readObject(final java.io.ObjectInputStream in) +// throws IOException, ClassNotFoundException { +// +// in.defaultReadObject(); +// +// final V v = (V) in.readObject(); +// +// if (v != null) { +// // set the value cache. +// setValue(v); +// } +// +// } - out.defaultWriteObject(); - - out.writeObject(getValueCache()); - - } - - /** - * Override default serialization to recover the cached {@link BigdataValue} - * . - */ - @SuppressWarnings("unchecked") - private void readObject(final java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException { - - in.defaultReadObject(); - - final V v = (V) in.readObject(); - - if (v != null) { - // set the value cache. - setValue(v); - } - - } - /** * Create a unique bnode id based on the {@link TermId}'s internal data. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |