[ 
https://issues.apache.org/jira/browse/TINKERPOP-1994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17295601#comment-17295601
 ] 

Stephen Mallette commented on TINKERPOP-1994:
---------------------------------------------

Came up with a way to fix this issue. It immediately resolved the problem 
traversal in the description as well:

{code}
gremlin> g.V().repeat(out().barrier()).times(2).explain()
==>Traversal Explanation
===========================================================================================================================================================
Original Traversal                 [GraphStep(vertex,[]), 
RepeatStep([VertexStep(OUT,vertex), NoOpBarrierStep, 
RepeatEndStep],until(loops(2)),emit(false))]

ConnectiveStrategy           [D]   [GraphStep(vertex,[]), 
RepeatStep([VertexStep(OUT,vertex), NoOpBarrierStep, 
RepeatEndStep],until(loops(2)),emit(false))]
RepeatUnrollStrategy         [O]   [GraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]
IncidentToAdjacentStrategy   [O]   [GraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]
MatchPredicateStrategy       [O]   [GraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]
PathRetractionStrategy       [O]   [GraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]
FilterRankingStrategy        [O]   [GraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]
InlineFilterStrategy         [O]   [GraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]
AdjacentToIncidentStrategy   [O]   [GraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]
CountStrategy                [O]   [GraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]
EarlyLimitStrategy           [O]   [GraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]
LazyBarrierStrategy          [O]   [GraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]
TinkerGraphCountStrategy     [P]   [GraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]
TinkerGraphStepStrategy      [P]   [TinkerGraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]
ProfileStrategy              [F]   [TinkerGraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]
StandardVerificationStrategy [V]   [TinkerGraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]

Final Traversal                    [TinkerGraphStep(vertex,[]), 
VertexStep(OUT,vertex), NoOpBarrierStep, VertexStep(OUT,vertex), 
NoOpBarrierStep]
{code}

The downside to my approach is that it further allows {{TraversalStrategy}} 
implementations to know things about each other. I don't particularly like 
that, but I think we've already allowed that to happen so I suppose there is 
precedence and doing it the way I did offers a relatively low risk fix. 

> LazyBarrierStrategy fully responsible for barrier() additions
> -------------------------------------------------------------
>
>                 Key: TINKERPOP-1994
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1994
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.2.9
>            Reporter: Stephen Mallette
>            Priority: Minor
>
> As it stands, {{LazyBarrierStrategy}}, {{RepeatUnrollStrategy}} and 
> {{PathRetractionStrategy}} (others??) add {{barrier()}} steps as needed - for 
> example:
> {code}
> gremlin> g.V().repeat(out().barrier()).times(2).explain()
> ==>Traversal Explanation
> ===============================================================================================================================================================================================
> Original Traversal                 [GraphStep(vertex,[]), 
> RepeatStep([VertexStep(OUT,vertex), NoOpBarrierStep, 
> RepeatEndStep],until(loops(2)),emit(false))]
> ConnectiveStrategy           [D]   [GraphStep(vertex,[]), 
> RepeatStep([VertexStep(OUT,vertex), NoOpBarrierStep, 
> RepeatEndStep],until(loops(2)),emit(false))]
> MatchPredicateStrategy       [O]   [GraphStep(vertex,[]), 
> RepeatStep([VertexStep(OUT,vertex), NoOpBarrierStep, 
> RepeatEndStep],until(loops(2)),emit(false))]
> FilterRankingStrategy        [O]   [GraphStep(vertex,[]), 
> RepeatStep([VertexStep(OUT,vertex), NoOpBarrierStep, 
> RepeatEndStep],until(loops(2)),emit(false))]
> InlineFilterStrategy         [O]   [GraphStep(vertex,[]), 
> RepeatStep([VertexStep(OUT,vertex), NoOpBarrierStep, 
> RepeatEndStep],until(loops(2)),emit(false))]
> IncidentToAdjacentStrategy   [O]   [GraphStep(vertex,[]), 
> RepeatStep([VertexStep(OUT,vertex), NoOpBarrierStep, 
> RepeatEndStep],until(loops(2)),emit(false))]
> RepeatUnrollStrategy         [O]   [GraphStep(vertex,[]), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500)]
> PathRetractionStrategy       [O]   [GraphStep(vertex,[]), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500)]
> AdjacentToIncidentStrategy   [O]   [GraphStep(vertex,[]), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500)]
> CountStrategy                [O]   [GraphStep(vertex,[]), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500)]
> LazyBarrierStrategy          [O]   [GraphStep(vertex,[]), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500)]
> TinkerGraphCountStrategy     [P]   [GraphStep(vertex,[]), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500)]
> TinkerGraphStepStrategy      [P]   [TinkerGraphStep(vertex,[]), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500)]
> ProfileStrategy              [F]   [TinkerGraphStep(vertex,[]), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500)]
> StandardVerificationStrategy [V]   [TinkerGraphStep(vertex,[]), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500)]
> Final Traversal                    [TinkerGraphStep(vertex,[]), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500), 
> VertexStep(OUT,vertex), NoOpBarrierStep, NoOpBarrierStep(2500)]
> {code}
> We should centralize the logic for this in {{LazyBarrierStrategy}} and remove 
> it from other strategies. By keeping the logic in a single place we can (1) 
> ensure the best implementation - note in the above example, we're getting 
> extra {{barrier()}} steps (2) users can be assured that removing the single 
> {{LazyBarrierStrategy}} will remove all automated {{barrier()}} applications.
> This isn't a breaking change, but it could change traversal behavior I 
> suppose - perhaps this goes just to 3.4.0.......



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to