1

DSE Graph allows to specify edge cardinalities, i.e. for certain edge labels, it can enforce that only one edge with such a label goes out from any vertex. This works pretty well in manual, linearized tests - trying to set a second edge with the same label will fail.

However, it is unclear to us what the exact guarantees are in concurrency scenarios, i.e. when two threads try to add edges with the same label to a vertex at roughly the same time.

Given Cassandra as the underlying data store, there could be two ways imaginable:

  1. Both threads are observing no present edges. Both threads succeed in adding edges, the first addition is overwritten and only the latter addition is visible.

  2. Some mechanism like Cassandra lightweight transactions is employed, such that an edge will only be added when there is none ('Compare-and-set'). One of the threads is guaranteed to fail.

We assume that DSE Graph guarantees are strong enough that we cannot possibly end with two observable edges with the same label. Is there any information about the actual implementation of DSE Graph regarding this?

Daniel C. Weber
  • 1,011
  • 5
  • 12
  • yes you are correct in the 2 option . as per now their is no documentation from dse regarding this . Also DSE graph do not provide transaction , and only provide transaction in single execution of query . – Piyush_Rana Feb 07 '17 at 11:15
  • Do you know of a way to observe failure to add an edge with gremlin? Cassandra's LWT give back an 'applied' flag, is there an equivalent for DSE Graph? – Daniel C. Weber Feb 07 '17 at 11:25
  • Unfortunately , i also didn't find any pre-defined way , only thing we have done is using the exception handling , and if success then by fetching the edge . – Piyush_Rana Feb 07 '17 at 12:31

1 Answers1

3

Single cardinality edges in DSE graph prevent you from adding more than one edge of the same label between a pair of vertices. This is achieved by having an edge ID with a fixed component. No LWT is used. It is possible to have multiple single cardinality edges of the same type connected to a vertex as long as the other sides of the edges are connected to different vertices.

Bryn
  • 487
  • 3
  • 11
  • 1
    Contrary to the observations in my initial post, this seems to be the actual behavior. Titan had support for MANY2ONE and ONE2MANY edge multiplicities, which is exactly what we need. Is there anything equivalent in DSE Graph ? – Daniel C. Weber Feb 07 '17 at 21:06