我们在CentOs-7系统上使用 Titan 1.0.0 与 cassandra版本3.9.0-1 ,来自 datastax-ddc 。我们看到一些奇怪的问题,例如:
具有相同边ID的多个边,这些边上的几个属性值不同。
gV()。has('msid',6171699).outE('prio_child')。has('hostid_e',153).as('e')inV()。has('msid',58713376) 。选择( 'E') ==> E [的 54ekdatm-1lezwb4-45cl-195s9km8 ] [3471761488-prio_child-> 98305011872] ==> E [的 54ekdatm-1lezwb4-45cl-195s9km8 ] [3471761488-prio_child-> 98305011872]
在应用更多限制后获得更多结果
g.V()。has('msid',6171699).outE('prio_child')。count()
==>的 60
g.V()。has('msid',6171699).outE('prio_child')。has('hostid_e,153).count()
==>的 66
我甚至尝试过按照Titan文档Eventually Consistent Backends的建议设置ConsistencyModifier.LOCK,但它没有帮助。我仍然得到任意结果。
答案 0 :(得分:6)
Titan 1.0.0与Cassandra 3.x http://s3.thinkaurelius.com/docs/titan/1.0.0/version-compat.html
不兼容 泰坦也不再被维护。 JanusGraph http://janusgraph.org/占据了Titan离开的地方,并且正在积极更新和维护。答案 1 :(得分:0)
通过关注Data Consistency,我能够重现并修复它。设置ConsistencyModifier后,我错过了以下命令。
mgmt.commit()
以下是重现问题的代码片段,其中包括cassandra的两个版本,即cassandra 2.1.x和cassandra 3.9.x。
TitanGraph graph = TitanFactory.open("/opt/cmsgraph/config/edgepoc.conf"); try { int parent = -2128958273; int child = 58541705; int hostid = 83; int numThreads = 100; Thread[] threads = new Thread[numThreads]; for(int i =0; i < numThreads; i++) { threads[i] = new Thread(new EdgeUpdator(graph, parent, child, hostid)); } for(int i =0; i < numThreads; i++) { threads[i].start(); } for(int i = 0; i < numThreads; i++) { threads[i].join(); } } finally { graph.close(); } private static class EdgeUpdator implements Runnable { public EdgeUpdator(TitanGraph graph, int parent, int child, int hostid) { this.graph = graph; this.parent = parent; this.child = child; this.hostid = hostid; } private int parent; private int child; private int hostid; private TitanGraph graph; public void run() { TitanTransaction trxn = graph.newTransaction(); GraphTraversalSource g = trxn.traversal(); Edge edge = (Edge)g.V().has("msid", parent).outE("prio_child").has("hostid_e", hostid).as("e").inV().has("msid", child).select("e").next(); Random random = new Random(System.nanoTime()); edge.property("updatedAt_e", random.nextLong()); edge.property("plrank", random.nextInt()); trxn.commit(); } }
在执行上述代码之前。我明白了:
gremlin> g.V().has('msid', -2128958273).outE('prio_child').has('hostid_e', 83).as('e').inV().has('msid', 58541705).select('e') ==>e[239suvpz-17ofqw-41ed-9eutzq8][73363640-prio_child->20489355296] gremlin> g.V().has('msid', -2128958273).outE('prio_child').has('hostid_e', 83).as('e').inV().has('msid', 58541705).select('e').count() ==>1 gremlin> g.V().has('msid', -2128958273).outE('prio_child').has('hostid_e', 83).count() ==>104
执行代码后,我看到:
gremlin> g.V().has('msid', -2128958273).outE('prio_child').has('hostid_e', 83).as('e').inV().has('msid', 58541705).select('e') ==>e[239suvpz-17ofqw-41ed-9eutzq8][73363640-prio_child->20489355296] ==>e[239suvpz-17ofqw-41ed-9eutzq8][73363640-prio_child->20489355296] ==>e[239suvpz-17ofqw-41ed-9eutzq8][73363640-prio_child->20489355296] ==>e[239suvpz-17ofqw-41ed-9eutzq8][73363640-prio_child->20489355296] ==>e[239suvpz-17ofqw-41ed-9eutzq8][73363640-prio_child->20489355296] ==>e[239suvpz-17ofqw-41ed-9eutzq8][73363640-prio_child->20489355296] ==>e[239suvpz-17ofqw-41ed-9eutzq8][73363640-prio_child->20489355296] ==>e[239suvpz-17ofqw-41ed-9eutzq8][73363640-prio_child->20489355296] ==>e[239suvpz-17ofqw-41ed-9eutzq8][73363640-prio_child->20489355296] ==>e[239suvpz-17ofqw-41ed-9eutzq8][73363640-prio_child->20489355296] gremlin> g.V().has('msid', -2128958273).outE('prio_child').has('hostid_e', 83).as('e').inV().has('msid', 58541705).select('e').count() ==>10 gremlin> g.V().has('msid', -2128958273).outE('prio_child').has('hostid_e', 83).as('e').inV().has('msid', 58541705).select('e').dedup().count() ==>1 gremlin> g.V().has('msid', -2128958273).outE('prio_child').has('hostid_e', 83).count() ==>113 gremlin> g.V().has('msid', -2128958273).outE('prio_child').count() ==>104
将ConsitencyModifier.LOCK应用于&#34; prio_child&#34;边缘,我观察到10个线程中的9个线程因以下异常而失败,并且我没有导致任何具有相同边缘ID问题的多个边缘。
Exception in thread "Thread-8" org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException
以下是我所做的确切更改:
mgmt = graph.openManagement() prio_child=mgmt.getRelationType('prio_child') mgmt.setConsistency(prio_child, ConsistencyModifier.LOCK) mgmt.commit()