private long findKeyRefToRead(byte[] key, int offset, int length,
          WriteBuffers.Position readPos, MatchTracker matchTracker) {
    final int bucketMask = (refs.length - 1);
    int hashCode = writeBuffers.hashCode(key, offset, length);
    int slot = hashCode & bucketMask;
    // LOG.info("Read hash code for " + Utils.toStringBinary(key, 0, length)
    //   + " is " + Integer.toBinaryString(hashCode) + " - " + slot);
    long probeSlot = slot;
    int i = 0;
    while (true) {
      long ref = refs[slot];
      // When we were inserting the key, we would have inserted here; so, there's no key.
      if (ref == 0) {
        return 0;
      }
      if (isSameKey(key, offset, length, ref, hashCode, readPos)) {

        if (matchTracker != null) {

          // Support for FULL OUTER MapJoin.  Track matches of the slot table entry.
          matchTracker.trackMatch(slot);
        }

        return ref;
      }
      ++metricGetConflict;
      probeSlot += (++i);
      if (i > largestNumberOfSteps) {
        // We know we never went that far when we were inserting.
        return 0;
      }
      slot = (int)(probeSlot & bucketMask);
    }
  }
Finds the slot to use for reading.
@param key Read key array.
@param length Read key length.
@return The ref to use for reading.
ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/BytesBytesMultiHashMap.java