Skip to content

Commit 1e92b1a

Browse files
committed
bugfix: fix rehashing to match perl client
1 parent dc66cb5 commit 1e92b1a

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/com/danga/MemCached/SockIOPool.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,25 @@ public SockIO getSock( String key, Integer hashCode ) {
661661
// if we failed to get a socket from this server
662662
// then we try again by adding an incrementer to the
663663
// current hash and then rehashing
664-
hv += ("" + hv + tries).hashCode();
664+
switch ( hashingAlg ) {
665+
case NATIVE_HASH:
666+
hv += ("" + tries + key).hashCode();
667+
break;
668+
669+
case OLD_COMPAT_HASH:
670+
hv += origCompatHashingAlg( "" + tries + key );
671+
break;
672+
673+
case NEW_COMPAT_HASH:
674+
hv += newCompatHashingAlg( "" + tries + key );
675+
break;
676+
677+
default:
678+
// use the native hash as a default
679+
hv += ("" + tries + key).hashCode();
680+
hashingAlg = NATIVE_HASH;
681+
break;
682+
}
665683
}
666684

667685
return null;

0 commit comments

Comments
 (0)