diff options
author | Ladar Levison <ladar@lavabit.com> | 2019-01-28 11:19:40 +0300 |
---|---|---|
committer | Ladar Levison <ladar@lavabit.com> | 2019-01-28 11:19:40 +0300 |
commit | 886c8684a648818fa66e3eaeee6464716b9d6320 (patch) | |
tree | 2cd338bfbc392b5c2a129a95f44bbf11382e1fba | |
parent | b6ab1a26c5788997307ca88876de72c961abc010 (diff) |
Attempt a slab size fix.
-rwxr-xr-x | dev/scripts/builders/build.lib.sh | 2 | ||||
-rw-r--r-- | lib/patches/memcached/1.0.18_fix_dump_return_code.patch | 74 |
2 files changed, 76 insertions, 0 deletions
diff --git a/dev/scripts/builders/build.lib.sh b/dev/scripts/builders/build.lib.sh index 1e288169..5fb18d9d 100755 --- a/dev/scripts/builders/build.lib.sh +++ b/dev/scripts/builders/build.lib.sh @@ -2128,6 +2128,8 @@ memcached() { cat "$M_PATCHES/memcached/"1.0.18_fix_ipv6_and_udp_test_failures.patch | patch -p1 --verbose &>> "$M_LOGS/memcached.txt"; error # Fix the return code comparison for the missing binary unit test. cat "$M_PATCHES/memcached/"1.0.18_fix_unittest_doesnotexist.patch | patch -p1 --verbose &>> "$M_LOGS/memcached.txt"; error + # Adjust the slab count based on the memcached server version. + cat "$M_PATCHES/memcached/"1.0.18_fix_dump_return_code.patch | patch -p1 --verbose &>> "$M_LOGS/memcached.txt"; error fi ;; memcached-build) diff --git a/lib/patches/memcached/1.0.18_fix_dump_return_code.patch b/lib/patches/memcached/1.0.18_fix_dump_return_code.patch new file mode 100644 index 00000000..53341621 --- /dev/null +++ b/lib/patches/memcached/1.0.18_fix_dump_return_code.patch @@ -0,0 +1,74 @@ +diff --git a/libmemcached/dump.cc b/libmemcached/dump.cc +index 8ddb2ee..e7f5ff4 100644 +--- a/libmemcached/dump.cc ++++ b/libmemcached/dump.cc +@@ -1,5 +1,5 @@ + /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: +- * ++ * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ +@@ -46,6 +46,8 @@ + + static memcached_return_t ascii_dump(Memcached *memc, memcached_dump_fn *callback, void *context, uint32_t number_of_callbacks) + { ++ ++//` if memc->server_info.version + /* MAX_NUMBER_OF_SLAB_CLASSES is defined to 200 in Memcached 1.4.10 */ + for (uint32_t x= 0; x < 200; x++) + { +@@ -53,7 +55,7 @@ static memcached_return_t ascii_dump(Memcached *memc, memcached_dump_fn *callbac + int buffer_length= snprintf(buffer, sizeof(buffer), "%u", x); + if (size_t(buffer_length) >= sizeof(buffer) or buffer_length < 0) + { +- return memcached_set_error(*memc, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT, ++ return memcached_set_error(*memc, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT, + memcached_literal_param("snprintf(MEMCACHED_DEFAULT_COMMAND_SIZE)")); + } + +@@ -70,6 +72,12 @@ static memcached_return_t ascii_dump(Memcached *memc, memcached_dump_fn *callbac + { + memcached_instance_st* instance= memcached_instance_fetch(memc, server_key); + ++ // Starting with version 1.4.23 the slab size went from 200 to 63. ++ if ((instance->major_version > 1 || instance->minor_version > 4 || instance->micro_version > 22) && x > 63) ++ { ++ continue; ++ } ++ + memcached_return_t vdo_rc; + if (memcached_success((vdo_rc= memcached_vdo(instance, vector, 3, true)))) + { +@@ -86,6 +94,13 @@ static memcached_return_t ascii_dump(Memcached *memc, memcached_dump_fn *callbac + memcached_return_t read_ret= MEMCACHED_SUCCESS; + while ((instance= memcached_io_get_readable_server(memc, read_ret))) + { ++ ++ // Starting with version 1.4.23 the slab size went from 200 to 63. ++ if ((instance->major_version > 1 || instance->minor_version > 4 || instance->micro_version > 22) && x > 63) ++ { ++ continue; ++ } ++ + memcached_return_t response_rc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL); + if (response_rc == MEMCACHED_ITEM) + { +@@ -111,7 +126,7 @@ static memcached_return_t ascii_dump(Memcached *memc, memcached_dump_fn *callbac + } + } + else if (response_rc == MEMCACHED_END) +- { ++ { + // All items have been returned + } + else if (response_rc == MEMCACHED_SERVER_ERROR or response_rc == MEMCACHED_CLIENT_ERROR or response_rc == MEMCACHED_ERROR) +@@ -146,7 +161,7 @@ memcached_return_t memcached_dump(memcached_st *shell, memcached_dump_fn *callba + return rc; + } + +- /* ++ /* + No support for Binary protocol yet + @todo Fix this so that we just flush, switch to ascii, and then go back to binary. + */ |