Skip to content

Commit

Permalink
Update TinkerPop 3.6.1
Browse files Browse the repository at this point in the history
Fixes JanusGraph#3069

* Upgrade hadoop 3.x
* Remove Jackson 1

Signed-off-by: Jan Jansen <jan.jansen@gdata.de>
  • Loading branch information
farodin91 committed Oct 2, 2022
1 parent b4653cc commit 04ac4f3
Show file tree
Hide file tree
Showing 15 changed files with 98 additions and 114 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-index-solr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
args: "-Psolr8"
name: solr8
java: 8
- module: es
- module: solr
install-args: "-Pjava-11"
args: "-Psolr8"
name: solr8
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced-topics/hadoop.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ computations of various OLAP queries may be persisted on the Hadoop file
system.

For configuring a single node Hadoop cluster, please refer to official
[Apache Hadoop Docs](https://hadoop.apache.org/docs/r{{hadoop2_version }}/hadoop-project-dist/hadoop-common/SingleCluster.html)
[Apache Hadoop Docs](https://hadoop.apache.org/docs/r{{hadoop_version }}/hadoop-project-dist/hadoop-common/SingleCluster.html)

Once you have a Hadoop cluster up and running, we will need to specify
the Hadoop configuration files in the `CLASSPATH`. The below document
Expand Down
2 changes: 1 addition & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ compile "org.janusgraph:janusgraph-core:1.0.0"
* Elasticsearch 6.0.1, 6.6.0, 7.17.5
* Apache Lucene 8.11.1
* Apache Solr 8.11.1
* Apache TinkerPop 3.5.3
* Apache TinkerPop 3.6.1
* Java 8, 11

**Installed versions in the Pre-Packaged Distribution**
Expand Down
27 changes: 0 additions & 27 deletions janusgraph-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,33 +104,6 @@
<version>${project.version}</version>
</dependency>

<!-- Override Jackson versions in our transitive dependencies.
Without these dependencies, janusgraph-all users can end up with
1.9 + 1.8 jars together, and this leads to linkage errors.
It might be a better idea to dependencyManagement imports if your Maven version supports it:
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies -->
<!-- Jackson 1.x -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson1.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>${jackson1.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
<version>${jackson1.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>${jackson1.version}</version>
</dependency>

<!-- Jackson 2.x -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@
method = "shouldResetAfterRollback",
reason = "JanusGraph assumes lifecycle of transactionListeners in AbstractThreadLocalTransaction ends when the " +
"transaction ends (commit/rollback/close). TinkerPop, however, asserts transactionListeners are active across transactions.")
@Graph.OptOut(
test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.MergeVertexTest",
method = "g_mergeVXlabel_person_name_markoX_optionXonMatch_age_19X_option",
reason = "JanusGraph doesn't support MergeVertex yet.")
@Graph.OptOut(
test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.MergeVertexTest",
method = "g_withSideEffectXc_label_person_name_markoX_withSideEffectXm_age_19X_mergeVXselectXcXX_optionXonMatch_selectXmXX_option",
reason = "JanusGraph doesn't support MergeVertex yet.")
public interface JanusGraph extends Transaction {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

package org.janusgraph.graphdb.tinkerpop;

import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.janusgraph.core.JanusGraphEdge;
import org.janusgraph.core.JanusGraphVertex;
Expand Down Expand Up @@ -61,13 +59,4 @@ public static RelationIdentifier getEdgeId(Object id) {
}
return null;
}

public static void verifyArgsMustBeEitherIdOrElement(Object... ids) {
assert ids.length>0;
int numElements = 0;
for (Object id : ids) {
if (id instanceof Element) numElements++;
}
if (numElements>0 && numElements<ids.length) throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ public JanusGraphVertex addVertex(Object... keyValues) {
@Override
public Iterator<Vertex> vertices(Object... vertexIds) {
if (vertexIds==null || vertexIds.length==0) return (Iterator)getVertices().iterator();
ElementUtils.verifyArgsMustBeEitherIdOrElement(vertexIds);
long[] ids = new long[vertexIds.length];
int pos = 0;
for (Object vertexId : vertexIds) {
Expand All @@ -147,7 +146,6 @@ public Iterator<Vertex> vertices(Object... vertexIds) {
@Override
public Iterator<Edge> edges(Object... edgeIds) {
if (edgeIds==null || edgeIds.length==0) return (Iterator)getEdges().iterator();
ElementUtils.verifyArgsMustBeEitherIdOrElement(edgeIds);
RelationIdentifier[] ids = new RelationIdentifier[edgeIds.length];
int pos = 0;
for (Object edgeId : edgeIds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
import org.apache.tinkerpop.gremlin.structure.Element;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.janusgraph.graphdb.tinkerpop.ElementUtils;
import org.janusgraph.graphdb.tinkerpop.optimize.JanusGraphTraversalUtil;
import org.janusgraph.graphdb.tinkerpop.optimize.step.HasStepFolder;
import org.janusgraph.graphdb.tinkerpop.optimize.step.JanusGraphStep;
Expand Down Expand Up @@ -63,17 +62,19 @@ public void apply(final Traversal.Admin<?, ?> traversal) {
} else {
//Make sure that any provided "start" elements are instantiated in the current transaction
final Object[] ids = originalGraphStep.getIds();
ElementUtils.verifyArgsMustBeEitherIdOrElement(ids);
if (ids[0] instanceof Element) {
//GraphStep constructor ensures that the entire array is elements
final Object[] elementIds = new Object[ids.length];
for (int i = 0; i < ids.length; i++) {
final Object[] elementIds = new Object[ids.length];
for (int i = 0; i < ids.length; i++) {
if (ids[i] instanceof Element) {
elementIds[i] = ((Element) ids[i]).id();
}
originalGraphStep.setIteratorSupplier(() -> originalGraphStep.returnsVertex() ?
((Graph) originalGraphStep.getTraversal().getGraph().get()).vertices(elementIds) :
((Graph) originalGraphStep.getTraversal().getGraph().get()).edges(elementIds));
else
{
elementIds[i] = ids[i];
}
}
originalGraphStep.setIteratorSupplier(() -> originalGraphStep.returnsVertex() ?
((Graph) originalGraphStep.getTraversal().getGraph().get()).vertices(elementIds) :
((Graph) originalGraphStep.getTraversal().getGraph().get()).edges(elementIds));
}

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

public class CloseableIteratorUtils {

public static final CloseableIterator<Object> EMPTY_CLOSABLE_ITERATOR = CloseableIterator.asCloseable(Collections.emptyIterator());
public static final CloseableIterator<Object> EMPTY_CLOSABLE_ITERATOR = CloseableIterator.of(Collections.emptyIterator());

public static <T> CloseableIterator<T> emptyIterator() {
return (CloseableIterator<T>) EMPTY_CLOSABLE_ITERATOR;
Expand Down
1 change: 1 addition & 0 deletions janusgraph-cql/src/test/resources/cql-read.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph
gremlin.hadoop.graphReader=org.janusgraph.hadoop.formats.cql.CqlInputFormat
gremlin.hadoop.graphWriter=org.apache.hadoop.mapreduce.lib.output.NullOutputFormat

gremlin.hadoop.jarsInDistributedCache=true
gremlin.hadoop.inputLocation=none
gremlin.hadoop.outputLocation=target/output
Expand Down
1 change: 0 additions & 1 deletion janusgraph-hadoop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>${hadoop2.version}</version>
</dependency>

<!-- JANUSGRAPH -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,24 @@
@Testcontainers
public class HBaseInputFormatIT extends AbstractInputFormatIT {
@Container
public static final HBaseContainer hBaseContainer = new HBaseContainer();
private static final HBaseContainer hbase = new HBaseContainer();

protected Graph getGraph() throws IOException, ConfigurationException {
final PropertiesConfiguration config = ConfigurationUtil.loadPropertiesConfig("target/test-classes/hbase-read.properties", false);
private PropertiesConfiguration getGraphConfiguration(final String filename) throws ConfigurationException, IOException {
final PropertiesConfiguration config = ConfigurationUtil.loadPropertiesConfig(filename, false);
Path baseOutDir = Paths.get((String) config.getProperty("gremlin.hadoop.outputLocation"));
baseOutDir.toFile().mkdirs();
String outDir = Files.createTempDirectory(baseOutDir, null).toAbsolutePath().toString();
config.setProperty("gremlin.hadoop.outputLocation", outDir);
return GraphFactory.open(config);
return config;
}

@Override
public WriteConfiguration getConfiguration() {
return hBaseContainer.getWriteConfiguration();
return hbase.getWriteConfiguration();
}

@Override
protected Graph getGraph() throws ConfigurationException, IOException {
return GraphFactory.open(getGraphConfiguration("target/test-classes/hbase-read.properties"));
}
}
16 changes: 13 additions & 3 deletions janusgraph-hbase/src/test/resources/hbase-read.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#
# Hadoop Graph Configuration
#
gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph
gremlin.hadoop.graphReader=org.janusgraph.hadoop.formats.hbase.HBaseInputFormat
gremlin.hadoop.graphWriter=org.apache.hadoop.mapreduce.lib.output.NullOutputFormat

gremlin.hadoop.jarsInDistributedCache=true
gremlin.hadoop.inputLocation=none
gremlin.hadoop.outputLocation=target/output
gremlin.spark.persistContext=true

#
# JanusGraph HBase InputFormat configuration
#
janusgraphmr.ioformat.conf.storage.backend=hbase
janusgraphmr.ioformat.conf.storage.hostname=localhost
####################################
# SparkGraphComputer Configuration #
####################################
janusgraphmr.ioformat.conf.storage.hbase.table=janusgraph

#
# SparkGraphComputer Configuration
#
spark.master=local[4]
spark.driver.host=127.0.0.1
spark.executor.memory=1g
Expand Down
4 changes: 2 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,6 @@ nav:
extra:
latest_version: 1.0.0
snapshot_version: 1.0.0-SNAPSHOT
tinkerpop_version: 3.5.3
hadoop2_version: 2.8.5
tinkerpop_version: 3.6.1
hadoop_version: 3.3.4
jamm_version: 0.3.0
Loading

0 comments on commit 04ac4f3

Please sign in to comment.