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
코드를 실행 한 후, 내가 볼 :
ConsitencyModifier.LOCK을 적용한 후에 "prio_child"가장자리, 내가 10 개 스레드 (9)가 예외를 다음과 같이 실패 관찰
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
및 , 나는 같은 가장자리 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()
심지어이 도움이되지 않았으며 문제는 여전히 존재합니다. ** ConsistencyModifier.LOCK **은 예상대로 작동하지 않습니다. 기본적으로 문제를 자세히 조사한 결과, VertexCentric 인덱스 손상의 경우임을 발견했습니다. 모든 커스텀 버텍스 중심을 떨어 뜨린 후에 (Titan은 자동으로 모든 edge 속성에 대한 기본 버텍스 중심 인덱스를 생성합니다.)이 문제는 해결되었습니다. – Pankaj
JanusGraph에서 [issue] (https://github.com/JanusGraph/janusgraph/issues/301)를 열었습니다. 기본적으로 VertexCentric 인덱스가 손상되고 있습니다. 인덱스가 그림에 나타나지 않으면 올바른 결과가 반환됩니다. – Pankaj