[
https://issues.apache.org/jira/browse/TINKERPOP-3300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18144008#comment-18144008
]
Yang Xia commented on TINKERPOP-3300:
-------------------------------------
The same root assumption also affects the mergeV()/mergeE() eventing path,
which this ticket's current description (property()/AddPropertyStep) does not
cover. Both steps compute the changed property's old value in a separate,
simpler implementation in
EventUtil.registerVertexPropertyChange()/registerEdgePropertyChange(), which
calls the single-result getter vertex.property(key)/edge.property(key) with no
regard for cardinality.
Because only vertex properties support list/set cardinality (edge properties
are always single), the two problems below are specific to mergeV():
1. Wrong old value. A list/set write adds a value and replaces nothing, so the
old value should be the keyed placeholder, as property() reports. mergeV()
instead reports an existing value.
2. Crash on a multi-valued key. vertex.property(key) throws when the key
already holds more than one value, so the merge fails outright when a listener
is registered, even though the same merge succeeds with no listener.
mergeE() shares the same EventUtil path but not these two problems, since edge
properties cannot be list/set.
> EventStrategy misses on property-removed events when property() narrows
> cardinality (list/set to single)
> --------------------------------------------------------------------------------------------------------
>
> Key: TINKERPOP-3300
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3300
> Project: TinkerPop
> Issue Type: Improvement
> Components: process
> Affects Versions: 3.8.2
> Reporter: Cole Greer
> Priority: Major
>
> AddPropertyStep.captureRemovedProperty() assumes a property() call removes at
> most one existing property. That holds for graphs that are always single, set
> or list, but not when the write changes the key's cardinality. For example, a
> single-cardinality write over a key holding multiple list or set values drops
> all of them:
> {code:java}
> gremlin> g.addV().property(list, "email", "[email protected]").property(list,
> "email", "[email protected]")
> gremlin> g.V().property(single, "email", "[email protected]")
> gremlin> g.V().valueMap()
> ==>[email:[[email protected]]]
> {code}
> Both original values are removed, but EventStrategy listeners can be notified
> of at most one removal, so the rest are missed.
> Fix: rework removed-property tracking so a single property() call can report
> every removed property, and emit one removal event for each (plus the
> addition). Add tests for list to single and set to single transitions with a
> registered listener.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)