Inconsistent composite index status after transaction failure


simone3.cattani@...
 

I have nodes with two properties: my_id (long) and package_name (string).
I have defined two composite indexes
* on my_id
* on my_id + package_name (unique)

I'm using JanusGraph 0.5.2 with CQL (actually ScyllaDB), no index-backend configured.

Now I have a situation where, considering a pair (my_id = 2, package_name = foo):
* searching for g.V().has('my_id', 2) produces an empty result
* searching for g.V().has('my_id', 2).has('package_name', 'foo') returns on node, actually a node that doesn't really exists

My hypothesis is: during the write transaction, some failure has occurred and somehow the status of the second index was not cleaned up.

Can I clean it up manually removing the index entry?


hadoopmarc@...
 

The janusgraph docs and gitrepo talk about ghost vertices or phantom vertices:

https://docs.janusgraph.org/advanced-topics/eventual-consistency/#ghost-vertices
https://docs.janusgraph.org/basics/transactions/#transaction-configuration
https://github.com/JanusGraph/janusgraph/issues/2176

What happens if you try to delete the vertex with my_id = 2?

If this works, I am afraid there is not a more helpful answer than:
https://lists.lfaidata.foundation/g/janusgraph-users/topic/79936778#3898

If deleting the vertex does not work, you might want to mention this discussion in issue 2176, explaining why your issue is different from a ghost vertex.

Best wishes,    Marc


simone3.cattani@...
 

I already tried to delete it both trying to reference the actual vertex id or using the query based on the "inconsistent" index, but in both cases it doesn't work (drop function return correctly as it has nothing to delete) 


Boxuan Li
 

Try this (v is the ghost vertex):
Iterator<JanusGraphRelation> iterator = v.query().noPartitionRestriction().relations().iterator();
while (iterator.hasNext()) {
iterator.next();
iterator.remove();
}
v.remove()

On Feb 17, 2021, at 7:24 PM, simone3.cattani@... wrote:

I already tried to delete it both trying to reference the actual vertex id or using the query based on the "inconsistent" index, but in both cases it doesn't work (drop function return correctly as it has nothing to delete)