JanusGraph / JanusGraph/janusgraph
ConfiguredGraphFactory.getGraphNames() cannot get latest graphNames in GremlinExecutorGraphBinder class
- Dominant language
- Java
- Stars
- 5.8k
- Forks
- 1.2k
- Avg merge
- 13h 53m
- Merged PRs (30d)
- 6
Description
As title desc, ConfiguredGraphFactory.getGraphNames() call in GremlinExecutorGraphBinder of JanusGraphManager cannot get latest graphNames that created by console like this:
> map = new HashMap();
> map.put("storage.backend", "hbase");
> map.put("storage.hostname", "127.0.0.1");
> map.put("graph.graphname", "sync_test");
> ConfiguredGraphFactory.createConfiguration(new MapConfiguration(map));
then i modify source code to add log info in this run method of GremlinExecutorGraphBinder like this:
```
@Override
public void run() {
log.info("GremlinExecutorGraphBinder of 20s:"+JSON.toJSONString(ConfiguredGraphFactory.getGraphNames()));
ConfiguredGraphFactory.getGraphNames().forEach(it -> {
try {
final Graph graph = ConfiguredGraphFactory.open(it);
updateTraversalSource(it, graph, this.gremlinExecutor, this.graphManager);
} catch (Exception e) {
// cannot open graph, do nothing
log.error(String.format("Failed to open graph %s with the following error:\n %s.\n" +
"Thus, it and its traversal will not be bound on this server.", it, e.toString()));
}
});
}
```
, find that it indeed not get latest graphname of **sync_test**, but when call ConfiguredGraphFactory.getGraphNames() in gremlin console it can return **sync_test**, so i think it's a big bug.
> 2019-05-07 20:30:17-5p org.janusgraph.graphdb.management.JanusGraphManager - GremlinExecutorGraphBinder of 20s:["graph12","graph11"]
> 2019-05-07 20:30:37-5p org.janusgraph.graphdb.management.JanusGraphManager - GremlinExecutorGraphBinder of 20s:["graph12","graph11"]
> 2019-05-07 20:30:57-5p org.janusgraph.graphdb.management.JanusGraphManager - GremlinExecutorGraphBinder of 20s:["graph12","graph11"]
> 2019-05-07 20:31:17-5p org.janusgraph.graphdb.management.JanusGraphManager - GremlinExecutorGraphBinder of 20s:["graph12","graph11"]
> 2019-05-07 20:31:37-5p org.janusgraph.graphdb.management.JanusGraphManager - GremlinExecutorGraphBinder of 20s:["graph12","graph11"]
> 2019-05-07 20:31:57-5p org.janusgraph.graphdb.management.JanusGraphManager - GremlinExecutorGraphBinder of 20s:["graph12","graph11"]
and in gremlin console, as below:
> gremlin> ConfiguredGraphFactory.getGraphNames()
> ==>graph12
> ==>graph11
> ==>sync_test
**but if you restart JanusGraph, then the GremlinExecutorGraphBinder can get the latest graphNames.**
my JansuGraph conf as below :
yaml file main content:
> host: 0.0.0.0
> port: 8182
> scriptEvaluationTimeout: 300000
> channelizer: org.janusgraph.channelizers.JanusGraphWebSocketChannelizer
> graphManager: org.janusgraph.graphdb.management.JanusGraphManager
> graphs: {
> ConfigurationManagementGraph: conf/janusgraph-hbase-configurationgraph.properties
> }
> scriptEngines: {
> gremlin-groovy: {
> plugins: { org.janusgraph.graphdb.tinkerpop.plugin.JanusGraphGremlinPlugin: {},
> org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
> org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
> org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
> org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: []}}}}
and **janusgraph-hbase-configurationgraph.properties** as:
> gremlin.graph=org.janusgraph.core.ConfiguredGraphFactory
> storage.backend=hbase
> storage.hostname=127.0.0.1
ps. same problem as ConfiguredGraphFactory.drop(), when drop graph in console, but in GremlinExecutorGraphBinder's run method that deleted graphname still return.
Contributor guide
Research direction
Start with GremlinExecutorGraphBinder.run() in JanusGraphManager and compare its ConfiguredGraphFactory.getGraphNames() behavior with calls from the Gremlin console. Review the ConfigurationManagementGraph settings in janusgraph-hbase-configurationgraph.properties and the createConfiguration/drop scenarios. Done means newly created or dropped graph names are reflected by the binder without restarting JanusGraph.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100