Date
1 - 4 of 4
Problem with index never becoming ENABLED.
Augusto Will <pw...@...>
I Think I can get the index enabled, wow!
After the good eraseall.sh
#!/bin/bash
sed -i 's/HttpChannelizer/WebSocketChannelizer/gi' ~/janusgraph-0.2.0-hadoop2/conf/gremlin-server/gremlin-server.yaml
./janusgraph.sh stop
./janusgraph.sh clean
./janusgraph.sh start
All clean.... Janus in websocket mode.
gremlin> :remote console
==>All scripts will now be sent to Gremlin Server - * - type ':remote console' to return to local mode
gremlin> graph.getOpenTransactions()
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@3d85c395
gremlin> mgmt.makeVertexLabel('person').make()
==>person
gremlin> mgmt.makePropertyKey('usuarioId').dataType(Integer.class).cardinality(Cardinality.SINGLE).make()
==>usuarioId
gremlin> mgmt.makePropertyKey('usuarioNome').dataType(String.class).cardinality(Cardinality.SET).make()
==>usuarioNome
gremlin> mgmt.makePropertyKey('usuarioEmail').dataType(String.class).cardinality(Cardinality.SET).make()
==>usuarioEmail
gremlin> mgmt.makePropertyKey('usuarioBloqueado').dataType(Boolean.class).cardinality(Cardinality.SET).make()
==>usuarioBloqueado
gremlin> mgmt.commit()
==>null
gremlin>
gremlin>
gremlin>
gremlin> graph.tx().rollback() //Never create new indexes while a transaction is active
==>null
gremlin>
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@4e8ef582
gremlin> name = mgmt.getPropertyKey('usuarioId')
==>usuarioId
gremlin> mgmt.buildIndex('byUsuarioIdComposite', Vertex.class).addKey(name).buildCompositeIndex()
==>byUsuarioIdComposite
gremlin> mgmt.commit()
==>null
gremlin>
gremlin> mgmt.awaitGraphIndexStatus(graph, 'byUsuarioIdComposite').call()
==>GraphIndexStatusReport[success=true, indexName='byUsuarioIdComposite', targetStatus=[REGISTERED], notConverged={}, converged={usuarioId=REGISTERED}, elapsed=PT7.03S]
gremlin>
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@7cddeeba
gremlin> //mgmt.updateIndex(mgmt.getGraphIndex("byUsuarioIdComposite"), SchemaAction.REINDEX).get()
==>null
gremlin> //mgmt.commit()
==>null
gremlin> mgmt.awaitGraphIndexStatus(graph, 'byUsuarioIdComposite').status(SchemaStatus.ENABLED).call()
==>GraphIndexStatusReport[success=false, indexName='byUsuarioIdComposite', targetStatus=[ENABLED], notConverged={usuarioId=REGISTERED}, converged={}, elapsed=PT1M0.183S]
gremlin>
gremlin> mgmt.awaitGraphIndexStatus(graph, 'byUsuarioIdComposite').status(SchemaStatus.ENABLED).call()
==>GraphIndexStatusReport[success=false, indexName='byUsuarioIdComposite', targetStatus=[ENABLED], notConverged={usuarioId=REGISTERED}, converged={}, elapsed=PT1M0.209S]
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@7d1154c4
gremlin> mgmt.updateIndex(mgmt.getGraphIndex("byIdUsuarioComposite"), SchemaAction.ENABLE_INDEX).get()
Need to provide an index
Type ':help' or ':h' for help.
Display stack trace? [yN]
gremlin> mgmt.updateIndex(mgmt.getGraphIndex("byUsuarioIdComposite"), SchemaAction.ENABLE_INDEX).get()
==>null
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@3d3de507
gremlin> name = mgmt.getPropertyKey('usuarioId')
==>usuarioId
gremlin> nameIndex = mgmt.getGraphIndex('byUsuarioIdComposite')
==>byUsuarioIdComposite
gremlin> nameIndexStatus = nameIndex.getIndexStatus(name)
==>REGISTERED
gremlin> graph.getOpenTransactions()
==>standardjanusgraphtx[0x12300940]
==>standardjanusgraphtx[0x5ed65562]
==>standardjanusgraphtx[0x132c3710]
gremlin> graph.tx().rollback()
==>null
gremlin> graph.tx().rollback()
==>null
gremlin> graph.tx().rollback()
==>null
gremlin> graph.tx().rollback()
==>null
gremlin> graph.getOpenTransactions()
==>standardjanusgraphtx[0x12300940]
==>standardjanusgraphtx[0x5ed65562]
==>standardjanusgraphtx[0x132c3710]
gremlin> graph.tx().rollback()
==>null
gremlin> graph.tx().rollback()
==>null
gremlin> graph.tx().rollback()
==>null
gremlin> graph.getOpenTransactions()
==>standardjanusgraphtx[0x12300940]
==>standardjanusgraphtx[0x5ed65562]
==>standardjanusgraphtx[0x132c3710]
gremlin> graph.getOpenTransactions().getAt(0).rollback()
==>null
gremlin> graph.getOpenTransactions().getAt(0).rollback()
==>null
gremlin> graph.getOpenTransactions().getAt(0).rollback()
==>null
gremlin> graph.getOpenTransactions().getAt(0).rollback()
Cannot invoke method rollback() on null object
Type ':help' or ':h' for help.
Display stack trace? [yN]graph.getOpenTransactions().getAt(0).rollback()
gremlin> graph.getOpenTransactions()
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@366ed168
gremlin> name = mgmt.getPropertyKey('usuarioId')
==>usuarioId
gremlin> nameIndex = mgmt.getGraphIndex('byUsuarioIdComposite')
==>byUsuarioIdComposite
gremlin> nameIndexStatus = nameIndex.getIndexStatus(name)
==>REGISTERED
gremlin> graph.getOpenTransactions()
==>standardjanusgraphtx[0x3d42dabb]
gremlin> graph.getOpenTransactions().getAt(0).rollback()
==>null
gremlin> graph.getOpenTransactions().getAt(0).rollback()
Cannot invoke method rollback() on null object
Type ':help' or ':h' for help.
Display stack trace? [yN]
gremlin> mgmt.updateIndex(mgmt.getGraphIndex("byUsuarioIdComposite"), SchemaAction.ENABLE_INDEX).get()
Cannot access element because its enclosing transaction is closed and unbound
Type ':help' or ':h' for help.
Display stack trace? [yN]
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@508a3f2c
gremlin> mgmt.updateIndex(mgmt.getGraphIndex("byUsuarioIdComposite"), SchemaAction.ENABLE_INDEX).get()
==>null
gremlin> name = mgmt.getPropertyKey('usuarioId')
==>usuarioId
gremlin> nameIndex = mgmt.getGraphIndex('byUsuarioIdComposite')
==>byUsuarioIdComposite
gremlin> nameIndexStatus = nameIndex.getIndexStatus(name)
==>ENABLED
gremlin>
What a battle hah? But I could find what the problem. WOW Nice!!!!
Robert Dale <rob...@...>
This example works on a clean database. Can you share what you are seeing? See also https://github.com/JanusGraph/janusgraph/wiki/Indexing
janusgraph-0.1.1-hadoop2]$ ./bin/gremlin.sh
\,,,/
(o o)
-----oOOo-(3)-oOOo-----
plugin activated: janusgraph.imports
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/data/janusgraph-0. 1.1-hadoop2/lib/slf4j-log4j12- 1.7.12.jar!/org/slf4j/impl/ StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/data/janusgraph-0. 1.1-hadoop2/lib/logback- classic-1.1.2.jar!/org/slf4j/ impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes. html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl. Log4jLoggerFactory]
06:53:32 WARN org.apache.hadoop.util. NativeCodeLoader - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
plugin activated: tinkerpop.hadoop
plugin activated: tinkerpop.spark
plugin activated: tinkerpop.tinkergraph
gremlin> // Example assumes this exists
==>true
gremlin> graph = JanusGraphFactory.open(' inmemory')
==>standardjanusgraph[ inmemory:[127.0.0.1]]
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb. database.management. ManagementSystem@56913163
gremlin> mgmt.makePropertyKey('name'). dataType(String.class).make()
==>name
gremlin> mgmt.makePropertyKey('age'). dataType(Integer.class).make()
==>age
gremlin> mgmt.commit()
==>null
gremlin>
gremlin> // Start example
==>true
gremlin> graph.tx().rollback() //Never create new indexes while a transaction is active
==>null
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb. database.management. ManagementSystem@5633ed82
gremlin> name = mgmt.getPropertyKey('name')
==>name
gremlin> age = mgmt.getPropertyKey('age')
==>age
gremlin> mgmt.buildIndex(' byNameComposite', Vertex.class).addKey(name). buildCompositeIndex()
==>byNameComposite
gremlin> mgmt.buildIndex(' byNameAndAgeComposite', Vertex.class).addKey(name). addKey(age). buildCompositeIndex()
==>byNameAndAgeComposite
gremlin> mgmt.commit()
==>null
gremlin>
gremlin> //Wait for the index to become REGISTERED
==>true
gremlin> mgmt.awaitGraphIndexStatus( graph, 'byNameComposite').call()
==>GraphIndexStatusReport[ success=true, indexName='byNameComposite', targetStatus=REGISTERED, notConverged={}, converged={name=REGISTERED}, elapsed=PT7.529S]
gremlin> mgmt.awaitGraphIndexStatus( graph, 'byNameAndAgeComposite').call( )
==>GraphIndexStatusReport[ success=true, indexName=' byNameAndAgeComposite', targetStatus=REGISTERED, notConverged={}, converged={name=REGISTERED, age=REGISTERED}, elapsed=PT0.002S]
gremlin>
gremlin> //Reindex the existing data
==>true
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb. database.management. ManagementSystem@3204e238
gremlin> mgmt.updateIndex(mgmt. getGraphIndex(" byNameComposite"), SchemaAction.REINDEX).get()
==>org.janusgraph.diskstorage. keycolumnvalue.scan. StandardScanMetrics@181d8899
gremlin> mgmt.updateIndex(mgmt. getGraphIndex(" byNameAndAgeComposite"), SchemaAction.REINDEX).get()
==>org.janusgraph.diskstorage. keycolumnvalue.scan. StandardScanMetrics@3d7fb838
gremlin> mgmt.commit()
==>null
gremlin>
gremlin> mgmt.awaitGraphIndexStatus( graph, 'byNameComposite').status( SchemaStatus.ENABLED).call()
==>GraphIndexStatusReport[ success=true, indexName='byNameComposite', targetStatus=ENABLED, notConverged={}, converged={name=ENABLED}, elapsed=PT0.002S]
gremlin> mgmt.awaitGraphIndexStatus( graph, 'byNameAndAgeComposite'). status(SchemaStatus.ENABLED). call()
==>GraphIndexStatusReport[ success=true, indexName=' byNameAndAgeComposite', targetStatus=ENABLED, notConverged={}, converged={name=ENABLED, age=ENABLED}, elapsed=PT0.001S]
Robert Dale
On Wed, Oct 18, 2017 at 5:57 AM, Augusto Will <pw...@...> wrote:
About the index that never becomes ENABLED and can't reindex the existent data, is because an example in documentation (http://docs.janusgraph.org/--latest/indexes.html) that create a index, wait for index to become available and try to reindex, wich cause an error, because the created index is not enabled never.
I think it's missing these line (in bold) inside documentation before the reindex. This is why I see other users had the same problem.graph.tx().rollback() //Never create new indexes while a transaction is active mgmt = graph.openManagement() name = mgmt.getPropertyKey('name') age = mgmt.getPropertyKey('age') mgmt.buildIndex('byNameComposite', Vertex.class).addKey(name). buildCompositeIndex() mgmt.buildIndex(' byNameAndAgeComposite', Vertex.class).addKey(name). addKey(age). buildCompositeIndex() mgmt.commit() //Wait for the index to become available mgmt.awaitGraphIndexStatus(gra ph, 'byNameComposite').call() mgmt.awaitGraphIndexStatus(gra ph, 'byNameAndAgeComposite').call( ) //Reindex the existing data mgmt = graph.openManagement()
mgmt.updateIndex(mgmt.getGraphIndex("byNameComposite "), SchemaAction.ENABLE_INDEX). get()
mgmt.updateIndex(mgmt.getGraphIndex("byNameAndAgeCom posite"), SchemaAction.ENABLE_INDEX). get()
mgmt.updateIndex(mgmt.getGraphIndex(" byNameComposite"), SchemaAction.REINDEX).get() mgmt.updateIndex(mgmt. getGraphIndex(" byNameAndAgeComposite"), SchemaAction.REINDEX).get() mgmt.commit()
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 janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/ 84b6b58e-2c9d-4190-be22- 47fc52aaf7a6%40googlegroups. com.
For more options, visit https://groups.google.com/d/optout.
Augusto Will <pw...@...>
About the index that never becomes ENABLED and can't reindex the
existent data, is because an example in documentation
(http://docs.janusgraph.org/latest/indexes.html) that create a index,
wait for index to become available and try to reindex, wich cause an
error, because the created index is not enabled never.
I think it's missing these line (in bold) inside documentation before the reindex. This is why I see other users had the same problem.
I think it's missing these line (in bold) inside documentation before the reindex. This is why I see other users had the same problem.
graph.tx().rollback() //Never create new indexes while a transaction is active mgmt = graph.openManagement() name = mgmt.getPropertyKey('name') age = mgmt.getPropertyKey('age') mgmt.buildIndex('byNameComposite', Vertex.class).addKey(name).buildCompositeIndex() mgmt.buildIndex('byNameAndAgeComposite', Vertex.class).addKey(name).addKey(age).buildCompositeIndex() mgmt.commit() //Wait for the index to become available mgmt.awaitGraphIndexStatus(graph, 'byNameComposite').call() mgmt.awaitGraphIndexStatus(graph, 'byNameAndAgeComposite').call() //Reindex the existing data mgmt = graph.openManagement()
mgmt.updateIndex(mgmt.getGraphIndex("byNameComposite"), SchemaAction.ENABLE_INDEX).get()
mgmt.updateIndex(mgmt.getGraphIndex("byNameAndAgeComposite"), SchemaAction.ENABLE_INDEX).get()
mgmt.updateIndex(mgmt.getGraphIndex("byNameComposite"), SchemaAction.REINDEX).get() mgmt.updateIndex(mgmt.getGraphIndex("byNameAndAgeComposite"), SchemaAction.REINDEX).get() mgmt.commit()