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

ASF GitHub Bot commented on TINKERPOP-1650:
-------------------------------------------

GitHub user twilmes opened a pull request:

    https://github.com/apache/tinkerpop/pull/731

    TINKERPOP-1650: PathRetractionStrategy makes Match steps unsolvable

    This bug was a result of an unintentionally shared set between a MatchStep 
and WhereStep's. This caused the `p` label to be incorrectly pulled into the 
`matchStartLabels` for the following query:
    
    ` 
g.V().hasLabel("person").as("p").match(__.as("a").out("created").as("sw"), 
__.as("sw").has("lang", "java").as("java")).where("sw", neq("a")).select("p")`
    
    As a result, when the match step was attempting to pick a 
`startLabelsBundle`, it failed to grab one because the incoming traverser 
already had the `p` label in its path. This fix added defensive copying to all 
of the `setKeepLabels` calls to prevent the possibility of this unintentional 
sharing of a mutable collection.
    
    ```
    [INFO] 
------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO] 
    [INFO] Apache TinkerPop ................................... SUCCESS [  
3.238 s]
    [INFO] Apache TinkerPop :: Gremlin Shaded ................. SUCCESS [  
1.972 s]
    [INFO] Apache TinkerPop :: Gremlin Core ................... SUCCESS [01:04 
min]
    [INFO] Apache TinkerPop :: Gremlin Test ................... SUCCESS [  
9.145 s]
    [INFO] Apache TinkerPop :: Gremlin Groovy ................. SUCCESS [04:00 
min]
    [INFO] Apache TinkerPop :: Gremlin Groovy Test ............ SUCCESS [  
5.057 s]
    [INFO] Apache TinkerPop :: TinkerGraph Gremlin ............ SUCCESS [02:58 
min]
    [INFO] Apache TinkerPop :: Gremlin Benchmark .............. SUCCESS [  
3.874 s]
    [INFO] Apache TinkerPop :: Gremlin Driver ................. SUCCESS [  
9.796 s]
    [INFO] Apache TinkerPop :: Neo4j Gremlin .................. SUCCESS [  
2.134 s]
    [INFO] Apache TinkerPop :: Gremlin Server ................. SUCCESS [ 
42.125 s]
    [INFO] Apache TinkerPop :: Gremlin Python ................. SUCCESS [  
6.630 s]
    [INFO] Apache TinkerPop :: Gremlin.Net .................... SUCCESS [  
2.892 s]
    [INFO] Apache TinkerPop :: Gremlin.Net - Source ........... SUCCESS [  
0.118 s]
    [INFO] Apache TinkerPop :: Gremlin.Net - Tests ............ SUCCESS [  
0.067 s]
    [INFO] Apache TinkerPop :: Hadoop Gremlin ................. SUCCESS [03:12 
min]
    [INFO] Apache TinkerPop :: Spark Gremlin .................. SUCCESS [01:14 
min]
    [INFO] Apache TinkerPop :: Giraph Gremlin ................. SUCCESS [  
7.819 s]
    [INFO] Apache TinkerPop :: Gremlin Console ................ SUCCESS [ 
21.415 s]
    [INFO] Apache TinkerPop :: Gremlin Archetype .............. SUCCESS [  
0.045 s]
    [INFO] Apache TinkerPop :: Archetype - TinkerGraph ........ SUCCESS [  
4.934 s]
    [INFO] Apache TinkerPop :: Archetype - Server ............. SUCCESS [ 
11.442 s]
    [INFO] Apache TinkerPop :: Archetype - DSL ................ SUCCESS [  
5.675 s]
    [INFO] 
------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] 
------------------------------------------------------------------------
    [INFO] Total time: 14:49 min
    [INFO] Finished at: 2017-10-10T15:35:23-05:00
    [INFO] Final Memory: 278M/6262M
    [INFO] 
------------------------------------------------------------------------
    ```
    VOTE: +1

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/tinkerpop TINKERPOP-1650

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tinkerpop/pull/731.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #731
    
----
commit 73a982c7c13bc00893f34c65beec6419a56c76bc
Author: Ted Wilmes <twil...@gmail.com>
Date:   2017-10-10T18:46:13Z

    TINKERPOP-1650
    * Updated setKeepLabels calls to make defensive copies of their input to 
avoid corruption.
    * Added a new test to PathRetractionStrategyTest for WhereStep.

----


> PathRetractionStrategy makes Match steps unsolvable
> ---------------------------------------------------
>
>                 Key: TINKERPOP-1650
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1650
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.2.3, 3.2.4
>            Reporter: Branden Moore
>            Assignee: Ted Wilmes
>
> The `PathRetractionStrategy` can make certain Match() steps "Unsolvable".
> This (nonsensical) example demonstrates the issue:
> {code}
> gremlin> g = graph.traversal()
> ==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
> gremlin> 
> g.V().hasLabel("person").as("perp").match(__.as("a").out("created").as("sw"), 
> __.as("sw").has("lang", "java").as("java")).where("sw", 
> neq("a")).select("perp")
> The provided match pattern is unsolvable: [[MatchStartStep(a), 
> VertexStep(OUT,[created],vertex), MatchEndStep(sw)], [MatchStartStep(sw), 
> HasStep([lang.eq(java)]), MatchEndStep(java)], [MatchStartStep(sw), 
> WherePredicateStep(neq(a)), MatchEndStep]]
> Type ':help' or ':h' for help.
> Display stack trace? [yN]n
> gremlin> 
> {code}
> If we remove the `PathRetractionStrategy`, or use `g.withPath()` the match 
> step is solvable, and works fine.
> {code}
> g.withoutStrategies(PathRetractionStrategy).V().hasLabel("person").as("perp").match(__.as("a").out("created").as("sw"),
>  __.as("sw").has("lang", "java").as("java")).where("sw", 
> neq("a")).select("perp")
> ==>v[1]
> ==>v[4]
> ==>v[4]
> ==>v[6]
> gremlin> 
> g.withPath().V().hasLabel("person").as("perp").match(__.as("a").out("created").as("sw"),
>  __.as("sw").has("lang", "java").as("java")).where("sw", 
> neq("a")).select("perp")
> ==>v[1]
> ==>v[4]
> ==>v[4]
> ==>v[6]
> gremlin> 
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to