Commit 27e8b2a4 by apoorvnaik

ATLAS-2817: Handle auto upgrade from janus 0.2.0 to janus 0.3.0

parent 5b406348
...@@ -30,6 +30,7 @@ import org.apache.atlas.typesystem.types.DataTypes.TypeCategory; ...@@ -30,6 +30,7 @@ import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
import org.apache.atlas.utils.AtlasPerfTracer; import org.apache.atlas.utils.AtlasPerfTracer;
import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.Configuration;
import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper; import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
import org.janusgraph.core.JanusGraphException;
import org.janusgraph.graphdb.database.serialize.attribute.SerializableSerializer; import org.janusgraph.graphdb.database.serialize.attribute.SerializableSerializer;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -50,6 +51,7 @@ public class AtlasJanusGraphDatabase implements GraphDatabase<AtlasJanusVertex, ...@@ -50,6 +51,7 @@ public class AtlasJanusGraphDatabase implements GraphDatabase<AtlasJanusVertex,
private static final Logger LOG = LoggerFactory.getLogger(AtlasJanusGraphDatabase.class); private static final Logger LOG = LoggerFactory.getLogger(AtlasJanusGraphDatabase.class);
private static final Logger PERF_LOG = AtlasPerfTracer.getPerfLogger("AtlasJanusGraphDatabase"); private static final Logger PERF_LOG = AtlasPerfTracer.getPerfLogger("AtlasJanusGraphDatabase");
private static final String OLDER_STORAGE_EXCEPTION = "Storage version is incompatible with current client";
/** /**
* Constant for the configuration property that indicates the prefix. * Constant for the configuration property that indicates the prefix.
...@@ -102,7 +104,16 @@ public class AtlasJanusGraphDatabase implements GraphDatabase<AtlasJanusVertex, ...@@ -102,7 +104,16 @@ public class AtlasJanusGraphDatabase implements GraphDatabase<AtlasJanusVertex,
throw new RuntimeException(e); throw new RuntimeException(e);
} }
try {
graphInstance = JanusGraphFactory.open(config);
} catch (JanusGraphException e) {
LOG.warn("JanusGraphException: {}", e.getMessage());
if (e.getMessage().startsWith(OLDER_STORAGE_EXCEPTION)) {
LOG.info("Newer client is being used with older janus storage version. Setting allow-upgrade=true and reattempting connection");
config.addProperty("graph.allow-upgrade", true);
graphInstance = JanusGraphFactory.open(config); graphInstance = JanusGraphFactory.open(config);
}
}
atlasGraphInstance = new AtlasJanusGraph(); atlasGraphInstance = new AtlasJanusGraph();
validateIndexBackend(config); validateIndexBackend(config);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment