From: Date: Fri, 29 Feb 2008 10:26:48 +0000 (-0800) Subject: Fixed issue around "when to calculate" next server key logic. X-Git-Tag: _20~1^2~55^2~1^2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=3d4ad9999de3113cce3335d4643c7be9a11075c7;p=m6w6%2Flibmemcached Fixed issue around "when to calculate" next server key logic. Decided to not make the distibution an issue. --- diff --git a/lib/memcached_auto.c b/lib/memcached_auto.c index 3aa63eed..923bfc14 100644 --- a/lib/memcached_auto.c +++ b/lib/memcached_auto.c @@ -62,7 +62,7 @@ static memcached_return memcached_auto(memcached_st *ptr, } /* On error we just jump to the next potential server */ error: - if (replicas > 1 && ptr->distribution == MEMCACHED_DISTRIBUTION_CONSISTENT) + if (ptr->number_of_replicas > 1) { if (server_key == (ptr->number_of_hosts - 1)) server_key= 0; diff --git a/lib/memcached_delete.c b/lib/memcached_delete.c index 24dc1660..dea5c92f 100644 --- a/lib/memcached_delete.c +++ b/lib/memcached_delete.c @@ -12,7 +12,7 @@ memcached_return memcached_delete_by_key(memcached_st *ptr, char *key, size_t key_length, time_t expiration) { - char to_write; + char to_write= (ptr->flags & MEM_BUFFER_REQUESTS) ? 0 : 1; size_t send_length; char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE]; unsigned int server_key; @@ -41,8 +41,6 @@ memcached_return memcached_delete_by_key(memcached_st *ptr, goto error; } - to_write= (ptr->flags & MEM_BUFFER_REQUESTS) ? 0 : 1; - do { rc[replicas]= memcached_do(&ptr->hosts[server_key], buffer, send_length, to_write); @@ -62,7 +60,7 @@ memcached_return memcached_delete_by_key(memcached_st *ptr, /* On error we just jump to the next potential server */ error: - if (replicas > 1 && ptr->distribution == MEMCACHED_DISTRIBUTION_CONSISTENT) + if (ptr->number_of_replicas > 1) { if (server_key == (ptr->number_of_hosts - 1)) server_key= 0; diff --git a/lib/memcached_get.c b/lib/memcached_get.c index 374793f5..b3cd8e51 100644 --- a/lib/memcached_get.c +++ b/lib/memcached_get.c @@ -84,7 +84,7 @@ char *memcached_get_by_key(memcached_st *ptr, /* On error we just jump to the next potential server */ error: - if (replicas > 1 && ptr->distribution == MEMCACHED_DISTRIBUTION_CONSISTENT) + if (ptr->number_of_replicas > 1) { if (server_key == (ptr->number_of_hosts - 1)) server_key= 0; diff --git a/lib/memcached_storage.c b/lib/memcached_storage.c index aac9b922..959f0b64 100644 --- a/lib/memcached_storage.c +++ b/lib/memcached_storage.c @@ -118,7 +118,7 @@ static inline memcached_return memcached_send(memcached_st *ptr, /* On error we just jump to the next potential server */ error: - if (replicas > 1 && ptr->distribution == MEMCACHED_DISTRIBUTION_CONSISTENT) + if (ptr->number_of_replicas > 1) { if (server_key == (ptr->number_of_hosts - 1)) server_key= 0;