X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fhosts.cc;h=1bcaaa7aca4bc9b7e90dff04e6d4ffbe3c67fcf4;hb=c5c5f2799a24eac8df5e11f447b48e031299579a;hp=89896e85c50a1071315eb9ce39749920eff25bbd;hpb=32767cce940f7bcde4633cc3cd23efc28ad954bd;p=m6w6%2Flibmemcached diff --git a/libmemcached/hosts.cc b/libmemcached/hosts.cc index 89896e85..1bcaaa7a 100644 --- a/libmemcached/hosts.cc +++ b/libmemcached/hosts.cc @@ -80,7 +80,9 @@ static void sort_hosts(memcached_st *ptr) memcached_return_t run_distribution(memcached_st *ptr) { if (ptr->flags.use_sort_hosts) + { sort_hosts(ptr); + } switch (ptr->distribution) { @@ -89,15 +91,18 @@ memcached_return_t run_distribution(memcached_st *ptr) case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY: case MEMCACHED_DISTRIBUTION_CONSISTENT_WEIGHTED: return update_continuum(ptr); + case MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET: case MEMCACHED_DISTRIBUTION_MODULA: break; + case MEMCACHED_DISTRIBUTION_RANDOM: srandom((uint32_t) time(NULL)); break; + case MEMCACHED_DISTRIBUTION_CONSISTENT_MAX: default: - WATCHPOINT_ASSERT(0); /* We have added a distribution without extending the logic */ + assert_msg(0, "Invalid distribution type passed to run_distribution()"); } return MEMCACHED_SUCCESS; @@ -252,9 +257,6 @@ static memcached_return_t update_continuum(memcached_st *ptr) #ifdef DEBUG printf("update_continuum: key is %s\n", sort_host); #endif - - WATCHPOINT_ASSERT(sort_host_length); - if (is_ketama_weighted) { for (uint32_t x= 0; x < pointer_per_hash; x++) @@ -303,8 +305,6 @@ static memcached_return_t update_continuum(memcached_st *ptr) memcached_literal_param("snprintf(MEMCACHED_DEFAULT_COMMAND_SIZE)")); } - WATCHPOINT_ASSERT(sort_host_length); - if (is_ketama_weighted) { for (uint32_t x = 0; x < pointer_per_hash; x++)