{"MEMCACHED_BEHAVIOR_TCP_KEEPALIVE", false, (test_callback_fn*)MEMCACHED_BEHAVIOR_TCP_KEEPALIVE_test},
{"MEMCACHED_BEHAVIOR_TCP_KEEPIDLE", false, (test_callback_fn*)MEMCACHED_BEHAVIOR_TCP_KEEPIDLE_test},
{"MEMCACHED_BEHAVIOR_POLL_TIMEOUT", false, (test_callback_fn*)MEMCACHED_BEHAVIOR_POLL_TIMEOUT_test},
+ {"MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH_TEST", true, (test_callback_fn*)MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH_TEST },
{"MEMCACHED_CALLBACK_DELETE_TRIGGER_and_MEMCACHED_BEHAVIOR_NOREPLY", false, (test_callback_fn*)test_MEMCACHED_CALLBACK_DELETE_TRIGGER_and_MEMCACHED_BEHAVIOR_NOREPLY},
{0, 0, 0}
};
return TEST_SUCCESS;
}
+test_return_t MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH_TEST(memcached_st *original_memc)
+{
+ test_skip(true, memcached_behavior_get(original_memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));
+
+ memcached_st *memc= create_single_instance_memcached(original_memc, "--BINARY-PROTOCOL");
+ test_true(memc);
+
+ test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH, 8));
+
+ keys_st keys(20480);
+
+ /* First add all of the items.. */
+ char blob[1024] = {0};
+
+ for (size_t x= 0; x < keys.size(); ++x)
+ {
+ uint64_t query_id= memcached_query_id(memc);
+ memcached_return_t rc= memcached_add(memc,
+ keys.key_at(x), keys.length_at(x),
+ blob, sizeof(blob),
+ 0, 0);
+ test_true(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED);
+ test_compare(query_id +1, memcached_query_id(memc));
+ }
+
+ /* Try to get all of them with a large multiget */
+ size_t counter= 0;
+ memcached_execute_fn callbacks[]= { &callback_counter };
+ test_compare(MEMCACHED_SUCCESS,
+ memcached_mget_execute(memc,
+ keys.keys_ptr(), keys.lengths_ptr(),
+ keys.size(), callbacks, &counter, 1));
+
+ {
+ uint64_t query_id= memcached_query_id(memc);
+ test_compare(MEMCACHED_SUCCESS,
+ memcached_fetch_execute(memc, callbacks, (void *)&counter, 1));
+ test_compare(query_id, memcached_query_id(memc));
+
+ /* Verify that we got all of the items */
+ test_compare(keys.size(), counter);
+ }
+
+ memcached_free(memc);
+
+ return TEST_SUCCESS;
+}
+
#define REGRESSION_BINARY_VS_BLOCK_COUNT 20480
static pairs_st *global_pairs= NULL;
test_return_t memcached_stat_execute_test(memcached_st *memc);
test_return_t mget_end(memcached_st *memc);
test_return_t mget_execute(memcached_st *original_memc);
+test_return_t MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH_TEST(memcached_st *original_memc);
test_return_t mget_result_alloc_test(memcached_st *memc);
test_return_t mget_result_function(memcached_st *memc);
test_return_t mget_result_test(memcached_st *memc);