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

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

spmallette commented on pull request #1359:
URL: https://github.com/apache/tinkerpop/pull/1359#issuecomment-729203661


   This is a good change. There's no reason I can think of to `hasNext()` 
before checking the barrier limit. Cherry-picked and merged as CTR: 
325d772d9be02bc51dbf1bb5efda37541ad47bd6
   
   Thanks you!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


> Barrier step touches one more element of next loop
> --------------------------------------------------
>
>                 Key: TINKERPOP-2475
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2475
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.4.8
>            Reporter: Liu-Delin
>            Priority: Major
>
> This bug will preload one more element in barrier action. For example, if we 
> have 4 vertices, and we have a barrier(2) step, we expect to get the first 2 
> in a barrier then the last 2 in another barrier loop. But when we get the 
> first 2 vertices, the third one has already been loaded.
> The root cause is below code: 
> {code:java}
> @Override
> public void processAllStarts() {
>     while (this.starts.hasNext() && (this.maxBarrierSize == Integer.MAX_VALUE 
> || this.barrier.size() < this.maxBarrierSize)) {
>         final Traverser.Admin<S> traverser = this.starts.next();
>         traverser.setStepId(this.getNextStep().getId()); // when barrier is 
> reloaded, the traversers should be at the next step
>         this.barrier.add(traverser);
>     }
> }
> {code}
> In while loop, we use this.starts.hasNext() at first, and it will cause the 
> vertex loading action. It will affect the performance when the vertex is 
> saved in DB instead of memory.
>  



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

Reply via email to