X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fmemcached_dump.c;h=4c1006e784cd6d46dfb636ac126dd1836d65758b;hb=b4de8d3fd063b9017797dd9809ab3acb8a537606;hp=393e140a557e50602876038b05b7500b25193d6f;hpb=31079a798f38d56476c644a7ec596a600fb01930;p=m6w6%2Flibmemcached diff --git a/libmemcached/memcached_dump.c b/libmemcached/memcached_dump.c index 393e140a..4c1006e7 100644 --- a/libmemcached/memcached_dump.c +++ b/libmemcached/memcached_dump.c @@ -7,9 +7,9 @@ */ #include "common.h" -static memcached_return ascii_dump(memcached_st *ptr, memcached_dump_func *callback, void *context, uint32_t number_of_callbacks) +static memcached_return_t ascii_dump(memcached_st *ptr, memcached_dump_fn *callback, void *context, uint32_t number_of_callbacks) { - memcached_return rc= 0; + memcached_return_t rc= 0; char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE]; size_t send_length; uint32_t server_key; @@ -55,6 +55,18 @@ static memcached_return ascii_dump(memcached_st *ptr, memcached_dump_func *callb } else if (rc == MEMCACHED_END) break; + else if (rc == MEMCACHED_SERVER_ERROR || rc == MEMCACHED_CLIENT_ERROR) + { + /* If we try to request stats cachedump for a slab class that is too big + * the server will return an incorrect error message: + * "MEMCACHED_SERVER_ERROR failed to allocate memory" + * This isn't really a fatal error, so let's just skip it. I want to + * fix the return value from the memcached server to a CLIENT_ERROR, + * so let's add support for that as well right now. + */ + rc= MEMCACHED_END; + break; + } else goto error; } @@ -68,10 +80,10 @@ error: return rc; } -memcached_return memcached_dump(memcached_st *ptr, memcached_dump_func *callback, void *context, uint32_t number_of_callbacks) +memcached_return_t memcached_dump(memcached_st *ptr, memcached_dump_fn *callback, void *context, uint32_t number_of_callbacks) { /* No support for Binary protocol yet */ - if (ptr->flags & MEM_BINARY_PROTOCOL) + if (ptr->flags.binary_protocol) return MEMCACHED_FAILURE; return ascii_dump(ptr, callback, context, number_of_callbacks);