From 27381720516540c89260c057e2c0761246004498 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja@tarantool.org> Date: Sun, 1 Sep 2013 00:48:28 +0400 Subject: [PATCH] ttps://blueprints.launchpad.net/tarantool/+spec/obsolete-memcached-protocol Remove memcached support in 1.6. We're about to change the type system. About to add authentication. This all makes supporting memcache within the core too cumbersome. --- cfg/tarantool_box_cfg.c | 204 ------ cfg/tarantool_box_cfg.h | 15 - include/memcached.h | 45 -- src/CMakeLists.txt | 38 +- src/box/box_cfg.cfg_tmpl | 12 - src/memcached-grammar.rl | 337 ---------- src/memcached.cc | 619 ------------------ src/tarantool.cc | 18 +- test/box/admin.result | 35 +- test/box/lua.result | 107 ++- test/box/lua_misc.result | 2 +- test/memcached/binary-get.result | 32 - test/memcached/binary-get.test.py | 16 - test/memcached/bogus-commands.result | 2 - test/memcached/bogus-commands.test.py | 3 - test/memcached/cas.result | 79 --- test/memcached/cas.test.py | 119 ---- test/memcached/cfg/master.cfg | 25 - .../memcached/cfg/tarantool_memcached_bad.cfg | 52 -- .../memcached/cfg/tarantool_memcached_off.cfg | 52 -- test/memcached/expirations.result | 46 -- test/memcached/expirations.test.py | 83 --- test/memcached/flags.result | 24 - test/memcached/flags.test.py | 16 - test/memcached/flush-all.result | 37 -- test/memcached/flush-all.test.py | 43 -- test/memcached/getset.result | 145 ---- test/memcached/getset.test.py | 83 --- test/memcached/incrdecr.result | 53 -- test/memcached/incrdecr.test.py | 39 -- test/memcached/lua.result | 20 - test/memcached/lua.test.lua | 5 - test/memcached/multiversioning.result | 31 - test/memcached/multiversioning.test.py | 39 -- test/memcached/noreply.result | 55 -- test/memcached/noreply.test.py | 44 -- test/memcached/off.result | 62 -- test/memcached/off.test.py | 35 - test/memcached/suite.ini | 7 - test/replication/cfg/hot_standby.cfg | 9 - test/replication/cfg/master.cfg | 10 - test/replication/cfg/master_to_replica.cfg | 11 - test/replication/cfg/replica.cfg | 10 - test/replication/cfg/replica_to_master.cfg | 10 - test/replication/suite.ini | 1 + 45 files changed, 66 insertions(+), 2664 deletions(-) delete mode 100644 include/memcached.h delete mode 100644 src/memcached-grammar.rl delete mode 100644 src/memcached.cc delete mode 100644 test/memcached/binary-get.result delete mode 100644 test/memcached/binary-get.test.py delete mode 100644 test/memcached/bogus-commands.result delete mode 100644 test/memcached/bogus-commands.test.py delete mode 100644 test/memcached/cas.result delete mode 100644 test/memcached/cas.test.py delete mode 100644 test/memcached/cfg/master.cfg delete mode 100644 test/memcached/cfg/tarantool_memcached_bad.cfg delete mode 100644 test/memcached/cfg/tarantool_memcached_off.cfg delete mode 100644 test/memcached/expirations.result delete mode 100644 test/memcached/expirations.test.py delete mode 100644 test/memcached/flags.result delete mode 100644 test/memcached/flags.test.py delete mode 100644 test/memcached/flush-all.result delete mode 100644 test/memcached/flush-all.test.py delete mode 100644 test/memcached/getset.result delete mode 100644 test/memcached/getset.test.py delete mode 100644 test/memcached/incrdecr.result delete mode 100644 test/memcached/incrdecr.test.py delete mode 100644 test/memcached/lua.result delete mode 100644 test/memcached/lua.test.lua delete mode 100644 test/memcached/multiversioning.result delete mode 100644 test/memcached/multiversioning.test.py delete mode 100644 test/memcached/noreply.result delete mode 100644 test/memcached/noreply.test.py delete mode 100644 test/memcached/off.result delete mode 100644 test/memcached/off.test.py delete mode 100644 test/memcached/suite.ini diff --git a/cfg/tarantool_box_cfg.c b/cfg/tarantool_box_cfg.c index 045aac6562..8075630bf8 100644 --- a/cfg/tarantool_box_cfg.c +++ b/cfg/tarantool_box_cfg.c @@ -59,11 +59,6 @@ init_tarantool_cfg(tarantool_cfg *c) { c->secondary_port = 0; c->too_long_threshold = 0; c->custom_proc_title = NULL; - c->memcached_port = 0; - c->memcached_space = 0; - c->memcached_expire = false; - c->memcached_expire_per_loop = 0; - c->memcached_expire_full_sweep = 0; c->replication_source = NULL; } @@ -108,11 +103,6 @@ fill_default_tarantool_cfg(tarantool_cfg *c) { c->secondary_port = 0; c->too_long_threshold = 0.5; c->custom_proc_title = NULL; - c->memcached_port = 0; - c->memcached_space = 23; - c->memcached_expire = false; - c->memcached_expire_per_loop = 1024; - c->memcached_expire_full_sweep = 3600; c->replication_source = NULL; return 0; } @@ -217,21 +207,6 @@ static NameAtom _name__too_long_threshold[] = { static NameAtom _name__custom_proc_title[] = { { "custom_proc_title", -1, NULL } }; -static NameAtom _name__memcached_port[] = { - { "memcached_port", -1, NULL } -}; -static NameAtom _name__memcached_space[] = { - { "memcached_space", -1, NULL } -}; -static NameAtom _name__memcached_expire[] = { - { "memcached_expire", -1, NULL } -}; -static NameAtom _name__memcached_expire_per_loop[] = { - { "memcached_expire_per_loop", -1, NULL } -}; -static NameAtom _name__memcached_expire_full_sweep[] = { - { "memcached_expire_full_sweep", -1, NULL } -}; static NameAtom _name__replication_source[] = { { "replication_source", -1, NULL } }; @@ -708,81 +683,6 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { if (opt->paramValue.scalarval && c->custom_proc_title == NULL) return CNF_NOMEMORY; } - else if ( cmpNameAtoms( opt->name, _name__memcached_port) ) { - if (opt->paramType != scalarType ) - return CNF_WRONGTYPE; - c->__confetti_flags &= ~CNF_FLAG_STRUCT_NOTSET; - errno = 0; - long int i32 = strtol(opt->paramValue.scalarval, NULL, 10); - if (i32 == 0 && errno == EINVAL) - return CNF_WRONGINT; - if ( (i32 == LONG_MIN || i32 == LONG_MAX) && errno == ERANGE) - return CNF_WRONGRANGE; - if (check_rdonly && c->memcached_port != i32) - return CNF_RDONLY; - c->memcached_port = i32; - } - else if ( cmpNameAtoms( opt->name, _name__memcached_space) ) { - if (opt->paramType != scalarType ) - return CNF_WRONGTYPE; - c->__confetti_flags &= ~CNF_FLAG_STRUCT_NOTSET; - errno = 0; - long int i32 = strtol(opt->paramValue.scalarval, NULL, 10); - if (i32 == 0 && errno == EINVAL) - return CNF_WRONGINT; - if ( (i32 == LONG_MIN || i32 == LONG_MAX) && errno == ERANGE) - return CNF_WRONGRANGE; - if (check_rdonly && c->memcached_space != i32) - return CNF_RDONLY; - c->memcached_space = i32; - } - else if ( cmpNameAtoms( opt->name, _name__memcached_expire) ) { - if (opt->paramType != scalarType ) - return CNF_WRONGTYPE; - c->__confetti_flags &= ~CNF_FLAG_STRUCT_NOTSET; - errno = 0; - bool bln; - - if (strcasecmp(opt->paramValue.scalarval, "true") == 0 || - strcasecmp(opt->paramValue.scalarval, "yes") == 0 || - strcasecmp(opt->paramValue.scalarval, "enable") == 0 || - strcasecmp(opt->paramValue.scalarval, "on") == 0 || - strcasecmp(opt->paramValue.scalarval, "1") == 0 ) - bln = true; - else if (strcasecmp(opt->paramValue.scalarval, "false") == 0 || - strcasecmp(opt->paramValue.scalarval, "no") == 0 || - strcasecmp(opt->paramValue.scalarval, "disable") == 0 || - strcasecmp(opt->paramValue.scalarval, "off") == 0 || - strcasecmp(opt->paramValue.scalarval, "0") == 0 ) - bln = false; - else - return CNF_WRONGRANGE; - if (check_rdonly && c->memcached_expire != bln) - return CNF_RDONLY; - c->memcached_expire = bln; - } - else if ( cmpNameAtoms( opt->name, _name__memcached_expire_per_loop) ) { - if (opt->paramType != scalarType ) - return CNF_WRONGTYPE; - c->__confetti_flags &= ~CNF_FLAG_STRUCT_NOTSET; - errno = 0; - long int i32 = strtol(opt->paramValue.scalarval, NULL, 10); - if (i32 == 0 && errno == EINVAL) - return CNF_WRONGINT; - if ( (i32 == LONG_MIN || i32 == LONG_MAX) && errno == ERANGE) - return CNF_WRONGRANGE; - c->memcached_expire_per_loop = i32; - } - else if ( cmpNameAtoms( opt->name, _name__memcached_expire_full_sweep) ) { - if (opt->paramType != scalarType ) - return CNF_WRONGTYPE; - c->__confetti_flags &= ~CNF_FLAG_STRUCT_NOTSET; - errno = 0; - double dbl = strtod(opt->paramValue.scalarval, NULL); - if ( (dbl == 0 || dbl == -HUGE_VAL || dbl == HUGE_VAL) && errno == ERANGE) - return CNF_WRONGRANGE; - c->memcached_expire_full_sweep = dbl; - } else if ( cmpNameAtoms( opt->name, _name__replication_source) ) { if (opt->paramType != scalarType ) return CNF_WRONGTYPE; @@ -799,8 +699,6 @@ acceptValue(tarantool_cfg* c, OptDef* opt, int check_rdonly) { return CNF_OK; } -static void cleanFlags(tarantool_cfg* c, OptDef* opt); - #define PRINTBUFLEN 8192 static char* dumpOptDef(NameAtom *atom) { @@ -822,7 +720,6 @@ dumpOptDef(NameAtom *atom) { static void acceptCfgDef(tarantool_cfg *c, OptDef *opt, int check_rdonly, int *n_accepted, int *n_skipped, int *n_optional) { ConfettyError r; - OptDef *orig_opt = opt; while(opt) { r = acceptValue(c, opt, check_rdonly); @@ -874,8 +771,6 @@ acceptCfgDef(tarantool_cfg *c, OptDef *opt, int check_rdonly, int *n_accepted, i opt = opt->next; } - - cleanFlags(c, orig_opt); } int @@ -940,11 +835,6 @@ typedef enum IteratorState { S_name__secondary_port, S_name__too_long_threshold, S_name__custom_proc_title, - S_name__memcached_port, - S_name__memcached_space, - S_name__memcached_expire, - S_name__memcached_expire_per_loop, - S_name__memcached_expire_full_sweep, S_name__replication_source, _S_Finished } IteratorState; @@ -1299,61 +1189,6 @@ tarantool_cfg_iterator_next(tarantool_cfg_iterator_t* i, tarantool_cfg *c, char return NULL; } snprintf(buf, PRINTBUFLEN-1, "custom_proc_title"); - i->state = S_name__memcached_port; - return buf; - case S_name__memcached_port: - *v = malloc(32); - if (*v == NULL) { - free(i); - out_warning(CNF_NOMEMORY, "No memory to output value"); - return NULL; - } - sprintf(*v, "%"PRId32, c->memcached_port); - snprintf(buf, PRINTBUFLEN-1, "memcached_port"); - i->state = S_name__memcached_space; - return buf; - case S_name__memcached_space: - *v = malloc(32); - if (*v == NULL) { - free(i); - out_warning(CNF_NOMEMORY, "No memory to output value"); - return NULL; - } - sprintf(*v, "%"PRId32, c->memcached_space); - snprintf(buf, PRINTBUFLEN-1, "memcached_space"); - i->state = S_name__memcached_expire; - return buf; - case S_name__memcached_expire: - *v = malloc(8); - if (*v == NULL) { - free(i); - out_warning(CNF_NOMEMORY, "No memory to output value"); - return NULL; - } - sprintf(*v, "%s", c->memcached_expire ? "true" : "false"); - snprintf(buf, PRINTBUFLEN-1, "memcached_expire"); - i->state = S_name__memcached_expire_per_loop; - return buf; - case S_name__memcached_expire_per_loop: - *v = malloc(32); - if (*v == NULL) { - free(i); - out_warning(CNF_NOMEMORY, "No memory to output value"); - return NULL; - } - sprintf(*v, "%"PRId32, c->memcached_expire_per_loop); - snprintf(buf, PRINTBUFLEN-1, "memcached_expire_per_loop"); - i->state = S_name__memcached_expire_full_sweep; - return buf; - case S_name__memcached_expire_full_sweep: - *v = malloc(32); - if (*v == NULL) { - free(i); - out_warning(CNF_NOMEMORY, "No memory to output value"); - return NULL; - } - sprintf(*v, "%g", c->memcached_expire_full_sweep); - snprintf(buf, PRINTBUFLEN-1, "memcached_expire_full_sweep"); i->state = S_name__replication_source; return buf; case S_name__replication_source: @@ -1388,11 +1223,6 @@ check_cfg_tarantool_cfg(tarantool_cfg *c) { return res; } -static void -cleanFlags(tarantool_cfg* c __attribute__((unused)), OptDef* opt __attribute__((unused))) { - -} - /************** Duplicate config **************/ int @@ -1449,11 +1279,6 @@ dup_tarantool_cfg(tarantool_cfg* dst, tarantool_cfg* src) { if (dst->custom_proc_title) free(dst->custom_proc_title);dst->custom_proc_title = src->custom_proc_title == NULL ? NULL : strdup(src->custom_proc_title); if (src->custom_proc_title != NULL && dst->custom_proc_title == NULL) return CNF_NOMEMORY; - dst->memcached_port = src->memcached_port; - dst->memcached_space = src->memcached_space; - dst->memcached_expire = src->memcached_expire; - dst->memcached_expire_per_loop = src->memcached_expire_per_loop; - dst->memcached_expire_full_sweep = src->memcached_expire_full_sweep; if (dst->replication_source) free(dst->replication_source);dst->replication_source = src->replication_source == NULL ? NULL : strdup(src->replication_source); if (src->replication_source != NULL && dst->replication_source == NULL) return CNF_NOMEMORY; @@ -1677,35 +1502,6 @@ cmp_tarantool_cfg(tarantool_cfg* c1, tarantool_cfg* c2, int only_check_rdonly) { return diff; } - if (c1->memcached_port != c2->memcached_port) { - snprintf(diff, PRINTBUFLEN - 1, "%s", "c->memcached_port"); - - return diff; - } - if (c1->memcached_space != c2->memcached_space) { - snprintf(diff, PRINTBUFLEN - 1, "%s", "c->memcached_space"); - - return diff; - } - if (c1->memcached_expire != c2->memcached_expire) { - snprintf(diff, PRINTBUFLEN - 1, "%s", "c->memcached_expire"); - - return diff; - } - if (!only_check_rdonly) { - if (c1->memcached_expire_per_loop != c2->memcached_expire_per_loop) { - snprintf(diff, PRINTBUFLEN - 1, "%s", "c->memcached_expire_per_loop"); - - return diff; - } - } - if (!only_check_rdonly) { - if (c1->memcached_expire_full_sweep != c2->memcached_expire_full_sweep) { - snprintf(diff, PRINTBUFLEN - 1, "%s", "c->memcached_expire_full_sweep"); - - return diff; - } - } if (!only_check_rdonly) { if (confetti_strcmp(c1->replication_source, c2->replication_source) != 0) { snprintf(diff, PRINTBUFLEN - 1, "%s", "c->replication_source"); diff --git a/cfg/tarantool_box_cfg.h b/cfg/tarantool_box_cfg.h index 39cbd4111d..1073c3937c 100644 --- a/cfg/tarantool_box_cfg.h +++ b/cfg/tarantool_box_cfg.h @@ -151,21 +151,6 @@ typedef struct tarantool_cfg { */ char* custom_proc_title; - /* Memcached protocol support is enabled if memcached_port is set */ - int32_t memcached_port; - - /* space used for memcached emulation */ - int32_t memcached_space; - - /* Memcached expiration is on if memcached_expire is set. */ - confetti_bool_t memcached_expire; - - /* maximum rows to consider per expire loop iteration */ - int32_t memcached_expire_per_loop; - - /* tarantool will try to iterate over all rows within this time */ - double memcached_expire_full_sweep; - /* * Replication mode (if enabled, the server, once * bound to the primary port, will connect to diff --git a/include/memcached.h b/include/memcached.h deleted file mode 100644 index cd3a2b7399..0000000000 --- a/include/memcached.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef TARANTOOL_MEMCACHED_H_INCLUDED -#define TARANTOOL_MEMCACHED_H_INCLUDED -/* - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the - * following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#include <stdarg.h> - -struct tarantool_cfg; - -void -memcached_init(const char *bind_ipaddr, int memcached_port); - -int -memcached_check_config(struct tarantool_cfg *conf); - -int -memcached_reload_config(struct tarantool_cfg *oldcfg, - struct tarantool_cfg *newcfg); - -#endif /* TARANTOOL_MEMCACHED_H_INCLUDED */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9a6678d780..2403d6ed0d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,41 +17,6 @@ if (CMAKE_COMPILER_IS_GNUCC) add_compile_flags("C;CXX" "-pthread") endif() -# -# Build memcached.cc from memcached.rl, but only if memcached.rl was changed. -# We track memcached.cc in revision control, and thus do not -# require engineers who do not modify .rl files to have Ragel -# installed. -# -add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/src/memcached-grammar.cc - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${RAGEL} -G2 src/memcached-grammar.rl - -o src/memcached-grammar.cc - DEPENDS ${CMAKE_SOURCE_DIR}/src/memcached-grammar.rl) - -add_custom_target(generate_admin_cc DEPENDS ${CMAKE_SOURCE_DIR}/src/admin.cc) -add_custom_target(generate_memcached_grammar_cc DEPENDS - ${CMAKE_SOURCE_DIR}/src/memcached-grammar.cc) - -# do not randomly try to re-generate admin.cc or memcached-grammar.cc -# after a fresh checkout/branch switch. -execute_process(COMMAND ${CMAKE_COMMAND} -E touch_nocreate - ${CMAKE_SOURCE_DIR}/src/admin.cc - ${CMAKE_SOURCE_DIR}/src/memcached-grammar.cc) - -set_source_files_properties(${CMAKE_SOURCE_DIR}/src/memcached-grammar.cc - PROPERTIES HEADER_FILE_ONLY true) - -set_source_files_properties(memcached.cc - PROPERTIES COMPILE_FLAGS "-Wno-uninitialized") - -# -# # Do not clean admin.cc, memcached.cc or other -# generated files in 'make clean' -- they are under -# revision control. -# -set_property(DIRECTORY PROPERTY CLEAN_NO_CUSTOM true) - # Compile src/lua/*.lua files into src/lua/*.lua.c sources file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/src/lua) set(lua_sources) @@ -74,7 +39,6 @@ set (recompiled_sources ${CMAKE_SOURCE_DIR}/src/say.cc ${CMAKE_SOURCE_DIR}/src/assoc.cc ${CMAKE_SOURCE_DIR}/src/replication.cc - ${CMAKE_SOURCE_DIR}/src/memcached.cc ${CMAKE_SOURCE_DIR}/src/fiber.cc) set (common_sources @@ -206,7 +170,7 @@ function(tarantool_module mod) add_library(lt${mod} STATIC ${recompiled_sources}) set_target_properties(lt${mod} PROPERTIES COMPILE_FLAGS "-DTARANTOOL_CONFIG='<cfg/tarantool_${mod}_cfg.h>'") - add_dependencies(lt${mod} generate_headers generate_admin_cc generate_memcached_grammar_cc build_bundled_libs) + add_dependencies(lt${mod} generate_headers generate_admin_cc build_bundled_libs) target_link_libraries(tarantool_${mod} lt${mod} ${common_libraries}) diff --git a/src/box/box_cfg.cfg_tmpl b/src/box/box_cfg.cfg_tmpl index f135f6eb9e..2619cba5b7 100644 --- a/src/box/box_cfg.cfg_tmpl +++ b/src/box/box_cfg.cfg_tmpl @@ -1,4 +1,3 @@ - ## BOX # Primary port (where updates are accepted) @@ -14,17 +13,6 @@ too_long_threshold=0.5 # program title. custom_proc_title=NULL, ro -# Memcached protocol support is enabled if memcached_port is set -memcached_port=0, ro -# space used for memcached emulation -memcached_space=23, ro -# Memcached expiration is on if memcached_expire is set. -memcached_expire=false, ro -# maximum rows to consider per expire loop iteration -memcached_expire_per_loop=1024 -# tarantool will try to iterate over all rows within this time -memcached_expire_full_sweep=3600.0 - # Replication mode (if enabled, the server, once # bound to the primary port, will connect to # replication_source (ipaddr:port) and run continously diff --git a/src/memcached-grammar.rl b/src/memcached-grammar.rl deleted file mode 100644 index d1cd7226fc..0000000000 --- a/src/memcached-grammar.rl +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the - * following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -%%{ - machine memcached; - write data; -}%% - -static int __attribute__((noinline)) -memcached_dispatch(struct ev_io *coio, struct iobuf *iobuf) -{ - int cs; - char *p, *pe; - char *fstart; - struct tbuf *keys = tbuf_new(fiber->gc_pool); - const char *key; - bool append, show_cas; - int incr_sign; - uint64_t cas, incr; - uint32_t flags, exptime, bytes; - bool noreply = false; - char *data = NULL; - bool done = false; - uintptr_t flush_delay = 0; - size_t keys_count = 0; - struct ibuf *in = &iobuf->in; - struct obuf *out = &iobuf->out; - /* Savepoint for 'noreply' */ - struct obuf_svp obuf_svp = obuf_create_svp(out); - - p = in->pos; - pe = in->end; - - say_debug("memcached_dispatch '%.*s'", MIN((int)(pe - p), 40) , p); - - %%{ - action set { - key = tbuf_read_field(keys); - STORE; - } - - action add { - key = tbuf_read_field(keys); - struct tuple *tuple = memcached_find(key); - if (tuple != NULL && !memcached_is_expired(tuple)) - obuf_dup(out, "NOT_STORED\r\n", 12); - else - STORE; - } - - action replace { - key = tbuf_read_field(keys); - struct tuple *tuple = memcached_find(key); - if (tuple == NULL || memcached_is_expired(tuple)) - obuf_dup(out, "NOT_STORED\r\n", 12); - else - STORE; - } - - action cas { - key = tbuf_read_field(keys); - struct tuple *tuple = memcached_find(key); - if (tuple == NULL || memcached_is_expired(tuple)) - obuf_dup(out, "NOT_FOUND\r\n", 11); - else if (memcached_meta(tuple)->cas != cas) - obuf_dup(out, "EXISTS\r\n", 8); - else - STORE; - } - - action append_prepend { - struct tbuf *b; - const char *field; - uint32_t field_len; - - key = tbuf_read_field(keys); - struct tuple *tuple = memcached_find(key); - if (tuple == NULL) { - obuf_dup(out, "NOT_STORED\r\n", 12); - } else { - field = tuple_field(tuple, 3, &field_len); - b = tbuf_new(fiber->gc_pool); - if (append) { - tbuf_append(b, field, field_len); - tbuf_append(b, data, bytes); - } else { - tbuf_append(b, data, bytes); - tbuf_append(b, field, field_len); - } - - bytes += field_len; - data = b->data; - STORE; - } - } - - action incr_decr { - struct meta *m; - struct tbuf *b; - const char *field; - uint32_t field_len; - uint64_t value; - - key = tbuf_read_field(keys); - struct tuple *tuple = memcached_find(key); - if (tuple == NULL || memcached_is_expired(tuple)) { - obuf_dup(out, "NOT_FOUND\r\n", 11); - } else { - m = memcached_meta(tuple); - field = tuple_field(tuple, 3, &field_len); - - if (memcached_is_numeric(field, field_len)) { - value = memcached_natoq(field, - field + field_len); - - if (incr_sign > 0) { - value += incr; - } else { - if (incr > value) - value = 0; - else - value -= incr; - } - - exptime = m->exptime; - flags = m->flags; - - b = tbuf_new(fiber->gc_pool); - tbuf_printf(b, "%" PRIu64, value); - data = b->data; - bytes = b->size; - - stats.cmd_set++; - try { - memcached_store(key, exptime, flags, bytes, data); - stats.total_items++; - obuf_dup(out, b->data, b->size); - obuf_dup(out, "\r\n", 2); - } catch (const ClientError& e) { - obuf_dup(out, "SERVER_ERROR ", 13); - obuf_dup(out, e.errmsg(), strlen(e.errmsg())); - obuf_dup(out, "\r\n", 2); - } - } else { - obuf_dup(out, "CLIENT_ERROR cannot increment or decrement non-numeric value\r\n", 62); - } - } - - } - - action delete { - key = tbuf_read_field(keys); - struct tuple *tuple = memcached_find(key); - if (tuple == NULL || memcached_is_expired(tuple)) { - obuf_dup(out, "NOT_FOUND\r\n", 11); - } else { - try { - memcached_delete(key); - obuf_dup(out, "DELETED\r\n", 9); - } - catch (const ClientError& e) { - obuf_dup(out, "SERVER_ERROR ", 13); - obuf_dup(out, e.errmsg(), strlen(e.errmsg())); - obuf_dup(out, "\r\n", 2); - } - } - } - - action get { - try { - memcached_get(out, keys_count, keys, show_cas); - } catch (const ClientError& e) { - obuf_rollback_to_svp(out, &obuf_svp); - obuf_dup(out, "SERVER_ERROR ", 13); - obuf_dup(out, e.errmsg(), strlen(e.errmsg())); - obuf_dup(out, "\r\n", 2); - } - } - - action flush_all { - struct fiber *f = fiber_new("flush_all", - memcached_flush_all); - fiber_call(f, flush_delay); - obuf_dup(out, "OK\r\n", 4); - } - - action stats { - memcached_print_stats(out); - } - - action quit { - return -1; - } - - action fstart { fstart = p; } - action key_start { - fstart = p; - for (; p < pe && *p != ' ' && *p != '\r' && *p != '\n'; p++); - if ( *p == ' ' || *p == '\r' || *p == '\n') { - tbuf_store_field(keys, fstart, p - fstart); - keys_count++; - p--; - } else - p = fstart; - } - - - printable = [^ \t\r\n]; - key = printable >key_start ; - - action exptime { - exptime = memcached_natoq(fstart, p); - if (exptime > 0 && exptime <= 60*60*24*30) - exptime = exptime + ev_now(); - } - exptime = digit+ >fstart %exptime; - - flags = digit+ >fstart %{flags = memcached_natoq(fstart, p);}; - bytes = digit+ >fstart %{bytes = memcached_natoq(fstart, p);}; - cas_value = digit+ >fstart %{cas = memcached_natoq(fstart, p);}; - incr_value = digit+ >fstart %{incr = memcached_natoq(fstart, p);}; - flush_delay = digit+ >fstart %{flush_delay = memcached_natoq(fstart, p);}; - - action read_data { - size_t parsed = p - in->pos; - while (ibuf_size(in) - parsed < bytes + 2) { - size_t to_read = bytes + 2 - (pe - p); - if (coio_bread(coio, in, to_read) < to_read) - return -1; /* premature EOF */ - } - /* - * Buffered read may have reallocated the - * buffer. - */ - p = in->pos + parsed; - pe = in->end; - - data = p; - - if (strncmp((char *)(p + bytes), "\r\n", 2) == 0) { - p += bytes + 2; - } else { - goto exit; - } - } - - action done { - done = true; - stats.bytes_read += p - in->pos; - in->pos = p; - } - - eol = ("\r\n" | "\n") @{ p++; }; - spc = " "+; - noreply = (spc "noreply"i %{ noreply = true; })?; - store_command_body = spc key spc flags spc exptime spc bytes noreply eol; - - set = ("set"i store_command_body) @read_data @done @set; - add = ("add"i store_command_body) @read_data @done @add; - replace = ("replace"i store_command_body) @read_data @done @replace; - append = ("append"i %{append = true; } store_command_body) @read_data @done @append_prepend; - prepend = ("prepend"i %{append = false;} store_command_body) @read_data @done @append_prepend; - cas = ("cas"i spc key spc flags spc exptime spc bytes spc cas_value noreply spc?) eol @read_data @done @cas; - - - get = "get"i %{show_cas = false;} spc key (spc key)* spc? eol @done @get; - gets = "gets"i %{show_cas = true;} spc key (spc key)* spc? eol @done @get; - delete = "delete"i spc key (spc exptime)? noreply spc? eol @done @delete; - incr = "incr"i %{incr_sign = 1; } spc key spc incr_value noreply spc? eol @done @incr_decr; - decr = "decr"i %{incr_sign = -1;} spc key spc incr_value noreply spc? eol @done @incr_decr; - - stats = "stats"i eol @done @stats; - flush_all = "flush_all"i (spc flush_delay)? noreply spc? eol @done @flush_all; - quit = "quit"i eol @done @quit; - - main := set | cas | add | replace | append | prepend | get | gets | delete | incr | decr | stats | flush_all | quit; - #main := set; - write init; - write exec; - }%% - - if (!done) { - say_debug("parse failed after: `%.*s'", (int)(pe - p), p); - if (pe - p > (1 << 20)) { - exit: - say_warn("memcached proto error"); - obuf_dup(out, "ERROR\r\n", 7); - stats.bytes_written += 7; - return -1; - } - char *r; - if ((r = (char *) memmem(p, pe - p, "\r\n", 2)) != NULL) { - in->pos = r + 2; - obuf_dup(out, "CLIENT_ERROR bad command line format\r\n", 38); - return 1; - } - return 0; - } - - if (noreply) { - obuf_rollback_to_svp(out, &obuf_svp); - } - return 1; -} - -/* - * Local Variables: - * mode: c - * End: - * vim: syntax=objc - */ diff --git a/src/memcached.cc b/src/memcached.cc deleted file mode 100644 index fc28c516c6..0000000000 --- a/src/memcached.cc +++ /dev/null @@ -1,619 +0,0 @@ -/* - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the - * following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF - * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#include "memcached.h" -#include "tarantool.h" - -#include <limits.h> - -#include "box/box.h" -#include "box/request.h" -#include "box/schema.h" -#include "box/space.h" -#include "box/port.h" -#include "box/tuple.h" -#include "fiber.h" -extern "C" { -#include <cfg/warning.h> -#include <cfg/tarantool_box_cfg.h> -} /* extern "C" */ -#include "say.h" -#include "stat.h" -#include "salloc.h" -#include "pickle.h" -#include "coio_buf.h" -#include "scoped_guard.h" - -#define STAT(_) \ - _(MEMC_GET, 1) \ - _(MEMC_GET_MISS, 2) \ - _(MEMC_GET_HIT, 3) \ - _(MEMC_EXPIRED_KEYS, 4) - -ENUM(memcached_stat, STAT); -STRS(memcached_stat, STAT); - -static int stat_base; - -static Index *memcached_index; -static struct iterator *memcached_it; - -/* memcached tuple format: - <key, meta, data> */ - -struct meta { - uint32_t exptime; - uint32_t flags; - uint64_t cas; -} __packed__; - -static uint64_t -memcached_natoq(const char *start, const char *end) -{ - uint64_t num = 0; - while (start < end) { - uint8_t code = *start++; - num = num * 10 + (code - '0'); - } - return num; -} - -void -tbuf_append_field(struct tbuf *b, const char *f) -{ - const char *begin = f; - uint32_t size = load_varint32(&f); - tbuf_append(b, begin, f - begin + size); -} - -void -tbuf_store_field(struct tbuf *b, const char *field, uint32_t len) -{ - char buf[sizeof(uint32_t)+1]; - char *bufend = pack_varint32(buf, len); - tbuf_append(b, buf, bufend - buf); - tbuf_append(b, field, len); -} - -/** - * Check that we have a valid field and return it. - * Advances the buffer to point after the field as a side effect. - */ -const char * -tbuf_read_field(struct tbuf *buf) -{ - const char *field = buf->data; - uint32_t field_len = pick_varint32((const char **) &buf->data, - buf->data + buf->size); - if (buf->data + field_len > field + buf->size) - tnt_raise(IllegalParams, "packet too short (expected a field)"); - buf->data += field_len; - buf->size -= buf->data - field; - buf->capacity -= buf->data - field; - return field; -} - -static void -memcached_store(const char *key, uint32_t exptime, uint32_t flags, uint32_t bytes, - const char *data) -{ - uint32_t box_flags = 0; - uint32_t field_count = 4; - static uint64_t cas = 42; - struct meta m; - - struct tbuf *req = tbuf_new(fiber->gc_pool); - - tbuf_append(req, &cfg.memcached_space, sizeof(uint32_t)); - tbuf_append(req, &box_flags, sizeof(box_flags)); - tbuf_append(req, &field_count, sizeof(field_count)); - - tbuf_append_field(req, key); - - m.exptime = exptime; - m.flags = flags; - m.cas = cas++; - tbuf_store_field(req, (const char *) &m, sizeof(m)); - - char b[43]; - sprintf(b, " %" PRIu32 " %" PRIu32 "\r\n", flags, bytes); - tbuf_store_field(req, b, strlen(b)); - - tbuf_store_field(req, data, bytes); - - int key_len = load_varint32(&key); - say_debug("memcached/store key:(%i)'%.*s' exptime:%" PRIu32 " flags:%" PRIu32 " cas:%" PRIu64, - key_len, key_len, (char*) key, exptime, flags, cas); - /* - * Use a box dispatch wrapper which handles correctly - * read-only/read-write modes. - */ - struct request request; - request_create(&request, REPLACE, req->data, req->size); - box_process(&null_port, &request); -} - -static void -memcached_delete(const char *key) -{ - uint32_t key_len = 1; - uint32_t box_flags = 0; - struct tbuf *req = tbuf_new(fiber->gc_pool); - - tbuf_append(req, &cfg.memcached_space, sizeof(uint32_t)); - tbuf_append(req, &box_flags, sizeof(box_flags)); - tbuf_append(req, &key_len, sizeof(key_len)); - tbuf_append_field(req, key); - struct request request; - request_create(&request, DELETE, req->data, req->size); - box_process(&null_port, &request); -} - -static struct tuple * -memcached_find(const char *key) -{ - return memcached_index->findByKey(key, 1); -} - -static struct meta * -memcached_meta(struct tuple *tuple) -{ - uint32_t len; - const char *field = tuple_field(tuple, 1, &len); - assert(sizeof(struct meta) <= len); - return (struct meta *) field; -} - -static bool -memcached_is_expired(struct tuple *tuple) -{ - struct meta *m = memcached_meta(tuple); - return m->exptime == 0 ? 0 : m->exptime < ev_now(); -} - -static bool -memcached_is_numeric(const char *field, uint32_t value_len) -{ - for (int i = 0; i < value_len; i++) - if (*(field + i) < '0' || '9' < *(field + i)) - return false; - return true; -} - -static struct stats { - uint64_t total_items; - uint32_t curr_connections; - uint32_t total_connections; - uint64_t cmd_get; - uint64_t cmd_set; - uint64_t get_hits; - uint64_t get_misses; - uint64_t evictions; - uint64_t bytes_read; - uint64_t bytes_written; -} stats; - -struct salloc_stat_memcached_cb_ctx { - int64_t bytes_used; - int64_t items; -}; - -static int -salloc_stat_memcached_cb(const struct slab_cache_stats *cstat, void *cb_ctx) -{ - struct salloc_stat_memcached_cb_ctx *ctx = - (struct salloc_stat_memcached_cb_ctx *) cb_ctx; - ctx->bytes_used += cstat->bytes_used; - ctx->items += cstat->items; - return 0; -} - -static void -memcached_print_stats(struct obuf *out) -{ - struct tbuf *buf = tbuf_new(fiber->gc_pool); - - struct salloc_stat_memcached_cb_ctx memstats; - memstats.bytes_used = memstats.items = 0; - salloc_stat(salloc_stat_memcached_cb, NULL, &memstats); - - tbuf_printf(buf, "STAT pid %" PRIu32 "\r\n", (uint32_t)getpid()); - tbuf_printf(buf, "STAT uptime %" PRIu32 "\r\n", (uint32_t)tarantool_uptime()); - tbuf_printf(buf, "STAT time %" PRIu32 "\r\n", (uint32_t)ev_now()); - tbuf_printf(buf, "STAT version 1.2.5 (tarantool/box)\r\n"); - tbuf_printf(buf, "STAT pointer_size %" PRI_SZ "\r\n", sizeof(void *)*8); - tbuf_printf(buf, "STAT curr_items %" PRIu64 "\r\n", memstats.items); - tbuf_printf(buf, "STAT total_items %" PRIu64 "\r\n", stats.total_items); - tbuf_printf(buf, "STAT bytes %" PRIu64 "\r\n", memstats.bytes_used); - tbuf_printf(buf, "STAT curr_connections %" PRIu32 "\r\n", stats.curr_connections); - tbuf_printf(buf, "STAT total_connections %" PRIu32 "\r\n", stats.total_connections); - tbuf_printf(buf, "STAT connection_structures %" PRIu32 "\r\n", stats.curr_connections); /* lie a bit */ - tbuf_printf(buf, "STAT cmd_get %" PRIu64 "\r\n", stats.cmd_get); - tbuf_printf(buf, "STAT cmd_set %" PRIu64 "\r\n", stats.cmd_set); - tbuf_printf(buf, "STAT get_hits %" PRIu64 "\r\n", stats.get_hits); - tbuf_printf(buf, "STAT get_misses %" PRIu64 "\r\n", stats.get_misses); - tbuf_printf(buf, "STAT evictions %" PRIu64 "\r\n", stats.evictions); - tbuf_printf(buf, "STAT bytes_read %" PRIu64 "\r\n", stats.bytes_read); - tbuf_printf(buf, "STAT bytes_written %" PRIu64 "\r\n", stats.bytes_written); - tbuf_printf(buf, "STAT limit_maxbytes %" PRIu64 "\r\n", (uint64_t)(cfg.slab_alloc_arena * (1 << 30))); - tbuf_printf(buf, "STAT threads 1\r\n"); - tbuf_printf(buf, "END\r\n"); - obuf_dup(out, buf->data, buf->size); -} - -void memcached_get(struct obuf *out, size_t keys_count, struct tbuf *keys, - bool show_cas) -{ - stat_collect(stat_base, MEMC_GET, 1); - stats.cmd_get++; - say_debug("ensuring space for %" PRI_SZ " keys", keys_count); - while (keys_count-- > 0) { - struct tuple *tuple; - const struct meta *m; - const char *value; - const char *suffix; - uint32_t key_len; - uint32_t value_len; - uint32_t suffix_len; - - const char *key = tbuf_read_field(keys); - tuple = memcached_find(key); - key_len = load_varint32(&key); - - if (tuple == NULL) { - stat_collect(stat_base, MEMC_GET_MISS, 1); - stats.get_misses++; - continue; - } - - uint32_t len; - struct tuple_iterator it; - tuple_rewind(&it, tuple); - /* skip key */ - (void) tuple_next(&it, &len); - - /* metainfo */ - m = (const struct meta *) tuple_next(&it, &len); - assert(sizeof(struct meta) <= len); - - /* suffix */ - suffix = tuple_next(&it, &suffix_len); - - /* value */ - value = tuple_next(&it, &value_len); - - assert(tuple_next(&it, &len) == NULL); - - if (m->exptime > 0 && m->exptime < ev_now()) { - stats.get_misses++; - stat_collect(stat_base, MEMC_GET_MISS, 1); - continue; - } - stats.get_hits++; - stat_collect(stat_base, MEMC_GET_HIT, 1); - - if (show_cas) { - struct tbuf *b = tbuf_new(fiber->gc_pool); - tbuf_printf(b, "VALUE %.*s %" PRIu32 " %" PRIu32 " %" PRIu64 "\r\n", key_len, (char*) key, m->flags, value_len, m->cas); - obuf_dup(out, b->data, b->size); - stats.bytes_written += b->size; - } else { - obuf_dup(out, "VALUE ", 6); - obuf_dup(out, key, key_len); - obuf_dup(out, suffix, suffix_len); - } - obuf_dup(out, value, value_len); - obuf_dup(out, "\r\n", 2); - stats.bytes_written += value_len + 2; - } - obuf_dup(out, "END\r\n", 5); - stats.bytes_written += 5; -} - -static void -memcached_flush_all(va_list ap) -{ - uintptr_t delay = va_arg(ap, uintptr_t); - fiber_sleep(delay - ev_now()); - struct tuple *tuple; - struct iterator *it = memcached_index->allocIterator(); - memcached_index->initIterator(it, ITER_ALL, NULL, 0); - while ((tuple = it->next(it))) { - memcached_meta(tuple)->exptime = 1; - } - it->free(it); -} - -#define STORE \ -do { \ - stats.cmd_set++; \ - if (bytes > (1<<20)) { \ - obuf_dup(out, "SERVER_ERROR object too large for cache\r\n", 41);\ - } else { \ - try { \ - memcached_store(key, exptime, flags, bytes, data); \ - stats.total_items++; \ - obuf_dup(out, "STORED\r\n", 8); \ - } \ - catch (const ClientError& e) { \ - obuf_dup(out, "SERVER_ERROR ", 13); \ - obuf_dup(out, e.errmsg(), strlen(e.errmsg())); \ - obuf_dup(out, "\r\n", 2); \ - } \ - } \ -} while (0) - -#include "memcached-grammar.cc" - -void -memcached_loop(struct ev_io *coio, struct iobuf *iobuf) -{ - int rc; - int bytes_written; - int batch_count; - struct ibuf *in = &iobuf->in; - - for (;;) { - batch_count = 0; - if (coio_bread(coio, in, 1) <= 0) - return; - - dispatch: - rc = memcached_dispatch(coio, iobuf); - if (rc < 0) { - say_debug("negative dispatch, closing connection"); - return; - } - - if (rc == 0 && batch_count == 0) /* we haven't successfully parsed any requests */ - continue; - - if (rc == 1) { - batch_count++; - /* some unparsed commands remain and batch count less than 20 */ - if (ibuf_size(in) > 0 && batch_count < 20) - goto dispatch; - } - - bytes_written = iobuf_flush(iobuf, coio); - fiber_gc(); - stats.bytes_written += bytes_written; - - if (rc == 1 && ibuf_size(in) > 0) { - batch_count = 0; - goto dispatch; - } - } -} - -static void -memcached_handler(va_list ap) -{ - struct ev_io coio = va_arg(ap, struct ev_io); - struct iobuf *iobuf = va_arg(ap, struct iobuf *); - stats.total_connections++; - stats.curr_connections++; - - try { - auto scoped_guard = make_scoped_guard([&] { - fiber_sleep(0.01); - stats.curr_connections--; - evio_close(&coio); - iobuf_delete(iobuf); - }); - - memcached_loop(&coio, iobuf); - iobuf_flush(iobuf, &coio); - } catch (const FiberCancelException& e) { - throw; - } catch (const Exception& e) { - e.log(); - } -} - -int -memcached_check_config(struct tarantool_cfg *conf) -{ - if (conf->memcached_port == 0) { - return 0; - } - - if (conf->memcached_port <= 0 || conf->memcached_port >= USHRT_MAX) { - /* invalid space number */ - out_warning(CNF_OK, "invalid memcached port value: %i", - conf->memcached_port); - return -1; - } - - /* check memcached space number: it shoud be in segment [0, max_space] */ - - if (conf->memcached_expire_per_loop <= 0) { - /* invalid expire per loop value */ - out_warning(CNF_OK, "invalid expire per loop value: %i", - conf->memcached_expire_per_loop); - return -1; - } - - if (conf->memcached_expire_full_sweep <= 0) { - /* invalid expire full sweep value */ - out_warning(CNF_OK, "invalid expire full sweep value: %i", - conf->memcached_expire_full_sweep); - return -1; - } - - return 0; -} - -static void -memcached_free(void) -{ - if (memcached_it) - memcached_it->free(memcached_it); -} - -void -memcached_start_expire(); - -void -memcached_init(const char *bind_ipaddr, int memcached_port) -{ - if (memcached_port == 0) - return; - - atexit(memcached_free); - - stat_base = stat_register(memcached_stat_strs, memcached_stat_MAX); - - /* run memcached server */ - static struct coio_service memcached; - coio_service_init(&memcached, "memcached", - bind_ipaddr, memcached_port, - memcached_handler, NULL); - evio_service_start(&memcached.evio_service); - memcached_start_expire(); -} - -void -memcached_space_init() -{ - if (cfg.memcached_port == 0) - return; - - /* Configure memcached index key. */ - struct key_def *key_def = key_def_new(0, HASH, true, 1); - key_def_set_part(key_def, 0, 0, STRING); - struct rlist keys; - rlist_create(&keys); - key_list_add_key(&keys, key_def); - - struct space_def space_def; - space_def.id = cfg.memcached_space; - space_def.arity = 4; - - struct space *space = space_new(&space_def, &keys); - space->engine.recover(space); - space_cache_replace(space); - key_def_delete(key_def); -} - -/** Delete a bunch of expired keys. */ - -void -memcached_delete_expired_keys(struct tbuf *keys_to_delete) -{ - int expired_keys = 0; - - while (keys_to_delete->size > 0) { - try { - memcached_delete(tbuf_read_field(keys_to_delete)); - expired_keys++; - } - catch (const ClientError& e) { - /* expire is off when replication is on */ - assert(e.errcode() != ER_NONMASTER); - /* The error is already logged. */ - } - } - stat_collect(stat_base, MEMC_EXPIRED_KEYS, expired_keys); - - double delay = ((double) cfg.memcached_expire_per_loop * - cfg.memcached_expire_full_sweep / - (memcached_index->size() + 1)); - if (delay > 1) - delay = 1; - fiber_setcancellable(true); - fiber_sleep(delay); - fiber_setcancellable(false); -} - -void -memcached_expire_loop(va_list ap __attribute__((unused))) -{ - memcached_space_init(); - struct tuple *tuple = NULL; - - say_info("memcached expire fiber started"); - memcached_it = memcached_index->allocIterator(); - try { -restart: - if (tuple == NULL) - memcached_index->initIterator(memcached_it, ITER_ALL, NULL, 0); - - struct tbuf *keys_to_delete = tbuf_new(fiber->gc_pool); - - for (int j = 0; j < cfg.memcached_expire_per_loop; j++) { - - tuple = memcached_it->next(memcached_it); - - if (tuple == NULL) - break; - - if (!memcached_is_expired(tuple)) - continue; - - say_debug("expire tuple %p", tuple); - uint32_t len = 0; - const char *field = tuple_field(tuple, 0, &len); - tbuf_store_field(keys_to_delete, field, len); - } - memcached_delete_expired_keys(keys_to_delete); - fiber_gc(); - goto restart; - } catch (const Exception& e) { - memcached_it->free(memcached_it); - memcached_it = NULL; - throw; - } -} - -void memcached_start_expire() -{ - struct fiber *memcached_expire; - if (cfg.memcached_port == 0 || cfg.memcached_expire == 0) - return; - - try { - memcached_expire = fiber_new("memcached_expire", - memcached_expire_loop); - } catch (const Exception& e) { - say_error("can't start the expire fiber"); - return; - } - fiber_call(memcached_expire); -} - -int -memcached_reload_config(struct tarantool_cfg *oldcfg, - struct tarantool_cfg *newcfg) -{ - (void) oldcfg; - (void) newcfg; - if (newcfg->memcached_port == 0) - return 0; - return -1; -} diff --git a/src/tarantool.cc b/src/tarantool.cc index f966168b80..76bf59325b 100644 --- a/src/tarantool.cc +++ b/src/tarantool.cc @@ -67,7 +67,6 @@ extern "C" { } /* extern "C" */ #include "tt_pthread.h" #include "lua/init.h" -#include "memcached.h" #include "session.h" #include "box/box.h" #include "bootstrap.h" @@ -111,10 +110,9 @@ title(const char *fmt, ...) va_end(ap); int ports[] = { cfg.primary_port, cfg.secondary_port, - cfg.memcached_port, cfg.admin_port, - cfg.replication_port }; + cfg.admin_port, cfg.replication_port }; int *pptr = ports; - const char *names[] = { "pri", "sec", "memc", "adm", "rpl", NULL }; + const char *names[] = { "pri", "sec", "adm", "rpl", NULL }; const char **nptr = names; for (; *nptr; nptr++, pptr++) @@ -169,10 +167,6 @@ load_cfg(struct tarantool_cfg *conf, int32_t check_rdonly) if (replication_check_config(conf) != 0) return -1; - /* check memcached configuration */ - if (memcached_check_config(conf) != 0) - return -1; - return box_check_config(conf); } @@ -284,8 +278,6 @@ reload_cfg(struct tbuf *out) if (box_reload_config(&cfg, &new_cfg) != 0) return -1; - if (memcached_reload_config(&cfg, &new_cfg) != 0) - return -1; /* All OK, activate the config. */ swap_tarantool_cfg(&cfg, &new_cfg); tarantool_lua_load_cfg(tarantool_L, &cfg); @@ -883,12 +875,6 @@ main(int argc, char **argv) * initialized. */ tarantool_lua_load_init_script(tarantool_L); - /* - * And when recovery is finalized, memcached - * expire loop is started, so binding can happen - * only after memcached is initialized. - */ - memcached_init(cfg.bind_ipaddr, cfg.memcached_port); prelease(fiber->gc_pool); say_crit("log level %i", cfg.log_level); say_crit("entering the event loop"); diff --git a/test/box/admin.result b/test/box/admin.result index ada44ecede..30312b93e0 100644 --- a/test/box/admin.result +++ b/test/box/admin.result @@ -45,38 +45,33 @@ box.cfg() --- - io_collect_interval: 0 pid_file: box.pid + slab_alloc_factor: 2 slab_alloc_minimal: 64 + admin_port: 33015 + logger: cat - >> tarantool.log slab_alloc_arena: 0.1 log_level: 4 + reload: function_ptr + too_long_threshold: 0.5 + secondary_port: 33014 + primary_port: 33013 logger_nonblock: true - memcached_expire_per_loop: 1024 + panic_on_wal_error: false snap_dir: . coredump: false - panic_on_snap_error: true - memcached_expire_full_sweep: 3600 - replication_port: 0 - wal_fsync_delay: 0 - too_long_threshold: 0.5 - slab_alloc_factor: 2 - admin_port: 33015 - logger: cat - >> tarantool.log snap_io_rate_limit: 0 - reload: function_ptr - wal_dir_rescan_delay: 0.1 - backlog: 1024 - secondary_port: 33014 wal_dir: . - local_hot_standby: false + readahead: 16320 wal_mode: fsync_delay rows_per_wal: 50 - readahead: 16320 - panic_on_wal_error: false + panic_on_snap_error: true + local_hot_standby: false script_dir: . - primary_port: 33013 + replication_port: 0 bind_ipaddr: INADDR_ANY - memcached_port: 0 - memcached_space: 23 - memcached_expire: false + wal_fsync_delay: 0 + backlog: 1024 + wal_dir_rescan_delay: 0.1 ... box.stat() --- diff --git a/test/box/lua.result b/test/box/lua.result index 2570a8fe71..1fe81ec114 100644 --- a/test/box/lua.result +++ b/test/box/lua.result @@ -437,38 +437,33 @@ t --- - - 'io_collect_interval: 0' - 'pid_file: box.pid' + - 'slab_alloc_factor: 2' - 'slab_alloc_minimal: 64' + - 'admin_port: 33015' + - 'logger: cat - >> tarantool.log' - 'slab_alloc_arena: 0.1' - 'log_level: 4' + - 'reload: function_ptr' + - 'too_long_threshold: 0.5' + - 'secondary_port: 33014' + - 'primary_port: 33013' - 'logger_nonblock: true' - - 'memcached_expire_per_loop: 1024' + - 'panic_on_wal_error: false' - 'snap_dir: .' - 'coredump: false' - - 'panic_on_snap_error: true' - - 'memcached_expire_full_sweep: 3600' - - 'replication_port: 0' - - 'wal_fsync_delay: 0' - - 'too_long_threshold: 0.5' - - 'slab_alloc_factor: 2' - - 'admin_port: 33015' - - 'logger: cat - >> tarantool.log' - 'snap_io_rate_limit: 0' - - 'reload: function_ptr' - - 'wal_dir_rescan_delay: 0.1' - - 'backlog: 1024' - - 'secondary_port: 33014' - 'wal_dir: .' - - 'local_hot_standby: false' + - 'readahead: 16320' - 'wal_mode: fsync_delay' - 'rows_per_wal: 50' - - 'readahead: 16320' - - 'panic_on_wal_error: false' + - 'panic_on_snap_error: true' + - 'local_hot_standby: false' - 'script_dir: .' - - 'primary_port: 33013' + - 'replication_port: 0' - 'bind_ipaddr: INADDR_ANY' - - 'memcached_port: 0' - - 'memcached_space: 23' - - 'memcached_expire: false' + - 'wal_fsync_delay: 0' + - 'backlog: 1024' + - 'wal_dir_rescan_delay: 0.1' ... t = {} for k,v in pairs(box.space[0]) do if type(v) ~= 'table' then table.insert(t, k..': '..tostring(v)) end end --- @@ -490,38 +485,33 @@ t --- - - 'io_collect_interval: 0' - 'pid_file: box.pid' + - 'slab_alloc_factor: 2' - 'slab_alloc_minimal: 64' + - 'admin_port: 33015' + - 'logger: cat - >> tarantool.log' - 'slab_alloc_arena: 0.1' - 'log_level: 4' + - 'reload: function_ptr' + - 'too_long_threshold: 0.5' + - 'secondary_port: 33014' + - 'primary_port: 33013' - 'logger_nonblock: true' - - 'memcached_expire_per_loop: 1024' + - 'panic_on_wal_error: false' - 'snap_dir: .' - 'coredump: false' - - 'panic_on_snap_error: true' - - 'memcached_expire_full_sweep: 3600' - - 'replication_port: 0' - - 'wal_fsync_delay: 0' - - 'too_long_threshold: 0.5' - - 'slab_alloc_factor: 2' - - 'admin_port: 33015' - - 'logger: cat - >> tarantool.log' - 'snap_io_rate_limit: 0' - - 'reload: function_ptr' - - 'wal_dir_rescan_delay: 0.1' - - 'backlog: 1024' - - 'secondary_port: 33014' - 'wal_dir: .' - - 'local_hot_standby: false' + - 'readahead: 16320' - 'wal_mode: fsync_delay' - 'rows_per_wal: 50' - - 'readahead: 16320' - - 'panic_on_wal_error: false' + - 'panic_on_snap_error: true' + - 'local_hot_standby: false' - 'script_dir: .' - - 'primary_port: 33013' + - 'replication_port: 0' - 'bind_ipaddr: INADDR_ANY' - - 'memcached_port: 0' - - 'memcached_space: 23' - - 'memcached_expire: false' + - 'wal_fsync_delay: 0' + - 'backlog: 1024' + - 'wal_dir_rescan_delay: 0.1' ... t = {} for k,v in pairs(box.space[0]) do if type(v) ~= 'table' then table.insert(t, k..': '..tostring(v)) end end --- @@ -1370,37 +1360,32 @@ print_config() --- - - io_collect_interval = 0 - pid_file = box.pid + - slab_alloc_factor = 2 - slab_alloc_minimal = 64 - - primary_port = 33013 + - admin_port = 33015 + - logger = cat - >> tarantool.log + - slab_alloc_arena = 0.1 - log_level = 4 + - primary_port = 33013 + - backlog = 1024 + - too_long_threshold = 0.5 + - snap_io_rate_limit = 0 - logger_nonblock = true - - memcached_expire_per_loop = 1024 + - wal_dir = . - snap_dir = . - coredump = false + - script_dir = . + - local_hot_standby = false + - readahead = 16320 + - wal_mode = fsync_delay + - rows_per_wal = 50 - panic_on_snap_error = true + - panic_on_wal_error = false - 'reload = function_ptr' - replication_port = 0 + - bind_ipaddr = INADDR_ANY - wal_fsync_delay = 0 - secondary_port = 33014 - - slab_alloc_factor = 2 - - admin_port = 33015 - - logger = cat - >> tarantool.log - - snap_io_rate_limit = 0 - - memcached_expire = false - - memcached_space = 23 - - backlog = 1024 - - memcached_port = 0 - - rows_per_wal = 50 - - memcached_expire_full_sweep = 3600 - - wal_mode = fsync_delay - - local_hot_standby = false - - wal_dir = . - - panic_on_wal_error = false - - script_dir = . - - too_long_threshold = 0.5 - - bind_ipaddr = INADDR_ANY - - readahead = 16320 - - slab_alloc_arena = 0.1 - wal_dir_rescan_delay = 0.1 ... diff --git a/test/box/lua_misc.result b/test/box/lua_misc.result index 9a227c32b1..c731595c6d 100644 --- a/test/box/lua_misc.result +++ b/test/box/lua_misc.result @@ -73,7 +73,7 @@ type(box.space); ... box.cfg.memcached_space; --- -- 23 +{} ... t = {}; --- diff --git a/test/memcached/binary-get.result b/test/memcached/binary-get.result deleted file mode 100644 index 3223968dc9..0000000000 --- a/test/memcached/binary-get.result +++ /dev/null @@ -1,32 +0,0 @@ -len is 5 -set foo_0 0 0 5 -mooo� -STORED -get foo_0 -VALUE foo_0 0 5 -mooo� -END -len is 17 -set foo_1 0 0 17 -mumble���� blarg -STORED -get foo_1 -VALUE foo_1 0 17 -mumble���� blarg -END -len is 1 -set foo_2 0 0 1 -� -STORED -get foo_2 -VALUE foo_2 0 1 -� -END -len is 1 -set foo_3 0 0 1 - -STORED -get foo_3 -VALUE foo_3 0 1 - -END diff --git a/test/memcached/binary-get.test.py b/test/memcached/binary-get.test.py deleted file mode 100644 index a9714cfd9a..0000000000 --- a/test/memcached/binary-get.test.py +++ /dev/null @@ -1,16 +0,0 @@ -# encoding: utf-8 -blobs_list = [ "mooo\0", "mumble\0\0\0\0\r\rblarg", "\0", "\r" ] - -for i in range(len(blobs_list)): - key = "foo_%d" % i - blob = blobs_list[i] - blob_len = len(blob) - - print "len is %d" % blob_len - memcached("set %s 0 0 %d\r\n%s\r\n" % (key, blob_len, blob)) - memcached("get %s\r\n" % key) - -# resore default suite config -server.stop() -server.deploy(self.suite_ini["config"]) -# vim: syntax=python diff --git a/test/memcached/bogus-commands.result b/test/memcached/bogus-commands.result deleted file mode 100644 index 590543efb3..0000000000 --- a/test/memcached/bogus-commands.result +++ /dev/null @@ -1,2 +0,0 @@ -boguscommand slkdsldkfjsd -CLIENT_ERROR bad command line format diff --git a/test/memcached/bogus-commands.test.py b/test/memcached/bogus-commands.test.py deleted file mode 100644 index a19830af0d..0000000000 --- a/test/memcached/bogus-commands.test.py +++ /dev/null @@ -1,3 +0,0 @@ -# encoding: utf-8 -memcached("boguscommand slkdsldkfjsd\r\n") -# vim: syntax=python diff --git a/test/memcached/cas.result b/test/memcached/cas.result deleted file mode 100644 index fbebb97466..0000000000 --- a/test/memcached/cas.result +++ /dev/null @@ -1,79 +0,0 @@ -cas bad blah 0 0 0 -CLIENT_ERROR bad command line format -cas bad 0 blah 0 0 -CLIENT_ERROR bad command line format -cas bad 0 0 blah 0 -CLIENT_ERROR bad command line format -cas bad 0 0 0 blah -CLIENT_ERROR bad command line format -# gets foo (should not exist) -gets foo -END -# set foo -set foo 0 0 6 -barval -STORED -# gets foo and verify identifier exists -gets foo -VALUE foo 0 6 42 -barval -END -# cas fail -cas foo 0 0 6 123 -barva2 -EXISTS -# gets foo and verify identifier exists -gets foo -# cas success -cas foo 0 0 6 <unique_id> -barva2 -STORED -# cas failure (reusing the same key) -cas foo 0 0 6 <unique_id> -barva2 -EXISTS -# delete foo -delete foo -DELETED -# cas missing -cas foo 0 0 6 <unique_id> -barva2 -NOT_FOUND -# set foo1 -set foo1 0 0 1 -1 -STORED -# set foo2 -set foo2 0 0 1 -2 -STORED -# gets foo1 check -gets foo1 -VALUE foo1 0 1 44 -1 -END -# gets foo2 check -gets foo2 -VALUE foo2 0 1 45 -2 -END -# validate foo1 != foo2 -pass: foo1_cas != foo2_cas -# gets foo from memcached1 - should success -# gets foo from memcached2 - should success -# send 'cas foo1' from memcached1 -# send 'cas foo1' from memcached2 -# recv reply 'cas foo1' from memcached1 -# recv reply 'cas foo1' from memcached2 -race cas: pass -# set bug15 -set bug15 0 0 1 -0 -STORED -# Check out the first gets. -# Increment. -incr bug15 1 -1 -# Validate a changed CAS. -# validate bug15_cas != next_bug15_cas -pass: bug15_cas != next_bug15_cas diff --git a/test/memcached/cas.test.py b/test/memcached/cas.test.py deleted file mode 100644 index a4fd676d55..0000000000 --- a/test/memcached/cas.test.py +++ /dev/null @@ -1,119 +0,0 @@ -# encoding: utf-8 -import sys -from lib.memcached_connection import MemcachedConnection - -memcached("cas bad blah 0 0 0\r\n") -memcached("cas bad 0 blah 0 0\r\n") -memcached("cas bad 0 0 blah 0\r\n") -memcached("cas bad 0 0 0 blah\r\n") - -print """# gets foo (should not exist) """ -memcached("gets foo\r\n") - -print """# set foo """ -memcached("set foo 0 0 6\r\nbarval\r\n") - -print """# gets foo and verify identifier exists """ -memcached("gets foo\r\n") - -print """# cas fail """ -memcached("cas foo 0 0 6 123\r\nbarva2\r\n") - -print """# gets foo and verify identifier exists """ -sys.stdout.write("gets foo\r\n") -result = memcached("gets foo\r\n", silent=True) -unique_id = int(result.split()[4]) - -print """# cas success """ -sys.stdout.write("cas foo 0 0 6 <unique_id>\r\nbarva2\r\n") -result = memcached("cas foo 0 0 6 %d\r\nbarva2\r\n" % unique_id, silent=True) -sys.stdout.write(result) - -print """# cas failure (reusing the same key) """ -sys.stdout.write("cas foo 0 0 6 <unique_id>\r\nbarva2\r\n") -result = memcached("cas foo 0 0 6 %d\r\nbarva2\r\n" % unique_id, silent=True) -sys.stdout.write(result) - -print """# delete foo """ -memcached("delete foo\r\n") - -print """# cas missing """ -sys.stdout.write("cas foo 0 0 6 <unique_id>\r\nbarva2\r\n") -result = memcached("cas foo 0 0 6 %d\r\nbarva2\r\n" % unique_id, silent=True) -sys.stdout.write(result) - -print """# set foo1 """ -memcached("set foo1 0 0 1\r\n1\r\n") - -print """# set foo2 """ -memcached("set foo2 0 0 1\r\n2\r\n") - -print """# gets foo1 check """ -result = memcached("gets foo1\r\n") -foo1_cas = int(result.split()[4]) - -print """# gets foo2 check """ -result = memcached("gets foo2\r\n") -foo2_cas = int(result.split()[4]) - -print """# validate foo1 != foo2 """ -if foo1_cas != foo2_cas: - print "pass: foo1_cas != foo2_cas" -else: - print "fail: foo1_cas == foo2_cas" - -memcached1 = server.memcached -memcached2 = MemcachedConnection('localhost', server.memcached_port) - -print """# gets foo from memcached1 - should success """ -result = memcached1("gets foo1\r\n", silent=True) -mem1_cas = int(result.split()[4]) - -print """# gets foo from memcached2 - should success """ -result = memcached2("gets foo1\r\n", silent=True) -mem2_cas = int(result.split()[4]) - -print """# send 'cas foo1' from memcached1 """ -memcached1.send("cas foo1 0 0 6 %d\r\nbarva2\r\n" % mem1_cas, silent=True) -print """# send 'cas foo1' from memcached2 """ -memcached2.send("cas foo1 0 0 4 %d\r\npear\r\n" % mem2_cas, silent=True) - -print """# recv reply 'cas foo1' from memcached1 """ -result = memcached1.recv(silent=True) -mem1_cas_result = result.split()[0] -print """# recv reply 'cas foo1' from memcached2 """ -result = memcached2.recv(silent=True) -mem2_cas_result = result.split()[0] - -if mem1_cas_result == "STORED" and mem2_cas_result == "EXISTS": - print "race cas: pass" -elif mem1_cas_result == "EXISTS" and mem2_cas_result == "STORED": - print "race cas: pass" -else: - print "race cas: fail" - print "cas 1 = %s" % mem1_cas_result - print "cas 2 = %s" % mem2_cas_result - -print """# set bug15 """ -memcached("set bug15 0 0 1\r\n0\r\n") - -print """# Check out the first gets. """ -result = memcached("gets bug15\r\n", silent=True) -bug15_cas = int(result.split()[4]) - -print """# Increment. """ -memcached("incr bug15 1\r\n") -print """# Validate a changed CAS. """ -result = memcached("gets bug15\r\n", silent=True) -next_bug15_cas = int(result.split()[4]) - -print """# validate bug15_cas != next_bug15_cas """ -if bug15_cas != next_bug15_cas: - print "pass: bug15_cas != next_bug15_cas" -else: - print "fail: bug15_cas == next_bug15_cas" - -# resore default suite config -server.stop() -server.deploy(self.suite_ini["config"]) -# vim: syntax=python diff --git a/test/memcached/cfg/master.cfg b/test/memcached/cfg/master.cfg deleted file mode 100644 index 0f83dcb182..0000000000 --- a/test/memcached/cfg/master.cfg +++ /dev/null @@ -1,25 +0,0 @@ -slab_alloc_arena = 0.1 - -pid_file = "box.pid" -logger="cat - >> tarantool.log" -bind_ipaddr="INADDR_ANY" -custom_proc_title="master" - -primary_port = 33013 -secondary_port = 33014 -admin_port = 33015 -memcached_port = 33016 - -replication_port = 33017 - -rows_per_wal = 200 - -space[0].enabled = 1 -space[0].index[0].type = "HASH" -space[0].index[0].unique = 1 -space[0].index[0].key_field[0].fieldno = 0 -space[0].index[0].key_field[0].type = "NUM" - -memcached_space = 2 -memcached_expire=true - diff --git a/test/memcached/cfg/tarantool_memcached_bad.cfg b/test/memcached/cfg/tarantool_memcached_bad.cfg deleted file mode 100644 index 2ea7a90600..0000000000 --- a/test/memcached/cfg/tarantool_memcached_bad.cfg +++ /dev/null @@ -1,52 +0,0 @@ -# -# Limit of memory used to store tuples to 100MB -# (0.1 GB) -# This effectively limits the memory, used by -# Tarantool. However, index and connection memory -# is stored outside the slab allocator, hence -# the effective memory usage can be higher (sometimes -# twice as high). -# -slab_alloc_arena = 0.1 - -# -# Store the pid in this file. Relative to -# startup dir. -# -pid_file = "box.pid" - -# -# Pipe the logs into the following process. -# -logger="cat - >> tarantool.log" - -# -# Read only and read-write port. -primary_port = 33013 -# Read-only port. -secondary_port = 33014 -# -# The port for administrative commands. -# -admin_port = 33015 -# -# Each write ahead log contains this many rows. -# When the limit is reached, Tarantool closes -# the WAL and starts a new one. -rows_per_wal = 50 - -# Define a simple space with 1 HASH-based -# primary key. -space[0].enabled = 1 -space[0].index[0].type = "HASH" -space[0].index[0].unique = 1 -space[0].index[0].key_field[0].fieldno = 0 -space[0].index[0].key_field[0].type = "NUM" -space[0].index[1].type = "TREE" -space[0].index[1].unique = 0 -space[0].index[1].key_field[0].fieldno = 1 -space[0].index[1].key_field[0].type = "STR" - -memcached_port = 33333 -memcached_space = 0 - diff --git a/test/memcached/cfg/tarantool_memcached_off.cfg b/test/memcached/cfg/tarantool_memcached_off.cfg deleted file mode 100644 index b3df27572e..0000000000 --- a/test/memcached/cfg/tarantool_memcached_off.cfg +++ /dev/null @@ -1,52 +0,0 @@ -# -# Limit of memory used to store tuples to 100MB -# (0.1 GB) -# This effectively limits the memory, used by -# Tarantool. However, index and connection memory -# is stored outside the slab allocator, hence -# the effective memory usage can be higher (sometimes -# twice as high). -# -slab_alloc_arena = 0.1 - -# -# Store the pid in this file. Relative to -# startup dir. -# -pid_file = "box.pid" - -# -# Pipe the logs into the following process. -# -logger="cat - >> tarantool.log" - -# -# Read only and read-write port. -primary_port = 33013 -# Read-only port. -secondary_port = 33014 -# -# The port for administrative commands. -# -admin_port = 33015 -# -# Each write ahead log contains this many rows. -# When the limit is reached, Tarantool closes -# the WAL and starts a new one. -rows_per_wal = 50 - -# Define a simple space with 1 HASH-based -# primary key. -space[0].enabled = 1 -space[0].index[0].type = "HASH" -space[0].index[0].unique = 1 -space[0].index[0].key_field[0].fieldno = 0 -space[0].index[0].key_field[0].type = "NUM" -space[0].index[1].type = "TREE" -space[0].index[1].unique = 0 -space[0].index[1].key_field[0].fieldno = 1 -space[0].index[1].key_field[0].type = "STR" - -#memcached_port = 33333 -memcached_space = 0 - diff --git a/test/memcached/expirations.result b/test/memcached/expirations.result deleted file mode 100644 index 30268ee42c..0000000000 --- a/test/memcached/expirations.result +++ /dev/null @@ -1,46 +0,0 @@ -# expire: after 1 second -# set foo -set foo 0 1 6 -fooval -STORED -# foo shoud be exists -get foo -VALUE foo 0 6 -fooval -END -# foo shoud expired -get foo -END -# expire: time - 1 second -# set foo -# foo shoud expired -get foo -END -# expire: time + 1 second -# set foo -# foo shoud be exists -get foo -VALUE foo 0 6 -fooval -END -# foo shoud expired -get foo -END -# expire: time - 20 second -# set boo -# foo shoud expired -get boo -END -# expire: after 2 second -# add add -add add 0 1 6 -addval -STORED -# readd add - shoud be fail -add add 0 1 7 -addval1 -NOT_STORED -# readd add - shoud be success -add add 0 1 7 -addval2 -STORED diff --git a/test/memcached/expirations.test.py b/test/memcached/expirations.test.py deleted file mode 100644 index ac3df7e71c..0000000000 --- a/test/memcached/expirations.test.py +++ /dev/null @@ -1,83 +0,0 @@ -# encoding: utf-8 -import time -import yaml - -################################### -def wait_for_next_lsn(lsn, serv): - serv_admin = serv.admin - while True: - if get_lsn(serv) != lsn: - return lsn - time.sleep(0.01) - -def get_lsn(serv): - serv_admin = serv.admin - resp = serv_admin("box.info.lsn", silent=True) - return yaml.load(resp)[0] - -def wait(serv = server): - lsn = get_lsn(serv) - return wait_for_next_lsn(lsn, serv) -################################### - -print """# expire: after 1 second""" - -print """# set foo""" -memcached("set foo 0 1 6\r\nfooval\r\n") - -print """# foo shoud be exists""" -memcached("get foo\r\n") - -wait() -print """# foo shoud expired""" -memcached("get foo\r\n") - - -print """# expire: time - 1 second""" -expire = time.time() - 1 - -print """# set foo""" -memcached("set foo 0 %d 6\r\nfooval\r\n" % expire, silent=True) - -print """# foo shoud expired""" -memcached("get foo\r\n") - - -print """# expire: time + 1 second""" -expire = time.time() + 1 - -print """# set foo""" -memcached("set foo 0 %d 6\r\nfooval\r\n" % expire, silent=True) - -print """# foo shoud be exists""" -memcached("get foo\r\n") - -wait() -print """# foo shoud expired""" -memcached("get foo\r\n") - -print """# expire: time - 20 second""" -expire = time.time() - 20 - -print """# set boo""" -memcached("set boo 0 %d 6\r\nbooval\r\n" % expire, silent=True) - -print """# foo shoud expired""" -memcached("get boo\r\n") - -print """# expire: after 2 second""" - -print """# add add""" -memcached("add add 0 1 6\r\naddval\r\n") - -print """# readd add - shoud be fail""" -memcached("add add 0 1 7\r\naddval1\r\n") - -wait() -print """# readd add - shoud be success""" -memcached("add add 0 1 7\r\naddval2\r\n") - -# resore default suite config -server.stop() -server.deploy(self.suite_ini["config"]) -# vim: syntax=python diff --git a/test/memcached/flags.result b/test/memcached/flags.result deleted file mode 100644 index 4a68c769fc..0000000000 --- a/test/memcached/flags.result +++ /dev/null @@ -1,24 +0,0 @@ -set foo 0 0 6 -fooval -STORED -gets foo -VALUE foo 0 6 42 -fooval -END -success: flags (0x0) == ret_flags (0x0) -set foo 123 0 6 -fooval -STORED -gets foo -VALUE foo 123 6 43 -fooval -END -success: flags (0x7b) == ret_flags (0x7b) -set foo 65535 0 6 -fooval -STORED -gets foo -VALUE foo 65535 6 44 -fooval -END -success: flags (0xffff) == ret_flags (0xffff) diff --git a/test/memcached/flags.test.py b/test/memcached/flags.test.py deleted file mode 100644 index bbebb17ba8..0000000000 --- a/test/memcached/flags.test.py +++ /dev/null @@ -1,16 +0,0 @@ -# encoding: utf-8 -flags_list = [ 0x0, 0x7b, 0xffff ] - -for flags in flags_list: - memcached("set foo %d 0 6\r\nfooval\r\n" % flags) - result = memcached("gets foo\r\n") - ret_flags = int(result.split()[2]) - if flags == ret_flags: - print "success: flags (0x%x) == ret_flags (0x%x)" % (flags, ret_flags) - else: - print "fail: flags (0x%x) != ret_flags (0x%x)" % (flags, ret_flags) - -# resore default suite config -server.stop() -server.deploy(self.suite_ini["config"]) -# vim: syntax=python diff --git a/test/memcached/flush-all.result b/test/memcached/flush-all.result deleted file mode 100644 index 245d0f0f74..0000000000 --- a/test/memcached/flush-all.result +++ /dev/null @@ -1,37 +0,0 @@ -# Test flush_all with zero delay. -set foo 0 0 6 -fooval -STORED -get foo -VALUE foo 0 6 -fooval -END -flush_all -OK -get foo -END -# check that flush_all doesn't blow away items that immediately get set -set foo 0 0 3 -new -STORED -get foo -VALUE foo 0 3 -new -END -# and the other form, specifying a flush_all time... -flush_all time + 1 -OK - -get foo -VALUE foo 0 3 -new -END -set foo 0 0 3 -123 -STORED -get foo -VALUE foo 0 3 -123 -END -get foo -END diff --git a/test/memcached/flush-all.test.py b/test/memcached/flush-all.test.py deleted file mode 100644 index c0ee28eb8c..0000000000 --- a/test/memcached/flush-all.test.py +++ /dev/null @@ -1,43 +0,0 @@ -# encoding: utf-8 -import time -import yaml - -################################### -def get_memcached_len(serv): - serv_admin = serv.admin - resp = serv_admin("box.space[box.cfg.memcached_space]:len()", silent=True) - return yaml.load(resp)[0] - -def wait_for_empty_space(serv = server): - serv_admin = serv.admin - while True: - if get_memcached_len(serv) == 0: - return - time.sleep(0.01) -################################### - -print """# Test flush_all with zero delay. """ -memcached("set foo 0 0 6\r\nfooval\r\n") -memcached("get foo\r\n") -memcached("flush_all\r\n") -memcached("get foo\r\n") - -print """# check that flush_all doesn't blow away items that immediately get set """ -memcached("set foo 0 0 3\r\nnew\r\n") -memcached("get foo\r\n") - -print """# and the other form, specifying a flush_all time... """ -expire = time.time() + 1 -print "flush_all time + 1" -print memcached("flush_all %d\r\n" % expire, silent=True) -memcached("get foo\r\n") - -memcached("set foo 0 0 3\r\n123\r\n") -memcached("get foo\r\n") -wait_for_empty_space() -memcached("get foo\r\n") - -# resore default suite config -server.stop() -server.deploy(self.suite_ini["config"]) -# vim: syntax=python diff --git a/test/memcached/getset.result b/test/memcached/getset.result deleted file mode 100644 index 860702f0e1..0000000000 --- a/test/memcached/getset.result +++ /dev/null @@ -1,145 +0,0 @@ -# set foo (and should get it) -set foo 0 0 6 -fooval -STORED -get foo -VALUE foo 0 6 -fooval -END -# add bar (and should get it) -set bar 0 0 6 -barval -STORED -get bar -VALUE bar 0 6 -barval -END -# add foo (but shouldn't get new value) -add foo 0 0 5 -foov2 -NOT_STORED -get foo -VALUE foo 0 6 -fooval -END -# replace bar (should work) -replace bar 0 0 6 -barva2 -STORED -get bar -VALUE bar 0 6 -barva2 -END -# replace notexist (shouldn't work) -replace notexist 0 0 6 -barva2 -NOT_STORED -get notexist -END -# delete foo -delete foo -DELETED -get foo -END -# delete foo again. not found this time. -delete foo -NOT_FOUND -get foo -END -# add moo -add moo 0 0 6 -mooval -STORED -get moo -VALUE moo 0 6 -mooval -END -# check-and-set (cas) failure case, try to set value with incorrect cas unique val -cas moo 0 0 6 0 -MOOVAL -EXISTS -get moo -VALUE moo 0 6 -mooval -END -# now test that we can store moo with the correct unique id -get moo -VALUE moo 0 6 -MOOVAL -END -set foo 0 0 6 -fooval -delete foo -set foo 0 0 6 -fooval -delete foo -STORED -DELETED -STORED -DELETED -# set big data: - should pass -set foo_1024 0 0 1024 -<big-data> - -STORED - -# set big data: - should pass -set foo_525312 0 0 525312 -<big-data> - -STORED - -# Ensure causing a memory overflow doesn't leave stale data. -# set small data: - should pass -set foo_1049600 0 0 3 -MOO -STORED -get foo_1049600 -VALUE foo_1049600 0 3 -MOO -END -# set big data: - should fail -set foo_1049600 0 0 1049600 -<big-data> - -SERVER_ERROR object too large for cache - -# -# A test for Bug#898198 memcached protocol isn't case-insensitive" -# -SET foo 0 0 6 -fooval -STORED -GET foo -VALUE foo 0 6 -fooval -END -ADD foo 0 0 5 -foov2 -NOT_STORED -GET foo -VALUE foo 0 6 -fooval -END -REPLACE bar 0 0 6 -barva2 -STORED -GET bar -VALUE bar 0 6 -barva2 -END -DELETE foo -DELETED -GET foo -END -CAS moo 0 0 6 0 -MOOVAL -EXISTS -GET moo -VALUE moo 0 6 -MOOVAL -END -GETS moo -VALUE moo 0 6 46 -MOOVAL -END diff --git a/test/memcached/getset.test.py b/test/memcached/getset.test.py deleted file mode 100644 index 3e13bda902..0000000000 --- a/test/memcached/getset.test.py +++ /dev/null @@ -1,83 +0,0 @@ -# encoding: utf-8 -print """# set foo (and should get it) """ -memcached("set foo 0 0 6\r\nfooval\r\n") -memcached("get foo\r\n") - -print """# add bar (and should get it)""" -memcached("set bar 0 0 6\r\nbarval\r\n") -memcached("get bar\r\n") - -print """# add foo (but shouldn't get new value)""" -memcached("add foo 0 0 5\r\nfoov2\r\n") -memcached("get foo\r\n") - -print """# replace bar (should work)""" -memcached("replace bar 0 0 6\r\nbarva2\r\n") -memcached("get bar\r\n") - -print """# replace notexist (shouldn't work)""" -memcached("replace notexist 0 0 6\r\nbarva2\r\n") -memcached("get notexist\r\n") - -print """# delete foo""" -memcached("delete foo\r\n") -memcached("get foo\r\n") - -print """# delete foo again. not found this time.""" -memcached("delete foo\r\n") -memcached("get foo\r\n") - -print """# add moo""" -memcached("add moo 0 0 6\r\nmooval\r\n") -memcached("get moo\r\n") - -print """# check-and-set (cas) failure case, try to set value with incorrect cas unique val""" -memcached("cas moo 0 0 6 0\r\nMOOVAL\r\n") -memcached("get moo\r\n") - -result = memcached("gets moo\r\n", silent=True) -unique_id = int(result.split()[4]) - -print """# now test that we can store moo with the correct unique id""" -memcached("cas moo 0 0 6 %d\r\nMOOVAL\r\n" % unique_id, silent=True) -memcached("get moo\r\n") - -memcached("set foo 0 0 6\r\nfooval\r\ndelete foo\r\nset foo 0 0 6\r\nfooval\r\ndelete foo\r\n") - -len = 1024 -while len < (1024 * 1028): - val = 'B' * len - if len > (1024 * 1024): - print """# Ensure causing a memory overflow doesn't leave stale data.""" - print "# set small data: - should pass" - memcached("set foo_%d 0 0 3\r\nMOO\r\n" % (len)) - memcached("get foo_%d\r\n" % (len)) - print "# set big data: - should fail" - print "set foo_%d 0 0 %d\r\n<big-data>\r\n" % (len, len) - print memcached("set foo_%d 0 0 %d\r\n%s\r\n" % (len, len, val), silent=True) - else: - print "# set big data: - should pass" - print "set foo_%d 0 0 %d\r\n<big-data>\r\n" % (len, len) - print memcached("set foo_%d 0 0 %d\r\n%s\r\n" % (len, len, val), silent=True) - len += 1024 * 512 - -print """# -# A test for Bug#898198 memcached protocol isn't case-insensitive" -#""" - -memcached("SET foo 0 0 6\r\nfooval\r\n") -memcached("GET foo\r\n") -memcached("ADD foo 0 0 5\r\nfoov2\r\n") -memcached("GET foo\r\n") -memcached("REPLACE bar 0 0 6\r\nbarva2\r\n") -memcached("GET bar\r\n") -memcached("DELETE foo\r\n") -memcached("GET foo\r\n") -memcached("CAS moo 0 0 6 0\r\nMOOVAL\r\n") -memcached("GET moo\r\n") -memcached("GETS moo\r\n") - -# resore default suite config -server.stop() -server.deploy(self.suite_ini["config"]) -# vim: syntax=python diff --git a/test/memcached/incrdecr.result b/test/memcached/incrdecr.result deleted file mode 100644 index d60524fab0..0000000000 --- a/test/memcached/incrdecr.result +++ /dev/null @@ -1,53 +0,0 @@ -# incr/decr big value -set bug21 0 0 19 -9223372036854775807 -STORED -incr bug21 1 -9223372036854775808 -incr bug21 1 -9223372036854775809 -decr bug21 1 -9223372036854775808 -# underflow protection -set num 0 0 1 -1 -STORED -incr num 1 -2 -incr num 8 -10 -decr num 1 -9 -decr num 9 -0 -decr num 5 -0 -# 32-bit value -set num 0 0 10 -4294967296 -STORED -incr num 1 -4294967297 -# overflow value -set num 0 0 20 -18446744073709551615 -STORED -incr num 1 -0 -# bogus -decr bogus 1 -NOT_FOUND -decr incr 1 -NOT_FOUND -# bit increment -set bigincr 0 0 1 -0 -STORED -incr num 18446744073709551610 -18446744073709551610 -# incr text value error -set text 0 0 2 -hi -STORED -incr text 1 -CLIENT_ERROR cannot increment or decrement non-numeric value diff --git a/test/memcached/incrdecr.test.py b/test/memcached/incrdecr.test.py deleted file mode 100644 index a081ccc107..0000000000 --- a/test/memcached/incrdecr.test.py +++ /dev/null @@ -1,39 +0,0 @@ -# encoding: utf-8 -print """# incr/decr big value """ -memcached("set bug21 0 0 19\r\n9223372036854775807\r\n") -memcached("incr bug21 1\r\n") -memcached("incr bug21 1\r\n") -memcached("decr bug21 1\r\n") - -print """# underflow protection """ -memcached("set num 0 0 1\r\n1\r\n") -memcached("incr num 1\r\n") -memcached("incr num 8\r\n") -memcached("decr num 1\r\n") -memcached("decr num 9\r\n") -memcached("decr num 5\r\n") - -print """# 32-bit value """ -memcached("set num 0 0 10\r\n4294967296\r\n") -memcached("incr num 1\r\n") - -print """# overflow value """ -memcached("set num 0 0 20\r\n18446744073709551615\r\n") -memcached("incr num 1\r\n") - -print """# bogus """ -memcached("decr bogus 1\r\n") -memcached("decr incr 1\r\n") - -print """# bit increment """ -memcached("set bigincr 0 0 1\r\n0\r\n") -memcached("incr num 18446744073709551610\r\n") - -print """# incr text value error """ -memcached("set text 0 0 2\r\nhi\r\n") -memcached("incr text 1\r\n") - -# resore default suite config -server.stop() -server.deploy(self.suite_ini["config"]) -# vim: syntax=python diff --git a/test/memcached/lua.result b/test/memcached/lua.result deleted file mode 100644 index cdd3822e07..0000000000 --- a/test/memcached/lua.result +++ /dev/null @@ -1,20 +0,0 @@ -box.space[box.cfg.memcached_space].arity ---- - - 4 -... -box.space[box.cfg.memcached_space].estimated_rows ---- - - nil -... -box.space[box.cfg.memcached_space].n ---- - - 2 -... -box.space[box.cfg.memcached_space].index[0].idx ---- - - index 0 -... -box.space[box.cfg.memcached_space].index[0].type ---- - - HASH -... diff --git a/test/memcached/lua.test.lua b/test/memcached/lua.test.lua deleted file mode 100644 index a775fdcb7c..0000000000 --- a/test/memcached/lua.test.lua +++ /dev/null @@ -1,5 +0,0 @@ -box.space[box.cfg.memcached_space].arity -box.space[box.cfg.memcached_space].estimated_rows -box.space[box.cfg.memcached_space].n -box.space[box.cfg.memcached_space].index[0].idx -box.space[box.cfg.memcached_space].index[0].type diff --git a/test/memcached/multiversioning.result b/test/memcached/multiversioning.result deleted file mode 100644 index 882c1e1d90..0000000000 --- a/test/memcached/multiversioning.result +++ /dev/null @@ -1,31 +0,0 @@ -# Store big in lower case via first memcached client -set big 0 0 262144 -<big-value-lower-case> -STORED - -# send command 'get big' to firs memcached client -get big -# send command 'delete big' to second client -delete big -DELETED -# Store big in lower case via first memcached client -set big 0 0 262144 -<big-value-upper-case> -STORED - -# recv reply 'get big' from the first memcached client -success: buf == reply -show stat ---- -statistics: - REPLACE: { rps: 0 , total: 0 } - SELECT: { rps: 0 , total: 0 } - UPDATE: { rps: 0 , total: 0 } - DELETE_1_3: { rps: 0 , total: 0 } - DELETE: { rps: 0 , total: 0 } - CALL: { rps: 0 , total: 0 } - MEMC_GET: { rps: 0 , total: 0 } - MEMC_GET_MISS: { rps: 0 , total: 0 } - MEMC_GET_HIT: { rps: 0 , total: 0 } - MEMC_EXPIRED_KEYS: { rps: 0 , total: 0 } -... diff --git a/test/memcached/multiversioning.test.py b/test/memcached/multiversioning.test.py deleted file mode 100644 index 21f6997325..0000000000 --- a/test/memcached/multiversioning.test.py +++ /dev/null @@ -1,39 +0,0 @@ -# encoding: utf-8 -from lib.memcached_connection import MemcachedConnection - -buf_size = 256 * 1024 -buf = "0123456789abcdef" * (buf_size / 16) -buf_upper = buf.upper() - -memcached1 = server.memcached -memcached2 = MemcachedConnection('localhost', server.memcached_port) - -print """# Store big in lower case via first memcached client """ -print "set big 0 0 %d\r\n<big-value-lower-case>" % buf_size -print memcached1("set big 0 0 %d\r\n%s\r\n" % (buf_size, buf), silent=True) - -print """# send command 'get big' to firs memcached client """ -memcached1.send("get big\r\n", silent=False) - -print """# send command 'delete big' to second client """ -memcached2("delete big\r\n") - -print """# Store big in lower case via first memcached client """ -print "set big 0 0 %d\r\n<big-value-upper-case>" % buf_size -print memcached2("set big 0 0 %d\r\n%s\r\n" % (buf_size, buf_upper), silent=True) - -print """# recv reply 'get big' from the first memcached client """ -reply = memcached1.recv(silent=True) -reply_buf = reply.split('\r\n')[1] -if buf == reply_buf: - print "success: buf == reply" -else: - print "fail: buf != reply" - print len(buf), len(reply_buf) - -# resore default suite config -server.stop() -server.deploy(self.suite_ini["config"]) -# check that we print clear memcached stats -admin("show stat") -# vim: syntax=python diff --git a/test/memcached/noreply.result b/test/memcached/noreply.result deleted file mode 100644 index 07e09a4451..0000000000 --- a/test/memcached/noreply.result +++ /dev/null @@ -1,55 +0,0 @@ -# Test that commands can take 'noreply' parameter. -flush_all noreply -flush_all 0 noreply -get noreply:foo -END -add noreply:foo 0 0 1 noreply -1 -get noreply:foo -VALUE noreply:foo 0 1 -1 -END -set noreply:foo 0 0 1 noreply -2 -get noreply:foo -VALUE noreply:foo 0 1 -2 -END -replace noreply:foo 0 0 1 noreply -3 -get noreply:foo -VALUE noreply:foo 0 1 -3 -END -append noreply:foo 0 0 1 noreply -4 -get noreply:foo -VALUE noreply:foo 0 2 -34 -END -prepend noreply:foo 0 0 1 noreply -5 -get noreply:foo -VALUE noreply:foo 0 3 -534 -END -gets noreply:foo -cas noreply:foo 0 0 1 <unique_id> noreply -6 -get noreply:foo -VALUE noreply:foo 0 1 -6 -END -incr noreply:foo 3 noreply -get noreply:foo -VALUE noreply:foo 0 1 -9 -END -decr noreply:foo 2 noreply -get noreply:foo -VALUE noreply:foo 0 1 -7 -END -delete noreply:foo noreply -get noreply:foo -END diff --git a/test/memcached/noreply.test.py b/test/memcached/noreply.test.py deleted file mode 100644 index c4654ae868..0000000000 --- a/test/memcached/noreply.test.py +++ /dev/null @@ -1,44 +0,0 @@ -# encoding: utf-8 -import sys - -print """# Test that commands can take 'noreply' parameter. """ -memcached("flush_all noreply\r\n") -memcached("flush_all 0 noreply\r\n") - -memcached("get noreply:foo\r\n") -memcached("add noreply:foo 0 0 1 noreply\r\n1\r\n") -memcached("get noreply:foo\r\n") - -memcached("set noreply:foo 0 0 1 noreply\r\n2\r\n") -memcached("get noreply:foo\r\n") - -memcached("replace noreply:foo 0 0 1 noreply\r\n3\r\n") -memcached("get noreply:foo\r\n") - -memcached("append noreply:foo 0 0 1 noreply\r\n4\r\n") -memcached("get noreply:foo\r\n") - -memcached("prepend noreply:foo 0 0 1 noreply\r\n5\r\n") -memcached("get noreply:foo\r\n") - -sys.stdout.write("gets noreply:foo\r\n") -result = memcached("gets noreply:foo\r\n", silent=True) -unique_id = int(result.split()[4]) - -sys.stdout.write("cas noreply:foo 0 0 1 <unique_id> noreply\r\n6\r\n") -memcached("cas noreply:foo 0 0 1 %d noreply\r\n6\r\n" % unique_id, silent=True) -memcached("get noreply:foo\r\n") - -memcached("incr noreply:foo 3 noreply\r\n") -memcached("get noreply:foo\r\n") - -memcached("decr noreply:foo 2 noreply\r\n") -memcached("get noreply:foo\r\n") - -memcached("delete noreply:foo noreply\r\n") -memcached("get noreply:foo\r\n") - -# resore default suite config -server.stop() -server.deploy(self.suite_ini["config"]) -# vim: syntax=python diff --git a/test/memcached/off.result b/test/memcached/off.result deleted file mode 100644 index b5bd0d754b..0000000000 --- a/test/memcached/off.result +++ /dev/null @@ -1,62 +0,0 @@ - -# Bug #855616: -# memcached_space must not be configured -# (https://bugs.launchpad.net/bugs/855616) - -show configuration ---- -configuration: - username: (null) - local_hot_standby: "false" - bind_ipaddr: "INADDR_ANY" - coredump: "false" - admin_port: "33015" - replication_port: "0" - log_level: "4" - slab_alloc_arena: "0.1" - slab_alloc_minimal: "64" - slab_alloc_factor: "2" - work_dir: (null) - snap_dir: "." - wal_dir: "." - script_dir: "." - pid_file: "box.pid" - logger: "cat - >> tarantool.log" - logger_nonblock: "true" - io_collect_interval: "0" - backlog: "1024" - readahead: "16320" - snap_io_rate_limit: "0" - rows_per_wal: "50" - wal_writer_inbox_size: "16384" - wal_mode: "fsync_delay" - wal_fsync_delay: "0" - wal_dir_rescan_delay: "0.1" - panic_on_snap_error: "true" - panic_on_wal_error: "false" - primary_port: "33013" - secondary_port: "33014" - too_long_threshold: "0.5" - custom_proc_title: (null) - memcached_port: "0" - memcached_space: "0" - memcached_expire: "false" - memcached_expire_per_loop: "1024" - memcached_expire_full_sweep: "3600" - replication_source: (null) - space[0].enabled: "true" - space[0].arity: "-1" - space[0].estimated_rows: "0" - space[0].index[0].type: "HASH" - space[0].index[0].unique: "true" - space[0].index[0].key_field[0].fieldno: "0" - space[0].index[0].key_field[0].type: "NUM" - space[0].index[1].type: "TREE" - space[0].index[1].unique: "false" - space[0].index[1].key_field[0].fieldno: "1" - space[0].index[1].key_field[0].type: "STR" -... -tarantool_box -c tarantool_memcached_bad.cfg -tarantool_box: can't load config: - - Space 0 is already used as memcached_space. - diff --git a/test/memcached/off.test.py b/test/memcached/off.test.py deleted file mode 100644 index fef9151a33..0000000000 --- a/test/memcached/off.test.py +++ /dev/null @@ -1,35 +0,0 @@ -# encoding: utf-8 -# - -import os -import sys - -# mask BFD warnings: https://bugs.launchpad.net/tarantool/+bug/1018356 -sys.stdout.push_filter("unable to read unknown load command 0x2\d+", "") - -print """ -# Bug #855616: -# memcached_space must not be configured -# (https://bugs.launchpad.net/bugs/855616) -""" -# stop current server -server.stop() -# start server with memcached off -server.deploy("memcached/cfg/tarantool_memcached_off.cfg") -# check values -admin("show configuration") - -# stop current server -server.stop() -# start server with memcached space conflict -sys.stdout.push_filter("(/\S+)+/tarantool", "tarantool") -server.test_option("-c " + os.path.join(os.getcwd(), "memcached/cfg/tarantool_memcached_bad.cfg")) -sys.stdout.pop_filter() - -# restore default server -server.stop() -server.deploy(self.suite_ini["config"]) - -sys.stdout.pop_filter() - -# vim: syntax=python diff --git a/test/memcached/suite.ini b/test/memcached/suite.ini deleted file mode 100644 index 3e6f37e450..0000000000 --- a/test/memcached/suite.ini +++ /dev/null @@ -1,7 +0,0 @@ -[default] -core = tarantool -description = tarantool/box memcached tests -config = cfg/master.cfg -disabled = cas.test -# put disabled in valgrind test here -valgrind_disabled = expirations.test, repl.test diff --git a/test/replication/cfg/hot_standby.cfg b/test/replication/cfg/hot_standby.cfg index 580e073cfe..36869d201e 100644 --- a/test/replication/cfg/hot_standby.cfg +++ b/test/replication/cfg/hot_standby.cfg @@ -11,15 +11,6 @@ snap_dir="../" primary_port = 33013 secondary_port = 33024 admin_port = 33025 -memcached_port = 33026 replication_port=33017 -space[0].enabled = 1 -space[0].index[0].type = "HASH" -space[0].index[0].unique = 1 -space[0].index[0].key_field[0].fieldno = 0 -space[0].index[0].key_field[0].type = "NUM" - -memcached_space = 2 -memcached_expire=true diff --git a/test/replication/cfg/master.cfg b/test/replication/cfg/master.cfg index 8069ab062c..d5e030893c 100644 --- a/test/replication/cfg/master.cfg +++ b/test/replication/cfg/master.cfg @@ -8,14 +8,4 @@ custom_proc_title="master" primary_port = 33013 secondary_port = 33014 admin_port = 33015 -memcached_port = 33016 replication_port = 33017 - -space[0].enabled = 1 -space[0].index[0].type = "HASH" -space[0].index[0].unique = 1 -space[0].index[0].key_field[0].fieldno = 0 -space[0].index[0].key_field[0].type = "NUM" - -memcached_space = 2 -memcached_expire=true diff --git a/test/replication/cfg/master_to_replica.cfg b/test/replication/cfg/master_to_replica.cfg index 2428d2c393..e685ec6c0b 100644 --- a/test/replication/cfg/master_to_replica.cfg +++ b/test/replication/cfg/master_to_replica.cfg @@ -8,17 +8,6 @@ custom_proc_title="master" primary_port = 33013 secondary_port = 33014 admin_port = 33015 -memcached_port = 33016 replication_port=33017 replication_source = "127.0.0.1:33117" - - -space[0].enabled = 1 -space[0].index[0].type = "HASH" -space[0].index[0].unique = 1 -space[0].index[0].key_field[0].fieldno = 0 -space[0].index[0].key_field[0].type = "NUM" - -memcached_space = 2 -memcached_expire=true diff --git a/test/replication/cfg/replica.cfg b/test/replication/cfg/replica.cfg index c214a3aef4..f33d571631 100644 --- a/test/replication/cfg/replica.cfg +++ b/test/replication/cfg/replica.cfg @@ -8,16 +8,6 @@ custom_proc_title="replica" primary_port = 33113 secondary_port = 33114 admin_port = 33115 -memcached_port = 33116 replication_port=33117 replication_source = 127.0.0.1:33017 - -space[0].enabled = 1 -space[0].index[0].type = "HASH" -space[0].index[0].unique = 1 -space[0].index[0].key_field[0].fieldno = 0 -space[0].index[0].key_field[0].type = "NUM" - -memcached_space = 2 -memcached_expire=true diff --git a/test/replication/cfg/replica_to_master.cfg b/test/replication/cfg/replica_to_master.cfg index 1f7c10c31e..e31c32ccb7 100644 --- a/test/replication/cfg/replica_to_master.cfg +++ b/test/replication/cfg/replica_to_master.cfg @@ -8,14 +8,4 @@ custom_proc_title="replica" primary_port = 33113 secondary_port = 33114 admin_port = 33115 -memcached_port = 33116 replication_port = 33117 - -space[0].enabled = 1 -space[0].index[0].type = "HASH" -space[0].index[0].unique = 1 -space[0].index[0].key_field[0].fieldno = 0 -space[0].index[0].key_field[0].type = "NUM" - -memcached_space = 2 -memcached_expire=true diff --git a/test/replication/suite.ini b/test/replication/suite.ini index f81ca33b87..b325a735aa 100644 --- a/test/replication/suite.ini +++ b/test/replication/suite.ini @@ -1,4 +1,5 @@ [default] core = tarantool description = tarantool/box, replication +disabled = memcached.test.py config = cfg/master.cfg -- GitLab