{
if (memcached_server_count(ptr))
{
-
qsort(memcached_instance_list(ptr), memcached_server_count(ptr), sizeof(org::libmemcached::Instance), compare_servers);
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, 0);
- instance->number_of_hosts= memcached_server_count(ptr);
}
}
/* Why 153? Hmmm... */
WATCHPOINT_ASSERT(ct1->value != 153);
if (ct1->value == ct2->value)
+ {
return 0;
+ }
else if (ct1->value > ct2->value)
+ {
return 1;
+ }
else
+ {
return -1;
+ }
}
static memcached_return_t update_continuum(memcached_st *ptr)
live_servers= memcached_server_count(ptr);
}
- uint64_t is_ketama_weighted= memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED);
- uint32_t points_per_server= (uint32_t) (is_ketama_weighted ? MEMCACHED_POINTS_PER_SERVER_KETAMA : MEMCACHED_POINTS_PER_SERVER);
+ uint32_t points_per_server= (uint32_t) (memcached_is_weighted_ketama(ptr) ? MEMCACHED_POINTS_PER_SERVER_KETAMA : MEMCACHED_POINTS_PER_SERVER);
if (live_servers == 0)
{
}
uint64_t total_weight= 0;
- if (is_ketama_weighted)
+ if (memcached_is_weighted_ketama(ptr))
{
for (uint32_t host_index = 0; host_index < memcached_server_count(ptr); ++host_index)
{
continue;
}
- if (is_ketama_weighted)
+ if (memcached_is_weighted_ketama(ptr))
{
float pct= (float)list[host_index].weight / (float)total_weight;
pointer_per_server= (uint32_t) ((::floor((float) (pct * MEMCACHED_POINTS_PER_SERVER_KETAMA / 4 * (float)live_servers + 0.0000000001))) * 4);
fprintf(stdout, "update_continuum: key is %s\n", sort_host);
}
- if (is_ketama_weighted)
+ if (memcached_is_weighted_ketama(ptr))
{
for (uint32_t x= 0; x < pointer_per_hash; x++)
{
memcached_literal_param("snprintf(sizeof(sort_host)))"));
}
- if (is_ketama_weighted)
+ if (memcached_is_weighted_ketama(ptr))
{
for (uint32_t x = 0; x < pointer_per_hash; x++)
{
if (weight > 1)
{
- ptr->ketama.weighted= true;
+ if (memcached_is_consistent_distribution(ptr))
+ {
+ memcached_set_weighted_ketama(ptr, true);
+ }
}
ptr->number_of_hosts++;
- // @note we place the count in the bottom of the server list
- instance= memcached_instance_fetch(ptr, 0);
- memcached_instance_set_count(instance, memcached_server_count(ptr));
-
return run_distribution(ptr);
}
if (list[x].weight > 1)
{
- ptr->ketama.weighted= true;
+ memcached_set_weighted_ketama(ptr, true);
}
ptr->number_of_hosts++;
}
- // Provides backwards compatibility with server list.
- {
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, 0);
- instance->number_of_hosts= memcached_server_count(ptr);
- }
-
return run_distribution(ptr);
}
if (list[x].weight > 1)
{
- ptr->ketama.weighted= true;
+ memcached_set_weighted_ketama(ptr, true);
}
ptr->number_of_hosts++;
}
- // Provides backwards compatibility with server list.
- {
- org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, 0);
- instance->number_of_hosts= memcached_server_count(ptr);
- }
-
return run_distribution(ptr);
}