private int doReadPrevSafely(int id, IntSet recursionGuard) throws IOException {
    recursionGuard.add(id);
    int prev = myStorage.getPrevRecord(id);
    if (!recursionGuard.add(prev)) throw new IOException("Recursive records found");
    return prev;
  }
private int doReadPrevSafely(int id, IntSet recursionGuard)