summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorContinuous Integration <ci@tangent.org>2014-02-01 14:30:50 -0800
committerContinuous Integration <ci@tangent.org>2014-02-01 14:30:50 -0800
commit293643983d9d8b8b5148f76bf7e794e7de329109 (patch)
tree1dcb28f12a2e15b15c3f9d4c3a95edfe406520d1
parentecb8ed2090d2bc35c4ffe5febe1ba465d3e0be5d (diff)
parent78ab72c934e80631b107026ff3bd7cabe305d38d (diff)
downloadlibmemcached-293643983d9d8b8b5148f76bf7e794e7de329109.tar.gz
Merge lp:~brianaker/libmemcached/1251482 Build: jenkins-Libmemcached-439
-rw-r--r--libmemcached/fetch.cc16
-rw-r--r--libmemcached/quit.cc9
2 files changed, 24 insertions, 1 deletions
diff --git a/libmemcached/fetch.cc b/libmemcached/fetch.cc
index 7f677d02..d7951092 100644
--- a/libmemcached/fetch.cc
+++ b/libmemcached/fetch.cc
@@ -194,6 +194,7 @@ memcached_result_st *memcached_fetch_result(memcached_st *ptr,
*error= MEMCACHED_MAXIMUM_RETURN; // We use this to see if we ever go into the loop
memcached_instance_st *server;
memcached_return_t read_ret= MEMCACHED_SUCCESS;
+ bool connection_failures= false;
while ((server= memcached_io_get_readable_server(ptr, read_ret)))
{
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
@@ -203,6 +204,11 @@ memcached_result_st *memcached_fetch_result(memcached_st *ptr,
{
continue;
}
+ else if (*error == MEMCACHED_CONNECTION_FAILURE)
+ {
+ connection_failures= true;
+ continue;
+ }
else if (*error == MEMCACHED_SUCCESS)
{
result->count++;
@@ -230,6 +236,16 @@ memcached_result_st *memcached_fetch_result(memcached_st *ptr,
{
*error= MEMCACHED_NOTFOUND;
}
+ else if (connection_failures)
+ {
+ /*
+ If we have a connection failure to some servers, the caller may
+ wish to treat that differently to getting a definitive NOT_FOUND
+ from all servers, so return MEMCACHED_CONNECTION_FAILURE to allow
+ that.
+ */
+ *error= MEMCACHED_CONNECTION_FAILURE;
+ }
else if (*error == MEMCACHED_SUCCESS)
{
*error= MEMCACHED_END;
diff --git a/libmemcached/quit.cc b/libmemcached/quit.cc
index 7ece03b9..04b77cea 100644
--- a/libmemcached/quit.cc
+++ b/libmemcached/quit.cc
@@ -120,8 +120,15 @@ void memcached_quit_server(memcached_instance_st* instance, bool io_death)
instance->close_socket();
- if (io_death)
+ if (io_death and memcached_is_udp(instance->root))
{
+ /*
+ If using UDP, we should stop using the server briefly on every IO
+ failure. If using TCP, it may be that the connection went down a
+ short while ago (e.g. the server failed) and we've only just
+ noticed, so we should only set the retry timeout on a connect
+ failure (which doesn't call this method).
+ */
memcached_mark_server_for_timeout(instance);
}
}