size_t number_of_keys,
bool mget_mode)
{
- memcached_return_t rc= MEMCACHED_NOTFOUND;
+ bool failures_occured_in_sending= false;
const char *get_command= "get ";
uint8_t get_command_length= 4;
unsigned int master_server_key= (unsigned int)-1; /* 0 is a valid server id! */
If a server fails we warn about errors and start all over with sending keys
to the server.
*/
+ memcached_return_t rc= MEMCACHED_SUCCESS;
+ size_t hosts_connected= 0;
for (uint32_t x= 0; x < number_of_keys; x++)
{
memcached_server_write_instance_st instance;
rc= memcached_connect(instance);
if (rc != MEMCACHED_SUCCESS)
+ {
continue;
+ }
+ hosts_connected++;
if ((memcached_io_writev(instance, vector, 4, false)) == -1)
{
fprintf(stderr, "%s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout);
- rc= MEMCACHED_SOME_ERRORS;
+ failures_occured_in_sending= true;
continue;
}
WATCHPOINT_ASSERT(instance->cursor_active == 0);
{
memcached_server_response_reset(instance);
fprintf(stderr, "%s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout);
- rc= MEMCACHED_SOME_ERRORS;
+ failures_occured_in_sending= true;
continue;
}
}
}
+ if (hosts_connected == 0)
+ {
+ LIBMEMCACHED_MEMCACHED_MGET_END();
+
+ if (rc != MEMCACHED_SUCCESS)
+ return rc;
+
+ return MEMCACHED_NO_SERVERS;
+ }
+
+
/*
Should we muddle on if some servers are dead?
*/
+ bool success_happened= false;
for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
memcached_server_write_instance_st instance=
if ((memcached_io_write(instance, "\r\n", 2, true)) == -1)
{
fprintf(stderr, "%s:%d (%s)\n", __FILE__, __LINE__,__func__);fflush(stdout);
- rc= MEMCACHED_SOME_ERRORS;
+ failures_occured_in_sending= true;
+ }
+ else
+ {
+ success_happened= true;
}
}
}
LIBMEMCACHED_MEMCACHED_MGET_END();
- return rc;
+
+ if (failures_occured_in_sending && success_happened)
+ return MEMCACHED_SOME_ERRORS;
+
+ if (success_happened)
+ return MEMCACHED_SUCCESS;
+
+ return MEMCACHED_FAILURE;
}
memcached_return_t memcached_mget_by_key(memcached_st *ptr,
static test_return_t generate_data(memcached_st *memc)
{
- execute_set(memc, global_pairs, global_count);
+ unsigned int check_execute= execute_set(memc, global_pairs, global_count);
+
+ test_true(check_execute == global_count);
return TEST_SUCCESS;
}
memcached_stat_st *stat_p;
memcached_return_t rc;
uint32_t host_index= 0;
- execute_set(memc, global_pairs, global_count);
+ unsigned int check_execute= execute_set(memc, global_pairs, global_count);
+
+ test_true(check_execute == global_count);
//TODO: hosts used size stats
stat_p= memcached_stat(memc, NULL, &rc);
(void)memcached_get(memc, "dsf", 3, &length, &flags, &rc);
- test_true(rc == MEMCACHED_TIMEOUT);
+ test_true_got(rc == MEMCACHED_TIMEOUT, memcached_strerror(NULL, rc));
memcached_free(memc);