Flush _all_ servers when we hit the prefetch limit
authorTrond Norbye <trond.norbye@sun.com>
Sun, 3 May 2009 21:30:16 +0000 (14:30 -0700)
committerTrond Norbye <trond.norbye@sun.com>
Sun, 3 May 2009 21:30:16 +0000 (14:30 -0700)
libmemcached/memcached_get.c

index 4d5fe7ca2d78a05330ac8c4993ba6ee9d400f32f..eb6877d7e59f707a96efc55b4b6ecc58da5fdfa7 100644 (file)
@@ -311,14 +311,16 @@ static memcached_return binary_mget_by_key(memcached_st *ptr,
     if ((memcached_io_write(&ptr->hosts[server_key], request.bytes,
                             sizeof(request.bytes), 0) == -1) ||
         (memcached_io_write(&ptr->hosts[server_key], keys[x], 
-                            key_length[x], 
-                            flush || (x > 0 && x == ptr->io_key_prefetch)) == -1)) 
+                            key_length[x], flush) == -1)) 
     {
       memcached_server_response_reset(&ptr->hosts[server_key]);
       rc= MEMCACHED_SOME_ERRORS;
       continue;
     }
     memcached_server_response_increment(&ptr->hosts[server_key]);    
+    if ((x > 0 && x == ptr->io_key_prefetch) &&
+        memcached_flush_buffers(ptr) != MEMCACHED_SUCCESS)
+      rc= MEMCACHED_SOME_ERRORS;
   }
 
   if (number_of_keys > 1)