2
似乎gremlin遍历在同一个遍历挂起中同时使用辅助索引和搜索索引。这是为什么?DSE图:使用辅助索引和搜索索引的遍历,它们为什么会挂起?
我对DSE图docs on indexing的理解是,对于低基数属性最合适的索引是二级索引。我有一个'type'属性的模型,以便有可能的类型数量有限;所以当我需要一个索引时,我使用了一个二级索引。
但它似乎是不可能在同一个遍历同时使用二次和搜索索引,通过下面的例子作为证明:
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'))
在最后遍历,服务器日志中/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]
而控制台完全冻结,甚至不响应SIGTERM。
我们正在考虑这一点,我发了一封电子邮件。 – peytoncas