Skip to content

Commit

Permalink
Make hash table algorithm selectable
Browse files Browse the repository at this point in the history
jenkins hash is old. Lets try murmur3 to start! Default is the old one, so
people aren't surprised.
  • Loading branch information
dormando committed Apr 17, 2014
1 parent d5d4c49 commit 05ca809
Show file tree
Hide file tree
Showing 16 changed files with 659 additions and 452 deletions.
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ timedrun_SOURCES = timedrun.c

memcached_SOURCES = memcached.c memcached.h \
hash.c hash.h \
jenkins_hash.c jenkins_hash.h \
murmur3_hash.c murmur3_hash.h \
slabs.c slabs.h \
items.c items.h \
assoc.c assoc.h \
Expand Down
2 changes: 1 addition & 1 deletion assoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static void *assoc_maintenance_thread(void *arg) {
for (it = old_hashtable[expand_bucket]; NULL != it; it = next) {
next = it->h_next;

bucket = hash(ITEM_key(it), it->nkey, 0) & hashmask(hashpower);
bucket = hash(ITEM_key(it), it->nkey) & hashmask(hashpower);
it->h_next = primary_hashtable[bucket];
primary_hashtable[bucket] = it;
}
Expand Down
1 change: 1 addition & 0 deletions doc/protocol.txt
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ other stats command.
| hashpower_init | 32 | Starting size multiplier for hash table |
| slab_reassign | bool | Whether slab page reassignment is allowed |
| slab_automove | bool | Whether slab page automover is enabled |
| hash_algorithm | char | Hash table algorithm in use |
|-------------------+----------+----------------------------------------------|


Expand Down
Loading

0 comments on commit 05ca809

Please sign in to comment.