Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-1379

unaccounted excess in TailGlobalStep

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.2-incubating, 3.1.3, 3.2.1
    • 3.1.4, 3.2.2, 3.3.0
    • process
    • None

    Description

      https://github.com/apache/tinkerpop/blob/master/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/TailGlobalStep.java#L71-L74

      This code doesn't account for the excess removed from tailBulk. This can cause the code to set incorrect bulk values when there are multiple traversers in the tail buffer.

      I observed this behavior intermittently in TitanGraph (https://github.com/thinkaurelius/titan/pull/1312), which doesn't allow user defined ids, so the ordering of the traversers in the TraverserSet is a lot more random than the unit tests using TinkerGraph.

      This issue is reproducible with TinkerGraph (master/3.2.1). Instead of loading from one of the data files, manually create the graph with the ids in inverted order.

      graph = TinkerGraph.open();
      
      // graph.io(IoCore.gryo()).readGraph("tinkerpop-modern.kryo");
      final Vertex v1 = graph.addVertex(T.id, 6L, T.label, "person", "name", "marko", "age", 29);
      final Vertex v2 = graph.addVertex(T.id, 5L, T.label, "person", "name", "vadas", "age", 27);
      final Vertex v3 = graph.addVertex(T.id, 4L, T.label, "software", "name", "lop", "lang", "java");
      final Vertex v4 = graph.addVertex(T.id, 3L, T.label, "person", "name", "josh", "age", 32);
      final Vertex v5 = graph.addVertex(T.id, 2L, T.label, "software", "name", "ripple", "lang", "java");
      final Vertex v6 = graph.addVertex(T.id, 1L, T.label, "person", "name", "peter", "age", 35);
      v1.addEdge("knows", v2, "weight", 0.5d);
      v1.addEdge("knows", v4, "weight", 1.0d);
      v1.addEdge("created", v2, "weight", 0.4d);
      v4.addEdge("knows", v5, "weight", 1.0d);
      v4.addEdge("knows", v3, "weight", 0.4d);
      v6.addEdge("knows", v3, "weight", 0.2d);
      if (graph.features().graph().supportsTransactions()) graph.tx().commit();
      
      final GraphTraversalSource g = graph.traversal();
      String result = g.V().repeat(both()).times(3).tail(7).count().next().toString();
      boolean success = "7".equals(result);
      

      The fix is this:

      if (excess > 0) {
          oldest.setBulk(oldestBulk-excess);
          // Account for the loss of excess in the tail buffer
          this.tailBulk -= excess;
      }
      

      Attachments

        Issue Links

          Activity

            People

              pluradj Jason Plurad
              pluradj Jason Plurad
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: