diff options
author | Ladar Levison <ladar@lavabit.com> | 2019-01-29 22:10:14 +0300 |
---|---|---|
committer | Ladar Levison <ladar@lavabit.com> | 2019-01-29 22:10:14 +0300 |
commit | 8cc0ad34123282b8255fe88783a9d8dab0d17691 (patch) | |
tree | 982f0496483ee6e3b4bfe41a5625c0fc529f83e3 /lib | |
parent | 8de436298e80488fa0d957dfd0b97ef305cca8b9 (diff) |
Overhauled the libemcached dump function. Added various minor libmemcached fixes to the patch stack.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/patches/memcached/1.0.18_disable_compiler_optimizations.patch | 6 | ||||
-rw-r--r-- | lib/patches/memcached/1.0.18_fix_aclocal_errors.patch | 18 | ||||
-rw-r--r-- | lib/patches/memcached/1.0.18_fix_alt_platform_build_errors.patch | 141 | ||||
-rw-r--r-- | lib/patches/memcached/1.0.18_fix_dump_function.patch (renamed from lib/patches/memcached/1.0.18_fix_dump_return_code.patch) | 209 | ||||
-rw-r--r-- | lib/patches/memcached/1.0.18_fix_invalid_comparison.patch | 22 | ||||
-rw-r--r-- | lib/patches/memcached/1.0.18_fix_ketama_segfaults.patch | 38 | ||||
-rw-r--r-- | lib/patches/memcached/1.0.18_fix_pthread_linking.patch | 18 |
7 files changed, 382 insertions, 70 deletions
diff --git a/lib/patches/memcached/1.0.18_disable_compiler_optimizations.patch b/lib/patches/memcached/1.0.18_disable_compiler_optimizations.patch index ca3a5bc7..ce2248e1 100644 --- a/lib/patches/memcached/1.0.18_disable_compiler_optimizations.patch +++ b/lib/patches/memcached/1.0.18_disable_compiler_optimizations.patch @@ -7,7 +7,7 @@ diff -r --unified a/configure b/configure elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then - CFLAGS="-g -O2" -+ CFLAGS="-g -O0" ++ CFLAGS="" else CFLAGS="-g" fi @@ -23,14 +23,14 @@ diff -r --unified a/configure b/configure elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then - CXXFLAGS="-g -O2" -+ CXXFLAGS="-g -O0" ++ CXXFLAGS="" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then - CXXFLAGS="-O2" -+ CXXFLAGS="-O0" ++ CXXFLAGS="" else CXXFLAGS= fi diff --git a/lib/patches/memcached/1.0.18_fix_aclocal_errors.patch b/lib/patches/memcached/1.0.18_fix_aclocal_errors.patch new file mode 100644 index 00000000..336489fb --- /dev/null +++ b/lib/patches/memcached/1.0.18_fix_aclocal_errors.patch @@ -0,0 +1,18 @@ +diff --git a/configure.ac b/configure.ac +index 17b7351..9cc1690 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -12,12 +12,12 @@ m4_include([version.m4]) + + AC_PREREQ([2.61]) + AC_INIT([libmemcached],VERSION_NUMBER,[http://libmemcached.org/]) ++AC_CONFIG_AUX_DIR([build-aux]) + + # Setup the compilers early on + AC_PROG_CC([cc gcc clang]) + AC_PROG_CXX([c++ g++ clang++]) + +-AC_CONFIG_AUX_DIR([build-aux]) + AC_CONFIG_MACRO_DIR([m4]) + + AC_CANONICAL_HOST diff --git a/lib/patches/memcached/1.0.18_fix_alt_platform_build_errors.patch b/lib/patches/memcached/1.0.18_fix_alt_platform_build_errors.patch new file mode 100644 index 00000000..26320892 --- /dev/null +++ b/lib/patches/memcached/1.0.18_fix_alt_platform_build_errors.patch @@ -0,0 +1,141 @@ +diff --git a/libtest/cmdline.cc b/libtest/cmdline.cc +index 29a22de..b1da8df 100644 +--- a/libtest/cmdline.cc ++++ b/libtest/cmdline.cc +@@ -62,7 +62,7 @@ using namespace libtest; + #include <stdexcept> + + #ifndef __USE_GNU +-static char **environ= NULL; ++char **environ= NULL; + #endif + + #ifndef FD_CLOEXEC +@@ -137,7 +137,7 @@ Application::Application(const std::string& arg, const bool _use_libtool_arg) : + _pid(-1), + _status(0), + _app_exit_state(UNINITIALIZED) +- { ++ { + if (_use_libtool) + { + if (libtool() == NULL) +@@ -210,7 +210,7 @@ Application::error_t Application::run(const char *args[]) + fatal_assert(posix_spawnattr_setpgroup(&spawnattr, 0) == 0); + + fatal_assert(posix_spawnattr_setflags(&spawnattr, flags) == 0); +- ++ + create_argv(args); + + int spawn_ret; +@@ -221,7 +221,7 @@ Application::error_t Application::run(const char *args[]) + file_stream.open(gdb_run_file.c_str(), std::fstream::out | std::fstream::trunc); + + _gdb_filename= create_tmpfile(_exectuble_name); +- file_stream ++ file_stream + << "set logging redirect on" << std::endl + << "set logging file " << _gdb_filename << std::endl + << "set logging overwrite on" << std::endl +@@ -244,8 +244,8 @@ Application::error_t Application::run(const char *args[]) + const_cast<char *>("-batch"), + const_cast<char *>("-f"), + const_cast<char *>("-x"), +- const_cast<char *>(gdb_run_file.c_str()), +- const_cast<char *>(_exectuble_with_path.c_str()), ++ const_cast<char *>(gdb_run_file.c_str()), ++ const_cast<char *>(_exectuble_with_path.c_str()), + 0}; + + spawn_ret= posix_spawnp(&_pid, libtool(), &file_actions, &spawnattr, argv, environ); +@@ -258,8 +258,8 @@ Application::error_t Application::run(const char *args[]) + const_cast<char *>("-batch"), + const_cast<char *>("-f"), + const_cast<char *>("-x"), +- const_cast<char *>(gdb_run_file.c_str()), +- const_cast<char *>(_exectuble_with_path.c_str()), ++ const_cast<char *>(gdb_run_file.c_str()), ++ const_cast<char *>(_exectuble_with_path.c_str()), + 0}; + spawn_ret= posix_spawnp(&_pid, "gdb", &file_actions, &spawnattr, argv, environ); + } +@@ -419,7 +419,7 @@ Application::error_t Application::join() + /* + What we are looking for here is how the exit status happened. + - 127 means that posix_spawn() itself had an error. +- - If WEXITSTATUS is positive we need to see if it is a signal that we sent to kill the process. If not something bad happened in the process itself. ++ - If WEXITSTATUS is positive we need to see if it is a signal that we sent to kill the process. If not something bad happened in the process itself. + - Finally something has happened that we don't currently understand. + */ + if (WEXITSTATUS(_status) == 127) +@@ -466,7 +466,7 @@ Application::error_t Application::join() + if (DEBUG) + { + Out << "waitpid() application terminated at request" +- << " pid:" << _pid ++ << " pid:" << _pid + << " name:" << built_argv[0]; + } + #endif +@@ -474,7 +474,7 @@ Application::error_t Application::join() + else + { + _app_exit_state= Application::UNKNOWN; +- Error << "Unknown logic state at exit:" << WEXITSTATUS(_status) ++ Error << "Unknown logic state at exit:" << WEXITSTATUS(_status) + << " pid:" << _pid + << " name:" << built_argv[0]; + } +@@ -591,7 +591,7 @@ bool Application::Pipe::read(libtest::vchar_t& arg) + void Application::Pipe::nonblock() + { + int flags; +- do ++ do + { + flags= fcntl(_pipe_fd[READ], F_GETFL, 0); + } while (flags == -1 and (errno == EINTR or errno == EAGAIN)); +@@ -641,10 +641,10 @@ void Application::Pipe::cloexec() + { + //if (SOCK_CLOEXEC == 0) + { +- if (FD_CLOEXEC) ++ if (FD_CLOEXEC) + { + int flags; +- do ++ do + { + flags= fcntl(_pipe_fd[WRITE], F_GETFD, 0); + } while (flags == -1 and (errno == EINTR or errno == EAGAIN)); +@@ -657,7 +657,7 @@ void Application::Pipe::cloexec() + + int rval; + do +- { ++ { + rval= fcntl(_pipe_fd[WRITE], F_SETFD, flags | FD_CLOEXEC); + } while (rval == -1 && (errno == EINTR or errno == EAGAIN)); + +@@ -752,7 +752,7 @@ void Application::create_argv(const char *args[]) + else if (_use_ptrcheck) + { + /* +- valgrind --error-exitcode=1 --tool=exp-ptrcheck --log-file= ++ valgrind --error-exitcode=1 --tool=exp-ptrcheck --log-file= + */ + vchar::append(built_argv, "valgrind"); + vchar::append(built_argv, "--error-exitcode=1"); +diff --git a/util/log.hpp b/util/log.hpp +index 662ef5f..1e3c35b 100644 +--- a/util/log.hpp ++++ b/util/log.hpp +@@ -40,6 +40,7 @@ + #include <cstdarg> + #include <cstdio> + #include <fcntl.h> ++#include <cstring> + #include <iostream> + #include <string> + #include <syslog.h> diff --git a/lib/patches/memcached/1.0.18_fix_dump_return_code.patch b/lib/patches/memcached/1.0.18_fix_dump_function.patch index 7c7277d8..cd34d3ed 100644 --- a/lib/patches/memcached/1.0.18_fix_dump_return_code.patch +++ b/lib/patches/memcached/1.0.18_fix_dump_function.patch @@ -1,5 +1,5 @@ diff --git a/libmemcached/dump.cc b/libmemcached/dump.cc -index 8ddb2ee..36068ee 100644 +index 8ddb2ee..ce09190 100644 --- a/libmemcached/dump.cc +++ b/libmemcached/dump.cc @@ -1,5 +1,5 @@ @@ -9,40 +9,59 @@ index 8ddb2ee..36068ee 100644 * Libmemcached library * * Copyright (C) 2011 Data Differential, http://datadifferential.com/ -@@ -46,14 +46,15 @@ +@@ -46,32 +46,113 @@ static memcached_return_t ascii_dump(Memcached *memc, memcached_dump_fn *callback, void *context, uint32_t number_of_callbacks) { - /* MAX_NUMBER_OF_SLAB_CLASSES is defined to 200 in Memcached 1.4.10 */ +- for (uint32_t x= 0; x < 200; x++) + -+ /* MAX_NUMBER_OF_SLAB_CLASSES is defined as 200 for memcached versions up to 1.4.22 and redefined to 64 above that.*/ - for (uint32_t x= 0; x < 200; x++) ++ if (memcached_server_count(memc) == 0) ++ return MEMCACHED_NO_SERVERS; ++ ++ if (memcached_version(memc) != MEMCACHED_SUCCESS) ++ return MEMCACHED_ERROR; ++ ++ ++ for (uint32_t server_key= 0; server_key < memcached_server_count(memc); server_key++) { - char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE]; - int buffer_length= snprintf(buffer, sizeof(buffer), "%u", x); - if (size_t(buffer_length) >= sizeof(buffer) or buffer_length < 0) - { +- char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE]; +- 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,66 +71,80 @@ static memcached_return_t ascii_dump(Memcached *memc, memcached_dump_fn *callbac - { - memcached_instance_st* instance= memcached_instance_fetch(memc, server_key); - -- memcached_return_t vdo_rc; -- if (memcached_success((vdo_rc= memcached_vdo(instance, vector, 3, true)))) -- { -- // We have sent the message to the server successfully -- } -- else -+ // Starting with version 1.4.23 the slab size went from 200 to 63. -+ if (x <= 63 || -+ (instance->major_version == 1 && instance->minor_version == 4 && instance->micro_version < 23) || -+ (instance->major_version <= 1 && instance->minor_version < 4)) - { -- return vdo_rc; +- memcached_literal_param("snprintf(MEMCACHED_DEFAULT_COMMAND_SIZE)")); ++ ++ memcached_instance_st* instance= memcached_instance_fetch(memc, server_key); ++ ++ /* The lru_metacrawler metadump doesn't arrive until version 1.4.33. */ ++ if ((instance->major_version == 1 && instance->minor_version == 4 && instance->micro_version < 33) || ++ (instance->major_version <= 1 && instance->minor_version < 4)) { ++ ++ uint32_t slabs= 64; ++ int buffer_length; ++ char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE]; ++ ++ /* The number of slabs descreased from 200 to 64 with version 1.4.23. Dumping versions with 256 slabs is unsupported. */ ++ if (instance->major_version == 1 && instance->minor_version == 4 && instance->micro_version < 23) ++ slabs= 200; ++ ++ for (uint32_t x= 0; x < slabs; x++) ++ { ++ 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, ++ memcached_literal_param("snprintf(MEMCACHED_DEFAULT_COMMAND_SIZE)")); ++ } ++ ++ libmemcached_io_vector_st vector[]= ++ { ++ { memcached_literal_param("stats cachedump ") }, ++ { buffer, size_t(buffer_length) }, ++ { memcached_literal_param(" 0\r\n") } ++ }; ++ + memcached_return_t vdo_rc; + if (memcached_success((vdo_rc= memcached_vdo(instance, vector, 3, true)))) + { @@ -52,30 +71,99 @@ index 8ddb2ee..36068ee 100644 + { + return vdo_rc; + } - } ++ ++ memcached_return_t response_rc; ++ while ((response_rc = memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL)) != MEMCACHED_END) { ++ if (response_rc == MEMCACHED_ITEM) ++ { ++ char *string_ptr, *end_ptr; ++ ++ string_ptr= buffer; ++ string_ptr+= 5; /* Move past ITEM */ ++ ++ for (end_ptr= string_ptr; isgraph(*end_ptr); end_ptr++) {} ; ++ ++ char *key= string_ptr; ++ key[(size_t)(end_ptr-string_ptr)]= 0; ++ ++ for (uint32_t callback_counter= 0; callback_counter < number_of_callbacks; callback_counter++) ++ { ++ memcached_return_t callback_rc= (*callback[callback_counter])(memc, key, (size_t)(end_ptr-string_ptr), context); ++ if (callback_rc != MEMCACHED_SUCCESS) ++ { ++ // @todo build up a message for the error from the value ++ memcached_set_error(*instance, callback_rc, MEMCACHED_AT); ++ break; ++ } ++ } ++ } ++ else if (response_rc == MEMCACHED_SERVER_ERROR or response_rc == MEMCACHED_CLIENT_ERROR or response_rc == MEMCACHED_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. ++ */ ++ assert(response_rc == MEMCACHED_SUCCESS); // Just fail ++ return response_rc; ++ } ++ else ++ { ++ // IO error of some sort must have occurred ++ return response_rc; ++ } ++ } ++ } ++ } - // Collect the returned items +- // @NOTE the hard coded zero means "no limit" +- libmemcached_io_vector_st vector[]= +- { +- { memcached_literal_param("stats cachedump ") }, +- { buffer, size_t(buffer_length) }, +- { memcached_literal_param(" 0\r\n") } +- }; ++ else { + +- // Send message to all servers +- for (uint32_t server_key= 0; server_key < memcached_server_count(memc); server_key++) +- { +- memcached_instance_st* instance= memcached_instance_fetch(memc, server_key); ++ libmemcached_io_vector_st vector[]= ++ { ++ { memcached_literal_param("lru_crawler metadump all\r\n") } ++ }; + + memcached_return_t vdo_rc; +- if (memcached_success((vdo_rc= memcached_vdo(instance, vector, 3, true)))) ++ if (memcached_success((vdo_rc= memcached_vdo(instance, vector, 1, true)))) + { + // We have sent the message to the server successfully + } +@@ -79,62 +160,59 @@ static memcached_return_t ascii_dump(Memcached *memc, memcached_dump_fn *callbac + { + return vdo_rc; + } +- } + +- // Collect the returned items - memcached_instance_st* instance; - memcached_return_t read_ret= MEMCACHED_SUCCESS; - while ((instance= memcached_io_get_readable_server(memc, read_ret))) -+ for (uint32_t server_key= 0; server_key < memcached_server_count(memc); server_key++) - { +- { - memcached_return_t response_rc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL); - if (response_rc == MEMCACHED_ITEM) -+ 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 (x <= 63 || -+ (instance->major_version == 1 && instance->minor_version == 4 && instance->micro_version < 23) || -+ (instance->major_version <= 1 && instance->minor_version < 4)) - { +- { - char *string_ptr, *end_ptr; ++ memcached_return_t response_rc; ++ char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE]; ++ while ((response_rc = memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL)) != MEMCACHED_END) { - string_ptr= buffer; - string_ptr+= 5; /* Move past ITEM */ -+ memcached_return_t read_ret= memcached_io_wait_for_read(instance); -+ memcached_return_t response_rc= memcached_response(instance, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL); + if (response_rc == MEMCACHED_ITEM) + { + char *string_ptr, *end_ptr; @@ -130,10 +218,7 @@ index 8ddb2ee..36068ee 100644 - { - // IO error of some sort must have occurred - return response_rc; -+ 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) + { + /* If we try to request stats cachedump for a slab class that is too big @@ -151,10 +236,18 @@ index 8ddb2ee..36068ee 100644 + // IO error of some sort must have occurred + return response_rc; + } - } ++ ++ } } ++ } -@@ -146,7 +161,7 @@ memcached_return_t memcached_dump(memcached_st *shell, memcached_dump_fn *callba + + return memcached_has_current_error(*memc) ? MEMCACHED_SOME_ERRORS : MEMCACHED_SUCCESS; ++ + } + + memcached_return_t memcached_dump(memcached_st *shell, memcached_dump_fn *callback, void *context, uint32_t number_of_callbacks) +@@ -146,7 +224,7 @@ memcached_return_t memcached_dump(memcached_st *shell, memcached_dump_fn *callba return rc; } @@ -164,7 +257,7 @@ index 8ddb2ee..36068ee 100644 @todo Fix this so that we just flush, switch to ascii, and then go back to binary. */ diff --git a/tests/libmemcached-1.0/dump.cc b/tests/libmemcached-1.0/dump.cc -index 03704cf..28a26d0 100644 +index 03704cf..faf495e 100644 --- a/tests/libmemcached-1.0/dump.cc +++ b/tests/libmemcached-1.0/dump.cc @@ -1,5 +1,5 @@ @@ -185,23 +278,7 @@ index 03704cf..28a26d0 100644 void *context) { size_t *counter= (size_t *)context; -@@ -105,11 +105,14 @@ test_return_t memcached_dump_TEST(memcached_st *memc) - } - #endif - --#define memcached_dump_TEST2_COUNT 64 -+#define memcached_dump_TEST2_COUNT 4096 - test_return_t memcached_dump_TEST2(memcached_st *memc) - { - test_skip(false, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL)); - -+ test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, MEMCACHED_DISTRIBUTION_CONSISTENT)); -+ test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_MURMUR)); -+ - /* The dump test relies on there being at least 32 items in memcached */ - for (uint32_t x= 0; x < memcached_dump_TEST2_COUNT; x++) - { -@@ -121,9 +124,10 @@ test_return_t memcached_dump_TEST2(memcached_st *memc) +@@ -121,8 +121,8 @@ test_return_t memcached_dump_TEST2(memcached_st *memc) test_compare(MEMCACHED_SUCCESS, memcached_set(memc, key, length, @@ -210,7 +287,5 @@ index 03704cf..28a26d0 100644 + key, length, // Zero length values + time_t(0) + 120, uint32_t(0))); } -+ memcached_flush_buffers(memc); memcached_quit(memc); - uint64_t counter= 0; diff --git a/lib/patches/memcached/1.0.18_fix_invalid_comparison.patch b/lib/patches/memcached/1.0.18_fix_invalid_comparison.patch new file mode 100644 index 00000000..254fa0bb --- /dev/null +++ b/lib/patches/memcached/1.0.18_fix_invalid_comparison.patch @@ -0,0 +1,22 @@ +diff --git a/clients/memflush.cc b/clients/memflush.cc +index 8bd0dbf..7641b88 100644 +--- a/clients/memflush.cc ++++ b/clients/memflush.cc +@@ -39,7 +39,7 @@ int main(int argc, char *argv[]) + { + options_parse(argc, argv); + +- if (opt_servers == false) ++ if (!opt_servers) + { + char *temp; + +@@ -48,7 +48,7 @@ int main(int argc, char *argv[]) + opt_servers= strdup(temp); + } + +- if (opt_servers == false) ++ if (!opt_servers) + { + std::cerr << "No Servers provided" << std::endl; + exit(EXIT_FAILURE); diff --git a/lib/patches/memcached/1.0.18_fix_ketama_segfaults.patch b/lib/patches/memcached/1.0.18_fix_ketama_segfaults.patch new file mode 100644 index 00000000..01bcfa82 --- /dev/null +++ b/lib/patches/memcached/1.0.18_fix_ketama_segfaults.patch @@ -0,0 +1,38 @@ +diff --git a/libmemcached/memcached.cc b/libmemcached/memcached.cc +index 337f918..9e1ed0e 100644 +--- a/libmemcached/memcached.cc ++++ b/libmemcached/memcached.cc +@@ -1,5 +1,5 @@ + /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: +- * ++ * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ +@@ -146,6 +146,8 @@ static void __memcached_free(Memcached *ptr, bool release_st) + + libmemcached_free(ptr, ptr->ketama.continuum); + ptr->ketama.continuum= NULL; ++ ptr->ketama.continuum_count= 0; ++ ptr->ketama.continuum_points_counter= 0; + + memcached_array_free(ptr->_namespace); + ptr->_namespace= NULL; +@@ -244,7 +246,7 @@ memcached_st *memcached(const char *string, size_t length) + { + rc= memcached_parse_configure_file(*memc, memcached_parse_filename(memc), memcached_parse_filename_length(memc)); + } +- ++ + if (memcached_failed(rc)) + { + memcached_free(memc); +@@ -285,6 +287,8 @@ void memcached_servers_reset(memcached_st *shell) + { + libmemcached_free(self, self->ketama.continuum); + self->ketama.continuum= NULL; ++ self->ketama.continuum_count= 0; ++ self->ketama.continuum_points_counter= 0; + + memcached_instance_list_free(memcached_instance_list(self), self->number_of_hosts); + memcached_instance_set(self, NULL, 0); diff --git a/lib/patches/memcached/1.0.18_fix_pthread_linking.patch b/lib/patches/memcached/1.0.18_fix_pthread_linking.patch new file mode 100644 index 00000000..189d1178 --- /dev/null +++ b/lib/patches/memcached/1.0.18_fix_pthread_linking.patch @@ -0,0 +1,18 @@ +diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh +index 63ae69d..a27fe41 100644 +--- a/build-aux/ltmain.sh ++++ b/build-aux/ltmain.sh +@@ -5664,6 +5664,13 @@ func_mode_link () + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac ++ # Handle the need for linking against libpthread even though nostdlib is in use. ++ if test "$tagname" = CXX -a x"$with_gcc" = xyes; then ++ case "$arg" in ++ -pthread*) func_append deplibs " -lpthread" ;; ++ esac ++ fi ++ + continue + ;; + |