break;
case MEMCACHED_HASH_CRC:
hash= ((hash_crc32(key, key_length) >> 16) & 0x7fff);
+ if (hash == 0)
+ hash= 1;
break;
/* FNV hash'es lifted from Dustin Sallings work */
case MEMCACHED_HASH_FNV1_64:
}
WATCHPOINT_ASSERT(hash);
- if (ptr->flags & MEM_USE_KETAMA)
+
+ if (ptr->distribution == MEMCACHED_DISTRIBUTION_MODULA)
{
- WATCHPOINT_ASSERT(0);
- return 0;
+ return hash % ptr->number_of_hosts;
}
else
{
unsigned int server_key;
- server_key= hash % ptr->number_of_hosts;
+ server_key= hash % MEMCACHED_WHEEL_SIZE;
- return server_key;
+ return ptr->wheel[server_key];
}
}