static memcached_return_t ascii_dump(Memcached *memc, memcached_dump_fn *callback, void *context, uint32_t number_of_callbacks)
{
+ memcached_version(memc);
/* MAX_NUMBER_OF_SLAB_CLASSES is defined to 200 in Memcached 1.4.10 */
for (uint32_t x= 0; x < 200; x++)
{
{
memcached_instance_st* instance= memcached_instance_fetch(memc, server_key);
- memcached_return_t vdo_rc;
- if (memcached_failed((vdo_rc= memcached_vdo(instance, vector, 3, true))))
- {
- return vdo_rc;
+ // skip slabs >63 for server versions >= 1.4.23
+ if (x < 64 || memcached_version_instance_cmp(instance, 1, 4, 23) < 0) {
+ memcached_return_t vdo_rc;
+ if (memcached_failed((vdo_rc= memcached_vdo(instance, vector, 3, true))))
+ {
+ return vdo_rc;
+ }
}
}
}
}
+int8_t memcached_version_instance_cmp(memcached_instance_st *instance,
+ uint8_t maj, uint8_t min, uint8_t mic)
+{
+ if (!instance || memcached_server_major_version(instance) == UINT8_MAX) {
+ return INT8_MIN;
+ } else {
+ uint32_t sv, cv;
+
+ sv = memcached_server_micro_version(instance)
+ |memcached_server_minor_version(instance) << 8
+ |memcached_server_major_version(instance) << 16
+ ;
+ cv = mic
+ |min << 8
+ |maj << 16
+ ;
+ if (sv < cv) {
+ return -1;
+ }
+ return sv != cv;
+ }
+}
+
memcached_return_t memcached_version(memcached_st *shell)
{
Memcached* memc= memcached2Memcached(shell);
#include "tests/libmemcached-1.0/dump.h"
static memcached_return_t callback_dump_counter(const memcached_st *,
- const char*, // key,
- size_t, // length,
+ const char* key,
+ size_t length,
void *context)
{
size_t *counter= (size_t *)context;
#if 0
std::cerr.write(key, length);
- std::cerr << std::endl;
+ std::cerr << ": " << *counter << std::endl;
+#else
+ (void)key;
+ (void)length;
#endif
*counter= *counter +1;
{
return MEMCACHED_FAILURE;
}
+#if 0
+ std::cerr << "# " << number_value << " items " << std::endl;
+#endif
*counter= *counter +number_value;
}
{
test_skip(false, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));
- /* The dump test relies on there being at least 32 items in memcached */
for (uint32_t x= 0; x < memcached_dump_TEST2_COUNT; x++)
{
char key[1024];
- int length= snprintf(key, sizeof(key), "%s%u", __func__, x);
+ int length= snprintf(key, sizeof(key), "%s_%u", __func__, x);
test_true(length > 0);
test_compare(MEMCACHED_SUCCESS,
memcached_set(memc, key, length,
- NULL, 0, // Zero length values
+ key, length,
time_t(0), uint32_t(0)));
}
memcached_quit(memc);
+ // give memcached some time
+ libtest::dream(1, 0);
+
uint64_t counter= 0;
test_compare(MEMCACHED_SUCCESS,
memcached_stat_execute(memc, NULL, item_counter, &counter));