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

ASF GitHub Bot commented on GIRAPH-1146:
----------------------------------------

Github user ikabiljo commented on a diff in the pull request:

    https://github.com/apache/giraph/pull/36#discussion_r115049370
  
    --- Diff: 
giraph-block-app/src/main/java/org/apache/giraph/block_app/framework/block/PieceCount.java
 ---
    @@ -0,0 +1,86 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.giraph.block_app.framework.block;
    +
    +import com.google.common.base.Objects;
    +
    +/**
    + * Number of pieces
    + */
    +public class PieceCount {
    +  private boolean known;
    +  private int count;
    +
    +  public PieceCount(int count) {
    +    known = true;
    +    this.count = count;
    +  }
    +
    +  private PieceCount() {
    +    known = false;
    +  }
    +
    +  public static PieceCount createUnknownCount() {
    +    return new PieceCount();
    +  }
    +
    +
    +  public PieceCount add(PieceCount other) {
    +    if (!this.known || !other.known) {
    +      known = false;
    +    } else {
    +      count += other.count;
    +    }
    +    return this;
    +  }
    +
    +  public PieceCount multiply(int value) {
    +    count *= value;
    +    return this;
    +  }
    +
    +  public int getCount() {
    +    return known ? count : Integer.MAX_VALUE;
    --- End diff --
    
    this might easily lead to overflow if anything is done with this number.
    
    You should either fatal (better), or return 1M or something here.


> Keep track of number of supersteps when possible
> ------------------------------------------------
>
>                 Key: GIRAPH-1146
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-1146
>             Project: Giraph
>          Issue Type: New Feature
>            Reporter: Maja Kabiljo
>            Assignee: Maja Kabiljo
>            Priority: Minor
>
> In many cases we know how many supersteps are there going to be. We can keep 
> track of it and log it with progress.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to