0

Titan から頂点を削除すると、一貫性のない読み取り動作が発生します。Cassandra を実行している単一のマシンでこれをテストしています。これが私の conf.properties です。

storage.backend=cassandra
storage.hostname=localhost
storage.cassandra.keyspace=test

次のメソッドは、適切な頂点を削除します。

public void deleteProfile(String uuid, String puuid) {
    for(Person person : this.graph.getVertices("uuid", uuid, Person.class)) {
        if (person != null) {
            for (Profile profile : this.graph.getVertices("uuid", puuid, Profile.class)) {
                person.removeProfile(profile);
                graph.removeVertex(profile.asVertex());
            }
        }
    }
    this.graph.getBaseGraph().commit();
}

次のメソッドが呼び出されると、2 つの異なる結果セットが返されます。

public Iterable<ProfileImpl> getProfiles(String uuid) {
    List<ProfileImpl> profiles = new ArrayList<>();
    for(Person person : this.graph.getVertices("uuid", uuid, Person.class)) {
        if (person != null) {
            for (Profile profile : person.getProfiles()) {
                profiles.add(profile.toImpl());
            }
        }
    }
    return profiles;
}

1 つの結果は期待どおりで、削除されたプロファイルは含まれません。ただし、十分な回数実行すると、削除されたプロファイルが1つ追加されることがあります。

同じ頂点を再度削除しようとすると、その「uuid」を持つ頂点が存在しないことが示され、反復子の hasNext() は false を返します。

ただし、プログラムを再起動すると、削除された頂点は返されません。この一貫性のない動作を修正するにはどうすればよいですか?

4

2 に答える 2

1

問題は、一部のスレッドで、グラフのトランザクションがすでに開かれていることです。何も変更されていなくても、グラフから読み取るとトランザクションが開かれます。これらのトランザクションは、動作の一貫性を確保するために閉じる必要があります。

于 2015-09-01T23:54:00.880 に答える
0

http://s3.thinkaurelius.com/docs/titan/0.9.0-M2/tx.html#tx-configによると、設定する必要がありますcheckInternalVertexExistence

于 2015-09-01T04:36:15.843 に答える