private void rehash() {
    rehashCount++;
    if (rehashCount > 20) {
      throw new RuntimeException("Too many rehashes");
    }
    updateHashSalt();

    // Save original values
    if (prev1 == null) {
      prev1 = t1;
      prev2 = t2;
    }
    t1 = new byte[n][];
    t2 = new byte[n][];
    for (byte[] v  : prev1) {
      if (v != null) {
        byte[] x = tryInsert(v);
        if (x != null) {
          rehash();
          return;
        }
      }
    }
    for (byte[] v  : prev2) {
      if (v != null) {
        byte[] x = tryInsert(v);
        if (x != null) {
          rehash();
          return;
        }
      }
    }

    // We succeeded in adding all the values, so
    // clear the previous values recorded.
    prev1 = null;
    prev2 = null;
  }
In case of rehash, hash function h2 is changed by updating the
salt value passed in to the function hash().
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/CuckooSetBytes.java