Summary
In older versions of DSE Graph, if you drop vertex or edge labels from the schema, you can get different count results from queries, depending on whether you use OLTP or OLAP.
Applies to
DSE with graph and analytics enabled, prior to 6.0.5 and 6.7.1.
Cause
When a vertex or edge label is dropped from the graph schema, some underlying C* records are not cleaned up. The TinkerPop graph engine will ignore them, but OLAP sees them and counts them.
Here’s a simple example, a graph with 2 vertexes and two edges, created in gremlin-console:
system.graph(‘test’).create()
:remote config alias g test.g
schema.config().option(“graph.allow_scan”).set(true)
schema.propertyKey(“name”).Text().single().create()
schema.vertexLabel(“person”).partitionKey(“name”).create()
schema.edgeLabel(“knows”).multiple().create()
schema.edgeLabel(“knows”).connection(“person”, “person”).add()
graph.addVertex(label, “person”,”name”, “Matt”)
graph.addVertex(label, “person”,”name”, “Jim”)
Matt = g.V().hasLabel(‘person’).has(‘name’,’Matt’).next()
Jim = g.V().hasLabel(‘person’).has(‘name’,’Jim’).next()
g.addE(‘knows’).from(Matt).to(Jim)
g.addE(‘knows’).from(Jim).to(Matt)
We have Matt and Jim, and they each know each other. Next, we drop the edge label ‘knows’:
schema.edgeLabel(‘knows’).drop()
Now in regular OLTP mode, we’ll see this:
gremlin> g.E()
gremlin> g.E().count()
==>0
But if we switch to OLAP mode, we’ll see a different count:
gremlin> :remote config alias g test.a
==>g=test.a
gremlin> g.E()
gremlin> g.E().count()
==>2
Solution
This is fixed in 6.0.5 and 6.7.1 (bug reports DSP-15885, DSP-15885). If you are experiencing this on an earlier version, upgrade to 6.0.5 or higher, or 6.7.1 or higher, then use the new "cleanUp" function - ‘graph.cleanUp()’ in gremlin, or ‘spark.dseGraph(“graphName”).cleanUp” in Spark - to clean up the orphaned C* rows, then run repair on the graph’s keyspaces.
To avoid this happening in earlier versions, use the OLAP engine to drop vertex or edge labels – it will clean up the underlying C* rows as well, unlike the OLTP TinkerPop engine.