code: public static long getOlderRunId(int i, long runId) {
  
      /**
       * try to pick a randomized hour around that old date instead of picking
       * exactly the same hour
       */
      int randomizedHourInSeconds = (int) (Math.random() * 23) * 3600;
      /**
       * consider the day before old date and add randomizedHour for example, for
       * retryCount = 0 pick a day which is 2 days before ageMult[0], that is 2
       * days before the current date in consideration and add the randomized hour
       * say 13 hours, so that gives an hour belonging to one day before current
       * date in consideration
       */
      if (i >= HdfsConstants.ageMult.length) {
        throw new ProcessingException("Can't look back in time that far " + i
            + ", only upto " + HdfsConstants.ageMult.length);
      }
      long newTs =
          runId - (HdfsConstants.ageMult[i] * HdfsConstants.NUM_SECONDS_IN_A_DAY
              + randomizedHourInSeconds);
      LOG.info(" Getting older runId for " + runId + ", returning " + newTs
          + " since ageMult[" + i + "]=" + HdfsConstants.ageMult[i]
          + " randomizedHourInSeconds=" + randomizedHourInSeconds);
      return newTs;
  
    }
docs: this function returns an older timestamp ideally we would be using the
  daily aggregation table and be simply looking for last run of the
  aggregation, but right now, in the hourly table, we try to look for certain
  timestamps in the past instead of scanning the entire table for the last
  run.
  @param i (i should always be less than ageMult.size)
  @param runId
  @return older runId
  
  @throws ProcessingException