projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
NEw code for the memcached_fetch_execute() function.
[m6w6/libmemcached]
/
lib
/
memcached_hash.c
diff --git
a/lib/memcached_hash.c
b/lib/memcached_hash.c
index 9cc846a80e8ab568b047d4b7e8c9896a9b4f9da9..9906f5d9be30f5dcd6dde919f36497bbd58b59b3 100644
(file)
--- a/
lib/memcached_hash.c
+++ b/
lib/memcached_hash.c
@@
-29,6
+29,8
@@
unsigned int memcached_generate_hash(memcached_st *ptr, char *key, size_t key_le
break;
case MEMCACHED_HASH_CRC:
hash= ((hash_crc32(key, key_length) >> 16) & 0x7fff);
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:
break;
/* FNV hash'es lifted from Dustin Sallings work */
case MEMCACHED_HASH_FNV1_64:
@@
-85,18
+87,18
@@
unsigned int memcached_generate_hash(memcached_st *ptr, char *key, size_t key_le
}
WATCHPOINT_ASSERT(hash);
}
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;
}
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]
;
}
}
}
}