tests/mem_functions.cc
/* Do a large mget() over all the keys we think exist */
Do a large mget() over all the keys we think exist
Do a large mget () over all the keys we think exist
static test_return_t user_supplied_bug3(memcached_st *memc)
{
  unsigned int setter= 1;
  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, setter);
  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, setter);
#ifdef NOT_YET
  setter = 20 * 1024576;
  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE, setter);
  setter = 20 * 1024576;
  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE, setter);
  getter = memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE);
  getter = memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE);
#endif
  size_t key_lengths[HALDENBRAND_KEY_COUNT];
  char **keys= static_cast<char **>(calloc(HALDENBRAND_KEY_COUNT, sizeof(char *)));
  test_true(keys);
  for (uint32_t x= 0; x < HALDENBRAND_KEY_COUNT; x++)
  {
    char key[MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH +1];
    int key_length= snprintf(key, sizeof(key), "%u", x);
    keys[x]= strdup(key);
    test_true(keys[x]);
    key_lengths[x]= key_length;
    test_compare(size_t(key_length), strlen(keys[x]));
  }
  test_compare(MEMCACHED_SUCCESS,
               memcached_mget(memc, (const char **)keys, key_lengths, HALDENBRAND_KEY_COUNT));
  unsigned int keys_returned;
  test_compare(TEST_SUCCESS, fetch_all_results(memc, keys_returned, MEMCACHED_SUCCESS));
  test_compare(HALDENBRAND_KEY_COUNT, keys_returned);
  for (uint32_t x= 0; x < HALDENBRAND_KEY_COUNT; x++)
  {
    free(keys[x]);
  }
  free(keys);
  return TEST_SUCCESS;
}
static test_return_t user_supplied_bug3 ( memcached_st * memc ) { unsigned int setter = 1 ; memcached_behavior_set ( memc , MEMCACHED_BEHAVIOR_NO_BLOCK , setter ) ; memcached_behavior_set ( memc , MEMCACHED_BEHAVIOR_TCP_NODELAY , setter ) ; #ifdef NOT_YET setter = 20 * 1024576 ; memcached_behavior_set ( memc , MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE , setter ) ; setter = 20 * 1024576 ; memcached_behavior_set ( memc , MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE , setter ) ; getter = memcached_behavior_get ( memc , MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE ) ; getter = memcached_behavior_get ( memc , MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE ) ; #endif size_t key_lengths [ HALDENBRAND_KEY_COUNT ] ; char * * keys = static_cast < char * * > ( calloc ( HALDENBRAND_KEY_COUNT , sizeof ( char * ) ) ) ; test_true ( keys ) ; for ( uint32_t x = 0 ; x < HALDENBRAND_KEY_COUNT ; x ++ ) { char key [ MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH + 1 ] ; int key_length = snprintf ( key , sizeof ( key ) , " " , x ) ; keys [ x ] = strdup ( key ) ; test_true ( keys [ x ] ) ; key_lengths [ x ] = key_length ; test_compare ( size_t ( key_length ) , strlen ( keys [ x ] ) ) ; } test_compare ( MEMCACHED_SUCCESS , memcached_mget ( memc , ( const char * * ) keys , key_lengths , HALDENBRAND_KEY_COUNT ) ) ; unsigned int keys_returned ; test_compare ( TEST_SUCCESS , fetch_all_results ( memc , keys_returned , MEMCACHED_SUCCESS ) ) ; test_compare ( HALDENBRAND_KEY_COUNT , keys_returned ) ; for ( uint32_t x = 0 ; x < HALDENBRAND_KEY_COUNT ; x ++ ) { free ( keys [ x ] ) ; } free ( keys ) ; return TEST_SUCCESS ; }
Do a large mget() over all the keys we think exist
Do a large mget () over all the keys we think exist