Search code examples
datastax-enterprisedatastax-startupdatastax-enterprise-graph

DSE Graph: traversals that use both secondary and search indexes, why do they hang?


It seems that gremlin traversals which use both secondary and search indexes in the same traversal hang. Why is that?

My understanding from the DSE Graph docs on indexing is that the most appropriate index for low-cardinality properties is a secondary index. I have a model with a 'type' property such that there are a limited number of possible types; so when I needed an index I used a secondary index.

But it seems that it's not possible to use both secondary and search indexes in the same traversal, as demonstrated by the following example:

gremlin> system.graph('example').create()
==>null
gremlin> :remote config alias g example.g
==>g=example.g
gremlin> schema.vertexLabel('item').create()
==>null
gremlin> schema.propertyKey('type').Text().single().create()
==>null
gremlin> schema.propertyKey('description').Text().single().create()
==>null
gremlin> schema.vertexLabel('item').properties('type').add()
==>null
gremlin> schema.vertexLabel('item').properties('description').add()
==>null
gremlin> schema.vertexLabel('item').index('byType').secondary().by('type').add()
==>null
gremlin> schema.vertexLabel('item').index('search').search().by('description').add()
==>null
gremlin> graph.addVertex(label, 'item', 'type', 'A', 'description', 'first item is orange')
==>v[{~label=item, community_id=96406144, member_id=0}]
gremlin> graph.addVertex(label, 'item', 'type', 'A', 'description', 'second item is blue')
==>v[{~label=item, community_id=2076720128, member_id=0}]
gremlin> graph.addVertex(label, 'item', 'type', 'B', 'description', 'third item is green')
==>v[{~label=item, community_id=51027072, member_id=0}]
gremlin> g.V().hasLabel('item').has('type', 'A')
==>v[{~label=item, community_id=2076720128, member_id=0}]
==>v[{~label=item, community_id=96406144, member_id=0}]
gremlin> g.V().hasLabel('item').has('description', Search.token('blue'))
==>v[{~label=item, community_id=2076720128, member_id=0}]
gremlin> g.V().hasLabel('item').has('type', 'A').has('description', Search.token('blue'))

On the last traversal, the server logs the following statement in /var/log/cassandra/system.log:

WARN  [gremlin-server-worker-1] 2016-09-15 14:26:49,759  GremlinExecutor.java:267 - Timing out script - g.V().hasLabel('item').has('type', 'A').has('description', Search.token('blue')) - in thread [gremlin-server-worker-1]

And the console freezes up completely, and doesn't even respond to SIGTERM.


Solution

  • This is resolved by DSE v5.0.3.