diff options
author | Ladar Levison <ladar@lavabit.com> | 2019-01-29 23:33:33 +0300 |
---|---|---|
committer | Ladar Levison <ladar@lavabit.com> | 2019-01-29 23:33:33 +0300 |
commit | b708655560cde9bbbe898d2dd397a7f62cc316c3 (patch) | |
tree | 6b6293704ce1f9403e775078c48fba2b8dd940b5 | |
parent | ce991690b350bf717462ba6dbebb38a2f60e1495 (diff) |
Adding key support for lru_crawler responses.
-rwxr-xr-x | dev/scripts/builders/build.lib.sh | 2 | ||||
-rw-r--r-- | lib/patches/memcached/1.0.18_add_key_response_support.patch | 66 | ||||
-rw-r--r-- | lib/patches/memcached/1.0.18_fix_dump_function.patch | 2 |
3 files changed, 69 insertions, 1 deletions
diff --git a/dev/scripts/builders/build.lib.sh b/dev/scripts/builders/build.lib.sh index 1ae647d0..42803668 100755 --- a/dev/scripts/builders/build.lib.sh +++ b/dev/scripts/builders/build.lib.sh @@ -2151,6 +2151,8 @@ memcached() { cat "$M_PATCHES/memcached/"1.0.18_fix_ketama_segfaults.patch | patch -p1 --verbose &>> "$M_LOGS/memcached.txt"; error # Handle systems which require the use of -nostdlib by adding -lpthread to the linker flags. cat "$M_PATCHES/memcached/"1.0.18_fix_pthread_linking.patch | patch -p1 --verbose &>> "$M_LOGS/memcached.txt"; error + # Return key responses from lru_crawler requests. + cat "$M_PATCHES/memcached/"1.0.18_add_key_response_support.patch | patch -p1 --verbose &>> "$M_LOGS/memcached.txt"; error # New versions of aclocal fail if the AC_CONFIG_AUX_DIR directive follows the AC_PROG_{CC,CXX} lines. # cat "$M_PATCHES/memcached/"1.0.18_fix_aclocal_errors.patch | patch -p1 --verbose &>> "$M_LOGS/memcached.txt"; error diff --git a/lib/patches/memcached/1.0.18_add_key_response_support.patch b/lib/patches/memcached/1.0.18_add_key_response_support.patch new file mode 100644 index 00000000..75879f1d --- /dev/null +++ b/lib/patches/memcached/1.0.18_add_key_response_support.patch @@ -0,0 +1,66 @@ +diff --git a/libmemcached/response.cc b/libmemcached/response.cc +index ad3c078..dc66a68 100644 +--- a/libmemcached/response.cc ++++ b/libmemcached/response.cc +@@ -182,7 +182,7 @@ static memcached_return_t textual_value_fetch(memcached_instance_st* instance, + if ((destination= hashkit_decrypt(&instance->root->hashkit, + memcached_result_value(result), memcached_result_length(result))) == NULL) + { +- rc= memcached_set_error(*instance->root, MEMCACHED_FAILURE, ++ rc= memcached_set_error(*instance->root, MEMCACHED_FAILURE, + MEMCACHED_AT, memcached_literal_param("hashkit_decrypt() failed")); + } + else +@@ -190,7 +190,7 @@ static memcached_return_t textual_value_fetch(memcached_instance_st* instance, + memcached_result_reset_value(result); + if (memcached_failed(memcached_result_set_value(result, hashkit_string_c_str(destination), hashkit_string_length(destination)))) + { +- rc= memcached_set_error(*instance->root, MEMCACHED_FAILURE, ++ rc= memcached_set_error(*instance->root, MEMCACHED_FAILURE, + MEMCACHED_AT, memcached_literal_param("hashkit_decrypt() failed")); + } + } +@@ -295,7 +295,7 @@ static memcached_return_t textual_read_one_response(memcached_instance_st* insta + } + // SERVER_ERROR + else if (buffer[1] == 'E' and buffer[2] == 'R' and buffer[3] == 'V' and buffer[4] == 'E' and buffer[5] == 'R' +- and buffer[6] == '_' ++ and buffer[6] == '_' + and buffer[7] == 'E' and buffer[8] == 'R' and buffer[9] == 'R' and buffer[10] == 'O' and buffer[11] == 'R' ) + { + if (total_read == memcached_literal_param_size("SERVER_ERROR")) +@@ -348,14 +348,14 @@ static memcached_return_t textual_read_one_response(memcached_instance_st* insta + case 'N': + { + // NOT_FOUND +- if (buffer[1] == 'O' and buffer[2] == 'T' ++ if (buffer[1] == 'O' and buffer[2] == 'T' + and buffer[3] == '_' + and buffer[4] == 'F' and buffer[5] == 'O' and buffer[6] == 'U' and buffer[7] == 'N' and buffer[8] == 'D') + { + return MEMCACHED_NOTFOUND; + } + // NOT_STORED +- else if (buffer[1] == 'O' and buffer[2] == 'T' ++ else if (buffer[1] == 'O' and buffer[2] == 'T' + and buffer[3] == '_' + and buffer[4] == 'S' and buffer[5] == 'T' and buffer[6] == 'O' and buffer[7] == 'R' and buffer[8] == 'E' and buffer[9] == 'D') + { +@@ -415,6 +415,17 @@ static memcached_return_t textual_read_one_response(memcached_instance_st* insta + } + break; + ++ case 'k': /* key */ ++ { ++ // lru_crawler key responses ++ if (buffer[1] == 'e' and buffer[2] == 'y' and buffer[3] == '=') ++ { ++ /* We add back in one because we will need to search for END */ ++ memcached_server_response_increment(instance); ++ return MEMCACHED_ITEM; ++ } ++ } ++ + case 'C': /* CLIENT ERROR */ + { + // CLIENT_ERROR diff --git a/lib/patches/memcached/1.0.18_fix_dump_function.patch b/lib/patches/memcached/1.0.18_fix_dump_function.patch index 980a4950..28656d96 100644 --- a/lib/patches/memcached/1.0.18_fix_dump_function.patch +++ b/lib/patches/memcached/1.0.18_fix_dump_function.patch @@ -36,7 +36,7 @@ index 8ddb2ee..ce09190 100644 + + /* 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) || (instance->major_version <= 99)) { ++ (instance->major_version <= 1 && instance->minor_version < 4)) { + + uint32_t slabs= 64; + int buffer_length; |