Пример #1
0
  /**
   * Max timestamp in journal for append operation. Objects with timestamp older then this will
   * always be rejected.
   *
   * @return max timestamp older then which append is impossible.
   * @throws com.nfsdb.exceptions.JournalException if journal cannot calculate timestamp.
   */
  public long getAppendTimestampLo() throws JournalException {
    if (appendTimestampLo == -1) {
      if (nonLagPartitionCount() == 0) {
        return 0;
      }

      FixedColumn column = lastNonEmptyNonLag().getTimestampColumn();
      long sz;
      if ((sz = column.size()) > 0) {
        appendTimestampLo = column.getLong(sz - 1);
      } else {
        return 0;
      }
    }
    return appendTimestampLo;
  }
Пример #2
0
  private void switchAppendPartition(long timestamp) throws JournalException {
    boolean computeTimestampLo = appendPartition == null;

    appendPartition = getAppendPartition(timestamp);

    Interval interval = appendPartition.getInterval();
    if (interval == null) {
      appendTimestampHi = Long.MAX_VALUE;
    } else {
      appendTimestampHi = interval.getHi();
    }

    if (computeTimestampLo) {
      FixedColumn column = appendPartition.getTimestampColumn();
      long sz;
      if ((sz = column.size()) > 0) {
        appendTimestampLo = column.getLong(sz - 1);
      }
    } else {
      appendTimestampLo = appendPartition.getInterval().getLo();
    }
  }