Re: Multiple writers cause inconsistent vertices

Ajay Srivastava <Ajay.Sr...@...>

Thanks Robert.
I have commit and await in my code. Here is more information -
scala> val mgt = graph.openManagement()
mgt: org.janusgraph.core.schema.JanusGraphManagement =

scala> val index = mgt.getGraphIndexes(classOf[Vertex])
index: org.janusgraph.core.schema.JanusGraphIndex = UniqueURI

scala> val properties = index.getFieldKeys
properties: Array[org.janusgraph.core.PropertyKey] = Array(URI)

scala> properties.toList
res30: List[org.janusgraph.core.PropertyKey] = List(URI)

scala> index.getIndexStatus(properties(0))
res29: org.janusgraph.core.schema.SchemaStatus = ENABLED

So, the status of index is “ENABLED”. Should it be “REGISTERED" ?
I deleted db and recreated schema again, the awaitGraphIndexStatus call times out -
14:03:04,435  INFO GraphIndexStatusWatcher:81 - Some key(s) on index UniqueURI do not currently have status REGISTERED: URI=ENABLED
14:03:04,435  INFO GraphIndexStatusWatcher:90 - Timed out (PT1M) while waiting for index UniqueURI to converge on status REGISTERED

I waited for half an hour but the status remains as “ENABLED”.
Note that there are no records in db and I create all vertex/edge properties and indexes in one transaction. I have tried creating only vertex properties, labels and index in one transaction and that also is not working.


On 23-Sep-2017, at 5:22 PM, Robert Dale <rob...@...> wrote:

Do you `mgt.commit()`?  Do you `mgt.awaitGraphIndexStatus(graph, 'UniqueURI').call()`?

You can use this script in the console to help see the state of the index -

Robert Dale

On Sat, Sep 23, 2017 at 6:36 AM, Ajay Srivastava <Ajay.Sr...@...> wrote:

I am using janusgraph-0.1.1 with HBase.
The data is being loaded in graph using three clients connecting to same gremlin server. The clients are executing same code that checks if vertex is not already present in the graph then it inserts the vertex.
I was verifying the data and found following problem -

scala> graph.V().hasLabel("Root").toList
15:27:22,361  WARN StandardJanusGraphTx:1273 - Query requires iterating over all vertices [(~label = Root)]. For better performance, use indexes
res11: List[gremlin.scala.Vertex] = List(v[737304], v[4136], v[442432])
Results is three vertices.

scala> graph.V().hasLabel("Root").properties("URI").toList
15:27:52,275  WARN StandardJanusGraphTx:1273 - Query requires iterating over all vertices [(~label = Root)]. For better performance, use indexes
res13: List[gremlin.scala.Property[Any]] = List(vp[URI->Root], vp[URI->Root], vp[URI->Root])
Result is three vertices having same URI.

scala> val uri = Key[String]("URI")
scala> graph.V().has(uri, "Root").toList
res12: List[gremlin.scala.Vertex] = List(v[442432])
Since vertices are uniquely indexed on URI, this result is correct. Janusgraph should not have allowed to insert vertices having same URI but it did as displayed in above two outputs.

I am new to janusgraph and have many questions -

1) What am I doing wrong here ?
2) Multiple clients writing to same gremlin server may create problem ?
3) How to read back the schema created by me ?
4) Below is the code for creating schema. Is this correct ?

/* Creating three types of vertices having same properties and indexed on same property URI */
    def createVertexSchema : Boolean = {
        val vertexLabels = Array("Root", "Lang", "Cocpt")

        val GUID     = mgt.makePropertyKey("GUID").dataType(classOf[String]).make
        val Name = mgt.makePropertyKey("Name").dataType(classOf[String]).make
        val URI      = mgt.makePropertyKey("URI").dataType(classOf[String]).make

        vertexLabels.foreach {
            vertexLabel =>
                val vLabel   = mgt.makeVertexLabel(vertexLabel).make

        mgt.buildIndex("UniqueURI", classOf[Vertex]).addKey(URI).unique().buildCompositeIndex()


You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit

Join { to automatically receive all group messages.