TITAN : Gremlin query returns inconsistent results

2019-05-11 02:21发布

I am running REXSTER/TITAN 0.4 over cassandra and uses gremlin for traversals. I ran below gremlin query in Rexster Doghouse Gremlin console.

Vertex 92 was deleted earlier, since it was a duplicate vertex with same key ("eddy.com")

But when I am querying, I am getting that vertex sometimes, and sometimes not . This is running in local dev machine, means no other threads or parallel task is running/updating this vertex in between. Am I missing any configuration/settings here? is this a bug? please help!

gremlin> g.V('domain','eddy.com')

==>v[88]
gremlin> g.V('domain','eddy.com')

==>v[88]
==>v[92]
gremlin> g.V('domain','eddy.com')

==>v[88]
gremlin> g.V('domain','eddy.com')

==>v[88]
gremlin> g.V('domain','eddy.com')

==>v[88]
==>v[92]

1条回答
爷、活的狠高调
2楼-- · 2019-05-11 03:10

You didn't say how your deletion occurred, but this issue almost always boils down to a uncommitted or stale transaction. In other words, it's either:

  1. The deleting transaction was not committed
  2. The transaction was committed but the querying side did not start a new transaction and is thus getting cached data.

So, be sure to call g.commit() after you do you graph mutation. Then, when you go to query (in a different context like Rexster Console, Dog House, etc.), be sure to g.rollback() before you query to ensure you aren't reading something stale.

If you're wondering why you would see the removed data in some cases and not others, it's because issuing a request to Rexster might get handled in a thread with a fresh transaction state (or not) giving you differing results.

On the chance that it is neither of these things and possibly a bug, I can only recommend that you update to Titan 0.5.4.

查看更多
登录 后发表回答