From: Date: Fri, 18 Jul 2008 12:23:02 +0000 (-0700) Subject: Removed dead code. X-Git-Tag: _23~25 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=073c4085895027aabe10aec9264dd8f4dae7e264;p=m6w6%2Flibmemcached Removed dead code. --- diff --git a/libmemcached/memcached.c b/libmemcached/memcached.c index f6d71d59..2efcc7d5 100644 --- a/libmemcached/memcached.c +++ b/libmemcached/memcached.c @@ -49,14 +49,6 @@ void memcached_free(memcached_st *ptr) free(ptr->continuum); } - if (ptr->wheel) - { - if (ptr->call_free) - ptr->call_free(ptr, ptr->wheel); - else - free(ptr->wheel); - } - if (ptr->is_allocated == MEMCACHED_ALLOCATED) { if (ptr->call_free) diff --git a/libmemcached/memcached.h b/libmemcached/memcached.h index 60c63b58..d1daf775 100644 --- a/libmemcached/memcached.h +++ b/libmemcached/memcached.h @@ -82,8 +82,6 @@ struct memcached_st { memcached_hash hash; memcached_server_distribution distribution; void *user_data; - unsigned int *wheel; - uint32_t wheel_count; uint32_t continuum_count; memcached_continuum_item_st *continuum; memcached_clone_func on_clone; @@ -95,10 +93,6 @@ struct memcached_st { memcached_trigger_delete_key delete_trigger; char prefix_key[MEMCACHED_PREFIX_KEY_MAX_SIZE]; size_t prefix_key_length; -#ifdef NOT_USED /* Future Use */ - uint8_t replicas; - memcached_return warning; -#endif }; diff --git a/libmemcached/memcached_constants.h b/libmemcached/memcached_constants.h index f698cff6..fd2f2b4d 100644 --- a/libmemcached/memcached_constants.h +++ b/libmemcached/memcached_constants.h @@ -66,7 +66,6 @@ typedef enum { typedef enum { MEMCACHED_DISTRIBUTION_MODULA, MEMCACHED_DISTRIBUTION_CONSISTENT, - MEMCACHED_DISTRIBUTION_CONSISTENT_WHEEL, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA, } memcached_server_distribution; diff --git a/libmemcached/memcached_hash.c b/libmemcached/memcached_hash.c index cca7b5a4..5bb0fcee 100644 --- a/libmemcached/memcached_hash.c +++ b/libmemcached/memcached_hash.c @@ -138,14 +138,6 @@ unsigned int dispatch_host(memcached_st *ptr, uint32_t hash) } } break; - case MEMCACHED_DISTRIBUTION_CONSISTENT_WHEEL: - { - unsigned int server_key; - - server_key= hash % MEMCACHED_STRIDE * ptr->wheel_count; - - return ptr->wheel[server_key]; - } case MEMCACHED_DISTRIBUTION_MODULA: return hash % ptr->number_of_hosts; default: diff --git a/libmemcached/memcached_hosts.c b/libmemcached/memcached_hosts.c index 2678a7c1..d75da5d2 100644 --- a/libmemcached/memcached_hosts.c +++ b/libmemcached/memcached_hosts.c @@ -6,49 +6,6 @@ static memcached_return server_add(memcached_st *ptr, char *hostname, memcached_connection type); memcached_return update_continuum(memcached_st *ptr); -#define MEMCACHED_WHEEL_SIZE 1024 -#define MEMCACHED_STRIDE 4 -static memcached_return rebalance_wheel(memcached_st *ptr) -{ - unsigned int x; - unsigned int y; - unsigned int latch; - - if (ptr->number_of_hosts > ptr->wheel_count) - { - uint32_t *new_ptr; - - if (ptr->call_realloc) - new_ptr= (uint32_t *)ptr->call_realloc(ptr, ptr->wheel, sizeof(uint32_t) * (ptr->number_of_hosts + MEMCACHED_CONTINUUM_ADDITION) * MEMCACHED_STRIDE); - else - new_ptr= (uint32_t *)realloc(ptr->wheel, sizeof(uint32_t) * (ptr->number_of_hosts + MEMCACHED_CONTINUUM_ADDITION) * MEMCACHED_STRIDE); - - if (new_ptr == 0) - return MEMCACHED_MEMORY_ALLOCATION_FAILURE; - - ptr->wheel= new_ptr; - ptr->wheel_count= ptr->number_of_hosts + MEMCACHED_CONTINUUM_ADDITION; - } - - /* Seed the Wheel */ - memset(ptr->wheel, 0, sizeof(uint32_t) * MEMCACHED_STRIDE * ptr->wheel_count); - - for (latch= y= x= 0; x < MEMCACHED_STRIDE * ptr->wheel_count; x++, latch++) - { - if (latch == MEMCACHED_STRIDE) - { - y++; - if (y == ptr->number_of_hosts) - y= 0; - latch= 0; - } - - ptr->wheel[x]= y; - } - - return MEMCACHED_SUCCESS; -} - static int compare_servers(const void *p1, const void *p2) { int return_value; @@ -82,9 +39,6 @@ memcached_return run_distribution(memcached_st *ptr) case MEMCACHED_DISTRIBUTION_CONSISTENT: case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA: return update_continuum(ptr); - case MEMCACHED_DISTRIBUTION_CONSISTENT_WHEEL: - return rebalance_wheel(ptr); - break; case MEMCACHED_DISTRIBUTION_MODULA: if (ptr->flags & MEM_USE_SORT_HOSTS) sort_hosts(ptr); diff --git a/tests/function.c b/tests/function.c index 253f21bd..59e1f2b9 100644 --- a/tests/function.c +++ b/tests/function.c @@ -2639,23 +2639,6 @@ memcached_return set_memory_alloc(memcached_st *memc) return MEMCACHED_SUCCESS; } -memcached_return enable_wheel(memcached_st *memc) -{ - memcached_server_distribution value= MEMCACHED_DISTRIBUTION_CONSISTENT_WHEEL; - memcached_hash hash; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, value); - pre_hsieh(memc); - - value= (memcached_server_distribution)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION); - assert(value == MEMCACHED_DISTRIBUTION_CONSISTENT_WHEEL); - - hash= (memcached_hash)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_HASH); - assert(hash == MEMCACHED_HASH_HSIEH); - - - return MEMCACHED_SUCCESS; -} - memcached_return enable_consistent(memcached_st *memc) { memcached_server_distribution value= MEMCACHED_DISTRIBUTION_CONSISTENT; @@ -2896,7 +2879,6 @@ collection_st collection[] ={ {"poll_timeout", poll_timeout, 0, tests}, {"gets", enable_cas, 0, tests}, {"consistent", enable_consistent, 0, tests}, - {"wheel", enable_wheel, 0, tests}, {"memory_allocators", set_memory_alloc, 0, tests}, {"prefix", set_prefix, 0, tests}, // {"udp", pre_udp, 0, tests}, @@ -2914,7 +2896,6 @@ collection_st collection[] ={ {"generate_nonblock", pre_nonblock, 0, generate_tests}, {"consistent_not", 0, 0, consistent_tests}, {"consistent_ketama", pre_behavior_ketama, 0, consistent_tests}, - {"consistent_wheel", enable_wheel, 0, consistent_tests}, {0, 0, 0, 0} };