diff --git a/.gitignore b/.gitignore index 5e89ecc0ee1d48ae7f387f4ac96ed50324751679..b93343473ab2a0381e8925093d93ac13e464a675 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,10 @@ lcov test/var test/lib/*.pyc test/lib/*/*.pyc +test/connector_c/rpl +test/connector_c/xlog +test/connector_c/tt +test/connector_c/update test/box/protocol test/box/connector test/unit/queue @@ -41,8 +45,6 @@ third_party/luajit/src/lj_folddef.h third_party/luajit/src/lj_libdef.h third_party/luajit/src/lj_recdef.h third_party/luajit/src/lj_vm.s -test/connector_c/tt -test/connector_c/update *.reject extra/txt2c mod/box/box.lua.c @@ -57,3 +59,5 @@ connector/c/tntnet/libtarantoolnet.so.1 connector/c/tntnet/libtarantoolnet.so.1.1 connector/c/tntsql/libtarantoolsql.so.1 connector/c/tntsql/libtarantoolsql.so.1.1 +connector/c/tntrpl/libtarantoolrpl.so.1 +connector/c/tntrpl/libtarantoolrpl.so.1.1 diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 1409637f72cf6c27cf37f8e3bc49df5c8d1aa923..8a1808c0043fc10d5cc559c0d4cf1a6b5fa24422 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -6,7 +6,7 @@ function(tarantool_client client_name) list(REMOVE_ITEM client_sources ${client_name}) add_executable(${client_name} ${client_sources} ${CMAKE_SOURCE_DIR}/src/errcode.c) - set (client_libs tntnet tntsql tnt) + set (client_libs tntrpl tntnet tntsql tnt) set_target_properties(${client_name} PROPERTIES COMPILE_FLAGS "${core_cflags}") target_link_libraries (${client_name} ${client_libs}) endfunction() diff --git a/client/tarantool/CMakeLists.txt b/client/tarantool/CMakeLists.txt index 3bed27ceb65ac342813ddbb94427fecb591909aa..f866ac8288bde50ed4f261a6dee4a1150b592f4c 100644 --- a/client/tarantool/CMakeLists.txt +++ b/client/tarantool/CMakeLists.txt @@ -26,8 +26,8 @@ else() endif() set (cli "tarantool") -set (cli_sources tnt.c tnt_admin.c) -set (cli_libs tntnet tntsql tnt gopt ${cli_deps}) +set (cli_sources tc.c tc_opt.c tc_admin.c tc_query.c tc_print.c tc_cli.c tc_wal.c) +set (cli_libs tntrpl tntnet tntsql tnt gopt ${cli_deps}) add_executable(${cli} ${cli_sources} ${CMAKE_SOURCE_DIR}/src/errcode.c) set_target_properties(${cli} PROPERTIES COMPILE_FLAGS "${core_cflags}") diff --git a/client/tarantool/tc.c b/client/tarantool/tc.c new file mode 100644 index 0000000000000000000000000000000000000000..68c0f6f92180c298249145c1e38b84f6c22358dd --- /dev/null +++ b/client/tarantool/tc.c @@ -0,0 +1,129 @@ + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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 <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <string.h> +#include <stdint.h> + +#include <connector/c/include/tarantool/tnt.h> +#include <connector/c/include/tarantool/tnt_net.h> +#include <connector/c/include/tarantool/tnt_sql.h> + +#include "client/tarantool/tc_opt.h" +#include "client/tarantool/tc_admin.h" +#include "client/tarantool/tc.h" +#include "client/tarantool/tc_cli.h" +#include "client/tarantool/tc_wal.h" + +struct tc tc; + +static void tc_init(void) { + memset(&tc, 0, sizeof(tc)); +} + +static void tc_free(void) { + if (tc.net) { + tnt_stream_free(tc.net); + } + tc_admin_close(&tc.admin); +} + +void tc_error(char *fmt, ...) { + char msg[256]; + va_list args; + tc_free(); + /* - - - - */ + va_start(args, fmt); + vsnprintf(msg, sizeof(msg), fmt, args); + va_end(args); + printf("error: %s\n", msg); + exit(1); +} + +static void tc_connect(void) +{ + /* allocating stream */ + tc.net = tnt_net(NULL); + if (tc.net == NULL) + tc_error("stream allocation error"); + /* initializing network stream */ + tnt_set(tc.net, TNT_OPT_HOSTNAME, tc.opt.host); + tnt_set(tc.net, TNT_OPT_PORT, tc.opt.port); + tnt_set(tc.net, TNT_OPT_SEND_BUF, 0); + tnt_set(tc.net, TNT_OPT_RECV_BUF, 0); + if (tnt_init(tc.net) == -1) + tc_error("%s", tnt_strerror(tc.net)); + /* connecting to server */ + if (tnt_connect(tc.net) == -1) + tc_error("%s", tnt_strerror(tc.net)); +} + +static void tc_connect_admin(void) +{ + if (tc_admin_connect(&tc.admin, + tc.opt.host, + tc.opt.port_admin) == -1) + tc_error("admin console connection failed"); +} + +int main(int argc, char *argv[]) +{ + tc_init(); + + int rc; + enum tc_opt_mode mode = tc_opt_init(&tc.opt, argc, argv); + switch (mode) { + case TC_OPT_USAGE: + tc_opt_usage(); + break; + case TC_OPT_RPL: + tc_connect(); + rc = tc_wal_remote(); + break; + case TC_OPT_WAL_CAT: + rc = tc_wal_cat(); + break; + case TC_OPT_WAL_PLAY: + tc_connect(); + rc = tc_wal_play(); + break; + case TC_OPT_CMD: + tc_connect(); + tc_connect_admin(); + rc = tc_cli_cmdv(); + break; + case TC_OPT_INTERACTIVE: + tc_connect(); + tc_connect_admin(); + rc = tc_cli(); + break; + } + + tc_free(); + return rc; +} diff --git a/client/tarantool/tc.h b/client/tarantool/tc.h new file mode 100644 index 0000000000000000000000000000000000000000..49166f138955abe35a7d3a578c15444f46a9b5d3 --- /dev/null +++ b/client/tarantool/tc.h @@ -0,0 +1,37 @@ +#ifndef TC_H_INCLUDED +#define TC_H_INCLUDED + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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. + */ + +struct tc { + struct tc_opt opt; + struct tc_admin admin; + struct tnt_stream *net; +}; + +void tc_error(char *fmt, ...); + +#endif /* TC_H_INCLUDED */ diff --git a/client/tarantool/tnt_admin.c b/client/tarantool/tc_admin.c similarity index 82% rename from client/tarantool/tnt_admin.c rename to client/tarantool/tc_admin.c index b5d7b16c299783e4f9125c08d904964290e1dc1b..167c94bcf1dddf9e1da575c07985f0c25faa99bd 100644 --- a/client/tarantool/tnt_admin.c +++ b/client/tarantool/tc_admin.c @@ -1,6 +1,6 @@ /* - * Copyright (C) 2011 Mail.RU + * Copyright (C) 2012 Mail.RU * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -41,11 +41,12 @@ #include <errno.h> #include <limits.h> -#include <client/tarantool/tnt_admin.h> +#include "client/tarantool/tc_admin.h" -static int -tnt_admin_connect(struct tnt_admin *a) +int tc_admin_connect(struct tc_admin *a, const char *host, int port) { + a->host = host; + a->port = port; a->fd = socket(AF_INET, SOCK_STREAM, 0); if (a->fd < 0) return -1; @@ -69,32 +70,21 @@ tnt_admin_connect(struct tnt_admin *a) return -1; } -int -tnt_admin_init(struct tnt_admin *a, char *host, int port) +int tc_admin_reconnect(struct tc_admin *a) { - a->host = host; - a->port = port; - return tnt_admin_connect(a); + tc_admin_close(a); + return tc_admin_connect(a, a->host, a->port); } -int -tnt_admin_reconnect(struct tnt_admin *a) -{ - tnt_admin_free(a); - return tnt_admin_connect(a); -} - -void -tnt_admin_free(struct tnt_admin *a) +void tc_admin_close(struct tc_admin *a) { if (a->fd > 0) close(a->fd); - a->fd = -1; + a->fd = 0; } static int -tnt_admin_send(struct tnt_admin *a, char *buf, size_t size) -{ +tc_admin_send(struct tc_admin *a, char *buf, size_t size) { ssize_t rc, off = 0; do { rc = send(a->fd, buf + off, size - off, 0); @@ -105,18 +95,16 @@ tnt_admin_send(struct tnt_admin *a, char *buf, size_t size) return 0; } -int -tnt_admin_query(struct tnt_admin *a, char *q) +int tc_admin_query(struct tc_admin *a, char *q) { - if (tnt_admin_send(a, q, strlen(q)) == -1) + if (tc_admin_send(a, q, strlen(q)) == -1) return -1; - if (tnt_admin_send(a, "\n", 1) == -1) + if (tc_admin_send(a, "\n", 1) == -1) return -1; return 0; } -int -tnt_admin_reply(struct tnt_admin *a, char **r, size_t *size) +int tc_admin_reply(struct tc_admin *a, char **r, size_t *size) { char *buf = NULL; size_t off = 0; diff --git a/client/tarantool/tnt_admin.h b/client/tarantool/tc_admin.h similarity index 75% rename from client/tarantool/tnt_admin.h rename to client/tarantool/tc_admin.h index 43e34cb20f95e8fe9806378895bcdb8b22748cbc..e981611977d82bb4957f1fdbe541b6243cdfb4db 100644 --- a/client/tarantool/tnt_admin.h +++ b/client/tarantool/tc_admin.h @@ -1,8 +1,8 @@ -#ifndef TNT_ADMIN_H_INCLUDED -#define TNT_ADMIN_H_INCLUDED +#ifndef TC_ADMIN_H_INCLUDED +#define TC_ADMIN_H_INCLUDED /* - * Copyright (C) 2011 Mail.RU + * Copyright (C) 2012 Mail.RU * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,18 +26,18 @@ * SUCH DAMAGE. */ -struct tnt_admin { - char *host; +struct tc_admin { + const char *host; int port; int fd; }; -int tnt_admin_init(struct tnt_admin *a, char *host, int port); -void tnt_admin_free(struct tnt_admin *a); +int tc_admin_connect(struct tc_admin *a, const char *host, int port); +int tc_admin_reconnect(struct tc_admin *a); -int tnt_admin_reconnect(struct tnt_admin *a); +void tc_admin_close(struct tc_admin *a); -int tnt_admin_query(struct tnt_admin *a, char *q); -int tnt_admin_reply(struct tnt_admin *a, char **r, size_t *size); +int tc_admin_query(struct tc_admin *a, char *q); +int tc_admin_reply(struct tc_admin *a, char **r, size_t *size); -#endif /* TNT_ADMIN_H_INCLUDED */ +#endif /* TC_ADMIN_H_INCLUDED */ diff --git a/client/tarantool/tc_cli.c b/client/tarantool/tc_cli.c new file mode 100644 index 0000000000000000000000000000000000000000..8389ddb9a3f047b959e39366371d98b7a78d2cc7 --- /dev/null +++ b/client/tarantool/tc_cli.c @@ -0,0 +1,176 @@ + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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 <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <string.h> +#include <stdint.h> + +#include <signal.h> +#include <errno.h> + +#include <readline/readline.h> +#include <readline/history.h> + +#include <connector/c/include/tarantool/tnt.h> +#include <connector/c/include/tarantool/tnt_net.h> +#include <connector/c/include/tarantool/tnt_sql.h> + +#include "client/tarantool/tc_opt.h" +#include "client/tarantool/tc_admin.h" +#include "client/tarantool/tc.h" +#include "client/tarantool/tc_query.h" +#include "client/tarantool/tc_cli.h" + +#define TC_DEFAULT_HISTORY_FILE ".tarantool_history" + +extern struct tc tc; + +static inline int tc_cli_error(char *e) { + if (e) { + printf("%s\n", e); + free(e); + } + return 1; +} + +static int tc_cli_reconnect(void) { + if (tnt_connect(tc.net) == -1) { + printf("reconnect: %s\n", tnt_strerror(tc.net)); + return 1; + } + if (tc_admin_reconnect(&tc.admin) == -1) { + printf("reconnect: admin console connection failed\n"); + return 1; + } + printf("reconnected\n"); + return 0; +} + +enum tc_cli_cmd_ret { + TC_CLI_OK, + TC_CLI_ERROR, + TC_CLI_EXIT +}; + +static enum tc_cli_cmd_ret tc_cli_cmd(char *cmd, size_t size) +{ + int reconnect = 0; + do { + if (reconnect) { + reconnect = tc_cli_reconnect(); + if (reconnect) + return TC_CLI_ERROR; + } + char *e; + if (tnt_query_is(cmd, size)) { + if (tc_query(cmd, &e) == 0) { + if (tc_query_foreach(tc_query_printer, NULL, &e) == -1) + reconnect = tc_cli_error(e); + } else { + reconnect = tc_cli_error(e); + } + /* reconnect only for network errors */ + if (reconnect && tnt_error(tc.net) != TNT_ESYSTEM) + reconnect = 0; + } else { + int reply = strcmp(cmd, "exit") && + strcmp(cmd, "quit"); + tc_query_admin_t cb = tc_query_admin_printer; + if (!reply) + cb = NULL; + if (tc_query_admin(cmd, cb, &e) == -1) + reconnect = tc_cli_error(e); + if (!reply) + return TC_CLI_EXIT; + } + } while (reconnect); + + return TC_CLI_OK; +} + +int tc_cli_cmdv(void) +{ + int i, rc = 0; + for (i = 0 ; i < tc.opt.cmdc ; i++) { + enum tc_cli_cmd_ret ret = + tc_cli_cmd(tc.opt.cmdv[i], strlen(tc.opt.cmdv[i])); + if (ret == TC_CLI_EXIT) + break; + if (ret == TC_CLI_ERROR) { + rc = 1; + break; + } + } + return rc; +} + +static void tc_cli_init(void) { + /* ignoring SIGPIPE for reconnection handling */ + struct sigaction sa; + memset(&sa, 0, sizeof(sa)); + sigemptyset(&sa.sa_mask); + sa.sa_handler = SIG_IGN; + if (sigaction(SIGPIPE, &sa, NULL) == -1) + tc_error("signal initialization failed\n"); +} + +int tc_cli(void) +{ + /* initializing cli */ + tc_cli_init(); + + /* loading history file */ + char *home = getenv("HOME"); + char history[1024]; + snprintf(history, sizeof(history), "%s/%s", home, + TC_DEFAULT_HISTORY_FILE); + read_history(history); + + /* setting prompt */ + char prompt[128]; + snprintf(prompt, sizeof(prompt), "%s> ", tc.opt.host); + + /* interactive mode */ + char *cmd; + while ((cmd = readline(prompt))) { + if (!cmd[0]) + goto next; + enum tc_cli_cmd_ret ret = + tc_cli_cmd(cmd, strlen(cmd)); + if (ret == TC_CLI_EXIT) + break; + add_history(cmd); +next: + free(cmd); + } + + /* updating history file */ + write_history(history); + clear_history(); + return 0; +} diff --git a/client/tarantool/tc_cli.h b/client/tarantool/tc_cli.h new file mode 100644 index 0000000000000000000000000000000000000000..03eba7f7a71145d03730fe49e6c33bf838c002fa --- /dev/null +++ b/client/tarantool/tc_cli.h @@ -0,0 +1,32 @@ +#ifndef TC_CLI_H_INCLUDED +#define TC_CLI_H_INCLUDED + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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. + */ + +int tc_cli_cmdv(void); +int tc_cli(void); + +#endif /* TC_CLI_H_INCLUDED */ diff --git a/client/tarantool/tc_opt.c b/client/tarantool/tc_opt.c new file mode 100644 index 0000000000000000000000000000000000000000..53b38699d28825c8d8bf8efdd0852b1a79498508 --- /dev/null +++ b/client/tarantool/tc_opt.c @@ -0,0 +1,121 @@ + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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 <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <stdint.h> + +#include <third_party/gopt/gopt.h> + +#include "client/tarantool/tc_opt.h" + +#define TC_DEFAULT_HOST "localhost" +#define TC_DEFAULT_PORT 33013 +#define TC_DEFAULT_PORT_ADMIN 33015 + +/* supported cli options */ +static const void *tc_options_def = gopt_start( + gopt_option('a', GOPT_ARG, gopt_shorts('a'), + gopt_longs("host"), " <host>", "server address"), + gopt_option('p', GOPT_ARG, gopt_shorts('p'), + gopt_longs("port"), " <port>", "server port"), + gopt_option('m', GOPT_ARG, gopt_shorts('m'), + gopt_longs("port-admin"), " <port>", "server admin port"), + gopt_option('C', GOPT_ARG, gopt_shorts('C'), + gopt_longs("wal-cat"), " <file>", "print xlog file content"), + gopt_option('P', GOPT_ARG, gopt_shorts('P'), + gopt_longs("wal-play"), " <file>", "replay xlog file to the specified server"), + gopt_option('R', GOPT_ARG, gopt_shorts('R'), + gopt_longs("rpl"), " <lsn>", "act as replica for the specified server"), + gopt_option('h', 0, gopt_shorts('h', '?'), gopt_longs("help"), + NULL, "display this help and exit") +); + +void tc_opt_usage(void) +{ + printf("usage: tarantool [options] [query]\n\n"); + printf("tarantool client.\n"); + gopt_help(tc_options_def); + exit(0); +} + +enum tc_opt_mode tc_opt_init(struct tc_opt *opt, int argc, char **argv) +{ + /* usage */ + void *tc_options = gopt_sort(&argc, (const char**)argv, tc_options_def); + if (gopt(tc_options, 'h')) { + opt->mode = TC_OPT_USAGE; + goto done; + } + + /* server host */ + gopt_arg(tc_options, 'a', &opt->host); + if (opt->host == NULL) + opt->host = TC_DEFAULT_HOST; + + /* server port */ + const char *arg = NULL; + opt->port = TC_DEFAULT_PORT; + if (gopt_arg(tc_options, 'p', &arg)) + opt->port = atoi(arg); + + /* server admin port */ + opt->port_admin = TC_DEFAULT_PORT_ADMIN; + if (gopt_arg(tc_options, 'm', &arg)) + opt->port_admin = atoi(arg); + + /* replica mode */ + if (gopt_arg(tc_options, 'R', &arg)) { + opt->mode = TC_OPT_RPL; + opt->lsn = strtoll(arg, NULL, 10); + goto done; + } + + /* wal-cat mode */ + if (gopt_arg(tc_options, 'C', &opt->xlog)) { + opt->mode = TC_OPT_WAL_CAT; + goto done; + } + + /* wal-play mode */ + if (gopt_arg(tc_options, 'P', &opt->xlog)) { + opt->mode = TC_OPT_WAL_PLAY; + goto done; + } + + /* default */ + if (argc >= 2) { + opt->cmdv = argv + 1; + opt->cmdc = argc - 1; + opt->mode = TC_OPT_CMD; + } else { + opt->mode = TC_OPT_INTERACTIVE; + } +done: + gopt_free(tc_options); + return opt->mode; +} diff --git a/client/tarantool/tc_opt.h b/client/tarantool/tc_opt.h new file mode 100644 index 0000000000000000000000000000000000000000..2e7ff605c7611041560076d226625ea179ca72de --- /dev/null +++ b/client/tarantool/tc_opt.h @@ -0,0 +1,54 @@ +#ifndef TC_OPT_H_INCLUDED +#define TC_OPT_H_INCLUDED + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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. + */ + +enum tc_opt_mode { + TC_OPT_USAGE, + TC_OPT_RPL, + TC_OPT_WAL_CAT, + TC_OPT_WAL_PLAY, + TC_OPT_CMD, + TC_OPT_INTERACTIVE +}; + +struct tc_opt { + enum tc_opt_mode mode; + const char *host; + int port; + int port_admin; + uint64_t lsn; + const char *xlog; + char **cmdv; + int cmdc; +}; + +void tc_opt_usage(void); + +enum tc_opt_mode +tc_opt_init(struct tc_opt *opt, int argc, char **argv); + +#endif /* TC_OPT_H_INCLUDED */ diff --git a/client/tarantool/tc_print.c b/client/tarantool/tc_print.c new file mode 100644 index 0000000000000000000000000000000000000000..48edd8f8c573a31e4540bb9cd9b113083717539e --- /dev/null +++ b/client/tarantool/tc_print.c @@ -0,0 +1,75 @@ + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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 <stdlib.h> +#include <stdio.h> +#include <stdint.h> +#include <inttypes.h> +#include <string.h> +#include <ctype.h> + +#include <connector/c/include/tarantool/tnt.h> + +#include "client/tarantool/tc_print.h" + +void tc_print_tuple(struct tnt_tuple *tu) +{ + struct tnt_iter ifl; + tnt_iter(&ifl, tu); + printf("["); + while (tnt_next(&ifl)) { + if (TNT_IFIELD_IDX(&ifl) != 0) + printf(", "); + char *data = TNT_IFIELD_DATA(&ifl); + uint32_t size = TNT_IFIELD_SIZE(&ifl); + if (!isprint(data[0]) && (size == 4 || size == 8)) { + if (size == 4) { + uint32_t i = *((uint32_t*)data); + printf("%"PRIu32, i); + } else { + uint64_t i = *((uint64_t*)data); + printf("%"PRIu64, i); + } + } else { + printf("'%-.*s'", size, data); + } + } + if (ifl.status == TNT_ITER_FAIL) + printf("<parsing error>"); + printf("]\n"); + tnt_iter_free(&ifl); +} + +void tc_print_list(struct tnt_list *l) +{ + struct tnt_iter it; + tnt_iter_list(&it, l); + while (tnt_next(&it)) { + struct tnt_tuple *tu = TNT_ILIST_TUPLE(&it); + tc_print_tuple(tu); + } + tnt_iter_free(&it); +} diff --git a/client/tarantool/tc_print.h b/client/tarantool/tc_print.h new file mode 100644 index 0000000000000000000000000000000000000000..cefe8a1e69596dcb707e3ae8a1eab9987533bd81 --- /dev/null +++ b/client/tarantool/tc_print.h @@ -0,0 +1,32 @@ +#ifndef TC_PRINT_H_INCLUDED +#define TC_PRINT_H_INCLUDED + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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. + */ + +void tc_print_tuple(struct tnt_tuple *tu); +void tc_print_list(struct tnt_list *l); + +#endif /* TC_PRINT_H_INCLUDED */ diff --git a/client/tarantool/tc_query.c b/client/tarantool/tc_query.c new file mode 100644 index 0000000000000000000000000000000000000000..dab1bdc41bca87b958431b8c4cca13ae4ad15ddd --- /dev/null +++ b/client/tarantool/tc_query.c @@ -0,0 +1,157 @@ + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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 <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <string.h> +#include <stdint.h> + +#include <include/errcode.h> + +#include <connector/c/include/tarantool/tnt.h> +#include <connector/c/include/tarantool/tnt_net.h> +#include <connector/c/include/tarantool/tnt_sql.h> + +#include "client/tarantool/tc_opt.h" +#include "client/tarantool/tc_admin.h" +#include "client/tarantool/tc.h" +#include "client/tarantool/tc_print.h" +#include "client/tarantool/tc_query.h" + +extern struct tc tc; + +char *tc_query_type(uint32_t type) { + switch (type) { + case TNT_OP_PING: return "Ping"; + case TNT_OP_INSERT: return "Insert"; + case TNT_OP_DELETE: return "Delete"; + case TNT_OP_UPDATE: return "Update"; + case TNT_OP_SELECT: return "Select"; + case TNT_OP_CALL: return "Call"; + } + return "Unknown"; +} + +static char *tc_query_op(struct tnt_reply *r) { + return tc_query_type(r->op); +} + +int tc_query_printer(struct tnt_reply *r, void *ptr, char **e) { + (void)ptr; + (void)e; + printf("%s OK, %d rows affected\n", tc_query_op(r), + r->count); + tc_print_list(TNT_REPLY_LIST(r)); + return 0; +} + +static char *tc_query_error(char *fmt, ...) { + char msg[256]; + va_list args; + va_start(args, fmt); + vsnprintf(msg, sizeof(msg), fmt, args); + va_end(args); + char *ptr = strdup(msg); + if (ptr == NULL) + tc_error("memory allocation failed"); + return ptr; +} + +int tc_query_foreach(tc_query_t cb, void *cba, char **e) +{ + int rc = -1; + struct tnt_iter i; + tnt_iter_reply(&i, tc.net); + while (tnt_next(&i)) { + struct tnt_reply *r = TNT_IREPLY_PTR(&i); + if (tnt_error(tc.net) != TNT_EOK) { + *e = tc_query_error("%s ERROR, %s", + tc_query_op(r), + tnt_strerror(tc.net)); + goto error; + } else if (r->code != 0) { + *e = tc_query_error("%s ERROR, %s (%s)", + tc_query_op(r), ((r->error) ? r->error : ""), + tnt_errcode_str(r->code >> 8)); + goto error; + } + /* invoking callback if supplied */ + if (cb) { + if (cb(r, cba, e) == -1) + goto error; + } + } + rc = (i.status == TNT_ITER_FAIL) ? -1 : 0; +error: + tnt_iter_free(&i); + return rc; +} + +int tc_query(char *q, char **e) { + int rc = tnt_query(tc.net, q, strlen(q), e); + if (rc == -1) + return -1; + rc = tnt_flush(tc.net); + if (rc < 0) { + char *ee = tnt_strerror(tc.net); + if (ee) { + *e = tc_query_error("%s", ee); + } + return -1; + } + return 0; +} + +int tc_query_admin_printer(char *r, char **e) { + (void)e; + printf("%s", r); + return 0; +} + +int tc_query_admin(char *q, tc_query_admin_t cb, char **e) +{ + if (tc_admin_query(&tc.admin, q) == -1) { + *e = tc_query_error("failed to send admin query"); + return -1; + } + if (cb == NULL) + return 0; + char *reply = NULL; + size_t reply_size = 0; + if (tc_admin_reply(&tc.admin, &reply, &reply_size) == -1) { + *e = tc_query_error("failed to recv admin reply"); + return -1; + } + if (cb && reply) { + if (cb(reply, e) == -1) { + free(reply); + return -1; + } + } + free(reply); + return 0; +} diff --git a/client/tarantool/tc_query.h b/client/tarantool/tc_query.h new file mode 100644 index 0000000000000000000000000000000000000000..b672e1556b828d185e827d8046edcdf3ff80923e --- /dev/null +++ b/client/tarantool/tc_query.h @@ -0,0 +1,41 @@ +#ifndef TC_QUERY_H_INCLUDED +#define TC_QUERY_H_INCLUDED + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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. + */ + +typedef int (*tc_query_t)(struct tnt_reply *r, void *ptr, char **e); +typedef int (*tc_query_admin_t)(char *r, char **e); + +char *tc_query_type(uint32_t type); + +int tc_query_printer(struct tnt_reply *r, void *ptr, char **e); +int tc_query_foreach(tc_query_t cb, void *cba, char **e); +int tc_query(char *q, char **e); + +int tc_query_admin_printer(char *r, char **e); +int tc_query_admin(char *q, tc_query_admin_t cb, char **e); + +#endif /* TC_QUERY_H_INCLUDED */ diff --git a/client/tarantool/tc_wal.c b/client/tarantool/tc_wal.c new file mode 100644 index 0000000000000000000000000000000000000000..b6f045dfd76bcf2680ea05726047429405d383ed --- /dev/null +++ b/client/tarantool/tc_wal.c @@ -0,0 +1,175 @@ + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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 <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <inttypes.h> +#include <limits.h> +#include <stdint.h> + +#include <connector/c/include/tarantool/tnt.h> +#include <connector/c/include/tarantool/tnt_net.h> +#include <connector/c/include/tarantool/tnt_sql.h> +#include <connector/c/include/tarantool/tnt_xlog.h> +#include <connector/c/include/tarantool/tnt_rpl.h> + +#include "client/tarantool/tc_opt.h" +#include "client/tarantool/tc_admin.h" +#include "client/tarantool/tc.h" +#include "client/tarantool/tc_print.h" +#include "client/tarantool/tc_query.h" +#include "client/tarantool/tc_wal.h" + +extern struct tc tc; + +typedef int (*tc_wal_t)(struct tnt_iter *i); + +static int tc_wal_error(char *fmt, ...) { + char msg[256]; + va_list args; + va_start(args, fmt); + vsnprintf(msg, sizeof(msg), fmt, args); + va_end(args); + printf("error: %s\n", msg); + return -1; +} + +static int tc_wal_foreach(struct tnt_stream *s, tc_wal_t cb) { + struct tnt_iter i; + tnt_iter_request(&i, s); + while (tnt_next(&i)) { + if (cb(&i) == -1) { + tnt_iter_free(&i); + return -1; + } + } + int rc = 0; + if (i.status == TNT_ITER_FAIL) + rc = tc_wal_error("parsing failed"); + tnt_iter_free(&i); + return rc; +} + +static void tc_wal_print(struct tnt_xlog_header_v11 *hdr, + struct tnt_request *r) +{ + printf("%s lsn: %"PRIu64", time: %f, len: %"PRIu32"\n", + tc_query_type(r->h.type), + hdr->lsn, + hdr->tm, + hdr->len); + switch (r->h.type) { + case TNT_OP_INSERT: + tc_print_tuple(&r->r.insert.t); + break; + case TNT_OP_DELETE: + tc_print_tuple(&r->r.delete.t); + break; + case TNT_OP_UPDATE: + tc_print_tuple(&r->r.update.t); + break; + case TNT_OP_CALL: + tc_print_tuple(&r->r.call.t); + break; + } +} + +static int tc_wal_printer(struct tnt_iter *i) { + struct tnt_request *r = TNT_IREQUEST_PTR(i); + struct tnt_stream_xlog *s = + TNT_SXLOG_CAST(TNT_IREQUEST_STREAM(i)); + tc_wal_print(&s->hdr, r); + return 0; +} + +static int tc_wal_foreach_xlog(tc_wal_t cb) { + struct tnt_stream s; + tnt_xlog(&s); + if (tnt_xlog_open(&s, (char*)tc.opt.xlog) == -1) { + tnt_stream_free(&s); + return 1; + } + if (tc_wal_foreach(&s, cb) == -1) { + tnt_stream_free(&s); + return 1; + } + tnt_stream_free(&s); + return 0; +} + +int tc_wal_cat(void) +{ + return tc_wal_foreach_xlog(tc_wal_printer); +} + +static int tc_wal_resender(struct tnt_iter *i) { + struct tnt_request *r = TNT_IREQUEST_PTR(i); + if (tc.net->write_request(tc.net, r) == -1) + return tc_wal_error("failed to write request"); + char *e = NULL; + if (tc_query_foreach(NULL, NULL, &e) == -1) { + tc_wal_error("%s", e); + free(e); + return -1; + } + return 0; +} + +int tc_wal_play(void) +{ + return tc_wal_foreach_xlog(tc_wal_resender); +} + +static int tc_wal_printer_from_rpl(struct tnt_iter *i) { + struct tnt_request *r = TNT_IREQUEST_PTR(i); + struct tnt_stream_rpl *s = + TNT_RPL_CAST(TNT_IREQUEST_STREAM(i)); + tc_wal_print(&s->hdr, r); + return 0; +} + +int tc_wal_remote(void) +{ + if (tc.opt.lsn == LLONG_MAX || + tc.opt.lsn == LLONG_MIN) { + tc_wal_error("bad lsn number"); + return 1; + } + struct tnt_stream s; + tnt_rpl(&s); + tnt_rpl_attach(&s, tc.net); + int rc = 0; + if (tnt_rpl_open(&s, tc.opt.lsn) == -1) { + rc = 1; + goto done; + } + if (tc_wal_foreach(&s, tc_wal_printer_from_rpl) == -1) + rc = 1; +done: + tnt_stream_free(&s); + return rc; +} diff --git a/client/tarantool/tc_wal.h b/client/tarantool/tc_wal.h new file mode 100644 index 0000000000000000000000000000000000000000..c49cd59f626f28e205658cfbaf2b87d5c3df8a5d --- /dev/null +++ b/client/tarantool/tc_wal.h @@ -0,0 +1,33 @@ +#ifndef TC_WAL_H_INCLUDED +#define TC_WAL_H_INCLUDED + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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. + */ + +int tc_wal_cat(void); +int tc_wal_play(void); +int tc_wal_remote(void); + +#endif /* TC_WAL_H_INCLUDED */ diff --git a/client/tarantool/tnt.c b/client/tarantool/tnt.c deleted file mode 100644 index 1b46a41892e8baa51d034ed02838801e135e2b94..0000000000000000000000000000000000000000 --- a/client/tarantool/tnt.c +++ /dev/null @@ -1,350 +0,0 @@ - -/* - * Copyright (C) 2011 Mail.RU - * - * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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 <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <ctype.h> -#include <inttypes.h> - -#include <signal.h> -#include <errno.h> - -#include <readline/readline.h> -#include <readline/history.h> - -#include <errcode.h> -#include <third_party/gopt/gopt.h> - -#include <connector/c/include/tarantool/tnt.h> -#include <connector/c/include/tarantool/tnt_sql.h> -#include <connector/c/include/tarantool/tnt_net.h> - -#include <client/tarantool/tnt_admin.h> - -#define DEFAULT_HOST "localhost" -#define DEFAULT_PORT 33013 -#define DEFAULT_PORT_ADMIN 33015 -#define HISTORY_FILE ".tarantool_history" - -static int query_reply_handle(struct tnt_stream *t, struct tnt_reply *r) { - switch (r->op) { - case TNT_OP_PING: - printf("Ping "); - break; - case TNT_OP_INSERT: - printf("Insert "); - break; - case TNT_OP_DELETE: - printf("Delete "); - break; - case TNT_OP_UPDATE: - printf("Update "); - break; - case TNT_OP_SELECT: - printf("Select "); - break; - case TNT_OP_CALL: - printf("Call "); - break; - default: - printf("Unknown "); - break; - } - if (tnt_error(t) != TNT_EOK) { - printf("ERROR, %s\n", tnt_strerror(t)); - return -1; - } else if (r->code != 0) { - printf("ERROR, %s (%s)\n", - ((r->error) ? r->error : ""), tnt_errcode_str(r->code >> 8)); - return -1; - } - printf("OK, %d rows affected\n", r->count); - struct tnt_iter it; - tnt_iter_list(&it, TNT_REPLY_LIST(r)); - while (tnt_next(&it)) { - printf("["); - struct tnt_tuple *tu = TNT_ILIST_TUPLE(&it); - struct tnt_iter ifl; - tnt_iter(&ifl, tu); - while (tnt_next(&ifl)) { - if (TNT_IFIELD_IDX(&ifl) != 0) - printf(", "); - char *data = TNT_IFIELD_DATA(&ifl); - uint32_t size = TNT_IFIELD_SIZE(&ifl); - if (!isprint(data[0]) && (size == 4 || size == 8)) { - if (size == 4) { - uint32_t i = *((uint32_t*)data); - printf("%"PRIu32, i); - } else { - uint64_t i = *((uint64_t*)data); - printf("%"PRIu64, i); - } - } else { - printf("'%-.*s'", size, data); - } - } - if (ifl.status == TNT_ITER_FAIL) - printf("<parsing error>"); - printf("]\n"); - } - return 0; -} - -static int -query_reply(struct tnt_stream *t) -{ - int rc = -1; - struct tnt_iter i; - tnt_iter_stream(&i, t); - while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); - if (query_reply_handle(t, r) == -1) - goto error; - - } - rc = (i.status == TNT_ITER_FAIL) ? -1 : 0; -error: - tnt_iter_free(&i); - return rc; -} - -static int -query(struct tnt_stream *t, char *q) -{ - char *e = NULL; - int rc = tnt_query(t, q, strlen(q), &e); - if (rc == -1) { - if (e) { - printf("error: %s", e); - free(e); - } - return -1; - } - rc = tnt_flush(t); - if (rc < 0) { - printf("error: %s\n", tnt_strerror(t)); - return -1; - } - if (query_reply(t) == -1) - return -1; - return 0; -} - -static int -query_admin(struct tnt_admin *a, char *q, int reply) -{ - if (tnt_admin_query(a, q) == -1) { - printf("error: failed to send admin query\n"); - return -1; - } - if (!reply) - return 0; - char *rep = NULL; - size_t reps = 0; - if (tnt_admin_reply(a, &rep, &reps) == -1) { - printf("error: failed to recv admin reply\n"); - return -1; - } - if (rep) { - printf("%s", rep); - free(rep); - } - return 0; -} - -static int -run_cmdline(struct tnt_stream *t, struct tnt_admin *a, int argc, char **argv) -{ - int i, rc = 0; - for (i = 1 ; i < argc ; i++) { - if (tnt_query_is(argv[i], strlen(argv[i]))) { - if (query(t, argv[i]) == -1) - rc = 1; - } else { - int reply = strcmp(argv[i], "exit") && strcmp(argv[i], "quit"); - if (query_admin(a, argv[i], reply) == -1) - rc = 1; - if (!reply) - break; - } - } - return rc; -} - -static int reconnect_do(struct tnt_stream *t, struct tnt_admin *a) { - if (tnt_connect(t) == -1) { - printf("reconnect: %s\n", tnt_strerror(t)); - return 0; - } - if (tnt_admin_reconnect(a) == -1) { - printf("reconnect: admin console connection failed\n"); - return 0; - } - printf("reconnected\n"); - return 1; -} - -static int -run_interactive(struct tnt_stream *t, struct tnt_admin *a, char *host) -{ - /* ignoring SIGPIPE */ - struct sigaction sa; - memset(&sa, 0, sizeof(sa)); - sigemptyset(&sa.sa_mask); - sa.sa_handler = SIG_IGN; - if (sigaction(SIGPIPE, &sa, NULL) == -1) { - printf("signal initialization failed\n"); - return 1; - } - - char *home = getenv("HOME"); - char history[1024]; - snprintf(history, sizeof(history), "%s/%s", home, HISTORY_FILE); - read_history(history); - - char prompt[128]; - snprintf(prompt, sizeof(prompt), "%s> ", host); - - /* interactive mode */ - int reconnect = 0; - char *cmd; - while ((cmd = readline(prompt))) { - if (!cmd[0]) - goto next; - if (reconnect) { -reconnect: if (reconnect_do(t, a)) - reconnect = 0; - else - goto next; - } - if (tnt_query_is(cmd, strlen(cmd))) { - if (query(t, cmd) == -1) { - /* broken pipe or recv() == 0 */ - int e = tnt_errno(t) == EPIPE || tnt_errno(t) == 0; - if (tnt_error(t) == TNT_ESYSTEM && e) - reconnect = 1; - } - } else { - int reply = strcmp(cmd, "exit") && strcmp(cmd, "quit"); - if (query_admin(a, cmd, reply) == -1) - reconnect = 1; - if (!reply) { - free(cmd); - break; - } - } - add_history(cmd); - if (reconnect) - goto reconnect; -next: - free(cmd); - } - - write_history(history); - clear_history(); - return 0; -} - -int -main(int argc, char *argv[]) -{ - const void *opt_def = - gopt_start(gopt_option('a', GOPT_ARG, gopt_shorts('a'), - gopt_longs("host"), " <host>", "server address"), - gopt_option('p', GOPT_ARG, gopt_shorts('p'), - gopt_longs("port"), " <port>", "server port"), - gopt_option('m', GOPT_ARG, gopt_shorts('m'), - gopt_longs("port-admin"), " <port>", "server admin port"), - gopt_option('h', 0, gopt_shorts('h', '?'), gopt_longs("help"), - NULL, "display this help and exit")); - void *opt = gopt_sort(&argc, (const char**)argv, opt_def); - if (gopt(opt, 'h')) { - printf("usage: tarantool [options] [query]\n\n"); - printf("tarantool sql client.\n"); - gopt_help(opt_def); - gopt_free(opt); - return 0; - } - - /* server host */ - const char *arg = NULL; - gopt_arg(opt, 'a', &arg); - - char host[128]; - snprintf(host, sizeof(host), "%s", (arg) ? arg : DEFAULT_HOST); - - /* server port */ - int port = DEFAULT_PORT; - if (gopt_arg(opt, 'p', &arg)) - port = atoi(arg); - - /* server admin port */ - int admin_port = DEFAULT_PORT_ADMIN; - if (gopt_arg(opt, 'm', &arg)) - admin_port = atoi(arg); - gopt_free(opt); - - /* creating and initializing tarantool network stream */ - struct tnt_stream *t = tnt_net(NULL); - if (t == NULL) - return 1; - tnt_set(t, TNT_OPT_HOSTNAME, host); - tnt_set(t, TNT_OPT_PORT, port); - tnt_set(t, TNT_OPT_SEND_BUF, 0); - tnt_set(t, TNT_OPT_RECV_BUF, 0); - - if (tnt_init(t) == -1) { - printf("error: %s\n", tnt_strerror(t)); - tnt_stream_free(t); - return 1; - } - - /* connecting to server */ - if (tnt_connect(t) == -1) { - printf("error: %s\n", tnt_strerror(t)); - tnt_stream_free(t); - return 1; - } - - /* creating tarantool admin handler */ - struct tnt_admin a; - if (tnt_admin_init(&a, host, admin_port) == -1) { - printf("error: admin console initialization failed\n"); - tnt_stream_free(t); - return 1; - } - - /* main */ - int rc = 0; - if (argc >= 2) - rc = run_cmdline(t, &a, argc, argv); - else - rc = run_interactive(t, &a, host); - tnt_stream_free(t); - tnt_admin_free(&a); - return rc; -} diff --git a/connector/c/CMakeLists.txt b/connector/c/CMakeLists.txt index 847182669fcdbbb601d14a425dad05823352af7f..df57af8b512d8b9a2b63782eab15dd7f9d17391d 100644 --- a/connector/c/CMakeLists.txt +++ b/connector/c/CMakeLists.txt @@ -11,4 +11,5 @@ set(LIBTNT_SOVERSION "${LIBTNT_VERSION_MAJOR}") add_subdirectory(tnt) add_subdirectory(tntsql) add_subdirectory(tntnet) +add_subdirectory(tntrpl) add_subdirectory(include) diff --git a/connector/c/README b/connector/c/README index 3712d03409e1bd3cf3ae9f30743b1c1345d014a3..1a780e4e36a99baa7f51fd94ab9c63fbdcb7b69f 100644 --- a/connector/c/README +++ b/connector/c/README @@ -6,3 +6,4 @@ tnt - tarantool iproto library tntsql - tarantool sql library tntnet - tarantool network io library +tntrpl - tarantool replication library diff --git a/connector/c/include/tarantool/tnt.h b/connector/c/include/tarantool/tnt.h index c67e012424c805c29cd9e73f0d98736e9044d79d..a3c84a98d1296f4b23e1db7ac03ee705cc751d97 100644 --- a/connector/c/include/tarantool/tnt.h +++ b/connector/c/include/tarantool/tnt.h @@ -37,6 +37,7 @@ extern "C" { #include <tarantool/tnt_proto.h> #include <tarantool/tnt_enc.h> #include <tarantool/tnt_tuple.h> +#include <tarantool/tnt_request.h> #include <tarantool/tnt_reply.h> #include <tarantool/tnt_stream.h> #include <tarantool/tnt_iter.h> diff --git a/connector/c/include/tarantool/tnt_buf.h b/connector/c/include/tarantool/tnt_buf.h index 1838ef4bc7f9ceaabb96fdfcbeb219c6a0172df4..6b16cdd2a46930ffabd0ca7c0f2ab107e83389d4 100644 --- a/connector/c/include/tarantool/tnt_buf.h +++ b/connector/c/include/tarantool/tnt_buf.h @@ -36,9 +36,9 @@ struct tnt_stream_buf { /* buffer stream accessors */ -#define TNT_SBUF_CAST(S) ((struct tnt_stream_buf*)(S)->data) -#define TNT_SBUF_DATA(S) TNT_SBUF_CAST(S)->data -#define TNT_SBUF_SIZE(S) TNT_SBUF_CAST(S)->size +#define TNT_SBUF_CAST(S) ((struct tnt_stream_buf*)(S)->data) +#define TNT_SBUF_DATA(S) TNT_SBUF_CAST(S)->data +#define TNT_SBUF_SIZE(S) TNT_SBUF_CAST(S)->size struct tnt_stream *tnt_buf(struct tnt_stream *s); diff --git a/connector/c/include/tarantool/tnt_iter.h b/connector/c/include/tarantool/tnt_iter.h index 9f04306df8d0300c88a6c5a5ef2ec9bc4a5ba67f..950a87caab6dbdaebe6472520683c99dac3a5ebf 100644 --- a/connector/c/include/tarantool/tnt_iter.h +++ b/connector/c/include/tarantool/tnt_iter.h @@ -31,7 +31,8 @@ enum tnt_iter_type { TNT_ITER_FIELD, TNT_ITER_LIST, - TNT_ITER_STREAM + TNT_ITER_REQUEST, + TNT_ITER_REPLY }; /* tuple field iterator */ @@ -48,11 +49,11 @@ struct tnt_iter_field { /* tuple field iterator accessors */ -#define TNT_IFIELD(I) (&(I)->data.field) +#define TNT_IFIELD(I) (&(I)->data.field) #define TNT_IFIELD_TUPLE(I) TNT_IFIELD(I)->tu -#define TNT_IFIELD_IDX(I) TNT_IFIELD(I)->fld_index -#define TNT_IFIELD_DATA(I) TNT_IFIELD(I)->fld_data -#define TNT_IFIELD_SIZE(I) TNT_IFIELD(I)->fld_size +#define TNT_IFIELD_IDX(I) TNT_IFIELD(I)->fld_index +#define TNT_IFIELD_DATA(I) TNT_IFIELD(I)->fld_data +#define TNT_IFIELD_SIZE(I) TNT_IFIELD(I)->fld_size /* list iterator */ @@ -64,21 +65,34 @@ struct tnt_iter_list { /* list iterator accessors */ -#define TNT_ILIST(I) (&(I)->data.list) -#define TNT_ILIST_TUPLE(I) TNT_ILIST(I)->tu -#define TNT_ILIST_INDEX(I) TNT_ILIST(I)->tu_index +#define TNT_ILIST(I) (&(I)->data.list) +#define TNT_ILIST_TUPLE(I) TNT_ILIST(I)->tu +#define TNT_ILIST_INDEX(I) TNT_ILIST(I)->tu_index -/* stream iterator */ +/* request iterator */ -struct tnt_iter_stream { +struct tnt_iter_request { + struct tnt_stream *s; /* stream pointer */ + struct tnt_request r; /* current request */ +}; + +/* request iterator accessors */ + +#define TNT_IREQUEST(I) (&(I)->data.request) +#define TNT_IREQUEST_PTR(I) &TNT_IREQUEST(I)->r +#define TNT_IREQUEST_STREAM(I) TNT_IREQUEST(I)->s + +/* reply iterator */ + +struct tnt_iter_reply { struct tnt_stream *s; /* stream pointer */ struct tnt_reply r; /* current reply */ }; -/* stream iterator accessors */ +/* reply iterator accessors */ -#define TNT_ISTREAM(I) (&(I)->data.stream) -#define TNT_ISTREAM_REPLY(I) &TNT_ISTREAM(I)->r +#define TNT_IREPLY(I) (&(I)->data.reply) +#define TNT_IREPLY_PTR(I) &TNT_IREPLY(I)->r enum tnt_iter_status { TNT_ITER_OK, @@ -99,13 +113,15 @@ struct tnt_iter { union { struct tnt_iter_field field; struct tnt_iter_list list; - struct tnt_iter_stream stream; + struct tnt_iter_request request; + struct tnt_iter_reply reply; } data; }; struct tnt_iter *tnt_iter(struct tnt_iter *i, struct tnt_tuple *t); struct tnt_iter *tnt_iter_list(struct tnt_iter *i, struct tnt_list *l); -struct tnt_iter *tnt_iter_stream(struct tnt_iter *i, struct tnt_stream *s); +struct tnt_iter *tnt_iter_request(struct tnt_iter *i, struct tnt_stream *s); +struct tnt_iter *tnt_iter_reply(struct tnt_iter *i, struct tnt_stream *s); void tnt_iter_free(struct tnt_iter *i); diff --git a/connector/c/include/tarantool/tnt_opt.h b/connector/c/include/tarantool/tnt_opt.h index 6f716dff2f19e855831b2af7731a53e510f5de71..f770a69f65d71ff099a70dbb834e54d3566ecc4b 100644 --- a/connector/c/include/tarantool/tnt_opt.h +++ b/connector/c/include/tarantool/tnt_opt.h @@ -62,4 +62,4 @@ void tnt_opt_free(struct tnt_opt *opt); int tnt_opt_set(struct tnt_opt *opt, enum tnt_opt_type name, va_list args); -#endif +#endif /* TNT_OPT_H_INCLUDED */ diff --git a/connector/c/include/tarantool/tnt_proto.h b/connector/c/include/tarantool/tnt_proto.h index f0dec21109f263c00f40e352361a27338adfa0e4..a659bf12927bc516e7a9b79656c9cfe6fa0ae044 100644 --- a/connector/c/include/tarantool/tnt_proto.h +++ b/connector/c/include/tarantool/tnt_proto.h @@ -45,4 +45,30 @@ struct tnt_header { uint32_t reqid; }; +struct tnt_header_insert { + uint32_t ns; + uint32_t flags; +}; + +struct tnt_header_delete { + uint32_t ns; + uint32_t flags; +}; + +struct tnt_header_update { + uint32_t ns; + uint32_t flags; +}; + +struct tnt_header_call { + uint32_t flags; +}; + +struct tnt_header_select { + uint32_t ns; + uint32_t index; + uint32_t offset; + uint32_t limit; +}; + #endif /* TNT_PROTO_H_INCLUDED */ diff --git a/connector/c/include/tarantool/tnt_reply.h b/connector/c/include/tarantool/tnt_reply.h index d3af969b8eeb81427cfbe15166983e23f8801c6d..926970a219adeb210d9c0b009d32b19a1fca981e 100644 --- a/connector/c/include/tarantool/tnt_reply.h +++ b/connector/c/include/tarantool/tnt_reply.h @@ -26,7 +26,7 @@ * SUCH DAMAGE. */ -typedef ssize_t (*tnt_replyf_t)(void *ptr, char *dst, ssize_t size); +typedef ssize_t (*tnt_reply_t)(void *ptr, char *dst, ssize_t size); struct tnt_reply { uint32_t op; @@ -37,13 +37,13 @@ struct tnt_reply { uint32_t count; }; -#define TNT_REPLY_ERR(R) ((R)->code >> 8) +#define TNT_REPLY_ERR(R) ((R)->code >> 8) #define TNT_REPLY_LIST(R) (&(R)->tuples) void tnt_reply_init(struct tnt_reply *r); void tnt_reply_free(struct tnt_reply *r); int tnt_reply(struct tnt_reply *r, char *buf, size_t size, size_t *off); -int tnt_reply_from(struct tnt_reply *r, tnt_replyf_t rcv, void *ptr); +int tnt_reply_from(struct tnt_reply *r, tnt_reply_t rcv, void *ptr); #endif /* TNT_REPLY_H_INCLUDED */ diff --git a/connector/c/include/tarantool/tnt_request.h b/connector/c/include/tarantool/tnt_request.h new file mode 100644 index 0000000000000000000000000000000000000000..f38bcc4a51a6896cd2ffda0338d1837c30e1d852 --- /dev/null +++ b/connector/c/include/tarantool/tnt_request.h @@ -0,0 +1,72 @@ +#ifndef TNT_REQUEST_H_INCLUDED +#define TNT_REQUEST_H_INCLUDED + +#include <sys/types.h> +#include <sys/uio.h> + +typedef ssize_t (*tnt_request_t)(void *ptr, char *dst, ssize_t size); + +struct tnt_request_insert { + struct tnt_header_insert h; + struct tnt_tuple t; +}; + +struct tnt_request_delete { + struct tnt_header_delete h; + struct tnt_tuple t; +}; + +struct tnt_request_update_op { + uint8_t op; + uint32_t field; + char size_enc[5]; + uint32_t size_enc_len; + uint32_t size; + char *data; +}; + +struct tnt_request_update { + struct tnt_header_update h; + struct tnt_tuple t; + char *ops; + uint32_t ops_size; + struct tnt_request_update_op *opv; + uint32_t opc; +}; + +struct tnt_request_call { + struct tnt_header_call h; + char proc_enc[5]; + uint32_t proc_enc_len; + char *proc; + uint32_t proc_len; + struct tnt_tuple t; +}; + +struct tnt_request_select { + struct tnt_header_select h; + struct tnt_list l; +}; + +struct tnt_request { + struct tnt_header h; + union { + struct tnt_request_insert insert; + struct tnt_request_delete delete; + struct tnt_request_call call; + struct tnt_request_select select; + struct tnt_request_update update; + } r; + int vc; + struct iovec *v; +}; + +void tnt_request_init(struct tnt_request *r); +void tnt_request_free(struct tnt_request *r); + +int tnt_request(struct tnt_request *r, char *buf, size_t size, size_t *off, + struct tnt_header *hdr); +int tnt_request_from(struct tnt_request *r, tnt_request_t rcv, void *ptr, + struct tnt_header *hdr); + +#endif /* TNT_REQUEST_H_INCLUDED */ diff --git a/connector/c/include/tarantool/tnt_rpl.h b/connector/c/include/tarantool/tnt_rpl.h new file mode 100644 index 0000000000000000000000000000000000000000..f5b17138501e80a641b847df1ef3dfad2c33f660 --- /dev/null +++ b/connector/c/include/tarantool/tnt_rpl.h @@ -0,0 +1,43 @@ +#ifndef TNT_RPL_H_INCLUDED +#define TNT_RPL_H_INCLUDED + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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. + */ + +struct tnt_stream_rpl { + struct tnt_xlog_header_v11 hdr; + struct tnt_xlog_row_v11 row; + struct tnt_stream *net; +}; + +#define TNT_RPL_CAST(S) ((struct tnt_stream_rpl*)(S)->data) + +struct tnt_stream *tnt_rpl(struct tnt_stream *s); +void tnt_rpl_attach(struct tnt_stream *s, struct tnt_stream *net); + +int tnt_rpl_open(struct tnt_stream *s, uint64_t lsn); +void tnt_rpl_close(struct tnt_stream *s); + +#endif /* TNT_XLOG_H_INCLUDED */ diff --git a/connector/c/include/tarantool/tnt_stream.h b/connector/c/include/tarantool/tnt_stream.h index 1a7ad978e7f9463dfdf0d3313ed62f3f2f0e720c..cb621c838288890540cf077d2b9b02b0338d6eb1 100644 --- a/connector/c/include/tarantool/tnt_stream.h +++ b/connector/c/include/tarantool/tnt_stream.h @@ -35,15 +35,19 @@ struct tnt_stream { int alloc; ssize_t (*write)(struct tnt_stream *s, char *buf, size_t size); ssize_t (*writev)(struct tnt_stream *s, struct iovec *iov, int count); + ssize_t (*write_request)(struct tnt_stream *s, struct tnt_request *r); ssize_t (*read)(struct tnt_stream *s, char *buf, size_t size); - int (*reply)(struct tnt_stream *s, struct tnt_reply *r); + int (*read_reply)(struct tnt_stream *s, struct tnt_reply *r); + int (*read_request)(struct tnt_stream *s, struct tnt_request *r); void (*free)(struct tnt_stream *s); void *data; uint32_t wrcnt; /* count of write operations */ uint32_t reqid; }; -uint32_t tnt_stream_reqid(struct tnt_stream *s, uint32_t reqid); +struct tnt_stream *tnt_stream_init(struct tnt_stream *s); void tnt_stream_free(struct tnt_stream *s); +uint32_t tnt_stream_reqid(struct tnt_stream *s, uint32_t reqid); + #endif /* TNT_STREAM_H_INCLUDED */ diff --git a/connector/c/include/tarantool/tnt_xlog.h b/connector/c/include/tarantool/tnt_xlog.h new file mode 100644 index 0000000000000000000000000000000000000000..98b354ae74ddcd6b99fd23abaec25828f79af951 --- /dev/null +++ b/connector/c/include/tarantool/tnt_xlog.h @@ -0,0 +1,75 @@ +#ifndef TNT_XLOG_H_INCLUDED +#define TNT_XLOG_H_INCLUDED + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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. + */ + +enum tnt_xlog_error { + TNT_XLOG_EOK, + TNT_XLOG_EFAIL, + TNT_XLOG_EMEMORY, + TNT_XLOG_ETYPE, + TNT_XLOG_EVERSION, + TNT_XLOG_ECORRUPT, + TNT_XLOG_ESYSTEM, + TNT_XLOG_LAST +}; + +struct tnt_xlog_header_v11 { + uint32_t crc32_hdr; + uint64_t lsn; + double tm; + uint32_t len; + uint32_t crc32_data; +} __attribute__((packed)); + +struct tnt_xlog_row_v11 { + uint16_t tag; + uint64_t cookie; + uint16_t op; +} __attribute__((packed)); + +struct tnt_stream_xlog { + char *file; + FILE *fd; + off_t offset; + struct tnt_xlog_header_v11 hdr; + struct tnt_xlog_row_v11 row; + enum tnt_xlog_error error; + int errno_; +}; + +#define TNT_SXLOG_CAST(S) ((struct tnt_stream_xlog*)(S)->data) + +struct tnt_stream *tnt_xlog(struct tnt_stream *s); + +int tnt_xlog_open(struct tnt_stream *s, char *file); +void tnt_xlog_close(struct tnt_stream *s); + +enum tnt_xlog_error tnt_xlog_error(struct tnt_stream *s); +char *tnt_xlog_strerror(struct tnt_stream *s); +int tnt_xlog_errno(struct tnt_stream *s); + +#endif /* TNT_XLOG_H_INCLUDED */ diff --git a/connector/c/tnt/CMakeLists.txt b/connector/c/tnt/CMakeLists.txt index 7f0899314410d73decdea91a9a691453fd6a5a53..8fbc77f23a3d493e004de59e8e07be26212a0c09 100644 --- a/connector/c/tnt/CMakeLists.txt +++ b/connector/c/tnt/CMakeLists.txt @@ -35,7 +35,8 @@ set (tnt_sources tnt_delete.c tnt_call.c tnt_select.c - tnt_reply.c) + tnt_reply.c + tnt_request.c) #----------------------------------------------------------------------------# # Builds diff --git a/connector/c/tnt/tnt_buf.c b/connector/c/tnt/tnt_buf.c index 358caa08d86950986bda562213db34238002a3db..c83d3c7cf3ed09ab0c62f4965a2032b80ff18b08 100644 --- a/connector/c/tnt/tnt_buf.c +++ b/connector/c/tnt/tnt_buf.c @@ -29,24 +29,13 @@ #include <string.h> #include <connector/c/include/tarantool/tnt_mem.h> +#include <connector/c/include/tarantool/tnt_proto.h> #include <connector/c/include/tarantool/tnt_tuple.h> +#include <connector/c/include/tarantool/tnt_request.h> #include <connector/c/include/tarantool/tnt_reply.h> #include <connector/c/include/tarantool/tnt_stream.h> #include <connector/c/include/tarantool/tnt_buf.h> -static struct tnt_stream *tnt_buf_tryalloc(struct tnt_stream *s) { - if (s) { - memset(s, 0, sizeof(struct tnt_stream)); - return s; - } - s = tnt_mem_alloc(sizeof(struct tnt_stream)); - if (s == NULL) - return NULL; - memset(s, 0, sizeof(struct tnt_stream)); - s->alloc = 1; - return s; -} - static void tnt_buf_free(struct tnt_stream *s) { struct tnt_stream_buf *sb = TNT_SBUF_CAST(s); if (sb->data) @@ -108,6 +97,11 @@ tnt_buf_writev(struct tnt_stream *s, struct iovec *iov, int count) { return size; } +static ssize_t +tnt_buf_write_request(struct tnt_stream *s, struct tnt_request *r) { + return tnt_buf_writev(s, r->v, r->vc); +} + static int tnt_buf_reply(struct tnt_stream *s, struct tnt_reply *r) { struct tnt_stream_buf *sb = TNT_SBUF_CAST(s); @@ -122,6 +116,21 @@ tnt_buf_reply(struct tnt_stream *s, struct tnt_reply *r) { return rc; } +static int +tnt_buf_request(struct tnt_stream *s, struct tnt_request *r) { + struct tnt_stream_buf *sb = TNT_SBUF_CAST(s); + if (sb->data == NULL) + return -1; + if (sb->size == sb->rdoff) + return 1; + size_t off = 0; + int rc = tnt_request(r, sb->data + sb->rdoff, sb->size - sb->rdoff, + &off, NULL); + if (rc == 0) + sb->rdoff += off; + return rc; +} + /* * tnt_buf() * @@ -135,7 +144,7 @@ tnt_buf_reply(struct tnt_stream *s, struct tnt_reply *r) { */ struct tnt_stream *tnt_buf(struct tnt_stream *s) { int allocated = s == NULL; - s = tnt_buf_tryalloc(s); + s = tnt_stream_init(s); if (s == NULL) return NULL; /* allocating stream data */ @@ -147,9 +156,11 @@ struct tnt_stream *tnt_buf(struct tnt_stream *s) { } /* initializing interfaces */ s->read = tnt_buf_read; - s->reply = tnt_buf_reply; + s->read_reply = tnt_buf_reply; + s->read_request = tnt_buf_request; s->write = tnt_buf_write; s->writev = tnt_buf_writev; + s->write_request = tnt_buf_write_request; s->free = tnt_buf_free; /* initializing internal data */ struct tnt_stream_buf *sb = TNT_SBUF_CAST(s); diff --git a/connector/c/tnt/tnt_call.c b/connector/c/tnt/tnt_call.c index 529c986c5a7dda1ebd1c10ec2c2cbcc7873a06cd..70cc788de14c000b14692c6167fe6d581496df2e 100644 --- a/connector/c/tnt/tnt_call.c +++ b/connector/c/tnt/tnt_call.c @@ -31,14 +31,11 @@ #include <connector/c/include/tarantool/tnt_proto.h> #include <connector/c/include/tarantool/tnt_enc.h> #include <connector/c/include/tarantool/tnt_tuple.h> +#include <connector/c/include/tarantool/tnt_request.h> #include <connector/c/include/tarantool/tnt_reply.h> #include <connector/c/include/tarantool/tnt_stream.h> #include <connector/c/include/tarantool/tnt_call.h> -struct tnt_header_call { - uint32_t flags; -}; - /* * tnt_call() * diff --git a/connector/c/tnt/tnt_delete.c b/connector/c/tnt/tnt_delete.c index e68f3915c7c6d0e115c10fd43e11db808a1c74d2..1ae70d127eb2da88b2ac837269bb493f473525eb 100644 --- a/connector/c/tnt/tnt_delete.c +++ b/connector/c/tnt/tnt_delete.c @@ -30,15 +30,11 @@ #include <connector/c/include/tarantool/tnt_proto.h> #include <connector/c/include/tarantool/tnt_tuple.h> +#include <connector/c/include/tarantool/tnt_request.h> #include <connector/c/include/tarantool/tnt_reply.h> #include <connector/c/include/tarantool/tnt_stream.h> #include <connector/c/include/tarantool/tnt_delete.h> -struct tnt_header_delete { - uint32_t ns; - uint32_t flags; -}; - /* * tnt_delete() * diff --git a/connector/c/tnt/tnt_insert.c b/connector/c/tnt/tnt_insert.c index fc60becd60d38dc16ad92d07adea73a257dd86ba..db3ddf1057a1a4eaa6a10cabb55eb9051706c309 100644 --- a/connector/c/tnt/tnt_insert.c +++ b/connector/c/tnt/tnt_insert.c @@ -30,15 +30,11 @@ #include <connector/c/include/tarantool/tnt_proto.h> #include <connector/c/include/tarantool/tnt_tuple.h> +#include <connector/c/include/tarantool/tnt_request.h> #include <connector/c/include/tarantool/tnt_reply.h> #include <connector/c/include/tarantool/tnt_stream.h> #include <connector/c/include/tarantool/tnt_insert.h> -struct tnt_header_insert { - uint32_t ns; - uint32_t flags; -}; - /* * tnt_insert() * diff --git a/connector/c/tnt/tnt_iter.c b/connector/c/tnt/tnt_iter.c index 6fd00584853e6d133020614166ed86689d120815..65a6c537db0c75a5c860ea77c21a6995b7063a70 100644 --- a/connector/c/tnt/tnt_iter.c +++ b/connector/c/tnt/tnt_iter.c @@ -29,13 +29,15 @@ #include <string.h> #include <connector/c/include/tarantool/tnt_mem.h> +#include <connector/c/include/tarantool/tnt_proto.h> #include <connector/c/include/tarantool/tnt_enc.h> #include <connector/c/include/tarantool/tnt_tuple.h> +#include <connector/c/include/tarantool/tnt_request.h> #include <connector/c/include/tarantool/tnt_reply.h> #include <connector/c/include/tarantool/tnt_stream.h> #include <connector/c/include/tarantool/tnt_iter.h> -static struct tnt_iter *tnt_iter_tryalloc(struct tnt_iter *i) { +static struct tnt_iter *tnt_iter_init(struct tnt_iter *i) { if (i) { memset(i, 0, sizeof(struct tnt_iter)); return i; @@ -107,7 +109,7 @@ static void tnt_iter_field_rewind(struct tnt_iter *i) { struct tnt_iter* tnt_iter(struct tnt_iter *i, struct tnt_tuple *t) { - i = tnt_iter_tryalloc(i); + i = tnt_iter_init(i); if (i == NULL) return NULL; i->type = TNT_ITER_FIELD; @@ -149,7 +151,7 @@ static void tnt_iter_list_rewind(struct tnt_iter *i) { struct tnt_iter* tnt_iter_list(struct tnt_iter *i, struct tnt_list *l) { - i = tnt_iter_tryalloc(i); + i = tnt_iter_init(i); if (i == NULL) return NULL; i->type = TNT_ITER_LIST; @@ -161,11 +163,11 @@ tnt_iter_list(struct tnt_iter *i, struct tnt_list *l) return i; } -static int tnt_iter_stream_next(struct tnt_iter *i) { - struct tnt_iter_stream *is = TNT_ISTREAM(i); - tnt_reply_free(&is->r); - tnt_reply_init(&is->r); - int rc = is->s->reply(is->s, &is->r); +static int tnt_iter_reply_next(struct tnt_iter *i) { + struct tnt_iter_reply *ir = TNT_IREPLY(i); + tnt_reply_free(&ir->r); + tnt_reply_init(&ir->r); + int rc = ir->s->read_reply(ir->s, &ir->r); if (rc == -1) { i->status = TNT_ITER_FAIL; return 0; @@ -173,18 +175,63 @@ static int tnt_iter_stream_next(struct tnt_iter *i) { return (rc == 1 /* finish */ ) ? 0 : 1; } -static void tnt_iter_stream_free(struct tnt_iter *i) { - struct tnt_iter_stream *is = TNT_ISTREAM(i); - tnt_reply_free(&is->r); +static void tnt_iter_reply_free(struct tnt_iter *i) { + struct tnt_iter_reply *ir = TNT_IREPLY(i); + tnt_reply_free(&ir->r); } /* - * tnt_iter_stream() + * tnt_iter_reply() * - * initialize tuple stream iterator; - * create and initialize stream iterator; + * initialize tuple reply iterator; + * create and initialize reply iterator; * - * i - tuple list iterator pointer, maybe NULL + * i - tuple reply iterator pointer, maybe NULL + * s - stream pointer + * + * if stream iterator pointer is NULL, then new stream + * iterator will be created. + * + * returns stream iterator pointer, or NULL on error. +*/ +struct tnt_iter *tnt_iter_reply(struct tnt_iter *i, struct tnt_stream *s) { + i = tnt_iter_init(i); + if (i == NULL) + return NULL; + i->type = TNT_ITER_REPLY; + i->next = tnt_iter_reply_next; + i->rewind = NULL; + i->free = tnt_iter_reply_free; + struct tnt_iter_reply *ir = TNT_IREPLY(i); + ir->s = s; + tnt_reply_init(&ir->r); + return i; +} + +static int tnt_iter_request_next(struct tnt_iter *i) { + struct tnt_iter_request *ir = TNT_IREQUEST(i); + tnt_request_free(&ir->r); + tnt_request_init(&ir->r); + int rc = ir->s->read_request(ir->s, &ir->r); + if (rc == -1) { + i->status = TNT_ITER_FAIL; + return 0; + } + return (rc == 1 /* finish */ ) ? 0 : 1; +} + +static void tnt_iter_request_free(struct tnt_iter *i) { + struct tnt_iter_request *ir = TNT_IREQUEST(i); + tnt_request_free(&ir->r); +} + +/* + * tnt_iter_request() + * + * initialize tuple request iterator; + * create and initialize request iterator; + * + * i - tuple request iterator pointer, maybe NULL * s - stream pointer * * if stream iterator pointer is NULL, then new stream @@ -192,17 +239,17 @@ static void tnt_iter_stream_free(struct tnt_iter *i) { * * returns stream iterator pointer, or NULL on error. */ -struct tnt_iter *tnt_iter_stream(struct tnt_iter *i, struct tnt_stream *s) { - i = tnt_iter_tryalloc(i); +struct tnt_iter *tnt_iter_request(struct tnt_iter *i, struct tnt_stream *s) { + i = tnt_iter_init(i); if (i == NULL) return NULL; - i->type = TNT_ITER_STREAM; - i->next = tnt_iter_stream_next; + i->type = TNT_ITER_REQUEST; + i->next = tnt_iter_request_next; i->rewind = NULL; - i->free = tnt_iter_stream_free; - struct tnt_iter_stream *is = TNT_ISTREAM(i); - is->s = s; - tnt_reply_init(&is->r); + i->free = tnt_iter_request_free; + struct tnt_iter_request *ir = TNT_IREQUEST(i); + ir->s = s; + tnt_request_init(&ir->r); return i; } diff --git a/connector/c/tnt/tnt_ping.c b/connector/c/tnt/tnt_ping.c index 674c38a950c43b04c9edf642ca7c945a909139d4..f8014cb545a685a8dc4885b72dea5d3047304395 100644 --- a/connector/c/tnt/tnt_ping.c +++ b/connector/c/tnt/tnt_ping.c @@ -30,6 +30,7 @@ #include <connector/c/include/tarantool/tnt_proto.h> #include <connector/c/include/tarantool/tnt_tuple.h> +#include <connector/c/include/tarantool/tnt_request.h> #include <connector/c/include/tarantool/tnt_reply.h> #include <connector/c/include/tarantool/tnt_stream.h> #include <connector/c/include/tarantool/tnt_ping.h> diff --git a/connector/c/tnt/tnt_reply.c b/connector/c/tnt/tnt_reply.c index 5e282621d0660e8fad8fdc49cff5c3bb34c24de2..b2224319391e3d26a10d7a0cdd8ff0519d1e221a 100644 --- a/connector/c/tnt/tnt_reply.c +++ b/connector/c/tnt/tnt_reply.c @@ -36,20 +36,20 @@ /* * tnt_reply_init() * - * initialize reply; + * initialize reply object; * - * r - reply pointer + * r - reply object pointer */ void tnt_reply_init(struct tnt_reply *r) { memset(r, 0, sizeof(struct tnt_reply)); } /* - * tnt_buf_free() + * tnt_reply_free() * - * free reply; + * free reply object; * - * r - reply pointer + * r - reply object pointer */ void tnt_reply_free(struct tnt_reply *r) { if (r->error) @@ -68,7 +68,7 @@ void tnt_reply_free(struct tnt_reply *r) { * * returns zero on fully read reply, or -1 on error. */ -int tnt_reply_from(struct tnt_reply *r, tnt_replyf_t rcv, void *ptr) { +int tnt_reply_from(struct tnt_reply *r, tnt_reply_t rcv, void *ptr) { /* reading iproto header */ struct tnt_header hdr; if (rcv(ptr, (char*)&hdr, sizeof(struct tnt_header)) == -1) @@ -129,7 +129,7 @@ int tnt_reply_from(struct tnt_reply *r, tnt_replyf_t rcv, void *ptr) { if (buf == NULL) return -1; if (rcv(ptr, buf, size) == -1) { - free(buf); + tnt_mem_free(buf); return -1; } char *p = buf; @@ -150,12 +150,12 @@ int tnt_reply_from(struct tnt_reply *r, tnt_replyf_t rcv, void *ptr) { p += tsize + 4; total += (4 + 4 + tsize); /* length + cardinality + tuple size */ } - free(buf); + tnt_mem_free(buf); return 0; rollback: tnt_list_free(&r->tuples); - free(buf); + tnt_mem_free(buf); return -1; } @@ -187,7 +187,8 @@ static ssize_t tnt_reply_cb(void *ptr[2], char *buf, ssize_t size) { return size; } -int tnt_reply(struct tnt_reply *r, char *buf, size_t size, size_t *off) { +int +tnt_reply(struct tnt_reply *r, char *buf, size_t size, size_t *off) { /* supplied buffer must contain full reply, * if it doesn't then returning count of bytes * needed to process */ @@ -204,7 +205,7 @@ int tnt_reply(struct tnt_reply *r, char *buf, size_t size, size_t *off) { } size_t offv = 0; void *ptr[2] = { buf, &offv }; - int rc = tnt_reply_from(r, (tnt_replyf_t)tnt_reply_cb, ptr); + int rc = tnt_reply_from(r, (tnt_reply_t)tnt_reply_cb, ptr); if (off) *off = offv; return rc; diff --git a/connector/c/tnt/tnt_request.c b/connector/c/tnt/tnt_request.c new file mode 100644 index 0000000000000000000000000000000000000000..27a0231e26d657defb6abb9877600fb942b0e787 --- /dev/null +++ b/connector/c/tnt/tnt_request.c @@ -0,0 +1,445 @@ + +/* + * Copyright (C) 2011 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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 <stdlib.h> +#include <stdint.h> +#include <string.h> + +#include <connector/c/include/tarantool/tnt_mem.h> +#include <connector/c/include/tarantool/tnt_proto.h> +#include <connector/c/include/tarantool/tnt_enc.h> +#include <connector/c/include/tarantool/tnt_tuple.h> +#include <connector/c/include/tarantool/tnt_proto.h> +#include <connector/c/include/tarantool/tnt_request.h> + +/* + * tnt_request_init() + * + * initialize request object; + * + * r - reply pointer +*/ +void +tnt_request_init(struct tnt_request *r) +{ + memset(r, 0, sizeof(struct tnt_request)); +} + +/* + * tnt_request_free() + * + * free request object; + * + * r - request object pointer +*/ +void +tnt_request_free(struct tnt_request *r) +{ + switch (r->h.type) { + case TNT_OP_INSERT: + tnt_tuple_free(&r->r.insert.t); + break; + case TNT_OP_DELETE: + tnt_tuple_free(&r->r.delete.t); + break; + case TNT_OP_CALL: + if (r->r.call.proc) { + tnt_mem_free(r->r.call.proc); + r->r.call.proc = NULL; + } + tnt_tuple_free(&r->r.call.t); + break; + case TNT_OP_SELECT: + tnt_list_free(&r->r.select.l); + break; + case TNT_OP_UPDATE: + tnt_tuple_free(&r->r.update.t); + if (r->r.update.ops) { + tnt_mem_free(r->r.update.ops); + r->r.update.ops = NULL; + } + if (r->r.update.opv) { + tnt_mem_free(r->r.update.opv); + r->r.update.opv = NULL; + } + break; + case TNT_OP_PING: + break; + } + if (r->v) { + tnt_mem_free(r->v); + r->v = NULL; + } +} + +static int +tnt_request_insert(struct tnt_request *r, tnt_request_t rcv, void *ptr) +{ + if (rcv(ptr, (char*)&r->r.insert, sizeof(struct tnt_header_insert)) == -1) + return -1; + uint32_t size = r->h.len - sizeof(struct tnt_header_insert); + char *buf = tnt_mem_alloc(size); + if (buf == NULL) + return -1; + if (rcv(ptr, buf, size) == -1) { + tnt_mem_free(buf); + return -1; + } + if (tnt_tuple_set(&r->r.insert.t, buf, size) == NULL) { + tnt_mem_free(buf); + return -1; + } + /* creating resend io vector */ + r->vc = 3; + r->v = tnt_mem_alloc(r->vc * sizeof(struct iovec)); + if (r->v == NULL) { + tnt_tuple_free(&r->r.insert.t); + tnt_mem_free(buf); + return -1; + } + r->v[0].iov_base = &r->h; + r->v[0].iov_len = sizeof(struct tnt_header); + r->v[1].iov_base = &r->r.insert.h; + r->v[1].iov_len = sizeof(struct tnt_header_insert); + r->v[2].iov_base = r->r.insert.t.data; + r->v[2].iov_len = r->r.insert.t.size; + tnt_mem_free(buf); + return 0; +} + +static int +tnt_request_delete(struct tnt_request *r, tnt_request_t rcv, void *ptr) +{ + if (rcv(ptr, (char*)&r->r.delete, sizeof(struct tnt_header_delete)) == -1) + return -1; + uint32_t size = r->h.len - sizeof(struct tnt_header_delete); + char *buf = tnt_mem_alloc(size); + if (buf == NULL) + return -1; + if (rcv(ptr, buf, size) == -1) { + tnt_mem_free(buf); + return -1; + } + if (tnt_tuple_set(&r->r.delete.t, buf, size) == NULL) { + tnt_mem_free(buf); + return -1; + } + /* creating resend io vector */ + r->vc = 3; + r->v = tnt_mem_alloc(r->vc * sizeof(struct iovec)); + if (r->v == NULL) { + tnt_tuple_free(&r->r.delete.t); + tnt_mem_free(buf); + return -1; + } + r->v[0].iov_base = &r->h; + r->v[0].iov_len = sizeof(struct tnt_header); + r->v[1].iov_base = &r->r.delete.h; + r->v[1].iov_len = sizeof(struct tnt_header_delete); + r->v[2].iov_base = r->r.delete.t.data; + r->v[2].iov_len = r->r.delete.t.size; + tnt_mem_free(buf); + return 0; +} + +static int +tnt_request_call(struct tnt_request *r, tnt_request_t rcv, void *ptr) +{ + if (rcv(ptr, (char*)&r->r.call, sizeof(struct tnt_header_call)) == -1) + return -1; + uint32_t size = r->h.len - sizeof(struct tnt_header_call); + char *buf = tnt_mem_alloc(size); + if (buf == NULL) + goto error; + if (rcv(ptr, buf, size) == -1) + goto error; + int esize = tnt_enc_read(buf, &r->r.call.proc_len); + if (esize == -1 || esize >= 5) + goto error; + memcpy(r->r.call.proc_enc, buf, esize); + /* function name */ + r->r.call.proc_enc_len = esize; + r->r.call.proc = tnt_mem_alloc(r->r.call.proc_len + 1); + if (r->r.call.proc == NULL) + goto error; + memcpy(r->r.call.proc, buf + esize, r->r.call.proc_len); + r->r.call.proc[r->r.call.proc_len] = 0; + /* function arguments */ + size -= esize + r->r.call.proc_len; + if (tnt_tuple_set(&r->r.call.t, buf + esize + r->r.call.proc_len, size) == NULL) { + tnt_mem_free(r->r.call.proc); + r->r.call.proc = NULL; + goto error; + } + /* creating resend io vector */ + r->vc = 5; + r->v = tnt_mem_alloc(r->vc * sizeof(struct iovec)); + if (r->v == NULL) + goto error; + r->v[0].iov_base = &r->h; + r->v[0].iov_len = sizeof(struct tnt_header); + r->v[1].iov_base = &r->r.call.h; + r->v[1].iov_len = sizeof(struct tnt_header_call); + r->v[2].iov_base = r->r.call.proc_enc; + r->v[2].iov_len = r->r.call.proc_enc_len; + r->v[3].iov_base = r->r.call.proc; + r->v[3].iov_len = r->r.call.proc_len; + r->v[4].iov_base = r->r.call.t.data; + r->v[4].iov_len = r->r.call.t.size; + tnt_mem_free(buf); + return 0; +error: + tnt_tuple_free(&r->r.call.t); + if (buf) + tnt_mem_free(buf); + return -1; +} + +static int +tnt_request_select(struct tnt_request *r, tnt_request_t rcv, void *ptr) +{ + if (rcv(ptr, (char*)&r->r.select, sizeof(struct tnt_header_select)) == -1) + return -1; + uint32_t size = r->h.len - sizeof(struct tnt_header_select); + char *buf = tnt_mem_alloc(size); + if (buf == NULL) + goto error; + if (rcv(ptr, buf, size) == -1) + goto error; + /* count of tuples */ + uint32_t i, count = *(uint32_t*)buf; + uint32_t off = 4; + /* processing tuples */ + tnt_list_init(&r->r.select.l); + for (i = 0 ; i < count ; i++) { + /* calculating tuple size */ + uint32_t j, cardinality = *(uint32_t*)(buf + off); + uint32_t size = 4; + for (j = 0 ; j < cardinality ; j++) { + uint32_t fld_size = 0; + int fld_esize = tnt_enc_read(buf + off + size, &fld_size); + if (fld_esize == -1) + goto error; + size += fld_esize + fld_size; + } + /* initializing tuple and adding to list */ + struct tnt_tuple *tu = tnt_list_at(&r->r.select.l, NULL); + if (tnt_tuple_set(tu, buf + off, size) == NULL) + goto error; + off += size; + } + tnt_mem_free(buf); + return 0; +error: + tnt_list_free(&r->r.select.l); + if (buf) + tnt_mem_free(buf); + return -1; +} + +static int +tnt_request_update(struct tnt_request *r, tnt_request_t rcv, void *ptr) +{ + if (rcv(ptr, (char*)&r->r.update, sizeof(struct tnt_header_update)) == -1) + return -1; + r->r.update.opc = 0; + r->r.update.opv = NULL; + uint32_t size = r->h.len - sizeof(struct tnt_header_update); + char *buf = tnt_mem_alloc(size); + if (buf == NULL) + goto error; + if (rcv(ptr, buf, size) == -1) + goto error; + /* calculating key tuple size */ + uint32_t i, cardinality = *(uint32_t*)(buf); + uint32_t ks = 4; + for (i = 0 ; i < cardinality ; i++) { + uint32_t fld_size = 0; + int fld_esize = tnt_enc_read(buf + ks, &fld_size); + if (fld_esize == -1) + goto error; + ks += fld_esize + fld_size; + } + /* initializing tuple */ + if (tnt_tuple_set(&r->r.update.t, buf, ks) == NULL) + goto error; + size -= ks - 4; + + /* ops data */ + r->r.update.opc = *(uint32_t*)(buf + ks); + uint32_t opvsz = sizeof(struct tnt_request_update_op) * r->r.update.opc; + r->r.update.opv = tnt_mem_alloc(opvsz); + if (r->r.update.opv == NULL) + goto error; + memset(r->r.update.opv, 0, sizeof(opvsz)); + + /* allocating ops buffer */ + r->r.update.ops_size = 0; + r->r.update.ops = tnt_mem_alloc(size); + if (r->r.update.ops == NULL) + goto error; + memcpy(r->r.update.ops, buf + ks + 4, size); + + /* parsing operations */ + char *p = r->r.update.ops; + for (i = 0 ; i < r->r.update.opc ; i++) { + struct tnt_request_update_op *op = &r->r.update.opv[i]; + /* field */ + op->field = *(uint32_t*)(p); + p += 4; + /* operation */ + op->op = *(uint8_t*)(p); + p += 1; + /* enc_size */ + int esize = tnt_enc_read(p, &op->size); + if (esize == -1 || esize >= 5) + goto error; + op->size_enc_len = esize; + memcpy(op->size_enc, p, op->size_enc_len); + p += op->size_enc_len; + op->data = p; + p += op->size; + r->r.update.ops_size += 4 + 1 + op->size_enc_len + op->size; + } + + /* creating resend io vector */ + r->vc = 5; + r->v = tnt_mem_alloc(r->vc * sizeof(struct iovec)); + if (r->v == NULL) + goto error; + r->v[0].iov_base = &r->h; + r->v[0].iov_len = sizeof(struct tnt_header); + r->v[1].iov_base = &r->r.update.h; + r->v[1].iov_len = sizeof(struct tnt_header_update); + r->v[2].iov_base = r->r.update.t.data; + r->v[2].iov_len = r->r.update.t.size; + r->v[3].iov_base = &r->r.update.opc; + r->v[3].iov_len = 4; + r->v[4].iov_base = r->r.update.ops; + r->v[4].iov_len = r->r.update.ops_size; + tnt_mem_free(buf); + return 0; +error: + tnt_tuple_free(&r->r.update.t); + if (r->r.update.ops) { + tnt_mem_free(r->r.update.ops); + r->r.update.ops = NULL; + } + if (r->r.update.opv) { + tnt_mem_free(r->r.update.opv); + r->r.update.opv = NULL; + } + if (buf) + tnt_mem_free(buf); + return -1; +} + +/* + * tnt_request_from() + * + * process iproto request with supplied recv function; + * + * r - request object pointer + * rcv - supplied recv function + * ptr - recv function argument + * hdr - pointer to iproto header, may be NULL + * + * returns zero on fully read reply, or -1 on error. +*/ +int +tnt_request_from(struct tnt_request *r, tnt_request_t rcv, void *ptr, + struct tnt_header *hdr) +{ + if (hdr) { + memcpy(&r->h, hdr, sizeof(struct tnt_header)); + } else { + if (rcv(ptr, (char*)&r->h, sizeof(struct tnt_header)) == -1) + return -1; + } + switch (r->h.type) { + case TNT_OP_INSERT: return tnt_request_insert(r, rcv, ptr); + case TNT_OP_DELETE: return tnt_request_delete(r, rcv, ptr); + case TNT_OP_CALL: return tnt_request_call(r, rcv, ptr); + case TNT_OP_SELECT: return tnt_request_select(r, rcv, ptr); + case TNT_OP_UPDATE: return tnt_request_update(r, rcv, ptr); + case TNT_OP_PING: return 0; + } + return -1; +} + +/* + * tnt_request() + * + * process buffer as iproto request (deserilization); + * + * r - request object pointer + * buf - buffer data pointer + * size - buffer data size + * off - returned offset, maybe NULL + * hdr - iproto header, maybe NULL + * + * if request is fully read, then zero is returned and offset set to the + * end of reply data in buffer. + * + * if request is not complete, then 1 is returned and offset set to the + * size needed to read. + * + * if there were error while parsing reply, -1 is returned. + * + * returns zero on fully read reply, or NULL on error. +*/ +static ssize_t tnt_request_cb(void *ptr[2], char *buf, ssize_t size) { + char *src = ptr[0]; + ssize_t *off = ptr[1]; + memcpy(buf, src + *off, size); + *off += size; + return size; +} + +int +tnt_request(struct tnt_request *r, char *buf, size_t size, size_t *off, + struct tnt_header *hdr) +{ + if (hdr == NULL) { + if (size < (sizeof(struct tnt_header))) { + if (off) + *off = sizeof(struct tnt_header) - size; + return 1; + } + struct tnt_header *hdr_ = (struct tnt_header*)buf; + if (size < hdr_->len) { + if (off) + *off = hdr_->len - size; + return 1; + } + } + size_t offv = 0; + void *ptr[2] = { buf, &offv }; + int rc = tnt_request_from(r, (tnt_request_t)tnt_request_cb, ptr, hdr); + if (off) + *off = offv; + return rc; +} diff --git a/connector/c/tnt/tnt_select.c b/connector/c/tnt/tnt_select.c index 30e0e63947ba14944f90a943bc3f5f58e30482d9..59d6927cb9940ae60d0289174d39d0af5f0c42cf 100644 --- a/connector/c/tnt/tnt_select.c +++ b/connector/c/tnt/tnt_select.c @@ -31,18 +31,12 @@ #include <connector/c/include/tarantool/tnt_mem.h> #include <connector/c/include/tarantool/tnt_proto.h> #include <connector/c/include/tarantool/tnt_tuple.h> +#include <connector/c/include/tarantool/tnt_request.h> #include <connector/c/include/tarantool/tnt_reply.h> #include <connector/c/include/tarantool/tnt_stream.h> #include <connector/c/include/tarantool/tnt_iter.h> #include <connector/c/include/tarantool/tnt_select.h> -struct tnt_header_select { - uint32_t ns; - uint32_t index; - uint32_t offset; - uint32_t limit; -}; - /* * tnt_select() * diff --git a/connector/c/tnt/tnt_stream.c b/connector/c/tnt/tnt_stream.c index 076707886436094d1f3933598338880916421d3f..a166fbe6f3ea92fe68e1f472abf70a20886b7e43 100644 --- a/connector/c/tnt/tnt_stream.c +++ b/connector/c/tnt/tnt_stream.c @@ -29,7 +29,9 @@ #include <string.h> #include <connector/c/include/tarantool/tnt_mem.h> +#include <connector/c/include/tarantool/tnt_proto.h> #include <connector/c/include/tarantool/tnt_tuple.h> +#include <connector/c/include/tarantool/tnt_request.h> #include <connector/c/include/tarantool/tnt_reply.h> #include <connector/c/include/tarantool/tnt_stream.h> @@ -52,6 +54,29 @@ tnt_stream_reqid(struct tnt_stream *s, uint32_t reqid) return old; } +/* + * tnt_stream_init() + * + * free stream object. + * + * s - stream pointer + * +*/ +struct tnt_stream* +tnt_stream_init(struct tnt_stream *s) +{ + if (s) { + memset(s, 0, sizeof(struct tnt_stream)); + return s; + } + s = tnt_mem_alloc(sizeof(struct tnt_stream)); + if (s == NULL) + return NULL; + memset(s, 0, sizeof(struct tnt_stream)); + s->alloc = 1; + return s; +} + /* * tnt_stream_free() * @@ -66,4 +91,3 @@ void tnt_stream_free(struct tnt_stream *s) { if (s->alloc) tnt_mem_free(s); } - diff --git a/connector/c/tnt/tnt_tuple.c b/connector/c/tnt/tnt_tuple.c index 00129c1310b33506dcbf7ed926d61307825fb683..0e5553d9974522b391239e7615d11c0f15fc8c96 100644 --- a/connector/c/tnt/tnt_tuple.c +++ b/connector/c/tnt/tnt_tuple.c @@ -30,9 +30,9 @@ #include <string.h> #include <ctype.h> -#include <tarantool/tnt_mem.h> -#include <tarantool/tnt_enc.h> -#include <tarantool/tnt_tuple.h> +#include <connector/c/include/tarantool/tnt_mem.h> +#include <connector/c/include/tarantool/tnt_enc.h> +#include <connector/c/include/tarantool/tnt_tuple.h> /* * tnt_tuple_init() diff --git a/connector/c/tnt/tnt_update.c b/connector/c/tnt/tnt_update.c index 0f370de2618bb7c02176ccf3acd5b7269e5fa90e..0ed0ae1a337bffd90a21ad1ea2a155e92816283b 100644 --- a/connector/c/tnt/tnt_update.c +++ b/connector/c/tnt/tnt_update.c @@ -28,14 +28,15 @@ #include <stdint.h> #include <string.h> -#include <tarantool/tnt_mem.h> -#include <tarantool/tnt_proto.h> -#include <tarantool/tnt_enc.h> -#include <tarantool/tnt_tuple.h> -#include <tarantool/tnt_reply.h> -#include <tarantool/tnt_stream.h> -#include <tarantool/tnt_buf.h> -#include <tarantool/tnt_update.h> +#include <connector/c/include/tarantool/tnt_mem.h> +#include <connector/c/include/tarantool/tnt_proto.h> +#include <connector/c/include/tarantool/tnt_enc.h> +#include <connector/c/include/tarantool/tnt_tuple.h> +#include <connector/c/include/tarantool/tnt_request.h> +#include <connector/c/include/tarantool/tnt_reply.h> +#include <connector/c/include/tarantool/tnt_stream.h> +#include <connector/c/include/tarantool/tnt_buf.h> +#include <connector/c/include/tarantool/tnt_update.h> static ssize_t tnt_update_op(struct tnt_stream *s, @@ -213,11 +214,6 @@ tnt_update_insert(struct tnt_stream *s, uint32_t field, return tnt_update_op(s, field, TNT_UPDATE_INSERT, data, size); } -struct tnt_header_update { - uint32_t ns; - uint32_t flags; -}; - /* * tnt_update() * diff --git a/connector/c/tntnet/tnt_net.c b/connector/c/tntnet/tnt_net.c index e4cf9b792e456ab35391d8dc6d69867b3c379d9a..c603577485e5c1db562e876ab5903c7ac3af4c38 100644 --- a/connector/c/tntnet/tnt_net.c +++ b/connector/c/tntnet/tnt_net.c @@ -33,19 +33,6 @@ #include <connector/c/include/tarantool/tnt_net.h> #include <connector/c/include/tarantool/tnt_io.h> -static struct tnt_stream *tnt_net_tryalloc(struct tnt_stream *s) { - if (s) { - memset(s, 0, sizeof(struct tnt_stream)); - return s; - } - s = tnt_mem_alloc(sizeof(struct tnt_stream)); - if (s == NULL) - return NULL; - memset(s, 0, sizeof(struct tnt_stream)); - s->alloc = 1; - return s; -} - static void tnt_net_free(struct tnt_stream *s) { struct tnt_stream_net *sn = TNT_SNET_CAST(s); tnt_io_close(sn); @@ -81,7 +68,12 @@ tnt_net_writev(struct tnt_stream *s, struct iovec *iov, int count) { } static ssize_t -tnt_net_reply_cb(struct tnt_stream *s, char *buf, ssize_t size) { +tnt_net_write_request(struct tnt_stream *s, struct tnt_request *r) { + return tnt_net_writev(s, r->v, r->vc); +} + +static ssize_t +tnt_net_recv_cb(struct tnt_stream *s, char *buf, ssize_t size) { struct tnt_stream_net *sn = TNT_SNET_CAST(s); return tnt_io_recv(sn, buf, size); } @@ -91,7 +83,13 @@ tnt_net_reply(struct tnt_stream *s, struct tnt_reply *r) { if (s->wrcnt == 0) return 1; s->wrcnt--; - return tnt_reply_from(r, (tnt_replyf_t)tnt_net_reply_cb, s); + return tnt_reply_from(r, (tnt_reply_t)tnt_net_recv_cb, s); +} + +static int +tnt_net_request(struct tnt_stream *s, struct tnt_request *r) { + /* read doesn't touches wrcnt */ + return tnt_request_from(r, (tnt_request_t)tnt_net_recv_cb, s, NULL); } /* @@ -107,7 +105,7 @@ tnt_net_reply(struct tnt_stream *s, struct tnt_reply *r) { */ struct tnt_stream *tnt_net(struct tnt_stream *s) { int allocated = s == NULL; - s = tnt_net_tryalloc(s); + s = tnt_stream_init(s); if (s == NULL) return NULL; /* allocating stream data */ @@ -120,9 +118,11 @@ struct tnt_stream *tnt_net(struct tnt_stream *s) { memset(s->data, 0, sizeof(struct tnt_stream_net)); /* initializing interfaces */ s->read = tnt_net_read; - s->reply = tnt_net_reply; + s->read_reply = tnt_net_reply; + s->read_request = tnt_net_request; s->write = tnt_net_write; s->writev = tnt_net_writev; + s->write_request = tnt_net_write_request; s->free = tnt_net_free; /* initializing internal data */ struct tnt_stream_net *sn = TNT_SNET_CAST(s); diff --git a/connector/c/tntrpl/CMakeLists.txt b/connector/c/tntrpl/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..85fcbcaf88c641e2b20ab10fb121c08933774337 --- /dev/null +++ b/connector/c/tntrpl/CMakeLists.txt @@ -0,0 +1,66 @@ +#============================================================================# +# build flags +#============================================================================# + +# default flags +if (${CMAKE_BUILD_TYPE} STREQUAL "None") + set (tntrpl_cflags "-std=gnu99") +else() + set (tntrpl_cflags "-std=gnu99 -Wall -Wextra") + set (tntrpl_cflags "${tntrpl_cflags} -Wno-sign-compare -Wno-strict-aliasing") +endif() + +# Only add -Werror if it's a debug build, done by developers. +if (${CMAKE_BUILD_TYPE} STREQUAL "Debug") + set (tntrpl_cflags "${tntrpl_cflags} -Werror") +endif() + +#============================================================================# +# Build tnt rpl project +#============================================================================# + +# +# source files +# + +set (tntrpl_sources tnt_xlog.c tnt_rpl.c + ${CMAKE_SOURCE_DIR}/third_party/crc32.c) + +#----------------------------------------------------------------------------# +# Builds +#----------------------------------------------------------------------------# + +# Here we manage to build static/dynamic libraries ourselves, +# do not use the top level settings. +string(REPLACE "-static" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + +# +# Static library +# + +project(tntrpl) +add_library(tntrpl STATIC ${tntrpl_sources}) +set_target_properties(tntrpl PROPERTIES COMPILE_FLAGS "${tntrpl_cflags}") +set_target_properties(tntrpl PROPERTIES VERSION ${LIBTNT_VERSION} SOVERSION ${LIBTNT_SOVERSION}) +set_target_properties(tntrpl PROPERTIES OUTPUT_NAME "tarantoolrpl") + +# +# Shared library +# + +project(tntrpl_shared) +add_library(tntrpl_shared SHARED ${tntrpl_sources}) +target_link_libraries(tntrpl_shared tnt_shared) +set_target_properties(tntrpl_shared PROPERTIES OUTPUT_NAME tntrpl) +set_target_properties(tntrpl_shared PROPERTIES COMPILE_FLAGS "${tntrpl_cflags}") +set_target_properties(tntrpl_shared PROPERTIES VERSION ${LIBTNT_VERSION} SOVERSION ${LIBTNT_SOVERSION}) +set_target_properties(tntrpl_shared PROPERTIES OUTPUT_NAME "tarantoolrpl") + +#----------------------------------------------------------------------------# +# Install +#----------------------------------------------------------------------------# + +# install static library +install_targets(/lib tntrpl) +# install shared library +install_targets(/lib tntrpl_shared) diff --git a/connector/c/tntrpl/tnt_rpl.c b/connector/c/tntrpl/tnt_rpl.c new file mode 100644 index 0000000000000000000000000000000000000000..4ed9a1ccefeae6d02cde19696c9712dc359d7fc6 --- /dev/null +++ b/connector/c/tntrpl/tnt_rpl.c @@ -0,0 +1,184 @@ + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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 <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <string.h> + +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> + +#include <connector/c/include/tarantool/tnt.h> +#include <connector/c/include/tarantool/tnt_net.h> +#include <connector/c/include/tarantool/tnt_io.h> +#include <connector/c/include/tarantool/tnt_xlog.h> +#include <connector/c/include/tarantool/tnt_rpl.h> + +static const uint32_t tnt_rpl_version = 11; + +static void tnt_rpl_free(struct tnt_stream *s) { + struct tnt_stream_rpl *sr = TNT_RPL_CAST(s); + if (sr->net) { + /* network stream should not be free'd here */ + sr->net = NULL; + } + tnt_mem_free(s->data); +} + +static ssize_t +tnt_rpl_recv_cb(struct tnt_stream *s, char *buf, ssize_t size) { + struct tnt_stream_net *sn = TNT_SNET_CAST(s); + return tnt_io_recv(sn, buf, size); +} + +static int +tnt_rpl_request(struct tnt_stream *s, struct tnt_request *r) +{ + struct tnt_stream_rpl *sr = TNT_RPL_CAST(s); + struct tnt_stream_net *sn = TNT_SNET_CAST(sr->net); + /* fetching header */ + if (tnt_io_recv(sn, (char*)&sr->hdr, sizeof(sr->hdr)) == -1) + return -1; + /* fetching row header */ + if (tnt_io_recv(sn, (char*)&sr->row, sizeof(sr->row)) == -1) + return -1; + /* preparing pseudo iproto header */ + struct tnt_header hdr_iproto; + hdr_iproto.type = sr->row.op; + hdr_iproto.len = sr->hdr.len - sizeof(struct tnt_xlog_row_v11); + hdr_iproto.reqid = 0; + /* deserializing operation */ + if (tnt_request_from(r, (tnt_request_t)tnt_rpl_recv_cb, + sr->net, + &hdr_iproto) == -1) + return -1; + return 0; +} + +/* + * tnt_rpl() + * + * create and initialize replication stream; + * + * s - stream pointer, maybe NULL + * + * if stream pointer is NULL, then new stream will be created. + * + * returns stream pointer, or NULL on error. +*/ +struct tnt_stream *tnt_rpl(struct tnt_stream *s) +{ + int allocated = s == NULL; + s = tnt_stream_init(s); + if (s == NULL) + return NULL; + /* allocating stream data */ + s->data = tnt_mem_alloc(sizeof(struct tnt_stream_rpl)); + if (s->data == NULL) + goto error; + memset(s->data, 0, sizeof(struct tnt_stream_rpl)); + /* initializing interfaces */ + s->read = NULL; + s->read_request = tnt_rpl_request; + s->read_reply = NULL; + s->write = NULL; + s->writev = NULL; + s->free = tnt_rpl_free; + /* initializing internal data */ + struct tnt_stream_rpl *sr = TNT_RPL_CAST(s); + sr->net = NULL; + return s; +error: + if (s->data) { + tnt_mem_free(s->data); + s->data = NULL; + } + if (allocated) + tnt_stream_free(s); + return NULL; +} + +/* + * tnt_rpl_open() + * + * connect to a server and initialize handshake; + * + * s - replication stream pointer + * lsn - start lsn + * + * network stream must be properly initialized before + * this function called (see ttnt_rpl_net, tnt_set). + * + * returns 0 on success, or -1 on error. +*/ +int tnt_rpl_open(struct tnt_stream *s, uint64_t lsn) +{ + struct tnt_stream_rpl *sr = TNT_RPL_CAST(s); + /* intializing connection */ + if (tnt_init(sr->net) == -1) + return -1; + if (tnt_connect(sr->net) == -1) + return -1; + /* sending initial lsn */ + struct tnt_stream_net *sn = TNT_SNET_CAST(sr->net); + if (tnt_io_send_raw(sn, (char*)&lsn, sizeof(lsn), 1) == -1) + return -1; + /* reading and checking version */ + uint32_t version = 0; + if (tnt_io_recv_raw(sn, (char*)&version, sizeof(version), 1) == -1) + return -1; + if (version != tnt_rpl_version) + return -1; + return 0; +} + +/* + * tnt_rpl_close() + * + * close a connection; + * + * s - replication stream pointer + * + * returns 0 on success, or -1 on error. +*/ +void tnt_rpl_close(struct tnt_stream *s) { + struct tnt_stream_rpl *sr = TNT_RPL_CAST(s); + if (sr->net) + tnt_close(s); +} + +/* + * tnt_rpl_net() + * + * get network stream (tnt_stream_net object); + * + * s - replication stream pointer +*/ +void tnt_rpl_attach(struct tnt_stream *s, struct tnt_stream *net) { + TNT_RPL_CAST(s)->net = net; +} diff --git a/connector/c/tntrpl/tnt_xlog.c b/connector/c/tntrpl/tnt_xlog.c new file mode 100644 index 0000000000000000000000000000000000000000..538cfa3f7f1ff40daa23f0fc957a55bfb04860b4 --- /dev/null +++ b/connector/c/tntrpl/tnt_xlog.c @@ -0,0 +1,341 @@ + +/* + * Copyright (C) 2012 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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 <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <string.h> + +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> + +#include <third_party/crc32.h> + +#include <connector/c/include/tarantool/tnt.h> +#include <connector/c/include/tarantool/tnt_xlog.h> + +static const uint32_t tnt_xlog_marker_v11 = 0xba0babed; +static const uint32_t tnt_xlog_marker_eof_v11 = 0x10adab1e; + +inline static int +tnt_xlog_seterr(struct tnt_stream_xlog *s, enum tnt_xlog_error e) { + s->error = e; + if (e == TNT_XLOG_ESYSTEM) + s->errno_ = errno; + return -1; +} + +static void tnt_xlog_free(struct tnt_stream *s) { + struct tnt_stream_xlog *sx = TNT_SXLOG_CAST(s); + if (sx->file) { + tnt_mem_free(sx->file); + sx->file = NULL; + } + if (sx->fd) { + fclose(sx->fd); + sx->fd = NULL; + } + tnt_mem_free(s->data); +} + +inline static int +tnt_xlog_eof(struct tnt_stream_xlog *s, unsigned char *data) { + uint32_t marker = 0; + if (data) + tnt_mem_free(data); + /* checking eof condition */ + if (ftello(s->fd) == s->offset + sizeof(tnt_xlog_marker_eof_v11)) { + fseeko(s->fd, s->offset, SEEK_SET); + if (fread(&marker, sizeof(marker), 1, s->fd) != 1) + return tnt_xlog_seterr(s, TNT_XLOG_ESYSTEM); + else + if (marker != tnt_xlog_marker_eof_v11) + return tnt_xlog_seterr(s, TNT_XLOG_ECORRUPT); + s->offset = ftello(s->fd); + } + /* eof */ + return 1; +} + +static int +tnt_xlog_request(struct tnt_stream *s, struct tnt_request *r) +{ + struct tnt_stream_xlog *sx = TNT_SXLOG_CAST(s); + /* reading marker */ + unsigned char *data = NULL; + uint32_t marker = 0; + if (fread(&marker, sizeof(marker), 1, sx->fd) != 1) + return tnt_xlog_eof(sx, data); + + /* seeking for marker if necessary */ + while (marker != tnt_xlog_marker_v11) { + int c = fgetc(sx->fd); + if (c == EOF) + return tnt_xlog_eof(sx, data); + marker = marker >> 8 | ((uint32_t) c & 0xff) << + (sizeof(marker) * 8 - 8); + } + + /* reading header */ + if (fread(&sx->hdr, sizeof(sx->hdr), 1, sx->fd) != 1) + return tnt_xlog_eof(sx, data); + + /* checking header crc, starting from lsn */ + uint32_t crc32_hdr = + crc32c(0, (unsigned char*)&sx->hdr + sizeof(uint32_t), + sizeof(struct tnt_xlog_header_v11) - + sizeof(uint32_t)); + if (crc32_hdr != sx->hdr.crc32_hdr) + return tnt_xlog_seterr(sx, TNT_XLOG_ECORRUPT); + + /* allocating memory and reading data */ + data = tnt_mem_alloc(sx->hdr.len); + if (data == NULL) + return tnt_xlog_seterr(sx, TNT_XLOG_EMEMORY); + if (fread(data, sx->hdr.len, 1, sx->fd) != 1) + return tnt_xlog_eof(sx, data); + + /* checking data crc */ + uint32_t crc32_data = crc32c(0, data, sx->hdr.len); + if (crc32_data != sx->hdr.crc32_data) { + tnt_mem_free(data); + return tnt_xlog_seterr(sx, TNT_XLOG_ECORRUPT); + } + + /* copying row data */ + memcpy(&sx->row, data, sizeof(struct tnt_xlog_row_v11)); + + /* preparing pseudo iproto header */ + struct tnt_header hdr_iproto; + hdr_iproto.type = sx->row.op; + hdr_iproto.len = sx->hdr.len - sizeof(struct tnt_xlog_row_v11); + hdr_iproto.reqid = 0; + + /* deserializing operation */ + tnt_request_init(r); + size_t off = 0; + int rc = tnt_request(r, (char*)data + sizeof(struct tnt_xlog_row_v11), + sx->hdr.len - sizeof(struct tnt_xlog_row_v11), + &off, + &hdr_iproto); + tnt_mem_free(data); + /* in case of not completed request or parsing error */ + if (rc != 0) + return tnt_xlog_seterr(sx, TNT_XLOG_ECORRUPT); + /* updating offset */ + sx->offset = ftello(sx->fd); + return 0; +} + +/* + * tnt_xlog() + * + * create and initialize xlog stream; + * + * s - stream pointer, maybe NULL + * + * if stream pointer is NULL, then new stream will be created. + * + * returns stream pointer, or NULL on error. +*/ +struct tnt_stream *tnt_xlog(struct tnt_stream *s) +{ + int allocated = s == NULL; + s = tnt_stream_init(s); + if (s == NULL) + return NULL; + /* allocating stream data */ + s->data = tnt_mem_alloc(sizeof(struct tnt_stream_xlog)); + if (s->data == NULL) { + if (allocated) + tnt_stream_free(s); + return NULL; + } + memset(s->data, 0, sizeof(struct tnt_stream_xlog)); + /* initializing interfaces */ + s->read = NULL; + s->read_request = tnt_xlog_request; + s->read_reply = NULL; + s->write = NULL; + s->writev = NULL; + s->free = tnt_xlog_free; + /* initializing internal data */ + struct tnt_stream_xlog *sx = TNT_SXLOG_CAST(s); + sx->file = NULL; + sx->fd = NULL; + return s; +} + +inline static int +tnt_xlog_open_err(struct tnt_stream_xlog *s, enum tnt_xlog_error e) { + tnt_xlog_seterr(s, e); + if (s->fd) { + fclose(s->fd); + s->fd = NULL; + } + return -1; +} + +static int tnt_xlog_open_init(struct tnt_stream *s) +{ + struct tnt_stream_xlog *sx = TNT_SXLOG_CAST(s); + char filetype[32]; + char version[32]; + char *rc; + /* trying to open file */ + sx->fd = fopen(sx->file, "r"); + if (sx->fd == NULL) + return tnt_xlog_open_err(sx, TNT_XLOG_ESYSTEM); + /* reading xlog filetype */ + rc = fgets(filetype, sizeof(filetype), sx->fd); + if (rc == NULL) + return tnt_xlog_open_err(sx, TNT_XLOG_ESYSTEM); + /* reading xlog version */ + rc = fgets(version, sizeof(version), sx->fd); + if (rc == NULL) + return tnt_xlog_open_err(sx, TNT_XLOG_ESYSTEM); + /* checking type */ + if (strcmp(filetype, "XLOG\n")) + return tnt_xlog_open_err(sx, TNT_XLOG_ETYPE); + /* checking version */ + if (strcmp(version, "0.11\n")) + return tnt_xlog_open_err(sx, TNT_XLOG_EVERSION); + for (;;) { + char buf[256]; + rc = fgets(buf, sizeof(buf), sx->fd); + if (rc == NULL) + return tnt_xlog_open_err(sx, TNT_XLOG_EFAIL); + if (strcmp(rc, "\n") == 0 || strcmp(rc, "\r\n") == 0) + break; + } + /* getting current offset */ + sx->offset = ftello(sx->fd); + return 0; +} + +/* + * tnt_xlog_open() + * + * open xlog file and associate it with stream; + * + * s - xlog stream pointer + * + * returns 0 on success, or -1 on error. +*/ +int tnt_xlog_open(struct tnt_stream *s, char *file) { + struct tnt_stream_xlog *sx = TNT_SXLOG_CAST(s); + sx->file = tnt_mem_dup(file); + if (sx->file == NULL) + return tnt_xlog_seterr(sx, TNT_XLOG_EMEMORY); + if (tnt_xlog_open_init(s) == -1) { + tnt_mem_free(sx->file); + sx->file = NULL; + return -1; + } + tnt_xlog_seterr(sx, TNT_XLOG_EOK); + return 0; +} + +/* + * tnt_xlog_close() + * + * close xlog stream; + * + * s - xlog stream pointer + * + * returns 0 on success, or -1 on error. +*/ +void tnt_xlog_close(struct tnt_stream *s) { + struct tnt_stream_xlog *sx = TNT_SXLOG_CAST(s); + if (sx->file) { + tnt_mem_free(sx->file); + sx->file = NULL; + } + if (sx->fd) { + fclose(sx->fd); + sx->fd = NULL; + } +} + +/* + * tnt_xlog_error() + * + * get stream error status; + * + * s - xlog stream pointer +*/ +enum tnt_xlog_error tnt_xlog_error(struct tnt_stream *s) { + return TNT_SXLOG_CAST(s)->error; +} + +/* must be in sync with enum tnt_xlog_error */ + +struct tnt_xlog_error_desc { + enum tnt_xlog_error type; + char *desc; +}; + +static struct tnt_xlog_error_desc tnt_xlog_error_list[] = +{ + { TNT_XLOG_EOK, "ok" }, + { TNT_XLOG_EFAIL, "fail" }, + { TNT_XLOG_EMEMORY, "memory allocation failed" }, + { TNT_XLOG_ETYPE, "xlog type mismatch" }, + { TNT_XLOG_EVERSION, "xlog version mismatch" }, + { TNT_XLOG_ECORRUPT, "xlog crc failed or bad eof marker" }, + { TNT_XLOG_ESYSTEM, "system error" }, + { TNT_XLOG_LAST, NULL } +}; + +/* + * tnt_xlog_strerror() + * + * get stream error status description string; + * + * s - xlog stream pointer +*/ +char *tnt_xlog_strerror(struct tnt_stream *s) { + struct tnt_stream_xlog *sx = TNT_SXLOG_CAST(s); + if (sx->error == TNT_XLOG_ESYSTEM) { + static char msg[256]; + snprintf(msg, sizeof(msg), "%s (errno: %d)", + strerror(sx->errno_), sx->errno_); + return msg; + } + return tnt_xlog_error_list[(int)sx->error].desc; +} + +/* + * tnt_xlog_errno() + * + * get saved errno; + * + * s - xlog stream pointer +*/ +int tnt_xlog_errno(struct tnt_stream *s) { + return TNT_SXLOG_CAST(s)->errno_; +} diff --git a/connector/c/tntsql/tnt_sql.c b/connector/c/tntsql/tnt_sql.c index b8b80c279a9cab8df03f1611e8f3994a0842d162..b6220052f0156a2da59cba0fe4858e97f2d3ce4e 100644 --- a/connector/c/tntsql/tnt_sql.c +++ b/connector/c/tntsql/tnt_sql.c @@ -55,7 +55,7 @@ tnt_sql_error(struct tnt_sql *sql, struct tnt_tk *last, char *fmt, ...) int line = (last) ? last->line : sql->l->line; int col = (last) ? last->col : sql->l->col; char msg[256]; - snprintf(msg, sizeof(msg), "%d:%d %s\n", line, col, msgu); + snprintf(msg, sizeof(msg), "%d:%d %s", line, col, msgu); if (sql->error == NULL) sql->error = tnt_mem_dup(msg); return false; diff --git a/test/box/protocol.c b/test/box/protocol.c index c22bbfdab1b1444720997d0ecd2d1cdf08bd1078..f2f14ed327a2637b05c155d286db2505d451bfeb 100644 --- a/test/box/protocol.c +++ b/test/box/protocol.c @@ -26,9 +26,9 @@ void test_ping() t->wrcnt++; struct tnt_iter i; - tnt_iter_stream(&i, t); + tnt_iter_reply(&i, t); tnt_next(&i); - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); printf("return_code: %"PRIu32"\n", r->code); /* =0 */ tnt_iter_free(&i); } @@ -49,9 +49,9 @@ void test_bug702397() t->wrcnt++; struct tnt_iter i; - tnt_iter_stream(&i, t); + tnt_iter_reply(&i, t); tnt_next(&i); - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); printf("return_code: %s, %s\n", tnt_errcode_str(r->code >> 8), r->error); tnt_iter_free(&i); @@ -76,9 +76,9 @@ void test_bug702399() t->wrcnt++; struct tnt_iter i; - tnt_iter_stream(&i, t); + tnt_iter_reply(&i, t); tnt_next(&i); - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); printf("return_code: %s, %s\n", tnt_errcode_str(r->code >> 8), r->error); tnt_iter_free(&i); diff --git a/test/connector_c/CMakeLists.txt b/test/connector_c/CMakeLists.txt index cd27efddf2b8788c96fff30f438cd2cdf5c0d7c3..633db2e1b90b8c9963a4bf4ea866da40e2ad1f8d 100644 --- a/test/connector_c/CMakeLists.txt +++ b/test/connector_c/CMakeLists.txt @@ -1,3 +1,5 @@ tarantool_client("tt" tt.c) tarantool_client("update" update.c) +tarantool_client("xlog" xlog.c) +tarantool_client("rpl" rpl.c) diff --git a/test/connector_c/cfg/master.cfg b/test/connector_c/cfg/master.cfg new file mode 100644 index 0000000000000000000000000000000000000000..a04a7d43f8abeea9e116d572c7774a3311beec5a --- /dev/null +++ b/test/connector_c/cfg/master.cfg @@ -0,0 +1,18 @@ + +slab_alloc_arena = 0.1 +pid_file = "box.pid" +logger="cat - >> tarantool.log" + +primary_port = 33013 +secondary_port = 33014 +admin_port = 33015 +replication_port = 33016 + +rows_per_wal = 50 + +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 = "STR" + diff --git a/test/connector_c/cfg/tarantool.cfg b/test/connector_c/cfg/tarantool.cfg new file mode 100644 index 0000000000000000000000000000000000000000..3a8088fff9137434df68584a748d8f5585ff96f2 --- /dev/null +++ b/test/connector_c/cfg/tarantool.cfg @@ -0,0 +1,16 @@ + +slab_alloc_arena = 0.1 +pid_file = "box.pid" +logger="cat - >> tarantool.log" + +primary_port = 33013 +secondary_port = 33014 +admin_port = 33015 + +rows_per_wal = 50 + +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" diff --git a/test/connector_c/connector.result b/test/connector_c/connector.result index e6e074ff4e1232d5d525c699ff6cc1c086c426f5..e1bff3a720d3319f258bf4ad8d3e3f5d303ca148 100644 --- a/test/connector_c/connector.result +++ b/test/connector_c/connector.result @@ -7,6 +7,12 @@ > iterator tuple (single field) [OK] > iterator tuple (tnt_field) [OK] > iterator list [OK] +> marshaling ping [OK] +> marshaling insert [OK] +> marshaling delete [OK] +> marshaling call [OK] +> marshaling select [OK] +> marshaling update [OK] > connect [OK] > ping [OK] > insert [OK] diff --git a/test/connector_c/connector.test b/test/connector_c/connector.test index 01e0b108455c44a83fa9deb6a2c5c82a26639de4..6b84a5dd0736a31a80fff2620c41624d0d44cf61 100644 --- a/test/connector_c/connector.test +++ b/test/connector_c/connector.test @@ -2,8 +2,10 @@ import subprocess import sys import os -p = subprocess.Popen([ os.path.join(builddir, "test/connector_c/tt") ], +p = subprocess.Popen([os.path.join(builddir, "test/connector_c/tt")], stdout=subprocess.PIPE) p.wait() for line in p.stdout.readlines(): sys.stdout.write(line) + +# vim: syntax=python diff --git a/test/connector_c/connector.xlog b/test/connector_c/connector.xlog new file mode 100644 index 0000000000000000000000000000000000000000..8230d2b0c9190908a798ef6fdaeb2d2b4c62be5d Binary files /dev/null and b/test/connector_c/connector.xlog differ diff --git a/test/connector_c/rpl.c b/test/connector_c/rpl.c new file mode 100644 index 0000000000000000000000000000000000000000..d57112f317c27a00558935fcd93d17000dfae01c --- /dev/null +++ b/test/connector_c/rpl.c @@ -0,0 +1,88 @@ + +/* + * Copyright (C) 2011 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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 <stdlib.h> +#include <stdint.h> +#include <inttypes.h> +#include <stdbool.h> +#include <stdio.h> +#include <string.h> + +#include <connector/c/include/tarantool/tnt.h> +#include <connector/c/include/tarantool/tnt_net.h> +#include <connector/c/include/tarantool/tnt_xlog.h> +#include <connector/c/include/tarantool/tnt_rpl.h> + +static char *opname(uint32_t type) { + switch (type) { + case TNT_OP_PING: return "Ping"; + case TNT_OP_INSERT: return "Insert"; + case TNT_OP_DELETE: return "Delete"; + case TNT_OP_UPDATE: return "Update"; + case TNT_OP_SELECT: return "Select"; + case TNT_OP_CALL: return "Call"; + } + return "Unknown"; +} + +int +main(int argc, char * argv[]) +{ + if (argc != 4) { + printf("usage %s: host port limit\n", argv[0]); + return 1; + } + struct tnt_stream s; + tnt_rpl(&s); + struct tnt_stream sn; + tnt_net(&sn); + tnt_set(&sn, TNT_OPT_HOSTNAME, argv[1]); + tnt_set(&sn, TNT_OPT_PORT, atoi(argv[2])); + tnt_set(&sn, TNT_OPT_SEND_BUF, 0); + tnt_set(&sn, TNT_OPT_RECV_BUF, 0); + tnt_rpl_attach(&s, &sn); + if (tnt_rpl_open(&s, 2) == -1) + return 1; + + struct tnt_iter i; + tnt_iter_request(&i, &s); + + int limit = atoi(argv[3]); + while (limit-- > 0 && tnt_next(&i)) { + struct tnt_stream_rpl *sr = TNT_RPL_CAST(&s); + printf("%s lsn: %"PRIu64", time: %f, len: %d\n", + opname(sr->row.op), + sr->hdr.lsn, + sr->hdr.tm, sr->hdr.len); + } + if (i.status == TNT_ITER_FAIL) + printf("parsing failed\n"); + + tnt_iter_free(&i); + tnt_stream_free(&s); + tnt_stream_free(&sn); + return 0; +} diff --git a/test/connector_c/suite.ini b/test/connector_c/suite.ini index a2e577cd3d8f93bd530cb6c383eeec491c3fdece..90dd1ddd3180329b36827056e6830bc06f4f49c0 100644 --- a/test/connector_c/suite.ini +++ b/test/connector_c/suite.ini @@ -1,6 +1,6 @@ [default] description = tarantool/box connector C -config = tarantool.cfg +config = cfg/tarantool.cfg # put disabled tests here #disabled = # put disabled in valgrind test here diff --git a/test/connector_c/tarantool.cfg b/test/connector_c/tarantool.cfg deleted file mode 100644 index 69674c64b7d329793e659c8864ed222f23a9eccf..0000000000000000000000000000000000000000 --- a/test/connector_c/tarantool.cfg +++ /dev/null @@ -1,45 +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" - diff --git a/test/connector_c/tt.c b/test/connector_c/tt.c index 0e531407aeaa644beda32827c6c250d021446e72..ea88ef937b01db3e09317043523b7a658e536316 100644 --- a/test/connector_c/tt.c +++ b/test/connector_c/tt.c @@ -295,6 +295,236 @@ static void tt_tnt_iter3(struct tt_test *test) { tnt_list_free(l); } +/* marshal ping */ +static void tt_tnt_marshal_ping(struct tt_test *test) { + struct tnt_stream s; + tnt_buf(&s); + tnt_ping(&s); + tnt_ping(&s); + struct tnt_iter i; + tnt_iter_request(&i, &s); + TT_ASSERT(tnt_next(&i) == 1); + struct tnt_request *r = TNT_IREQUEST_PTR(&i); + TT_ASSERT(r->h.type == TNT_OP_PING); + TT_ASSERT(tnt_next(&i) == 1); + TT_ASSERT(r->h.type == TNT_OP_PING); + TT_ASSERT(tnt_next(&i) == 0); + tnt_iter_free(&i); + tnt_stream_free(&s); +} + +/* marshal insert */ +static void tt_tnt_marshal_insert(struct tt_test *test) { + struct tnt_stream s; + tnt_buf(&s); + struct tnt_tuple t; + tnt_tuple_init(&t); + tnt_tuple(&t, "%s%d", "foo", 123); + tnt_insert(&s, 0, 0, &t); + tnt_insert(&s, 0, 0, &t); + struct tnt_iter i; + tnt_iter_request(&i, &s); + TT_ASSERT(tnt_next(&i) == 1); + struct tnt_request *r = TNT_IREQUEST_PTR(&i); + TT_ASSERT(r->h.type == TNT_OP_INSERT); + struct tnt_iter *f = tnt_field(NULL, &r->r.insert.t, 0); + TT_ASSERT(tnt_field(f, NULL, 0) != NULL); + TT_ASSERT(TNT_IFIELD_IDX(f) == 0); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 3); + TT_ASSERT(memcmp(TNT_IFIELD_DATA(f), "foo", 3) == 0); + TT_ASSERT(tnt_field(f, NULL, 1) != NULL); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 4); + TT_ASSERT(TNT_IFIELD_IDX(f) == 1); + TT_ASSERT(*(uint32_t*)TNT_IFIELD_DATA(f) == 123); + TT_ASSERT(tnt_next(&i) == 1); + r = TNT_IREQUEST_PTR(&i); + TT_ASSERT(r->h.type == TNT_OP_INSERT); + TT_ASSERT(tnt_field(f, NULL, 0) != NULL); + TT_ASSERT(TNT_IFIELD_IDX(f) == 0); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 3); + TT_ASSERT(memcmp(TNT_IFIELD_DATA(f), "foo", 3) == 0); + TT_ASSERT(tnt_field(f, NULL, 1) != NULL); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 4); + TT_ASSERT(TNT_IFIELD_IDX(f) == 1); + TT_ASSERT(*(uint32_t*)TNT_IFIELD_DATA(f) == 123); + TT_ASSERT(tnt_next(&i) == 0); + tnt_tuple_free(&t); + tnt_iter_free(&i); + tnt_stream_free(&s); +} + +/* marshal delete */ +static void tt_tnt_marshal_delete(struct tt_test *test) { + struct tnt_stream s; + tnt_buf(&s); + struct tnt_tuple t; + tnt_tuple_init(&t); + tnt_tuple(&t, "%s", "foo"); + tnt_delete(&s, 0, 0, &t); + tnt_delete(&s, 0, 0, &t); + struct tnt_iter i; + tnt_iter_request(&i, &s); + TT_ASSERT(tnt_next(&i) == 1); + struct tnt_request *r = TNT_IREQUEST_PTR(&i); + TT_ASSERT(r->h.type == TNT_OP_DELETE); + struct tnt_iter *f = tnt_field(NULL, &r->r.delete.t, 0); + TT_ASSERT(tnt_field(f, NULL, 0) != NULL); + TT_ASSERT(TNT_IFIELD_IDX(f) == 0); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 3); + TT_ASSERT(memcmp(TNT_IFIELD_DATA(f), "foo", 3) == 0); + TT_ASSERT(tnt_next(&i) == 1); + r = TNT_IREQUEST_PTR(&i); + TT_ASSERT(r->h.type == TNT_OP_DELETE); + TT_ASSERT(tnt_field(f, NULL, 0) != NULL); + TT_ASSERT(TNT_IFIELD_IDX(f) == 0); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 3); + TT_ASSERT(memcmp(TNT_IFIELD_DATA(f), "foo", 3) == 0); + TT_ASSERT(tnt_next(&i) == 0); + tnt_tuple_free(&t); + tnt_iter_free(&i); + tnt_stream_free(&s); +} + +/* marshal call */ +static void tt_tnt_marshal_call(struct tt_test *test) { + struct tnt_stream s; + tnt_buf(&s); + struct tnt_tuple t; + tnt_tuple_init(&t); + tnt_tuple(&t, "%s%d", "foo", 123); + tnt_call(&s, 0, "box.select", &t); + tnt_call(&s, 0, "box.select", &t); + struct tnt_iter i; + tnt_iter_request(&i, &s); + TT_ASSERT(tnt_next(&i) == 1); + struct tnt_request *r = TNT_IREQUEST_PTR(&i); + TT_ASSERT(r->h.type == TNT_OP_CALL); + TT_ASSERT(strcmp(r->r.call.proc, "box.select") == 0); + struct tnt_iter *f = tnt_field(NULL, &r->r.call.t, 0); + TT_ASSERT(tnt_field(f, NULL, 0) != NULL); + TT_ASSERT(TNT_IFIELD_IDX(f) == 0); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 3); + TT_ASSERT(memcmp(TNT_IFIELD_DATA(f), "foo", 3) == 0); + TT_ASSERT(tnt_field(f, NULL, 1) != NULL); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 4); + TT_ASSERT(TNT_IFIELD_IDX(f) == 1); + TT_ASSERT(*(uint32_t*)TNT_IFIELD_DATA(f) == 123); + TT_ASSERT(tnt_next(&i) == 1); + r = TNT_IREQUEST_PTR(&i); + TT_ASSERT(r->h.type == TNT_OP_CALL); + TT_ASSERT(strcmp(r->r.call.proc, "box.select") == 0); + TT_ASSERT(tnt_field(f, NULL, 0) != NULL); + TT_ASSERT(TNT_IFIELD_IDX(f) == 0); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 3); + TT_ASSERT(memcmp(TNT_IFIELD_DATA(f), "foo", 3) == 0); + TT_ASSERT(tnt_field(f, NULL, 1) != NULL); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 4); + TT_ASSERT(TNT_IFIELD_IDX(f) == 1); + TT_ASSERT(*(uint32_t*)TNT_IFIELD_DATA(f) == 123); + TT_ASSERT(tnt_next(&i) == 0); + tnt_tuple_free(&t); + tnt_iter_free(&i); + tnt_stream_free(&s); +} + +/* marshal select */ +static void tt_tnt_marshal_select(struct tt_test *test) { + struct tnt_stream s; + tnt_buf(&s); + struct tnt_list list; + tnt_list_init(&list); + tnt_list(&list, tnt_tuple(NULL, "%s", "foo"), + tnt_tuple(NULL, "%s%d", "bar", 444), + tnt_tuple(NULL, "%s%d%d", "baz", 1, 2), + NULL); + tnt_select(&s, 0, 0, 0, 1, &list); + struct tnt_iter i; + tnt_iter_request(&i, &s); + TT_ASSERT(tnt_next(&i) == 1); + struct tnt_request *r = TNT_IREQUEST_PTR(&i); + TT_ASSERT(r->h.type == TNT_OP_SELECT); + struct tnt_iter il; + tnt_iter_list(&il, &r->r.select.l); + TT_ASSERT(tnt_next(&il) == 1); + struct tnt_tuple *t = TNT_ILIST_TUPLE(&il); + struct tnt_iter *f = tnt_field(NULL, t, 0); + TT_ASSERT(tnt_field(f, NULL, 0) != NULL); + TT_ASSERT(TNT_IFIELD_IDX(f) == 0); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 3); + TT_ASSERT(memcmp(TNT_IFIELD_DATA(f), "foo", 3) == 0); + tnt_iter_free(f); + TT_ASSERT(tnt_next(&il) == 1); + t = TNT_ILIST_TUPLE(&il); + f = tnt_field(NULL, t, 0); + TT_ASSERT(tnt_field(f, NULL, 0) != NULL); + TT_ASSERT(TNT_IFIELD_IDX(f) == 0); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 3); + TT_ASSERT(memcmp(TNT_IFIELD_DATA(f), "bar", 3) == 0); + TT_ASSERT(tnt_field(f, NULL, 1) != NULL); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 4); + TT_ASSERT(TNT_IFIELD_IDX(f) == 1); + TT_ASSERT(*(uint32_t*)TNT_IFIELD_DATA(f) == 444); + tnt_iter_free(f); + TT_ASSERT(tnt_next(&il) == 1); + t = TNT_ILIST_TUPLE(&il); + f = tnt_field(NULL, t, 0); + TT_ASSERT(tnt_field(f, NULL, 0) != NULL); + TT_ASSERT(TNT_IFIELD_IDX(f) == 0); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 3); + TT_ASSERT(memcmp(TNT_IFIELD_DATA(f), "baz", 3) == 0); + TT_ASSERT(tnt_field(f, NULL, 1) != NULL); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 4); + TT_ASSERT(TNT_IFIELD_IDX(f) == 1); + TT_ASSERT(*(uint32_t*)TNT_IFIELD_DATA(f) == 1); + TT_ASSERT(tnt_field(f, NULL, 2) != NULL); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 4); + TT_ASSERT(TNT_IFIELD_IDX(f) == 2); + TT_ASSERT(*(uint32_t*)TNT_IFIELD_DATA(f) == 2); + tnt_iter_free(f); + TT_ASSERT(tnt_next(&il) == 0); + tnt_iter_free(&i); + tnt_iter_free(&il); + tnt_list_free(&list); + tnt_stream_free(&s); +} + +/* marshal update */ +static void tt_tnt_marshal_update(struct tt_test *test) { + struct tnt_stream s, ops; + tnt_buf(&s); + tnt_buf(&ops); + struct tnt_tuple t; + tnt_tuple_init(&t); + tnt_tuple(&t, "%s", "foo"); + tnt_update_assign(&ops, 444, "FOO", 3); + tnt_update_arith(&ops, 2, TNT_UPDATE_ADD, 7); + TT_ASSERT(tnt_update(&s, 0, 0, &t, &ops) > 0); + struct tnt_iter i; + tnt_iter_request(&i, &s); + TT_ASSERT(tnt_next(&i) == 1); + struct tnt_request *r = TNT_IREQUEST_PTR(&i); + TT_ASSERT(r->h.type == TNT_OP_UPDATE); + TT_ASSERT(r->r.update.opc == 2); + struct tnt_iter *f = tnt_field(NULL, &r->r.update.t, 0); + TT_ASSERT(tnt_field(f, NULL, 0) != NULL); + TT_ASSERT(TNT_IFIELD_IDX(f) == 0); + TT_ASSERT(TNT_IFIELD_SIZE(f) == 3); + TT_ASSERT(memcmp(TNT_IFIELD_DATA(f), "foo", 3) == 0); + TT_ASSERT(r->r.update.opv[0].op == TNT_UPDATE_ASSIGN); + TT_ASSERT(r->r.update.opv[0].field == 444); + TT_ASSERT(r->r.update.opv[0].size == 3); + TT_ASSERT(memcmp(r->r.update.opv[0].data, "FOO", 3) == 0); + TT_ASSERT(r->r.update.opv[1].op == TNT_UPDATE_ADD); + TT_ASSERT(r->r.update.opv[1].field == 2); + TT_ASSERT(r->r.update.opv[1].size == 4); + TT_ASSERT(*(uint32_t*)r->r.update.opv[1].data == 7); + TT_ASSERT(tnt_next(&i) == 0); + tnt_tuple_free(&t); + tnt_stream_free(&s); + tnt_stream_free(&ops); + tnt_iter_free(&i); +} + static struct tnt_stream net; /* network connection */ @@ -311,9 +541,9 @@ static void tt_tnt_net_ping(struct tt_test *test) { TT_ASSERT(tnt_ping(&net) > 0); TT_ASSERT(tnt_flush(&net) > 0); struct tnt_iter i; - tnt_iter_stream(&i, &net); + tnt_iter_reply(&i, &net); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); TT_ASSERT(r->code == 0); TT_ASSERT(r->op == TNT_OP_PING); } @@ -335,9 +565,9 @@ static void tt_tnt_net_insert(struct tt_test *test) { tnt_tuple_free(&kv1); tnt_tuple_free(&kv2); struct tnt_iter i; - tnt_iter_stream(&i, &net); + tnt_iter_reply(&i, &net); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); TT_ASSERT(r->reqid == 777); TT_ASSERT(r->code == 0); TT_ASSERT(r->op == TNT_OP_INSERT); @@ -358,9 +588,9 @@ static void tt_tnt_net_update(struct tt_test *test) { tnt_stream_free(&ops); TT_ASSERT(tnt_flush(&net) > 0); struct tnt_iter i; - tnt_iter_stream(&i, &net); + tnt_iter_reply(&i, &net); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); TT_ASSERT(r->code == 0); TT_ASSERT(r->op == TNT_OP_UPDATE); TT_ASSERT(r->count == 1); @@ -375,9 +605,9 @@ static void tt_tnt_net_select(struct tt_test *test) { TT_ASSERT(tnt_flush(&net) > 0); tnt_list_free(search); struct tnt_iter i; - tnt_iter_stream(&i, &net); + tnt_iter_reply(&i, &net); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); TT_ASSERT(r->code == 0); TT_ASSERT(r->op == TNT_OP_SELECT); TT_ASSERT(r->count == 1); @@ -415,9 +645,9 @@ static void tt_tnt_net_delete(struct tt_test *test) { TT_ASSERT(tnt_flush(&net) > 0); tnt_tuple_free(&k); struct tnt_iter i; - tnt_iter_stream(&i, &net); + tnt_iter_reply(&i, &net); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); TT_ASSERT(r->code == 0); TT_ASSERT(r->op == TNT_OP_DELETE); TT_ASSERT(r->count == 1); @@ -434,9 +664,9 @@ static void tt_tnt_net_call(struct tt_test *test) { TT_ASSERT(tnt_flush(&net) > 0); tnt_tuple_free(&args); struct tnt_iter i; - tnt_iter_stream(&i, &net); + tnt_iter_reply(&i, &net); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); TT_ASSERT(r->code == 0); TT_ASSERT(r->op == TNT_OP_CALL); TT_ASSERT(r->count == 1); @@ -452,9 +682,9 @@ static void tt_tnt_net_call_na(struct tt_test *test) { TT_ASSERT(tnt_flush(&net) > 0); tnt_tuple_free(&args); struct tnt_iter i; - tnt_iter_stream(&i, &net); + tnt_iter_reply(&i, &net); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); TT_ASSERT(r->code != 0); TT_ASSERT(strcmp(r->error, "Illegal parameters, tuple field count is 0") == 0); } @@ -726,9 +956,9 @@ static void tt_tnt_sql_ping(struct tt_test *test) { TT_ASSERT(tnt_query(&net, q, sizeof(q) - 1, &e) == 0); TT_ASSERT(tnt_flush(&net) > 0); struct tnt_iter i; - tnt_iter_stream(&i, &net); + tnt_iter_reply(&i, &net); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); TT_ASSERT(r->code == 0); TT_ASSERT(r->op == TNT_OP_PING); } @@ -742,9 +972,9 @@ static void tt_tnt_sql_insert(struct tt_test *test) { TT_ASSERT(tnt_query(&net, q, sizeof(q) - 1, &e) == 0); TT_ASSERT(tnt_flush(&net) > 0); struct tnt_iter i; - tnt_iter_stream(&i, &net); + tnt_iter_reply(&i, &net); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); TT_ASSERT(r->code == 0); TT_ASSERT(r->op == TNT_OP_INSERT); TT_ASSERT(r->count == 1); @@ -777,9 +1007,9 @@ static void tt_tnt_sql_update(struct tt_test *test) { TT_ASSERT(tnt_query(&net, q7, sizeof(q7) - 1, &e) == 0); TT_ASSERT(tnt_flush(&net) > 0); struct tnt_iter i; - tnt_iter_stream(&i, &net); + tnt_iter_reply(&i, &net); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); TT_ASSERT(r->code == 0); TT_ASSERT(r->op == TNT_OP_UPDATE); TT_ASSERT(r->count == 1); @@ -794,9 +1024,9 @@ static void tt_tnt_sql_select(struct tt_test *test) { TT_ASSERT(tnt_query(&net, q, sizeof(q) - 1, &e) == 0); TT_ASSERT(tnt_flush(&net) > 0); struct tnt_iter i; - tnt_iter_stream(&i, &net); + tnt_iter_reply(&i, &net); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); TT_ASSERT(r->code == 0); TT_ASSERT(r->op == TNT_OP_SELECT); TT_ASSERT(r->count == 2); @@ -833,9 +1063,9 @@ static void tt_tnt_sql_select_limit(struct tt_test *test) { TT_ASSERT(tnt_query(&net, q, sizeof(q) - 1, &e) == 0); TT_ASSERT(tnt_flush(&net) > 0); struct tnt_iter i; - tnt_iter_stream(&i, &net); + tnt_iter_reply(&i, &net); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); TT_ASSERT(r->code == 0); TT_ASSERT(r->op == TNT_OP_SELECT); TT_ASSERT(r->count == 0); @@ -850,9 +1080,9 @@ static void tt_tnt_sql_delete(struct tt_test *test) { TT_ASSERT(tnt_query(&net, q, sizeof(q) - 1, &e) == 0); TT_ASSERT(tnt_flush(&net) > 0); struct tnt_iter i; - tnt_iter_stream(&i, &net); + tnt_iter_reply(&i, &net); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); TT_ASSERT(r->code == 0); TT_ASSERT(r->op == TNT_OP_DELETE); TT_ASSERT(r->count == 1); @@ -867,9 +1097,9 @@ static void tt_tnt_sql_call(struct tt_test *test) { TT_ASSERT(tnt_query(&net, q, sizeof(q) - 1, &e) == 0); TT_ASSERT(tnt_flush(&net) > 0); struct tnt_iter i; - tnt_iter_stream(&i, &net); + tnt_iter_reply(&i, &net); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); TT_ASSERT(r->code == 0); TT_ASSERT(r->op == TNT_OP_CALL); TT_ASSERT(r->count == 1); @@ -895,6 +1125,13 @@ main(int argc, char * argv[]) tt_test(&t, "iterator tuple (single field)", tt_tnt_iter11); tt_test(&t, "iterator tuple (tnt_field)", tt_tnt_iter2); tt_test(&t, "iterator list", tt_tnt_iter3); + /* marshaling */ + tt_test(&t, "marshaling ping", tt_tnt_marshal_ping); + tt_test(&t, "marshaling insert", tt_tnt_marshal_insert); + tt_test(&t, "marshaling delete", tt_tnt_marshal_delete); + tt_test(&t, "marshaling call", tt_tnt_marshal_call); + tt_test(&t, "marshaling select", tt_tnt_marshal_select); + tt_test(&t, "marshaling update", tt_tnt_marshal_update); /* common operations */ tt_test(&t, "connect", tt_tnt_net_connect); tt_test(&t, "ping", tt_tnt_net_ping); diff --git a/test/connector_c/update.c b/test/connector_c/update.c index cbeaa002566fea20dcdb8727360b7e06dc8c9d72..4b4f7275ffa10d2e41c972d43d3670cc03414973 100644 --- a/test/connector_c/update.c +++ b/test/connector_c/update.c @@ -310,9 +310,9 @@ void recv_command(char *command) { struct tnt_iter i; - tnt_iter_stream(&i, tnt); + tnt_iter_reply(&i, tnt); while (tnt_next(&i)) { - struct tnt_reply *r = TNT_ISTREAM_REPLY(&i); + struct tnt_reply *r = TNT_IREPLY_PTR(&i); printf("%s: respond %s (op: %"PRIu32", reqid: %"PRIu32", code: %"PRIu32", count: %"PRIu32")\n", command, tnt_strerror(tnt), r->op, diff --git a/test/connector_c/update.test b/test/connector_c/update.test index 75bf1f5986b34f3a3a4aead47b2ec9f2504bb278..a516b6575b219cfbe8d72caf55807c3dd33067bc 100644 --- a/test/connector_c/update.test +++ b/test/connector_c/update.test @@ -1,4 +1,3 @@ -# encoding: tarantool import subprocess import sys import os diff --git a/test/connector_c/xlog.c b/test/connector_c/xlog.c new file mode 100644 index 0000000000000000000000000000000000000000..f615812abd8fe44c5820ab83066691195227a1a6 --- /dev/null +++ b/test/connector_c/xlog.c @@ -0,0 +1,80 @@ + + +/* + * Copyright (C) 2011 Mail.RU + * + * 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 AUTHOR AND CONTRIBUTORS ``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 AUTHOR 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 <stdlib.h> +#include <stdint.h> +#include <inttypes.h> +#include <stdbool.h> +#include <stdio.h> +#include <string.h> + +#include <connector/c/include/tarantool/tnt.h> +#include <connector/c/include/tarantool/tnt_net.h> +#include <connector/c/include/tarantool/tnt_xlog.h> +#include <connector/c/include/tarantool/tnt_rpl.h> + +static char *opname(uint32_t type) { + switch (type) { + case TNT_OP_PING: return "Ping"; + case TNT_OP_INSERT: return "Insert"; + case TNT_OP_DELETE: return "Delete"; + case TNT_OP_UPDATE: return "Update"; + case TNT_OP_SELECT: return "Select"; + case TNT_OP_CALL: return "Call"; + } + return "Unknown"; +} + +int +main(int argc, char * argv[]) +{ + if (argc != 2) + return 1; + + struct tnt_stream s; + tnt_xlog(&s); + + if (tnt_xlog_open(&s, argv[1]) == -1) + return 1; + + struct tnt_iter i; + tnt_iter_request(&i, &s); + + while (tnt_next(&i)) { + struct tnt_stream_xlog *sx = TNT_SXLOG_CAST(&s); + printf("%s lsn: %"PRIu64", time: %f, len: %d\n", + opname(sx->row.op), + sx->hdr.lsn, + sx->hdr.tm, sx->hdr.len); + } + if (i.status == TNT_ITER_FAIL) + printf("parsing failed: %s\n", tnt_xlog_strerror(&s)); + + tnt_iter_free(&i); + tnt_stream_free(&s); + return 0; +} diff --git a/test/connector_c/xlog_rpl.result b/test/connector_c/xlog_rpl.result new file mode 100644 index 0000000000000000000000000000000000000000..890faaeabe641e0f98f7ef2e874ad1a28787dfe9 --- /dev/null +++ b/test/connector_c/xlog_rpl.result @@ -0,0 +1,2401 @@ +Insert lsn: 2, time: 1338903440.187947, len: 68 +Insert lsn: 3, time: 1338903440.190419, len: 68 +Insert lsn: 4, time: 1338903440.190539, len: 68 +Insert lsn: 5, time: 1338903440.190582, len: 68 +Insert lsn: 6, time: 1338903440.190608, len: 68 +Insert lsn: 7, time: 1338903440.190633, len: 68 +Insert lsn: 8, time: 1338903440.190657, len: 68 +Insert lsn: 9, time: 1338903440.190681, len: 68 +Insert lsn: 10, time: 1338903440.190712, len: 68 +Insert lsn: 11, time: 1338903440.190736, len: 68 +Insert lsn: 12, time: 1338903440.190762, len: 69 +Insert lsn: 13, time: 1338903440.190785, len: 69 +Insert lsn: 14, time: 1338903440.190810, len: 69 +Insert lsn: 15, time: 1338903440.190834, len: 69 +Insert lsn: 16, time: 1338903440.190858, len: 69 +Insert lsn: 17, time: 1338903440.190883, len: 69 +Insert lsn: 18, time: 1338903440.190908, len: 69 +Insert lsn: 19, time: 1338903440.190942, len: 69 +Insert lsn: 20, time: 1338903440.190967, len: 69 +Insert lsn: 21, time: 1338903440.190992, len: 69 +Insert lsn: 22, time: 1338903440.191015, len: 69 +Insert lsn: 23, time: 1338903440.191040, len: 69 +Insert lsn: 24, time: 1338903440.191064, len: 69 +Insert lsn: 25, time: 1338903440.191088, len: 69 +Insert lsn: 26, time: 1338903440.191112, len: 69 +Insert lsn: 27, time: 1338903440.191138, len: 69 +Insert lsn: 28, time: 1338903440.191163, len: 69 +Insert lsn: 29, time: 1338903440.191188, len: 69 +Insert lsn: 30, time: 1338903440.191213, len: 69 +Insert lsn: 31, time: 1338903440.191238, len: 69 +Insert lsn: 32, time: 1338903440.191262, len: 69 +Insert lsn: 33, time: 1338903440.191284, len: 69 +Insert lsn: 34, time: 1338903440.191319, len: 69 +Insert lsn: 35, time: 1338903440.191344, len: 69 +Insert lsn: 36, time: 1338903440.191369, len: 69 +Insert lsn: 37, time: 1338903440.191393, len: 69 +Insert lsn: 38, time: 1338903440.191417, len: 69 +Insert lsn: 39, time: 1338903440.191441, len: 69 +Insert lsn: 40, time: 1338903440.191479, len: 69 +Insert lsn: 41, time: 1338903440.191503, len: 69 +Insert lsn: 42, time: 1338903440.191526, len: 69 +Insert lsn: 43, time: 1338903440.191603, len: 69 +Insert lsn: 44, time: 1338903440.191632, len: 69 +Insert lsn: 45, time: 1338903440.191655, len: 69 +Insert lsn: 46, time: 1338903440.191681, len: 69 +Insert lsn: 47, time: 1338903440.191704, len: 69 +Insert lsn: 48, time: 1338903440.191727, len: 69 +Insert lsn: 49, time: 1338903440.191750, len: 69 +Insert lsn: 50, time: 1338903440.191774, len: 69 +Insert lsn: 51, time: 1338903440.191797, len: 69 +Insert lsn: 52, time: 1338903440.191820, len: 69 +Insert lsn: 53, time: 1338903440.191844, len: 69 +Insert lsn: 54, time: 1338903440.191874, len: 69 +Insert lsn: 55, time: 1338903440.191897, len: 69 +Insert lsn: 56, time: 1338903440.191921, len: 69 +Insert lsn: 57, time: 1338903440.191944, len: 69 +Insert lsn: 58, time: 1338903440.191967, len: 69 +Insert lsn: 59, time: 1338903440.191992, len: 69 +Insert lsn: 60, time: 1338903440.192016, len: 69 +Insert lsn: 61, time: 1338903440.192039, len: 69 +Insert lsn: 62, time: 1338903440.192063, len: 69 +Insert lsn: 63, time: 1338903440.192086, len: 69 +Insert lsn: 64, time: 1338903440.192111, len: 69 +Insert lsn: 65, time: 1338903440.192134, len: 69 +Insert lsn: 66, time: 1338903440.192164, len: 69 +Insert lsn: 67, time: 1338903440.192188, len: 69 +Insert lsn: 68, time: 1338903440.192212, len: 69 +Insert lsn: 69, time: 1338903440.192235, len: 69 +Insert lsn: 70, time: 1338903440.192278, len: 69 +Insert lsn: 71, time: 1338903440.192302, len: 69 +Insert lsn: 72, time: 1338903440.192327, len: 69 +Insert lsn: 73, time: 1338903440.192351, len: 69 +Insert lsn: 74, time: 1338903440.192376, len: 69 +Insert lsn: 75, time: 1338903440.192401, len: 69 +Insert lsn: 76, time: 1338903440.192424, len: 69 +Insert lsn: 77, time: 1338903440.192449, len: 69 +Insert lsn: 78, time: 1338903440.192473, len: 69 +Insert lsn: 79, time: 1338903440.192497, len: 69 +Insert lsn: 80, time: 1338903440.192521, len: 69 +Insert lsn: 81, time: 1338903440.192545, len: 69 +Insert lsn: 82, time: 1338903440.192569, len: 69 +Insert lsn: 83, time: 1338903440.192593, len: 69 +Insert lsn: 84, time: 1338903440.192642, len: 69 +Insert lsn: 85, time: 1338903440.192670, len: 69 +Insert lsn: 86, time: 1338903440.192701, len: 69 +Insert lsn: 87, time: 1338903440.192726, len: 69 +Insert lsn: 88, time: 1338903440.192749, len: 69 +Insert lsn: 89, time: 1338903440.192773, len: 69 +Insert lsn: 90, time: 1338903440.192798, len: 69 +Insert lsn: 91, time: 1338903440.192822, len: 69 +Insert lsn: 92, time: 1338903440.192846, len: 69 +Insert lsn: 93, time: 1338903440.192871, len: 69 +Insert lsn: 94, time: 1338903440.192896, len: 69 +Insert lsn: 95, time: 1338903440.192921, len: 69 +Insert lsn: 96, time: 1338903440.192946, len: 69 +Insert lsn: 97, time: 1338903440.192970, len: 69 +Insert lsn: 98, time: 1338903440.192993, len: 69 +Insert lsn: 99, time: 1338903440.193017, len: 69 +Insert lsn: 100, time: 1338903440.193042, len: 69 +Insert lsn: 101, time: 1338903440.193065, len: 69 +Insert lsn: 102, time: 1338903440.193547, len: 100 +Insert lsn: 103, time: 1338903440.207494, len: 100 +Insert lsn: 104, time: 1338903440.207539, len: 100 +Insert lsn: 105, time: 1338903440.207564, len: 100 +Insert lsn: 106, time: 1338903440.207613, len: 100 +Insert lsn: 107, time: 1338903440.207639, len: 100 +Insert lsn: 108, time: 1338903440.207665, len: 100 +Insert lsn: 109, time: 1338903440.207690, len: 100 +Insert lsn: 110, time: 1338903440.207717, len: 100 +Insert lsn: 111, time: 1338903440.207745, len: 100 +Insert lsn: 112, time: 1338903440.207770, len: 101 +Insert lsn: 113, time: 1338903440.207795, len: 101 +Insert lsn: 114, time: 1338903440.207819, len: 101 +Insert lsn: 115, time: 1338903440.207844, len: 101 +Insert lsn: 116, time: 1338903440.207870, len: 101 +Insert lsn: 117, time: 1338903440.207895, len: 101 +Insert lsn: 118, time: 1338903440.207918, len: 101 +Insert lsn: 119, time: 1338903440.207976, len: 101 +Insert lsn: 120, time: 1338903440.208004, len: 101 +Insert lsn: 121, time: 1338903440.208029, len: 101 +Insert lsn: 122, time: 1338903440.208054, len: 101 +Insert lsn: 123, time: 1338903440.208078, len: 101 +Insert lsn: 124, time: 1338903440.208119, len: 101 +Insert lsn: 125, time: 1338903440.208144, len: 101 +Insert lsn: 126, time: 1338903440.208168, len: 101 +Insert lsn: 127, time: 1338903440.208193, len: 101 +Insert lsn: 128, time: 1338903440.208218, len: 101 +Insert lsn: 129, time: 1338903440.208291, len: 101 +Insert lsn: 130, time: 1338903440.208318, len: 101 +Insert lsn: 131, time: 1338903440.208343, len: 101 +Insert lsn: 132, time: 1338903440.208370, len: 101 +Insert lsn: 133, time: 1338903440.208396, len: 101 +Insert lsn: 134, time: 1338903440.208422, len: 101 +Insert lsn: 135, time: 1338903440.208447, len: 101 +Insert lsn: 136, time: 1338903440.208473, len: 101 +Insert lsn: 137, time: 1338903440.208499, len: 101 +Insert lsn: 138, time: 1338903440.208561, len: 101 +Insert lsn: 139, time: 1338903440.208586, len: 101 +Insert lsn: 140, time: 1338903440.208610, len: 101 +Insert lsn: 141, time: 1338903440.208634, len: 101 +Insert lsn: 142, time: 1338903440.208664, len: 101 +Insert lsn: 143, time: 1338903440.208688, len: 101 +Insert lsn: 144, time: 1338903440.208712, len: 101 +Insert lsn: 145, time: 1338903440.208735, len: 101 +Insert lsn: 146, time: 1338903440.208760, len: 101 +Insert lsn: 147, time: 1338903440.208783, len: 101 +Insert lsn: 148, time: 1338903440.208807, len: 101 +Insert lsn: 149, time: 1338903440.208831, len: 101 +Insert lsn: 150, time: 1338903440.208875, len: 101 +Insert lsn: 151, time: 1338903440.208900, len: 101 +Insert lsn: 152, time: 1338903440.208924, len: 101 +Insert lsn: 153, time: 1338903440.208947, len: 101 +Insert lsn: 154, time: 1338903440.208971, len: 101 +Insert lsn: 155, time: 1338903440.208994, len: 101 +Insert lsn: 156, time: 1338903440.209018, len: 101 +Insert lsn: 157, time: 1338903440.209043, len: 101 +Insert lsn: 158, time: 1338903440.209066, len: 101 +Insert lsn: 159, time: 1338903440.209090, len: 101 +Insert lsn: 160, time: 1338903440.209126, len: 101 +Insert lsn: 161, time: 1338903440.209151, len: 101 +Insert lsn: 162, time: 1338903440.209175, len: 101 +Insert lsn: 163, time: 1338903440.209199, len: 101 +Insert lsn: 164, time: 1338903440.209223, len: 101 +Insert lsn: 165, time: 1338903440.209247, len: 101 +Insert lsn: 166, time: 1338903440.209296, len: 101 +Insert lsn: 167, time: 1338903440.209320, len: 101 +Insert lsn: 168, time: 1338903440.209344, len: 101 +Insert lsn: 169, time: 1338903440.209367, len: 101 +Insert lsn: 170, time: 1338903440.209390, len: 101 +Insert lsn: 171, time: 1338903440.209414, len: 101 +Insert lsn: 172, time: 1338903440.209438, len: 101 +Insert lsn: 173, time: 1338903440.209461, len: 101 +Insert lsn: 174, time: 1338903440.209485, len: 101 +Insert lsn: 175, time: 1338903440.209509, len: 101 +Insert lsn: 176, time: 1338903440.209533, len: 101 +Insert lsn: 177, time: 1338903440.209564, len: 101 +Insert lsn: 178, time: 1338903440.209589, len: 101 +Insert lsn: 179, time: 1338903440.209613, len: 101 +Insert lsn: 180, time: 1338903440.209637, len: 101 +Insert lsn: 181, time: 1338903440.209678, len: 101 +Insert lsn: 182, time: 1338903440.209703, len: 101 +Insert lsn: 183, time: 1338903440.209745, len: 101 +Insert lsn: 184, time: 1338903440.209770, len: 101 +Insert lsn: 185, time: 1338903440.209794, len: 101 +Insert lsn: 186, time: 1338903440.209819, len: 101 +Insert lsn: 187, time: 1338903440.209842, len: 101 +Insert lsn: 188, time: 1338903440.209866, len: 101 +Insert lsn: 189, time: 1338903440.209889, len: 101 +Insert lsn: 190, time: 1338903440.209913, len: 101 +Insert lsn: 191, time: 1338903440.209937, len: 101 +Insert lsn: 192, time: 1338903440.209961, len: 101 +Insert lsn: 193, time: 1338903440.209985, len: 101 +Insert lsn: 194, time: 1338903440.210010, len: 101 +Insert lsn: 195, time: 1338903440.210041, len: 101 +Insert lsn: 196, time: 1338903440.210065, len: 101 +Insert lsn: 197, time: 1338903440.210088, len: 101 +Insert lsn: 198, time: 1338903440.210112, len: 101 +Insert lsn: 199, time: 1338903440.210135, len: 101 +Insert lsn: 200, time: 1338903440.210160, len: 101 +Insert lsn: 201, time: 1338903440.210183, len: 101 +Insert lsn: 202, time: 1338903440.210887, len: 166 +Insert lsn: 203, time: 1338903440.213901, len: 166 +Insert lsn: 204, time: 1338903440.213959, len: 166 +Insert lsn: 205, time: 1338903440.213986, len: 166 +Insert lsn: 206, time: 1338903440.214033, len: 166 +Insert lsn: 207, time: 1338903440.214060, len: 166 +Insert lsn: 208, time: 1338903440.214119, len: 166 +Insert lsn: 209, time: 1338903440.214145, len: 166 +Insert lsn: 210, time: 1338903440.214170, len: 166 +Insert lsn: 211, time: 1338903440.214196, len: 166 +Insert lsn: 212, time: 1338903440.214221, len: 167 +Insert lsn: 213, time: 1338903440.214246, len: 167 +Insert lsn: 214, time: 1338903440.214271, len: 167 +Insert lsn: 215, time: 1338903440.214297, len: 167 +Insert lsn: 216, time: 1338903440.214322, len: 167 +Insert lsn: 217, time: 1338903440.214347, len: 167 +Insert lsn: 218, time: 1338903440.214373, len: 167 +Insert lsn: 219, time: 1338903440.214398, len: 167 +Insert lsn: 220, time: 1338903440.214430, len: 167 +Insert lsn: 221, time: 1338903440.214456, len: 167 +Insert lsn: 222, time: 1338903440.214482, len: 167 +Insert lsn: 223, time: 1338903440.214507, len: 167 +Insert lsn: 224, time: 1338903440.214531, len: 167 +Insert lsn: 225, time: 1338903440.214556, len: 167 +Insert lsn: 226, time: 1338903440.214580, len: 167 +Insert lsn: 227, time: 1338903440.214604, len: 167 +Insert lsn: 228, time: 1338903440.214628, len: 167 +Insert lsn: 229, time: 1338903440.214673, len: 167 +Insert lsn: 230, time: 1338903440.214703, len: 167 +Insert lsn: 231, time: 1338903440.214729, len: 167 +Insert lsn: 232, time: 1338903440.214753, len: 167 +Insert lsn: 233, time: 1338903440.214778, len: 167 +Insert lsn: 234, time: 1338903440.214828, len: 167 +Insert lsn: 235, time: 1338903440.214853, len: 167 +Insert lsn: 236, time: 1338903440.214878, len: 167 +Insert lsn: 237, time: 1338903440.214927, len: 167 +Insert lsn: 238, time: 1338903440.214953, len: 167 +Insert lsn: 239, time: 1338903440.214980, len: 167 +Insert lsn: 240, time: 1338903440.215005, len: 167 +Insert lsn: 241, time: 1338903440.215030, len: 167 +Insert lsn: 242, time: 1338903440.215055, len: 167 +Insert lsn: 243, time: 1338903440.215080, len: 167 +Insert lsn: 244, time: 1338903440.215105, len: 167 +Insert lsn: 245, time: 1338903440.215131, len: 167 +Insert lsn: 246, time: 1338903440.215157, len: 167 +Insert lsn: 247, time: 1338903440.215190, len: 167 +Insert lsn: 248, time: 1338903440.215215, len: 167 +Insert lsn: 249, time: 1338903440.215277, len: 167 +Insert lsn: 250, time: 1338903440.215327, len: 167 +Insert lsn: 251, time: 1338903440.215356, len: 167 +Insert lsn: 252, time: 1338903440.215382, len: 167 +Insert lsn: 253, time: 1338903440.215407, len: 167 +Insert lsn: 254, time: 1338903440.215432, len: 167 +Insert lsn: 255, time: 1338903440.215459, len: 167 +Insert lsn: 256, time: 1338903440.215486, len: 167 +Insert lsn: 257, time: 1338903440.215513, len: 167 +Insert lsn: 258, time: 1338903440.215539, len: 167 +Insert lsn: 259, time: 1338903440.215563, len: 167 +Insert lsn: 260, time: 1338903440.215590, len: 167 +Insert lsn: 261, time: 1338903440.215623, len: 167 +Insert lsn: 262, time: 1338903440.215649, len: 167 +Insert lsn: 263, time: 1338903440.215675, len: 167 +Insert lsn: 264, time: 1338903440.215699, len: 167 +Insert lsn: 265, time: 1338903440.215723, len: 167 +Insert lsn: 266, time: 1338903440.215748, len: 167 +Insert lsn: 267, time: 1338903440.215773, len: 167 +Insert lsn: 268, time: 1338903440.215797, len: 167 +Insert lsn: 269, time: 1338903440.215822, len: 167 +Insert lsn: 270, time: 1338903440.215866, len: 167 +Insert lsn: 271, time: 1338903440.215894, len: 167 +Insert lsn: 272, time: 1338903440.215918, len: 167 +Insert lsn: 273, time: 1338903440.215942, len: 167 +Insert lsn: 274, time: 1338903440.215968, len: 167 +Insert lsn: 275, time: 1338903440.216054, len: 167 +Insert lsn: 276, time: 1338903440.216105, len: 167 +Insert lsn: 277, time: 1338903440.216130, len: 167 +Insert lsn: 278, time: 1338903440.216155, len: 167 +Insert lsn: 279, time: 1338903440.216181, len: 167 +Insert lsn: 280, time: 1338903440.216207, len: 167 +Insert lsn: 281, time: 1338903440.216231, len: 167 +Insert lsn: 282, time: 1338903440.216256, len: 167 +Insert lsn: 283, time: 1338903440.216281, len: 167 +Insert lsn: 284, time: 1338903440.216306, len: 167 +Insert lsn: 285, time: 1338903440.216332, len: 167 +Insert lsn: 286, time: 1338903440.216357, len: 167 +Insert lsn: 287, time: 1338903440.216382, len: 167 +Insert lsn: 288, time: 1338903440.216407, len: 167 +Insert lsn: 289, time: 1338903440.216444, len: 167 +Insert lsn: 290, time: 1338903440.216470, len: 167 +Insert lsn: 291, time: 1338903440.216519, len: 167 +Insert lsn: 292, time: 1338903440.216549, len: 167 +Insert lsn: 293, time: 1338903440.216576, len: 167 +Insert lsn: 294, time: 1338903440.216602, len: 167 +Insert lsn: 295, time: 1338903440.216627, len: 167 +Insert lsn: 296, time: 1338903440.216652, len: 167 +Insert lsn: 297, time: 1338903440.216677, len: 167 +Insert lsn: 298, time: 1338903440.216701, len: 167 +Insert lsn: 299, time: 1338903440.216725, len: 167 +Insert lsn: 300, time: 1338903440.216749, len: 167 +Insert lsn: 301, time: 1338903440.216774, len: 167 +Insert lsn: 302, time: 1338903440.217291, len: 68 +Insert lsn: 303, time: 1338903440.217376, len: 68 +Insert lsn: 304, time: 1338903440.217406, len: 68 +Insert lsn: 305, time: 1338903440.217431, len: 68 +Insert lsn: 306, time: 1338903440.217458, len: 68 +Insert lsn: 307, time: 1338903440.217483, len: 68 +Insert lsn: 308, time: 1338903440.217508, len: 68 +Insert lsn: 309, time: 1338903440.217533, len: 68 +Insert lsn: 310, time: 1338903440.217565, len: 68 +Insert lsn: 311, time: 1338903440.217591, len: 68 +Insert lsn: 312, time: 1338903440.217618, len: 69 +Insert lsn: 313, time: 1338903440.217644, len: 69 +Insert lsn: 314, time: 1338903440.217670, len: 69 +Insert lsn: 315, time: 1338903440.217697, len: 69 +Insert lsn: 316, time: 1338903440.217722, len: 69 +Insert lsn: 317, time: 1338903440.217749, len: 69 +Insert lsn: 318, time: 1338903440.217776, len: 69 +Insert lsn: 319, time: 1338903440.217801, len: 69 +Insert lsn: 320, time: 1338903440.217865, len: 69 +Insert lsn: 321, time: 1338903440.217896, len: 69 +Insert lsn: 322, time: 1338903440.217923, len: 69 +Insert lsn: 323, time: 1338903440.217949, len: 69 +Insert lsn: 324, time: 1338903440.217974, len: 69 +Insert lsn: 325, time: 1338903440.218000, len: 69 +Insert lsn: 326, time: 1338903440.218045, len: 69 +Insert lsn: 327, time: 1338903440.218071, len: 69 +Insert lsn: 328, time: 1338903440.218097, len: 69 +Insert lsn: 329, time: 1338903440.218124, len: 69 +Insert lsn: 330, time: 1338903440.218150, len: 69 +Insert lsn: 331, time: 1338903440.218176, len: 69 +Insert lsn: 332, time: 1338903440.218203, len: 69 +Insert lsn: 333, time: 1338903440.218246, len: 69 +Insert lsn: 334, time: 1338903440.218277, len: 69 +Insert lsn: 335, time: 1338903440.218303, len: 69 +Insert lsn: 336, time: 1338903440.218329, len: 69 +Insert lsn: 337, time: 1338903440.218354, len: 69 +Insert lsn: 338, time: 1338903440.218380, len: 69 +Insert lsn: 339, time: 1338903440.218406, len: 69 +Insert lsn: 340, time: 1338903440.218431, len: 69 +Insert lsn: 341, time: 1338903440.218456, len: 69 +Insert lsn: 342, time: 1338903440.218491, len: 69 +Insert lsn: 343, time: 1338903440.218516, len: 69 +Insert lsn: 344, time: 1338903440.218542, len: 69 +Insert lsn: 345, time: 1338903440.218567, len: 69 +Insert lsn: 346, time: 1338903440.218592, len: 69 +Insert lsn: 347, time: 1338903440.218617, len: 69 +Insert lsn: 348, time: 1338903440.218643, len: 69 +Insert lsn: 349, time: 1338903440.218669, len: 69 +Insert lsn: 350, time: 1338903440.218695, len: 69 +Insert lsn: 351, time: 1338903440.218721, len: 69 +Insert lsn: 352, time: 1338903440.218748, len: 69 +Insert lsn: 353, time: 1338903440.218773, len: 69 +Insert lsn: 354, time: 1338903440.218798, len: 69 +Insert lsn: 355, time: 1338903440.218824, len: 69 +Insert lsn: 356, time: 1338903440.218851, len: 69 +Insert lsn: 357, time: 1338903440.218877, len: 69 +Insert lsn: 358, time: 1338903440.218915, len: 69 +Insert lsn: 359, time: 1338903440.218943, len: 69 +Insert lsn: 360, time: 1338903440.218969, len: 69 +Insert lsn: 361, time: 1338903440.219052, len: 69 +Insert lsn: 362, time: 1338903440.219089, len: 69 +Insert lsn: 363, time: 1338903440.219114, len: 69 +Insert lsn: 364, time: 1338903440.219139, len: 69 +Insert lsn: 365, time: 1338903440.219164, len: 69 +Insert lsn: 366, time: 1338903440.219190, len: 69 +Insert lsn: 367, time: 1338903440.219216, len: 69 +Insert lsn: 368, time: 1338903440.219241, len: 69 +Insert lsn: 369, time: 1338903440.219266, len: 69 +Insert lsn: 370, time: 1338903440.219291, len: 69 +Insert lsn: 371, time: 1338903440.219316, len: 69 +Insert lsn: 372, time: 1338903440.219342, len: 69 +Insert lsn: 373, time: 1338903440.219367, len: 69 +Insert lsn: 374, time: 1338903440.219391, len: 69 +Insert lsn: 375, time: 1338903440.219422, len: 69 +Insert lsn: 376, time: 1338903440.219448, len: 69 +Insert lsn: 377, time: 1338903440.219478, len: 69 +Insert lsn: 378, time: 1338903440.219503, len: 69 +Insert lsn: 379, time: 1338903440.219528, len: 69 +Insert lsn: 380, time: 1338903440.219552, len: 69 +Insert lsn: 381, time: 1338903440.219577, len: 69 +Insert lsn: 382, time: 1338903440.219601, len: 69 +Insert lsn: 383, time: 1338903440.219625, len: 69 +Insert lsn: 384, time: 1338903440.219650, len: 69 +Insert lsn: 385, time: 1338903440.219675, len: 69 +Insert lsn: 386, time: 1338903440.219700, len: 69 +Insert lsn: 387, time: 1338903440.219725, len: 69 +Insert lsn: 388, time: 1338903440.219749, len: 69 +Insert lsn: 389, time: 1338903440.219774, len: 69 +Insert lsn: 390, time: 1338903440.219798, len: 69 +Insert lsn: 391, time: 1338903440.219823, len: 69 +Insert lsn: 392, time: 1338903440.219847, len: 69 +Insert lsn: 393, time: 1338903440.219882, len: 69 +Insert lsn: 394, time: 1338903440.219907, len: 69 +Insert lsn: 395, time: 1338903440.219932, len: 69 +Insert lsn: 396, time: 1338903440.219957, len: 69 +Insert lsn: 397, time: 1338903440.219981, len: 69 +Insert lsn: 398, time: 1338903440.220006, len: 69 +Insert lsn: 399, time: 1338903440.220031, len: 69 +Insert lsn: 400, time: 1338903440.220055, len: 69 +Insert lsn: 401, time: 1338903440.220099, len: 69 +Insert lsn: 402, time: 1338903440.220698, len: 100 +Insert lsn: 403, time: 1338903440.220780, len: 100 +Insert lsn: 404, time: 1338903440.220809, len: 100 +Insert lsn: 405, time: 1338903440.220836, len: 100 +Insert lsn: 406, time: 1338903440.220861, len: 100 +Insert lsn: 407, time: 1338903440.220887, len: 100 +Insert lsn: 408, time: 1338903440.220913, len: 100 +Insert lsn: 409, time: 1338903440.220939, len: 100 +Insert lsn: 410, time: 1338903440.220966, len: 100 +Insert lsn: 411, time: 1338903440.220993, len: 100 +Insert lsn: 412, time: 1338903440.221020, len: 101 +Insert lsn: 413, time: 1338903440.221047, len: 101 +Insert lsn: 414, time: 1338903440.221074, len: 101 +Insert lsn: 415, time: 1338903440.221101, len: 101 +Insert lsn: 416, time: 1338903440.221127, len: 101 +Insert lsn: 417, time: 1338903440.221155, len: 101 +Insert lsn: 418, time: 1338903440.221181, len: 101 +Insert lsn: 419, time: 1338903440.221207, len: 101 +Insert lsn: 420, time: 1338903440.221233, len: 101 +Insert lsn: 421, time: 1338903440.221260, len: 101 +Insert lsn: 422, time: 1338903440.221287, len: 101 +Insert lsn: 423, time: 1338903440.221313, len: 101 +Insert lsn: 424, time: 1338903440.221339, len: 101 +Insert lsn: 425, time: 1338903440.221366, len: 101 +Insert lsn: 426, time: 1338903440.221393, len: 101 +Insert lsn: 427, time: 1338903440.221418, len: 101 +Insert lsn: 428, time: 1338903440.221443, len: 101 +Insert lsn: 429, time: 1338903440.221468, len: 101 +Insert lsn: 430, time: 1338903440.221493, len: 101 +Insert lsn: 431, time: 1338903440.221518, len: 101 +Insert lsn: 432, time: 1338903440.221605, len: 101 +Insert lsn: 433, time: 1338903440.221638, len: 101 +Insert lsn: 434, time: 1338903440.221663, len: 101 +Insert lsn: 435, time: 1338903440.221688, len: 101 +Insert lsn: 436, time: 1338903440.221714, len: 101 +Insert lsn: 437, time: 1338903440.221739, len: 101 +Insert lsn: 438, time: 1338903440.221764, len: 101 +Insert lsn: 439, time: 1338903440.221788, len: 101 +Insert lsn: 440, time: 1338903440.221814, len: 101 +Insert lsn: 441, time: 1338903440.221840, len: 101 +Insert lsn: 442, time: 1338903440.221865, len: 101 +Insert lsn: 443, time: 1338903440.221889, len: 101 +Insert lsn: 444, time: 1338903440.221914, len: 101 +Insert lsn: 445, time: 1338903440.221939, len: 101 +Insert lsn: 446, time: 1338903440.221964, len: 101 +Insert lsn: 447, time: 1338903440.221988, len: 101 +Insert lsn: 448, time: 1338903440.222013, len: 101 +Insert lsn: 449, time: 1338903440.222038, len: 101 +Insert lsn: 450, time: 1338903440.222062, len: 101 +Insert lsn: 451, time: 1338903440.222087, len: 101 +Insert lsn: 452, time: 1338903440.222111, len: 101 +Insert lsn: 453, time: 1338903440.222136, len: 101 +Insert lsn: 454, time: 1338903440.222160, len: 101 +Insert lsn: 455, time: 1338903440.222184, len: 101 +Insert lsn: 456, time: 1338903440.222211, len: 101 +Insert lsn: 457, time: 1338903440.222237, len: 101 +Insert lsn: 458, time: 1338903440.222264, len: 101 +Insert lsn: 459, time: 1338903440.222289, len: 101 +Insert lsn: 460, time: 1338903440.222314, len: 101 +Insert lsn: 461, time: 1338903440.222339, len: 101 +Insert lsn: 462, time: 1338903440.222366, len: 101 +Insert lsn: 463, time: 1338903440.222422, len: 101 +Insert lsn: 464, time: 1338903440.222450, len: 101 +Insert lsn: 465, time: 1338903440.222475, len: 101 +Insert lsn: 466, time: 1338903440.222500, len: 101 +Insert lsn: 467, time: 1338903440.222526, len: 101 +Insert lsn: 468, time: 1338903440.222562, len: 101 +Insert lsn: 469, time: 1338903440.222588, len: 101 +Insert lsn: 470, time: 1338903440.222614, len: 101 +Insert lsn: 471, time: 1338903440.222639, len: 101 +Insert lsn: 472, time: 1338903440.222664, len: 101 +Insert lsn: 473, time: 1338903440.222691, len: 101 +Insert lsn: 474, time: 1338903440.222717, len: 101 +Insert lsn: 475, time: 1338903440.222742, len: 101 +Insert lsn: 476, time: 1338903440.222767, len: 101 +Insert lsn: 477, time: 1338903440.222800, len: 101 +Insert lsn: 478, time: 1338903440.222826, len: 101 +Insert lsn: 479, time: 1338903440.222851, len: 101 +Insert lsn: 480, time: 1338903440.222876, len: 101 +Insert lsn: 481, time: 1338903440.222901, len: 101 +Insert lsn: 482, time: 1338903440.222926, len: 101 +Insert lsn: 483, time: 1338903440.222951, len: 101 +Insert lsn: 484, time: 1338903440.222976, len: 101 +Insert lsn: 485, time: 1338903440.223000, len: 101 +Insert lsn: 486, time: 1338903440.223025, len: 101 +Insert lsn: 487, time: 1338903440.223049, len: 101 +Insert lsn: 488, time: 1338903440.223074, len: 101 +Insert lsn: 489, time: 1338903440.223100, len: 101 +Insert lsn: 490, time: 1338903440.223125, len: 101 +Insert lsn: 491, time: 1338903440.223149, len: 101 +Insert lsn: 492, time: 1338903440.223174, len: 101 +Insert lsn: 493, time: 1338903440.223199, len: 101 +Insert lsn: 494, time: 1338903440.223256, len: 101 +Insert lsn: 495, time: 1338903440.223284, len: 101 +Insert lsn: 496, time: 1338903440.223311, len: 101 +Insert lsn: 497, time: 1338903440.223336, len: 101 +Insert lsn: 498, time: 1338903440.223361, len: 101 +Insert lsn: 499, time: 1338903440.223386, len: 101 +Insert lsn: 500, time: 1338903440.223410, len: 101 +Insert lsn: 501, time: 1338903440.223435, len: 101 +Insert lsn: 502, time: 1338903440.224114, len: 166 +Insert lsn: 503, time: 1338903440.224227, len: 166 +Insert lsn: 504, time: 1338903440.224259, len: 166 +Insert lsn: 505, time: 1338903440.224284, len: 166 +Insert lsn: 506, time: 1338903440.224311, len: 166 +Insert lsn: 507, time: 1338903440.224339, len: 166 +Insert lsn: 508, time: 1338903440.224365, len: 166 +Insert lsn: 509, time: 1338903440.224391, len: 166 +Insert lsn: 510, time: 1338903440.224418, len: 166 +Insert lsn: 511, time: 1338903440.224444, len: 166 +Insert lsn: 512, time: 1338903440.224471, len: 167 +Insert lsn: 513, time: 1338903440.224497, len: 167 +Insert lsn: 514, time: 1338903440.224523, len: 167 +Insert lsn: 515, time: 1338903440.224550, len: 167 +Insert lsn: 516, time: 1338903440.224576, len: 167 +Insert lsn: 517, time: 1338903440.224639, len: 167 +Insert lsn: 518, time: 1338903440.224671, len: 167 +Insert lsn: 519, time: 1338903440.224698, len: 167 +Insert lsn: 520, time: 1338903440.224725, len: 167 +Insert lsn: 521, time: 1338903440.224753, len: 167 +Insert lsn: 522, time: 1338903440.224780, len: 167 +Insert lsn: 523, time: 1338903440.224806, len: 167 +Insert lsn: 524, time: 1338903440.224833, len: 167 +Insert lsn: 525, time: 1338903440.224860, len: 167 +Insert lsn: 526, time: 1338903440.224888, len: 167 +Insert lsn: 527, time: 1338903440.224938, len: 167 +Insert lsn: 528, time: 1338903440.224967, len: 167 +Insert lsn: 529, time: 1338903440.224994, len: 167 +Insert lsn: 530, time: 1338903440.225020, len: 167 +Insert lsn: 531, time: 1338903440.225047, len: 167 +Insert lsn: 532, time: 1338903440.225073, len: 167 +Insert lsn: 533, time: 1338903440.225100, len: 167 +Insert lsn: 534, time: 1338903440.225126, len: 167 +Insert lsn: 535, time: 1338903440.225152, len: 167 +Insert lsn: 536, time: 1338903440.225180, len: 167 +Insert lsn: 537, time: 1338903440.225206, len: 167 +Insert lsn: 538, time: 1338903440.225260, len: 167 +Insert lsn: 539, time: 1338903440.225290, len: 167 +Insert lsn: 540, time: 1338903440.225316, len: 167 +Insert lsn: 541, time: 1338903440.225343, len: 167 +Insert lsn: 542, time: 1338903440.225369, len: 167 +Insert lsn: 543, time: 1338903440.225395, len: 167 +Insert lsn: 544, time: 1338903440.225421, len: 167 +Insert lsn: 545, time: 1338903440.225448, len: 167 +Insert lsn: 546, time: 1338903440.225474, len: 167 +Insert lsn: 547, time: 1338903440.225500, len: 167 +Insert lsn: 548, time: 1338903440.225527, len: 167 +Insert lsn: 549, time: 1338903440.225554, len: 167 +Insert lsn: 550, time: 1338903440.225580, len: 167 +Insert lsn: 551, time: 1338903440.225605, len: 167 +Insert lsn: 552, time: 1338903440.225631, len: 167 +Insert lsn: 553, time: 1338903440.225658, len: 167 +Insert lsn: 554, time: 1338903440.225685, len: 167 +Insert lsn: 555, time: 1338903440.225711, len: 167 +Insert lsn: 556, time: 1338903440.225738, len: 167 +Insert lsn: 557, time: 1338903440.225765, len: 167 +Insert lsn: 558, time: 1338903440.225792, len: 167 +Insert lsn: 559, time: 1338903440.225836, len: 167 +Insert lsn: 560, time: 1338903440.225865, len: 167 +Insert lsn: 561, time: 1338903440.225892, len: 167 +Insert lsn: 562, time: 1338903440.225919, len: 167 +Insert lsn: 563, time: 1338903440.225945, len: 167 +Insert lsn: 564, time: 1338903440.225971, len: 167 +Insert lsn: 565, time: 1338903440.225997, len: 167 +Insert lsn: 566, time: 1338903440.226024, len: 167 +Insert lsn: 567, time: 1338903440.226051, len: 167 +Insert lsn: 568, time: 1338903440.226080, len: 167 +Insert lsn: 569, time: 1338903440.226107, len: 167 +Insert lsn: 570, time: 1338903440.226134, len: 167 +Insert lsn: 571, time: 1338903440.226162, len: 167 +Insert lsn: 572, time: 1338903440.226190, len: 167 +Insert lsn: 573, time: 1338903440.226217, len: 167 +Insert lsn: 574, time: 1338903440.226244, len: 167 +Insert lsn: 575, time: 1338903440.226271, len: 167 +Insert lsn: 576, time: 1338903440.226296, len: 167 +Insert lsn: 577, time: 1338903440.226322, len: 167 +Insert lsn: 578, time: 1338903440.226348, len: 167 +Insert lsn: 579, time: 1338903440.226392, len: 167 +Insert lsn: 580, time: 1338903440.226420, len: 167 +Insert lsn: 581, time: 1338903440.226446, len: 167 +Insert lsn: 582, time: 1338903440.226471, len: 167 +Insert lsn: 583, time: 1338903440.226496, len: 167 +Insert lsn: 584, time: 1338903440.226521, len: 167 +Insert lsn: 585, time: 1338903440.226546, len: 167 +Insert lsn: 586, time: 1338903440.226571, len: 167 +Insert lsn: 587, time: 1338903440.226596, len: 167 +Insert lsn: 588, time: 1338903440.226622, len: 167 +Insert lsn: 589, time: 1338903440.226648, len: 167 +Insert lsn: 590, time: 1338903440.226674, len: 167 +Insert lsn: 591, time: 1338903440.226699, len: 167 +Insert lsn: 592, time: 1338903440.226724, len: 167 +Insert lsn: 593, time: 1338903440.226749, len: 167 +Insert lsn: 594, time: 1338903440.226774, len: 167 +Insert lsn: 595, time: 1338903440.226799, len: 167 +Insert lsn: 596, time: 1338903440.226825, len: 167 +Insert lsn: 597, time: 1338903440.226850, len: 167 +Insert lsn: 598, time: 1338903440.226882, len: 167 +Insert lsn: 599, time: 1338903440.226907, len: 167 +Insert lsn: 600, time: 1338903440.226949, len: 167 +Insert lsn: 601, time: 1338903440.226978, len: 167 +Update lsn: 602, time: 1338903440.227788, len: 77 +Update lsn: 603, time: 1338903440.227901, len: 77 +Update lsn: 604, time: 1338903440.227932, len: 77 +Update lsn: 605, time: 1338903440.227961, len: 77 +Update lsn: 606, time: 1338903440.227988, len: 77 +Update lsn: 607, time: 1338903440.228014, len: 77 +Update lsn: 608, time: 1338903440.228041, len: 77 +Update lsn: 609, time: 1338903440.228069, len: 77 +Update lsn: 610, time: 1338903440.228096, len: 77 +Update lsn: 611, time: 1338903440.228123, len: 77 +Update lsn: 612, time: 1338903440.228150, len: 78 +Update lsn: 613, time: 1338903440.228177, len: 78 +Update lsn: 614, time: 1338903440.228204, len: 78 +Update lsn: 615, time: 1338903440.228250, len: 78 +Update lsn: 616, time: 1338903440.228283, len: 78 +Update lsn: 617, time: 1338903440.228311, len: 78 +Update lsn: 618, time: 1338903440.228338, len: 78 +Update lsn: 619, time: 1338903440.228365, len: 78 +Update lsn: 620, time: 1338903440.228393, len: 78 +Update lsn: 621, time: 1338903440.228421, len: 78 +Update lsn: 622, time: 1338903440.228448, len: 78 +Update lsn: 623, time: 1338903440.228475, len: 78 +Update lsn: 624, time: 1338903440.228502, len: 78 +Update lsn: 625, time: 1338903440.228530, len: 78 +Update lsn: 626, time: 1338903440.228556, len: 78 +Update lsn: 627, time: 1338903440.228583, len: 78 +Update lsn: 628, time: 1338903440.228611, len: 78 +Update lsn: 629, time: 1338903440.228639, len: 78 +Update lsn: 630, time: 1338903440.228668, len: 78 +Update lsn: 631, time: 1338903440.228695, len: 78 +Update lsn: 632, time: 1338903440.228723, len: 78 +Update lsn: 633, time: 1338903440.228751, len: 78 +Update lsn: 634, time: 1338903440.228778, len: 78 +Update lsn: 635, time: 1338903440.228838, len: 78 +Update lsn: 636, time: 1338903440.228867, len: 78 +Update lsn: 637, time: 1338903440.228892, len: 78 +Update lsn: 638, time: 1338903440.228918, len: 78 +Update lsn: 639, time: 1338903440.228944, len: 78 +Update lsn: 640, time: 1338903440.228969, len: 78 +Update lsn: 641, time: 1338903440.228995, len: 78 +Update lsn: 642, time: 1338903440.229021, len: 78 +Update lsn: 643, time: 1338903440.229047, len: 78 +Update lsn: 644, time: 1338903440.229073, len: 78 +Update lsn: 645, time: 1338903440.229099, len: 78 +Update lsn: 646, time: 1338903440.229125, len: 78 +Update lsn: 647, time: 1338903440.229150, len: 78 +Update lsn: 648, time: 1338903440.229176, len: 78 +Update lsn: 649, time: 1338903440.229201, len: 78 +Update lsn: 650, time: 1338903440.229228, len: 78 +Update lsn: 651, time: 1338903440.229254, len: 78 +Update lsn: 652, time: 1338903440.229281, len: 78 +Update lsn: 653, time: 1338903440.229307, len: 78 +Update lsn: 654, time: 1338903440.229333, len: 78 +Update lsn: 655, time: 1338903440.229360, len: 78 +Update lsn: 656, time: 1338903440.229386, len: 78 +Update lsn: 657, time: 1338903440.229412, len: 78 +Update lsn: 658, time: 1338903440.229439, len: 78 +Update lsn: 659, time: 1338903440.229465, len: 78 +Update lsn: 660, time: 1338903440.229491, len: 78 +Update lsn: 661, time: 1338903440.229517, len: 78 +Update lsn: 662, time: 1338903440.229544, len: 78 +Update lsn: 663, time: 1338903440.229584, len: 78 +Update lsn: 664, time: 1338903440.229612, len: 78 +Update lsn: 665, time: 1338903440.229639, len: 78 +Update lsn: 666, time: 1338903440.229666, len: 78 +Update lsn: 667, time: 1338903440.229694, len: 78 +Update lsn: 668, time: 1338903440.229723, len: 78 +Update lsn: 669, time: 1338903440.229752, len: 78 +Update lsn: 670, time: 1338903440.229779, len: 78 +Update lsn: 671, time: 1338903440.229808, len: 78 +Update lsn: 672, time: 1338903440.229862, len: 78 +Update lsn: 673, time: 1338903440.229892, len: 78 +Update lsn: 674, time: 1338903440.229933, len: 78 +Update lsn: 675, time: 1338903440.229961, len: 78 +Update lsn: 676, time: 1338903440.229988, len: 78 +Update lsn: 677, time: 1338903440.230015, len: 78 +Update lsn: 678, time: 1338903440.230042, len: 78 +Update lsn: 679, time: 1338903440.230069, len: 78 +Update lsn: 680, time: 1338903440.230096, len: 78 +Update lsn: 681, time: 1338903440.230124, len: 78 +Update lsn: 682, time: 1338903440.230153, len: 78 +Update lsn: 683, time: 1338903440.230180, len: 78 +Update lsn: 684, time: 1338903440.230210, len: 78 +Update lsn: 685, time: 1338903440.230248, len: 78 +Update lsn: 686, time: 1338903440.230274, len: 78 +Update lsn: 687, time: 1338903440.230300, len: 78 +Update lsn: 688, time: 1338903440.230326, len: 78 +Update lsn: 689, time: 1338903440.230352, len: 78 +Update lsn: 690, time: 1338903440.230380, len: 78 +Update lsn: 691, time: 1338903440.230408, len: 78 +Update lsn: 692, time: 1338903440.230434, len: 78 +Update lsn: 693, time: 1338903440.230462, len: 78 +Update lsn: 694, time: 1338903440.230488, len: 78 +Update lsn: 695, time: 1338903440.230515, len: 78 +Update lsn: 696, time: 1338903440.230541, len: 78 +Update lsn: 697, time: 1338903440.230567, len: 78 +Update lsn: 698, time: 1338903440.230593, len: 78 +Update lsn: 699, time: 1338903440.230619, len: 78 +Update lsn: 700, time: 1338903440.230645, len: 78 +Update lsn: 701, time: 1338903440.230670, len: 78 +Update lsn: 702, time: 1338903440.231167, len: 109 +Update lsn: 703, time: 1338903440.231248, len: 109 +Update lsn: 704, time: 1338903440.231279, len: 109 +Update lsn: 705, time: 1338903440.231308, len: 109 +Update lsn: 706, time: 1338903440.231335, len: 109 +Update lsn: 707, time: 1338903440.231362, len: 109 +Update lsn: 708, time: 1338903440.231420, len: 109 +Update lsn: 709, time: 1338903440.231452, len: 109 +Update lsn: 710, time: 1338903440.231482, len: 109 +Update lsn: 711, time: 1338903440.231512, len: 109 +Update lsn: 712, time: 1338903440.231540, len: 110 +Update lsn: 713, time: 1338903440.231589, len: 110 +Update lsn: 714, time: 1338903440.231620, len: 110 +Update lsn: 715, time: 1338903440.231647, len: 110 +Update lsn: 716, time: 1338903440.231674, len: 110 +Update lsn: 717, time: 1338903440.231703, len: 110 +Update lsn: 718, time: 1338903440.231731, len: 110 +Update lsn: 719, time: 1338903440.231761, len: 110 +Update lsn: 720, time: 1338903440.231789, len: 110 +Update lsn: 721, time: 1338903440.231818, len: 110 +Update lsn: 722, time: 1338903440.231847, len: 110 +Update lsn: 723, time: 1338903440.231874, len: 110 +Update lsn: 724, time: 1338903440.231900, len: 110 +Update lsn: 725, time: 1338903440.231927, len: 110 +Update lsn: 726, time: 1338903440.231954, len: 110 +Update lsn: 727, time: 1338903440.231981, len: 110 +Update lsn: 728, time: 1338903440.232007, len: 110 +Update lsn: 729, time: 1338903440.232034, len: 110 +Update lsn: 730, time: 1338903440.232061, len: 110 +Update lsn: 731, time: 1338903440.232088, len: 110 +Update lsn: 732, time: 1338903440.232114, len: 110 +Update lsn: 733, time: 1338903440.232140, len: 110 +Update lsn: 734, time: 1338903440.232166, len: 110 +Update lsn: 735, time: 1338903440.232192, len: 110 +Update lsn: 736, time: 1338903440.232217, len: 110 +Update lsn: 737, time: 1338903440.232270, len: 110 +Update lsn: 738, time: 1338903440.232300, len: 110 +Update lsn: 739, time: 1338903440.232326, len: 110 +Update lsn: 740, time: 1338903440.232352, len: 110 +Update lsn: 741, time: 1338903440.232377, len: 110 +Update lsn: 742, time: 1338903440.232403, len: 110 +Update lsn: 743, time: 1338903440.232429, len: 110 +Update lsn: 744, time: 1338903440.232456, len: 110 +Update lsn: 745, time: 1338903440.232483, len: 110 +Update lsn: 746, time: 1338903440.232509, len: 110 +Update lsn: 747, time: 1338903440.232537, len: 110 +Update lsn: 748, time: 1338903440.232564, len: 110 +Update lsn: 749, time: 1338903440.232590, len: 110 +Update lsn: 750, time: 1338903440.232617, len: 110 +Update lsn: 751, time: 1338903440.232643, len: 110 +Update lsn: 752, time: 1338903440.232670, len: 110 +Update lsn: 753, time: 1338903440.232697, len: 110 +Update lsn: 754, time: 1338903440.232724, len: 110 +Update lsn: 755, time: 1338903440.232750, len: 110 +Update lsn: 756, time: 1338903440.232777, len: 110 +Update lsn: 757, time: 1338903440.232803, len: 110 +Update lsn: 758, time: 1338903440.232829, len: 110 +Update lsn: 759, time: 1338903440.232856, len: 110 +Update lsn: 760, time: 1338903440.232883, len: 110 +Update lsn: 761, time: 1338903440.232909, len: 110 +Update lsn: 762, time: 1338903440.232936, len: 110 +Update lsn: 763, time: 1338903440.232962, len: 110 +Update lsn: 764, time: 1338903440.232989, len: 110 +Update lsn: 765, time: 1338903440.233016, len: 110 +Update lsn: 766, time: 1338903440.233063, len: 110 +Update lsn: 767, time: 1338903440.233091, len: 110 +Update lsn: 768, time: 1338903440.233117, len: 110 +Update lsn: 769, time: 1338903440.233144, len: 110 +Update lsn: 770, time: 1338903440.233170, len: 110 +Update lsn: 771, time: 1338903440.233196, len: 110 +Update lsn: 772, time: 1338903440.233221, len: 110 +Update lsn: 773, time: 1338903440.233247, len: 110 +Update lsn: 774, time: 1338903440.233274, len: 110 +Update lsn: 775, time: 1338903440.233300, len: 110 +Update lsn: 776, time: 1338903440.233327, len: 110 +Update lsn: 777, time: 1338903440.233354, len: 110 +Update lsn: 778, time: 1338903440.233381, len: 110 +Update lsn: 779, time: 1338903440.233407, len: 110 +Update lsn: 780, time: 1338903440.233434, len: 110 +Update lsn: 781, time: 1338903440.233461, len: 110 +Update lsn: 782, time: 1338903440.233488, len: 110 +Update lsn: 783, time: 1338903440.233515, len: 110 +Update lsn: 784, time: 1338903440.233542, len: 110 +Update lsn: 785, time: 1338903440.233568, len: 110 +Update lsn: 786, time: 1338903440.233595, len: 110 +Update lsn: 787, time: 1338903440.233622, len: 110 +Update lsn: 788, time: 1338903440.233649, len: 110 +Update lsn: 789, time: 1338903440.233677, len: 110 +Update lsn: 790, time: 1338903440.233704, len: 110 +Update lsn: 791, time: 1338903440.233730, len: 110 +Update lsn: 792, time: 1338903440.233757, len: 110 +Update lsn: 793, time: 1338903440.233784, len: 110 +Update lsn: 794, time: 1338903440.233827, len: 110 +Update lsn: 795, time: 1338903440.233855, len: 110 +Update lsn: 796, time: 1338903440.233882, len: 110 +Update lsn: 797, time: 1338903440.233909, len: 110 +Update lsn: 798, time: 1338903440.233936, len: 110 +Update lsn: 799, time: 1338903440.233963, len: 110 +Update lsn: 800, time: 1338903440.233989, len: 110 +Update lsn: 801, time: 1338903440.234015, len: 110 +Update lsn: 802, time: 1338903440.234573, len: 175 +Update lsn: 803, time: 1338903440.234678, len: 175 +Update lsn: 804, time: 1338903440.234710, len: 175 +Update lsn: 805, time: 1338903440.234738, len: 175 +Update lsn: 806, time: 1338903440.234767, len: 175 +Update lsn: 807, time: 1338903440.234796, len: 175 +Update lsn: 808, time: 1338903440.234823, len: 175 +Update lsn: 809, time: 1338903440.234851, len: 175 +Update lsn: 810, time: 1338903440.234878, len: 175 +Update lsn: 811, time: 1338903440.234923, len: 175 +Update lsn: 812, time: 1338903440.234954, len: 176 +Update lsn: 813, time: 1338903440.234984, len: 176 +Update lsn: 814, time: 1338903440.235012, len: 176 +Update lsn: 815, time: 1338903440.235040, len: 176 +Update lsn: 816, time: 1338903440.235068, len: 176 +Update lsn: 817, time: 1338903440.235132, len: 176 +Update lsn: 818, time: 1338903440.235167, len: 176 +Update lsn: 819, time: 1338903440.235196, len: 176 +Update lsn: 820, time: 1338903440.235224, len: 176 +Update lsn: 821, time: 1338903440.235254, len: 176 +Update lsn: 822, time: 1338903440.235282, len: 176 +Update lsn: 823, time: 1338903440.235310, len: 176 +Update lsn: 824, time: 1338903440.235339, len: 176 +Update lsn: 825, time: 1338903440.235368, len: 176 +Update lsn: 826, time: 1338903440.235395, len: 176 +Update lsn: 827, time: 1338903440.235422, len: 176 +Update lsn: 828, time: 1338903440.235449, len: 176 +Update lsn: 829, time: 1338903440.235476, len: 176 +Update lsn: 830, time: 1338903440.235503, len: 176 +Update lsn: 831, time: 1338903440.235530, len: 176 +Update lsn: 832, time: 1338903440.235556, len: 176 +Update lsn: 833, time: 1338903440.235583, len: 176 +Update lsn: 834, time: 1338903440.235609, len: 176 +Update lsn: 835, time: 1338903440.235635, len: 176 +Update lsn: 836, time: 1338903440.235682, len: 176 +Update lsn: 837, time: 1338903440.235711, len: 176 +Update lsn: 838, time: 1338903440.235738, len: 176 +Update lsn: 839, time: 1338903440.235764, len: 176 +Update lsn: 840, time: 1338903440.235790, len: 176 +Update lsn: 841, time: 1338903440.235817, len: 176 +Update lsn: 842, time: 1338903440.235843, len: 176 +Update lsn: 843, time: 1338903440.235869, len: 176 +Update lsn: 844, time: 1338903440.235896, len: 176 +Update lsn: 845, time: 1338903440.235923, len: 176 +Update lsn: 846, time: 1338903440.235949, len: 176 +Update lsn: 847, time: 1338903440.235977, len: 176 +Update lsn: 848, time: 1338903440.236004, len: 176 +Update lsn: 849, time: 1338903440.236031, len: 176 +Update lsn: 850, time: 1338903440.236057, len: 176 +Update lsn: 851, time: 1338903440.236084, len: 176 +Update lsn: 852, time: 1338903440.236110, len: 176 +Update lsn: 853, time: 1338903440.236136, len: 176 +Update lsn: 854, time: 1338903440.236163, len: 176 +Update lsn: 855, time: 1338903440.236189, len: 176 +Update lsn: 856, time: 1338903440.236233, len: 176 +Update lsn: 857, time: 1338903440.236262, len: 176 +Update lsn: 858, time: 1338903440.236289, len: 176 +Update lsn: 859, time: 1338903440.236315, len: 176 +Update lsn: 860, time: 1338903440.236341, len: 176 +Update lsn: 861, time: 1338903440.236368, len: 176 +Update lsn: 862, time: 1338903440.236394, len: 176 +Update lsn: 863, time: 1338903440.236421, len: 176 +Update lsn: 864, time: 1338903440.236448, len: 176 +Update lsn: 865, time: 1338903440.236475, len: 176 +Update lsn: 866, time: 1338903440.236501, len: 176 +Update lsn: 867, time: 1338903440.236527, len: 176 +Update lsn: 868, time: 1338903440.236554, len: 176 +Update lsn: 869, time: 1338903440.236581, len: 176 +Update lsn: 870, time: 1338903440.236608, len: 176 +Update lsn: 871, time: 1338903440.236634, len: 176 +Update lsn: 872, time: 1338903440.236660, len: 176 +Update lsn: 873, time: 1338903440.236687, len: 176 +Update lsn: 874, time: 1338903440.236713, len: 176 +Update lsn: 875, time: 1338903440.236739, len: 176 +Update lsn: 876, time: 1338903440.236782, len: 176 +Update lsn: 877, time: 1338903440.236810, len: 176 +Update lsn: 878, time: 1338903440.236837, len: 176 +Update lsn: 879, time: 1338903440.236864, len: 176 +Update lsn: 880, time: 1338903440.236892, len: 176 +Update lsn: 881, time: 1338903440.236919, len: 176 +Update lsn: 882, time: 1338903440.236945, len: 176 +Update lsn: 883, time: 1338903440.236972, len: 176 +Update lsn: 884, time: 1338903440.236998, len: 176 +Update lsn: 885, time: 1338903440.237024, len: 176 +Update lsn: 886, time: 1338903440.237050, len: 176 +Update lsn: 887, time: 1338903440.237077, len: 176 +Update lsn: 888, time: 1338903440.237103, len: 176 +Update lsn: 889, time: 1338903440.237131, len: 176 +Update lsn: 890, time: 1338903440.237158, len: 176 +Update lsn: 891, time: 1338903440.237184, len: 176 +Update lsn: 892, time: 1338903440.237211, len: 176 +Update lsn: 893, time: 1338903440.237236, len: 176 +Update lsn: 894, time: 1338903440.237262, len: 176 +Update lsn: 895, time: 1338903440.237289, len: 176 +Update lsn: 896, time: 1338903440.237339, len: 176 +Update lsn: 897, time: 1338903440.237368, len: 176 +Update lsn: 898, time: 1338903440.237395, len: 176 +Update lsn: 899, time: 1338903440.237421, len: 176 +Update lsn: 900, time: 1338903440.237448, len: 176 +Update lsn: 901, time: 1338903440.237475, len: 176 +Update lsn: 902, time: 1338903440.238040, len: 77 +Update lsn: 903, time: 1338903440.238124, len: 77 +Update lsn: 904, time: 1338903440.238156, len: 77 +Update lsn: 905, time: 1338903440.238183, len: 77 +Update lsn: 906, time: 1338903440.238212, len: 77 +Update lsn: 907, time: 1338903440.238899, len: 77 +Update lsn: 908, time: 1338903440.238960, len: 77 +Update lsn: 909, time: 1338903440.238989, len: 77 +Update lsn: 910, time: 1338903440.239016, len: 77 +Update lsn: 911, time: 1338903440.239043, len: 77 +Update lsn: 912, time: 1338903440.239070, len: 78 +Update lsn: 913, time: 1338903440.239097, len: 78 +Update lsn: 914, time: 1338903440.239125, len: 78 +Update lsn: 915, time: 1338903440.239153, len: 78 +Update lsn: 916, time: 1338903440.239180, len: 78 +Update lsn: 917, time: 1338903440.239207, len: 78 +Update lsn: 918, time: 1338903440.239234, len: 78 +Update lsn: 919, time: 1338903440.239261, len: 78 +Update lsn: 920, time: 1338903440.239290, len: 78 +Update lsn: 921, time: 1338903440.240279, len: 78 +Update lsn: 922, time: 1338903440.240328, len: 78 +Update lsn: 923, time: 1338903440.240355, len: 78 +Update lsn: 924, time: 1338903440.240382, len: 78 +Update lsn: 925, time: 1338903440.240409, len: 78 +Update lsn: 926, time: 1338903440.240436, len: 78 +Update lsn: 927, time: 1338903440.240494, len: 78 +Update lsn: 928, time: 1338903440.240522, len: 78 +Update lsn: 929, time: 1338903440.240548, len: 78 +Update lsn: 930, time: 1338903440.240575, len: 78 +Update lsn: 931, time: 1338903440.240604, len: 78 +Update lsn: 932, time: 1338903440.240632, len: 78 +Update lsn: 933, time: 1338903440.240660, len: 78 +Update lsn: 934, time: 1338903440.240687, len: 78 +Update lsn: 935, time: 1338903440.240714, len: 78 +Update lsn: 936, time: 1338903440.240742, len: 78 +Update lsn: 937, time: 1338903440.240770, len: 78 +Update lsn: 938, time: 1338903440.240797, len: 78 +Update lsn: 939, time: 1338903440.240823, len: 78 +Update lsn: 940, time: 1338903440.240851, len: 78 +Update lsn: 941, time: 1338903440.240879, len: 78 +Update lsn: 942, time: 1338903440.240906, len: 78 +Update lsn: 943, time: 1338903440.240934, len: 78 +Update lsn: 944, time: 1338903440.240961, len: 78 +Update lsn: 945, time: 1338903440.240988, len: 78 +Update lsn: 946, time: 1338903440.241016, len: 78 +Update lsn: 947, time: 1338903440.241044, len: 78 +Update lsn: 948, time: 1338903440.241071, len: 78 +Update lsn: 949, time: 1338903440.241097, len: 78 +Update lsn: 950, time: 1338903440.241124, len: 78 +Update lsn: 951, time: 1338903440.241152, len: 78 +Update lsn: 952, time: 1338903440.241179, len: 78 +Update lsn: 953, time: 1338903440.241206, len: 78 +Update lsn: 954, time: 1338903440.241233, len: 78 +Update lsn: 955, time: 1338903440.241260, len: 78 +Update lsn: 956, time: 1338903440.241287, len: 78 +Update lsn: 957, time: 1338903440.241314, len: 78 +Update lsn: 958, time: 1338903440.241341, len: 78 +Update lsn: 959, time: 1338903440.241369, len: 78 +Update lsn: 960, time: 1338903440.241396, len: 78 +Update lsn: 961, time: 1338903440.241424, len: 78 +Update lsn: 962, time: 1338903440.241451, len: 78 +Update lsn: 963, time: 1338903440.241478, len: 78 +Update lsn: 964, time: 1338903440.241524, len: 78 +Update lsn: 965, time: 1338903440.241552, len: 78 +Update lsn: 966, time: 1338903440.241604, len: 78 +Update lsn: 967, time: 1338903440.241632, len: 78 +Update lsn: 968, time: 1338903440.241661, len: 78 +Update lsn: 969, time: 1338903440.241688, len: 78 +Update lsn: 970, time: 1338903440.241715, len: 78 +Update lsn: 971, time: 1338903440.241741, len: 78 +Update lsn: 972, time: 1338903440.241769, len: 78 +Update lsn: 973, time: 1338903440.241796, len: 78 +Update lsn: 974, time: 1338903440.241823, len: 78 +Update lsn: 975, time: 1338903440.241851, len: 78 +Update lsn: 976, time: 1338903440.241879, len: 78 +Update lsn: 977, time: 1338903440.241909, len: 78 +Update lsn: 978, time: 1338903440.241935, len: 78 +Update lsn: 979, time: 1338903440.241962, len: 78 +Update lsn: 980, time: 1338903440.241990, len: 78 +Update lsn: 981, time: 1338903440.242017, len: 78 +Update lsn: 982, time: 1338903440.242044, len: 78 +Update lsn: 983, time: 1338903440.242071, len: 78 +Update lsn: 984, time: 1338903440.242099, len: 78 +Update lsn: 985, time: 1338903440.242126, len: 78 +Update lsn: 986, time: 1338903440.242154, len: 78 +Update lsn: 987, time: 1338903440.242181, len: 78 +Update lsn: 988, time: 1338903440.242208, len: 78 +Update lsn: 989, time: 1338903440.242236, len: 78 +Update lsn: 990, time: 1338903440.242263, len: 78 +Update lsn: 991, time: 1338903440.242290, len: 78 +Update lsn: 992, time: 1338903440.242317, len: 78 +Update lsn: 993, time: 1338903440.242343, len: 78 +Update lsn: 994, time: 1338903440.242370, len: 78 +Update lsn: 995, time: 1338903440.242398, len: 78 +Update lsn: 996, time: 1338903440.242425, len: 78 +Update lsn: 997, time: 1338903440.242452, len: 78 +Update lsn: 998, time: 1338903440.242479, len: 78 +Update lsn: 999, time: 1338903440.242506, len: 78 +Update lsn: 1000, time: 1338903440.242534, len: 78 +Update lsn: 1001, time: 1338903440.242582, len: 78 +Update lsn: 1002, time: 1338903440.243265, len: 109 +Update lsn: 1003, time: 1338903440.243367, len: 109 +Update lsn: 1004, time: 1338903440.243399, len: 109 +Update lsn: 1005, time: 1338903440.243427, len: 109 +Update lsn: 1006, time: 1338903440.243455, len: 109 +Update lsn: 1007, time: 1338903440.243484, len: 109 +Update lsn: 1008, time: 1338903440.243512, len: 109 +Update lsn: 1009, time: 1338903440.243540, len: 109 +Update lsn: 1010, time: 1338903440.243569, len: 109 +Update lsn: 1011, time: 1338903440.243598, len: 109 +Update lsn: 1012, time: 1338903440.243626, len: 110 +Update lsn: 1013, time: 1338903440.243654, len: 110 +Update lsn: 1014, time: 1338903440.243681, len: 110 +Update lsn: 1015, time: 1338903440.243710, len: 110 +Update lsn: 1016, time: 1338903440.243738, len: 110 +Update lsn: 1017, time: 1338903440.243767, len: 110 +Update lsn: 1018, time: 1338903440.243796, len: 110 +Update lsn: 1019, time: 1338903440.243826, len: 110 +Update lsn: 1020, time: 1338903440.243855, len: 110 +Update lsn: 1021, time: 1338903440.243883, len: 110 +Update lsn: 1022, time: 1338903440.243913, len: 110 +Update lsn: 1023, time: 1338903440.243941, len: 110 +Update lsn: 1024, time: 1338903440.243968, len: 110 +Update lsn: 1025, time: 1338903440.243996, len: 110 +Update lsn: 1026, time: 1338903440.244023, len: 110 +Update lsn: 1027, time: 1338903440.244049, len: 110 +Update lsn: 1028, time: 1338903440.244076, len: 110 +Update lsn: 1029, time: 1338903440.244103, len: 110 +Update lsn: 1030, time: 1338903440.244164, len: 110 +Update lsn: 1031, time: 1338903440.244193, len: 110 +Update lsn: 1032, time: 1338903440.244220, len: 110 +Update lsn: 1033, time: 1338903440.244246, len: 110 +Update lsn: 1034, time: 1338903440.244272, len: 110 +Update lsn: 1035, time: 1338903440.244299, len: 110 +Update lsn: 1036, time: 1338903440.244325, len: 110 +Update lsn: 1037, time: 1338903440.244351, len: 110 +Update lsn: 1038, time: 1338903440.244378, len: 110 +Update lsn: 1039, time: 1338903440.244404, len: 110 +Update lsn: 1040, time: 1338903440.244431, len: 110 +Update lsn: 1041, time: 1338903440.244457, len: 110 +Update lsn: 1042, time: 1338903440.244483, len: 110 +Update lsn: 1043, time: 1338903440.244509, len: 110 +Update lsn: 1044, time: 1338903440.244535, len: 110 +Update lsn: 1045, time: 1338903440.244561, len: 110 +Update lsn: 1046, time: 1338903440.244587, len: 110 +Update lsn: 1047, time: 1338903440.244613, len: 110 +Update lsn: 1048, time: 1338903440.244640, len: 110 +Update lsn: 1049, time: 1338903440.244666, len: 110 +Update lsn: 1050, time: 1338903440.244692, len: 110 +Update lsn: 1051, time: 1338903440.244718, len: 110 +Update lsn: 1052, time: 1338903440.244744, len: 110 +Update lsn: 1053, time: 1338903440.244771, len: 110 +Update lsn: 1054, time: 1338903440.244798, len: 110 +Update lsn: 1055, time: 1338903440.244827, len: 110 +Update lsn: 1056, time: 1338903440.244854, len: 110 +Update lsn: 1057, time: 1338903440.244881, len: 110 +Update lsn: 1058, time: 1338903440.244936, len: 110 +Update lsn: 1059, time: 1338903440.244995, len: 110 +Update lsn: 1060, time: 1338903440.245028, len: 110 +Update lsn: 1061, time: 1338903440.245057, len: 110 +Update lsn: 1062, time: 1338903440.245086, len: 110 +Update lsn: 1063, time: 1338903440.245115, len: 110 +Update lsn: 1064, time: 1338903440.245142, len: 110 +Update lsn: 1065, time: 1338903440.245169, len: 110 +Update lsn: 1066, time: 1338903440.245196, len: 110 +Update lsn: 1067, time: 1338903440.245222, len: 110 +Update lsn: 1068, time: 1338903440.245248, len: 110 +Update lsn: 1069, time: 1338903440.245275, len: 110 +Update lsn: 1070, time: 1338903440.245302, len: 110 +Update lsn: 1071, time: 1338903440.245329, len: 110 +Update lsn: 1072, time: 1338903440.245355, len: 110 +Update lsn: 1073, time: 1338903440.245382, len: 110 +Update lsn: 1074, time: 1338903440.245408, len: 110 +Update lsn: 1075, time: 1338903440.245435, len: 110 +Update lsn: 1076, time: 1338903440.245462, len: 110 +Update lsn: 1077, time: 1338903440.245491, len: 110 +Update lsn: 1078, time: 1338903440.245518, len: 110 +Update lsn: 1079, time: 1338903440.245545, len: 110 +Update lsn: 1080, time: 1338903440.245572, len: 110 +Update lsn: 1081, time: 1338903440.245600, len: 110 +Update lsn: 1082, time: 1338903440.245628, len: 110 +Update lsn: 1083, time: 1338903440.245656, len: 110 +Update lsn: 1084, time: 1338903440.245683, len: 110 +Update lsn: 1085, time: 1338903440.245709, len: 110 +Update lsn: 1086, time: 1338903440.245736, len: 110 +Update lsn: 1087, time: 1338903440.245763, len: 110 +Update lsn: 1088, time: 1338903440.245815, len: 110 +Update lsn: 1089, time: 1338903440.245847, len: 110 +Update lsn: 1090, time: 1338903440.245874, len: 110 +Update lsn: 1091, time: 1338903440.245900, len: 110 +Update lsn: 1092, time: 1338903440.245928, len: 110 +Update lsn: 1093, time: 1338903440.245955, len: 110 +Update lsn: 1094, time: 1338903440.245983, len: 110 +Update lsn: 1095, time: 1338903440.246011, len: 110 +Update lsn: 1096, time: 1338903440.246040, len: 110 +Update lsn: 1097, time: 1338903440.246068, len: 110 +Update lsn: 1098, time: 1338903440.246097, len: 110 +Update lsn: 1099, time: 1338903440.246124, len: 110 +Update lsn: 1100, time: 1338903440.246151, len: 110 +Update lsn: 1101, time: 1338903440.246177, len: 110 +Update lsn: 1102, time: 1338903440.246866, len: 175 +Update lsn: 1103, time: 1338903440.246967, len: 175 +Update lsn: 1104, time: 1338903440.247000, len: 175 +Update lsn: 1105, time: 1338903440.247028, len: 175 +Update lsn: 1106, time: 1338903440.247058, len: 175 +Update lsn: 1107, time: 1338903440.247086, len: 175 +Update lsn: 1108, time: 1338903440.247115, len: 175 +Update lsn: 1109, time: 1338903440.247144, len: 175 +Update lsn: 1110, time: 1338903440.247173, len: 175 +Update lsn: 1111, time: 1338903440.247202, len: 175 +Update lsn: 1112, time: 1338903440.247263, len: 176 +Update lsn: 1113, time: 1338903440.247297, len: 176 +Update lsn: 1114, time: 1338903440.247326, len: 176 +Update lsn: 1115, time: 1338903440.247355, len: 176 +Update lsn: 1116, time: 1338903440.247384, len: 176 +Update lsn: 1117, time: 1338903440.247415, len: 176 +Update lsn: 1118, time: 1338903440.247444, len: 176 +Update lsn: 1119, time: 1338903440.247473, len: 176 +Update lsn: 1120, time: 1338903440.247503, len: 176 +Update lsn: 1121, time: 1338903440.247531, len: 176 +Update lsn: 1122, time: 1338903440.247559, len: 176 +Update lsn: 1123, time: 1338903440.247586, len: 176 +Update lsn: 1124, time: 1338903440.247614, len: 176 +Update lsn: 1125, time: 1338903440.247641, len: 176 +Update lsn: 1126, time: 1338903440.247668, len: 176 +Update lsn: 1127, time: 1338903440.247695, len: 176 +Update lsn: 1128, time: 1338903440.247722, len: 176 +Update lsn: 1129, time: 1338903440.247749, len: 176 +Update lsn: 1130, time: 1338903440.247775, len: 176 +Update lsn: 1131, time: 1338903440.247801, len: 176 +Update lsn: 1132, time: 1338903440.247851, len: 176 +Update lsn: 1133, time: 1338903440.247880, len: 176 +Update lsn: 1134, time: 1338903440.247906, len: 176 +Update lsn: 1135, time: 1338903440.247932, len: 176 +Update lsn: 1136, time: 1338903440.247960, len: 176 +Update lsn: 1137, time: 1338903440.247986, len: 176 +Update lsn: 1138, time: 1338903440.248012, len: 176 +Update lsn: 1139, time: 1338903440.248039, len: 176 +Update lsn: 1140, time: 1338903440.248065, len: 176 +Update lsn: 1141, time: 1338903440.248092, len: 176 +Update lsn: 1142, time: 1338903440.248118, len: 176 +Update lsn: 1143, time: 1338903440.248146, len: 176 +Update lsn: 1144, time: 1338903440.248173, len: 176 +Update lsn: 1145, time: 1338903440.248201, len: 176 +Update lsn: 1146, time: 1338903440.248250, len: 176 +Update lsn: 1147, time: 1338903440.248282, len: 176 +Update lsn: 1148, time: 1338903440.248311, len: 176 +Update lsn: 1149, time: 1338903440.248339, len: 176 +Update lsn: 1150, time: 1338903440.248367, len: 176 +Update lsn: 1151, time: 1338903440.248394, len: 176 +Update lsn: 1152, time: 1338903440.248443, len: 176 +Update lsn: 1153, time: 1338903440.248471, len: 176 +Update lsn: 1154, time: 1338903440.248498, len: 176 +Update lsn: 1155, time: 1338903440.248525, len: 176 +Update lsn: 1156, time: 1338903440.248553, len: 176 +Update lsn: 1157, time: 1338903440.248579, len: 176 +Update lsn: 1158, time: 1338903440.248606, len: 176 +Update lsn: 1159, time: 1338903440.248633, len: 176 +Update lsn: 1160, time: 1338903440.248659, len: 176 +Update lsn: 1161, time: 1338903440.248686, len: 176 +Update lsn: 1162, time: 1338903440.248713, len: 176 +Update lsn: 1163, time: 1338903440.248740, len: 176 +Update lsn: 1164, time: 1338903440.248767, len: 176 +Update lsn: 1165, time: 1338903440.248794, len: 176 +Update lsn: 1166, time: 1338903440.248821, len: 176 +Update lsn: 1167, time: 1338903440.248849, len: 176 +Update lsn: 1168, time: 1338903440.248876, len: 176 +Update lsn: 1169, time: 1338903440.248904, len: 176 +Update lsn: 1170, time: 1338903440.248932, len: 176 +Update lsn: 1171, time: 1338903440.248982, len: 176 +Update lsn: 1172, time: 1338903440.249012, len: 176 +Update lsn: 1173, time: 1338903440.249038, len: 176 +Update lsn: 1174, time: 1338903440.249064, len: 176 +Update lsn: 1175, time: 1338903440.249091, len: 176 +Update lsn: 1176, time: 1338903440.249120, len: 176 +Update lsn: 1177, time: 1338903440.249149, len: 176 +Update lsn: 1178, time: 1338903440.249179, len: 176 +Update lsn: 1179, time: 1338903440.249208, len: 176 +Update lsn: 1180, time: 1338903440.249237, len: 176 +Update lsn: 1181, time: 1338903440.249265, len: 176 +Update lsn: 1182, time: 1338903440.249292, len: 176 +Update lsn: 1183, time: 1338903440.249320, len: 176 +Update lsn: 1184, time: 1338903440.249347, len: 176 +Update lsn: 1185, time: 1338903440.249375, len: 176 +Update lsn: 1186, time: 1338903440.249404, len: 176 +Update lsn: 1187, time: 1338903440.249431, len: 176 +Update lsn: 1188, time: 1338903440.249460, len: 176 +Update lsn: 1189, time: 1338903440.249490, len: 176 +Update lsn: 1190, time: 1338903440.249517, len: 176 +Update lsn: 1191, time: 1338903440.249563, len: 176 +Update lsn: 1192, time: 1338903440.249593, len: 176 +Update lsn: 1193, time: 1338903440.249621, len: 176 +Update lsn: 1194, time: 1338903440.249648, len: 176 +Update lsn: 1195, time: 1338903440.249676, len: 176 +Update lsn: 1196, time: 1338903440.249705, len: 176 +Update lsn: 1197, time: 1338903440.249733, len: 176 +Update lsn: 1198, time: 1338903440.249761, len: 176 +Update lsn: 1199, time: 1338903440.249789, len: 176 +Update lsn: 1200, time: 1338903440.249816, len: 176 +Update lsn: 1201, time: 1338903440.249846, len: 176 + +Insert lsn: 2, time: 1338903440.187947, len: 68 +Insert lsn: 3, time: 1338903440.190419, len: 68 +Insert lsn: 4, time: 1338903440.190539, len: 68 +Insert lsn: 5, time: 1338903440.190582, len: 68 +Insert lsn: 6, time: 1338903440.190608, len: 68 +Insert lsn: 7, time: 1338903440.190633, len: 68 +Insert lsn: 8, time: 1338903440.190657, len: 68 +Insert lsn: 9, time: 1338903440.190681, len: 68 +Insert lsn: 10, time: 1338903440.190712, len: 68 +Insert lsn: 11, time: 1338903440.190736, len: 68 +Insert lsn: 12, time: 1338903440.190762, len: 69 +Insert lsn: 13, time: 1338903440.190785, len: 69 +Insert lsn: 14, time: 1338903440.190810, len: 69 +Insert lsn: 15, time: 1338903440.190834, len: 69 +Insert lsn: 16, time: 1338903440.190858, len: 69 +Insert lsn: 17, time: 1338903440.190883, len: 69 +Insert lsn: 18, time: 1338903440.190908, len: 69 +Insert lsn: 19, time: 1338903440.190942, len: 69 +Insert lsn: 20, time: 1338903440.190967, len: 69 +Insert lsn: 21, time: 1338903440.190992, len: 69 +Insert lsn: 22, time: 1338903440.191015, len: 69 +Insert lsn: 23, time: 1338903440.191040, len: 69 +Insert lsn: 24, time: 1338903440.191064, len: 69 +Insert lsn: 25, time: 1338903440.191088, len: 69 +Insert lsn: 26, time: 1338903440.191112, len: 69 +Insert lsn: 27, time: 1338903440.191138, len: 69 +Insert lsn: 28, time: 1338903440.191163, len: 69 +Insert lsn: 29, time: 1338903440.191188, len: 69 +Insert lsn: 30, time: 1338903440.191213, len: 69 +Insert lsn: 31, time: 1338903440.191238, len: 69 +Insert lsn: 32, time: 1338903440.191262, len: 69 +Insert lsn: 33, time: 1338903440.191284, len: 69 +Insert lsn: 34, time: 1338903440.191319, len: 69 +Insert lsn: 35, time: 1338903440.191344, len: 69 +Insert lsn: 36, time: 1338903440.191369, len: 69 +Insert lsn: 37, time: 1338903440.191393, len: 69 +Insert lsn: 38, time: 1338903440.191417, len: 69 +Insert lsn: 39, time: 1338903440.191441, len: 69 +Insert lsn: 40, time: 1338903440.191479, len: 69 +Insert lsn: 41, time: 1338903440.191503, len: 69 +Insert lsn: 42, time: 1338903440.191526, len: 69 +Insert lsn: 43, time: 1338903440.191603, len: 69 +Insert lsn: 44, time: 1338903440.191632, len: 69 +Insert lsn: 45, time: 1338903440.191655, len: 69 +Insert lsn: 46, time: 1338903440.191681, len: 69 +Insert lsn: 47, time: 1338903440.191704, len: 69 +Insert lsn: 48, time: 1338903440.191727, len: 69 +Insert lsn: 49, time: 1338903440.191750, len: 69 +Insert lsn: 50, time: 1338903440.191774, len: 69 +Insert lsn: 51, time: 1338903440.191797, len: 69 +Insert lsn: 52, time: 1338903440.191820, len: 69 +Insert lsn: 53, time: 1338903440.191844, len: 69 +Insert lsn: 54, time: 1338903440.191874, len: 69 +Insert lsn: 55, time: 1338903440.191897, len: 69 +Insert lsn: 56, time: 1338903440.191921, len: 69 +Insert lsn: 57, time: 1338903440.191944, len: 69 +Insert lsn: 58, time: 1338903440.191967, len: 69 +Insert lsn: 59, time: 1338903440.191992, len: 69 +Insert lsn: 60, time: 1338903440.192016, len: 69 +Insert lsn: 61, time: 1338903440.192039, len: 69 +Insert lsn: 62, time: 1338903440.192063, len: 69 +Insert lsn: 63, time: 1338903440.192086, len: 69 +Insert lsn: 64, time: 1338903440.192111, len: 69 +Insert lsn: 65, time: 1338903440.192134, len: 69 +Insert lsn: 66, time: 1338903440.192164, len: 69 +Insert lsn: 67, time: 1338903440.192188, len: 69 +Insert lsn: 68, time: 1338903440.192212, len: 69 +Insert lsn: 69, time: 1338903440.192235, len: 69 +Insert lsn: 70, time: 1338903440.192278, len: 69 +Insert lsn: 71, time: 1338903440.192302, len: 69 +Insert lsn: 72, time: 1338903440.192327, len: 69 +Insert lsn: 73, time: 1338903440.192351, len: 69 +Insert lsn: 74, time: 1338903440.192376, len: 69 +Insert lsn: 75, time: 1338903440.192401, len: 69 +Insert lsn: 76, time: 1338903440.192424, len: 69 +Insert lsn: 77, time: 1338903440.192449, len: 69 +Insert lsn: 78, time: 1338903440.192473, len: 69 +Insert lsn: 79, time: 1338903440.192497, len: 69 +Insert lsn: 80, time: 1338903440.192521, len: 69 +Insert lsn: 81, time: 1338903440.192545, len: 69 +Insert lsn: 82, time: 1338903440.192569, len: 69 +Insert lsn: 83, time: 1338903440.192593, len: 69 +Insert lsn: 84, time: 1338903440.192642, len: 69 +Insert lsn: 85, time: 1338903440.192670, len: 69 +Insert lsn: 86, time: 1338903440.192701, len: 69 +Insert lsn: 87, time: 1338903440.192726, len: 69 +Insert lsn: 88, time: 1338903440.192749, len: 69 +Insert lsn: 89, time: 1338903440.192773, len: 69 +Insert lsn: 90, time: 1338903440.192798, len: 69 +Insert lsn: 91, time: 1338903440.192822, len: 69 +Insert lsn: 92, time: 1338903440.192846, len: 69 +Insert lsn: 93, time: 1338903440.192871, len: 69 +Insert lsn: 94, time: 1338903440.192896, len: 69 +Insert lsn: 95, time: 1338903440.192921, len: 69 +Insert lsn: 96, time: 1338903440.192946, len: 69 +Insert lsn: 97, time: 1338903440.192970, len: 69 +Insert lsn: 98, time: 1338903440.192993, len: 69 +Insert lsn: 99, time: 1338903440.193017, len: 69 +Insert lsn: 100, time: 1338903440.193042, len: 69 +Insert lsn: 101, time: 1338903440.193065, len: 69 +Insert lsn: 102, time: 1338903440.193547, len: 100 +Insert lsn: 103, time: 1338903440.207494, len: 100 +Insert lsn: 104, time: 1338903440.207539, len: 100 +Insert lsn: 105, time: 1338903440.207564, len: 100 +Insert lsn: 106, time: 1338903440.207613, len: 100 +Insert lsn: 107, time: 1338903440.207639, len: 100 +Insert lsn: 108, time: 1338903440.207665, len: 100 +Insert lsn: 109, time: 1338903440.207690, len: 100 +Insert lsn: 110, time: 1338903440.207717, len: 100 +Insert lsn: 111, time: 1338903440.207745, len: 100 +Insert lsn: 112, time: 1338903440.207770, len: 101 +Insert lsn: 113, time: 1338903440.207795, len: 101 +Insert lsn: 114, time: 1338903440.207819, len: 101 +Insert lsn: 115, time: 1338903440.207844, len: 101 +Insert lsn: 116, time: 1338903440.207870, len: 101 +Insert lsn: 117, time: 1338903440.207895, len: 101 +Insert lsn: 118, time: 1338903440.207918, len: 101 +Insert lsn: 119, time: 1338903440.207976, len: 101 +Insert lsn: 120, time: 1338903440.208004, len: 101 +Insert lsn: 121, time: 1338903440.208029, len: 101 +Insert lsn: 122, time: 1338903440.208054, len: 101 +Insert lsn: 123, time: 1338903440.208078, len: 101 +Insert lsn: 124, time: 1338903440.208119, len: 101 +Insert lsn: 125, time: 1338903440.208144, len: 101 +Insert lsn: 126, time: 1338903440.208168, len: 101 +Insert lsn: 127, time: 1338903440.208193, len: 101 +Insert lsn: 128, time: 1338903440.208218, len: 101 +Insert lsn: 129, time: 1338903440.208291, len: 101 +Insert lsn: 130, time: 1338903440.208318, len: 101 +Insert lsn: 131, time: 1338903440.208343, len: 101 +Insert lsn: 132, time: 1338903440.208370, len: 101 +Insert lsn: 133, time: 1338903440.208396, len: 101 +Insert lsn: 134, time: 1338903440.208422, len: 101 +Insert lsn: 135, time: 1338903440.208447, len: 101 +Insert lsn: 136, time: 1338903440.208473, len: 101 +Insert lsn: 137, time: 1338903440.208499, len: 101 +Insert lsn: 138, time: 1338903440.208561, len: 101 +Insert lsn: 139, time: 1338903440.208586, len: 101 +Insert lsn: 140, time: 1338903440.208610, len: 101 +Insert lsn: 141, time: 1338903440.208634, len: 101 +Insert lsn: 142, time: 1338903440.208664, len: 101 +Insert lsn: 143, time: 1338903440.208688, len: 101 +Insert lsn: 144, time: 1338903440.208712, len: 101 +Insert lsn: 145, time: 1338903440.208735, len: 101 +Insert lsn: 146, time: 1338903440.208760, len: 101 +Insert lsn: 147, time: 1338903440.208783, len: 101 +Insert lsn: 148, time: 1338903440.208807, len: 101 +Insert lsn: 149, time: 1338903440.208831, len: 101 +Insert lsn: 150, time: 1338903440.208875, len: 101 +Insert lsn: 151, time: 1338903440.208900, len: 101 +Insert lsn: 152, time: 1338903440.208924, len: 101 +Insert lsn: 153, time: 1338903440.208947, len: 101 +Insert lsn: 154, time: 1338903440.208971, len: 101 +Insert lsn: 155, time: 1338903440.208994, len: 101 +Insert lsn: 156, time: 1338903440.209018, len: 101 +Insert lsn: 157, time: 1338903440.209043, len: 101 +Insert lsn: 158, time: 1338903440.209066, len: 101 +Insert lsn: 159, time: 1338903440.209090, len: 101 +Insert lsn: 160, time: 1338903440.209126, len: 101 +Insert lsn: 161, time: 1338903440.209151, len: 101 +Insert lsn: 162, time: 1338903440.209175, len: 101 +Insert lsn: 163, time: 1338903440.209199, len: 101 +Insert lsn: 164, time: 1338903440.209223, len: 101 +Insert lsn: 165, time: 1338903440.209247, len: 101 +Insert lsn: 166, time: 1338903440.209296, len: 101 +Insert lsn: 167, time: 1338903440.209320, len: 101 +Insert lsn: 168, time: 1338903440.209344, len: 101 +Insert lsn: 169, time: 1338903440.209367, len: 101 +Insert lsn: 170, time: 1338903440.209390, len: 101 +Insert lsn: 171, time: 1338903440.209414, len: 101 +Insert lsn: 172, time: 1338903440.209438, len: 101 +Insert lsn: 173, time: 1338903440.209461, len: 101 +Insert lsn: 174, time: 1338903440.209485, len: 101 +Insert lsn: 175, time: 1338903440.209509, len: 101 +Insert lsn: 176, time: 1338903440.209533, len: 101 +Insert lsn: 177, time: 1338903440.209564, len: 101 +Insert lsn: 178, time: 1338903440.209589, len: 101 +Insert lsn: 179, time: 1338903440.209613, len: 101 +Insert lsn: 180, time: 1338903440.209637, len: 101 +Insert lsn: 181, time: 1338903440.209678, len: 101 +Insert lsn: 182, time: 1338903440.209703, len: 101 +Insert lsn: 183, time: 1338903440.209745, len: 101 +Insert lsn: 184, time: 1338903440.209770, len: 101 +Insert lsn: 185, time: 1338903440.209794, len: 101 +Insert lsn: 186, time: 1338903440.209819, len: 101 +Insert lsn: 187, time: 1338903440.209842, len: 101 +Insert lsn: 188, time: 1338903440.209866, len: 101 +Insert lsn: 189, time: 1338903440.209889, len: 101 +Insert lsn: 190, time: 1338903440.209913, len: 101 +Insert lsn: 191, time: 1338903440.209937, len: 101 +Insert lsn: 192, time: 1338903440.209961, len: 101 +Insert lsn: 193, time: 1338903440.209985, len: 101 +Insert lsn: 194, time: 1338903440.210010, len: 101 +Insert lsn: 195, time: 1338903440.210041, len: 101 +Insert lsn: 196, time: 1338903440.210065, len: 101 +Insert lsn: 197, time: 1338903440.210088, len: 101 +Insert lsn: 198, time: 1338903440.210112, len: 101 +Insert lsn: 199, time: 1338903440.210135, len: 101 +Insert lsn: 200, time: 1338903440.210160, len: 101 +Insert lsn: 201, time: 1338903440.210183, len: 101 +Insert lsn: 202, time: 1338903440.210887, len: 166 +Insert lsn: 203, time: 1338903440.213901, len: 166 +Insert lsn: 204, time: 1338903440.213959, len: 166 +Insert lsn: 205, time: 1338903440.213986, len: 166 +Insert lsn: 206, time: 1338903440.214033, len: 166 +Insert lsn: 207, time: 1338903440.214060, len: 166 +Insert lsn: 208, time: 1338903440.214119, len: 166 +Insert lsn: 209, time: 1338903440.214145, len: 166 +Insert lsn: 210, time: 1338903440.214170, len: 166 +Insert lsn: 211, time: 1338903440.214196, len: 166 +Insert lsn: 212, time: 1338903440.214221, len: 167 +Insert lsn: 213, time: 1338903440.214246, len: 167 +Insert lsn: 214, time: 1338903440.214271, len: 167 +Insert lsn: 215, time: 1338903440.214297, len: 167 +Insert lsn: 216, time: 1338903440.214322, len: 167 +Insert lsn: 217, time: 1338903440.214347, len: 167 +Insert lsn: 218, time: 1338903440.214373, len: 167 +Insert lsn: 219, time: 1338903440.214398, len: 167 +Insert lsn: 220, time: 1338903440.214430, len: 167 +Insert lsn: 221, time: 1338903440.214456, len: 167 +Insert lsn: 222, time: 1338903440.214482, len: 167 +Insert lsn: 223, time: 1338903440.214507, len: 167 +Insert lsn: 224, time: 1338903440.214531, len: 167 +Insert lsn: 225, time: 1338903440.214556, len: 167 +Insert lsn: 226, time: 1338903440.214580, len: 167 +Insert lsn: 227, time: 1338903440.214604, len: 167 +Insert lsn: 228, time: 1338903440.214628, len: 167 +Insert lsn: 229, time: 1338903440.214673, len: 167 +Insert lsn: 230, time: 1338903440.214703, len: 167 +Insert lsn: 231, time: 1338903440.214729, len: 167 +Insert lsn: 232, time: 1338903440.214753, len: 167 +Insert lsn: 233, time: 1338903440.214778, len: 167 +Insert lsn: 234, time: 1338903440.214828, len: 167 +Insert lsn: 235, time: 1338903440.214853, len: 167 +Insert lsn: 236, time: 1338903440.214878, len: 167 +Insert lsn: 237, time: 1338903440.214927, len: 167 +Insert lsn: 238, time: 1338903440.214953, len: 167 +Insert lsn: 239, time: 1338903440.214980, len: 167 +Insert lsn: 240, time: 1338903440.215005, len: 167 +Insert lsn: 241, time: 1338903440.215030, len: 167 +Insert lsn: 242, time: 1338903440.215055, len: 167 +Insert lsn: 243, time: 1338903440.215080, len: 167 +Insert lsn: 244, time: 1338903440.215105, len: 167 +Insert lsn: 245, time: 1338903440.215131, len: 167 +Insert lsn: 246, time: 1338903440.215157, len: 167 +Insert lsn: 247, time: 1338903440.215190, len: 167 +Insert lsn: 248, time: 1338903440.215215, len: 167 +Insert lsn: 249, time: 1338903440.215277, len: 167 +Insert lsn: 250, time: 1338903440.215327, len: 167 +Insert lsn: 251, time: 1338903440.215356, len: 167 +Insert lsn: 252, time: 1338903440.215382, len: 167 +Insert lsn: 253, time: 1338903440.215407, len: 167 +Insert lsn: 254, time: 1338903440.215432, len: 167 +Insert lsn: 255, time: 1338903440.215459, len: 167 +Insert lsn: 256, time: 1338903440.215486, len: 167 +Insert lsn: 257, time: 1338903440.215513, len: 167 +Insert lsn: 258, time: 1338903440.215539, len: 167 +Insert lsn: 259, time: 1338903440.215563, len: 167 +Insert lsn: 260, time: 1338903440.215590, len: 167 +Insert lsn: 261, time: 1338903440.215623, len: 167 +Insert lsn: 262, time: 1338903440.215649, len: 167 +Insert lsn: 263, time: 1338903440.215675, len: 167 +Insert lsn: 264, time: 1338903440.215699, len: 167 +Insert lsn: 265, time: 1338903440.215723, len: 167 +Insert lsn: 266, time: 1338903440.215748, len: 167 +Insert lsn: 267, time: 1338903440.215773, len: 167 +Insert lsn: 268, time: 1338903440.215797, len: 167 +Insert lsn: 269, time: 1338903440.215822, len: 167 +Insert lsn: 270, time: 1338903440.215866, len: 167 +Insert lsn: 271, time: 1338903440.215894, len: 167 +Insert lsn: 272, time: 1338903440.215918, len: 167 +Insert lsn: 273, time: 1338903440.215942, len: 167 +Insert lsn: 274, time: 1338903440.215968, len: 167 +Insert lsn: 275, time: 1338903440.216054, len: 167 +Insert lsn: 276, time: 1338903440.216105, len: 167 +Insert lsn: 277, time: 1338903440.216130, len: 167 +Insert lsn: 278, time: 1338903440.216155, len: 167 +Insert lsn: 279, time: 1338903440.216181, len: 167 +Insert lsn: 280, time: 1338903440.216207, len: 167 +Insert lsn: 281, time: 1338903440.216231, len: 167 +Insert lsn: 282, time: 1338903440.216256, len: 167 +Insert lsn: 283, time: 1338903440.216281, len: 167 +Insert lsn: 284, time: 1338903440.216306, len: 167 +Insert lsn: 285, time: 1338903440.216332, len: 167 +Insert lsn: 286, time: 1338903440.216357, len: 167 +Insert lsn: 287, time: 1338903440.216382, len: 167 +Insert lsn: 288, time: 1338903440.216407, len: 167 +Insert lsn: 289, time: 1338903440.216444, len: 167 +Insert lsn: 290, time: 1338903440.216470, len: 167 +Insert lsn: 291, time: 1338903440.216519, len: 167 +Insert lsn: 292, time: 1338903440.216549, len: 167 +Insert lsn: 293, time: 1338903440.216576, len: 167 +Insert lsn: 294, time: 1338903440.216602, len: 167 +Insert lsn: 295, time: 1338903440.216627, len: 167 +Insert lsn: 296, time: 1338903440.216652, len: 167 +Insert lsn: 297, time: 1338903440.216677, len: 167 +Insert lsn: 298, time: 1338903440.216701, len: 167 +Insert lsn: 299, time: 1338903440.216725, len: 167 +Insert lsn: 300, time: 1338903440.216749, len: 167 +Insert lsn: 301, time: 1338903440.216774, len: 167 +Insert lsn: 302, time: 1338903440.217291, len: 68 +Insert lsn: 303, time: 1338903440.217376, len: 68 +Insert lsn: 304, time: 1338903440.217406, len: 68 +Insert lsn: 305, time: 1338903440.217431, len: 68 +Insert lsn: 306, time: 1338903440.217458, len: 68 +Insert lsn: 307, time: 1338903440.217483, len: 68 +Insert lsn: 308, time: 1338903440.217508, len: 68 +Insert lsn: 309, time: 1338903440.217533, len: 68 +Insert lsn: 310, time: 1338903440.217565, len: 68 +Insert lsn: 311, time: 1338903440.217591, len: 68 +Insert lsn: 312, time: 1338903440.217618, len: 69 +Insert lsn: 313, time: 1338903440.217644, len: 69 +Insert lsn: 314, time: 1338903440.217670, len: 69 +Insert lsn: 315, time: 1338903440.217697, len: 69 +Insert lsn: 316, time: 1338903440.217722, len: 69 +Insert lsn: 317, time: 1338903440.217749, len: 69 +Insert lsn: 318, time: 1338903440.217776, len: 69 +Insert lsn: 319, time: 1338903440.217801, len: 69 +Insert lsn: 320, time: 1338903440.217865, len: 69 +Insert lsn: 321, time: 1338903440.217896, len: 69 +Insert lsn: 322, time: 1338903440.217923, len: 69 +Insert lsn: 323, time: 1338903440.217949, len: 69 +Insert lsn: 324, time: 1338903440.217974, len: 69 +Insert lsn: 325, time: 1338903440.218000, len: 69 +Insert lsn: 326, time: 1338903440.218045, len: 69 +Insert lsn: 327, time: 1338903440.218071, len: 69 +Insert lsn: 328, time: 1338903440.218097, len: 69 +Insert lsn: 329, time: 1338903440.218124, len: 69 +Insert lsn: 330, time: 1338903440.218150, len: 69 +Insert lsn: 331, time: 1338903440.218176, len: 69 +Insert lsn: 332, time: 1338903440.218203, len: 69 +Insert lsn: 333, time: 1338903440.218246, len: 69 +Insert lsn: 334, time: 1338903440.218277, len: 69 +Insert lsn: 335, time: 1338903440.218303, len: 69 +Insert lsn: 336, time: 1338903440.218329, len: 69 +Insert lsn: 337, time: 1338903440.218354, len: 69 +Insert lsn: 338, time: 1338903440.218380, len: 69 +Insert lsn: 339, time: 1338903440.218406, len: 69 +Insert lsn: 340, time: 1338903440.218431, len: 69 +Insert lsn: 341, time: 1338903440.218456, len: 69 +Insert lsn: 342, time: 1338903440.218491, len: 69 +Insert lsn: 343, time: 1338903440.218516, len: 69 +Insert lsn: 344, time: 1338903440.218542, len: 69 +Insert lsn: 345, time: 1338903440.218567, len: 69 +Insert lsn: 346, time: 1338903440.218592, len: 69 +Insert lsn: 347, time: 1338903440.218617, len: 69 +Insert lsn: 348, time: 1338903440.218643, len: 69 +Insert lsn: 349, time: 1338903440.218669, len: 69 +Insert lsn: 350, time: 1338903440.218695, len: 69 +Insert lsn: 351, time: 1338903440.218721, len: 69 +Insert lsn: 352, time: 1338903440.218748, len: 69 +Insert lsn: 353, time: 1338903440.218773, len: 69 +Insert lsn: 354, time: 1338903440.218798, len: 69 +Insert lsn: 355, time: 1338903440.218824, len: 69 +Insert lsn: 356, time: 1338903440.218851, len: 69 +Insert lsn: 357, time: 1338903440.218877, len: 69 +Insert lsn: 358, time: 1338903440.218915, len: 69 +Insert lsn: 359, time: 1338903440.218943, len: 69 +Insert lsn: 360, time: 1338903440.218969, len: 69 +Insert lsn: 361, time: 1338903440.219052, len: 69 +Insert lsn: 362, time: 1338903440.219089, len: 69 +Insert lsn: 363, time: 1338903440.219114, len: 69 +Insert lsn: 364, time: 1338903440.219139, len: 69 +Insert lsn: 365, time: 1338903440.219164, len: 69 +Insert lsn: 366, time: 1338903440.219190, len: 69 +Insert lsn: 367, time: 1338903440.219216, len: 69 +Insert lsn: 368, time: 1338903440.219241, len: 69 +Insert lsn: 369, time: 1338903440.219266, len: 69 +Insert lsn: 370, time: 1338903440.219291, len: 69 +Insert lsn: 371, time: 1338903440.219316, len: 69 +Insert lsn: 372, time: 1338903440.219342, len: 69 +Insert lsn: 373, time: 1338903440.219367, len: 69 +Insert lsn: 374, time: 1338903440.219391, len: 69 +Insert lsn: 375, time: 1338903440.219422, len: 69 +Insert lsn: 376, time: 1338903440.219448, len: 69 +Insert lsn: 377, time: 1338903440.219478, len: 69 +Insert lsn: 378, time: 1338903440.219503, len: 69 +Insert lsn: 379, time: 1338903440.219528, len: 69 +Insert lsn: 380, time: 1338903440.219552, len: 69 +Insert lsn: 381, time: 1338903440.219577, len: 69 +Insert lsn: 382, time: 1338903440.219601, len: 69 +Insert lsn: 383, time: 1338903440.219625, len: 69 +Insert lsn: 384, time: 1338903440.219650, len: 69 +Insert lsn: 385, time: 1338903440.219675, len: 69 +Insert lsn: 386, time: 1338903440.219700, len: 69 +Insert lsn: 387, time: 1338903440.219725, len: 69 +Insert lsn: 388, time: 1338903440.219749, len: 69 +Insert lsn: 389, time: 1338903440.219774, len: 69 +Insert lsn: 390, time: 1338903440.219798, len: 69 +Insert lsn: 391, time: 1338903440.219823, len: 69 +Insert lsn: 392, time: 1338903440.219847, len: 69 +Insert lsn: 393, time: 1338903440.219882, len: 69 +Insert lsn: 394, time: 1338903440.219907, len: 69 +Insert lsn: 395, time: 1338903440.219932, len: 69 +Insert lsn: 396, time: 1338903440.219957, len: 69 +Insert lsn: 397, time: 1338903440.219981, len: 69 +Insert lsn: 398, time: 1338903440.220006, len: 69 +Insert lsn: 399, time: 1338903440.220031, len: 69 +Insert lsn: 400, time: 1338903440.220055, len: 69 +Insert lsn: 401, time: 1338903440.220099, len: 69 +Insert lsn: 402, time: 1338903440.220698, len: 100 +Insert lsn: 403, time: 1338903440.220780, len: 100 +Insert lsn: 404, time: 1338903440.220809, len: 100 +Insert lsn: 405, time: 1338903440.220836, len: 100 +Insert lsn: 406, time: 1338903440.220861, len: 100 +Insert lsn: 407, time: 1338903440.220887, len: 100 +Insert lsn: 408, time: 1338903440.220913, len: 100 +Insert lsn: 409, time: 1338903440.220939, len: 100 +Insert lsn: 410, time: 1338903440.220966, len: 100 +Insert lsn: 411, time: 1338903440.220993, len: 100 +Insert lsn: 412, time: 1338903440.221020, len: 101 +Insert lsn: 413, time: 1338903440.221047, len: 101 +Insert lsn: 414, time: 1338903440.221074, len: 101 +Insert lsn: 415, time: 1338903440.221101, len: 101 +Insert lsn: 416, time: 1338903440.221127, len: 101 +Insert lsn: 417, time: 1338903440.221155, len: 101 +Insert lsn: 418, time: 1338903440.221181, len: 101 +Insert lsn: 419, time: 1338903440.221207, len: 101 +Insert lsn: 420, time: 1338903440.221233, len: 101 +Insert lsn: 421, time: 1338903440.221260, len: 101 +Insert lsn: 422, time: 1338903440.221287, len: 101 +Insert lsn: 423, time: 1338903440.221313, len: 101 +Insert lsn: 424, time: 1338903440.221339, len: 101 +Insert lsn: 425, time: 1338903440.221366, len: 101 +Insert lsn: 426, time: 1338903440.221393, len: 101 +Insert lsn: 427, time: 1338903440.221418, len: 101 +Insert lsn: 428, time: 1338903440.221443, len: 101 +Insert lsn: 429, time: 1338903440.221468, len: 101 +Insert lsn: 430, time: 1338903440.221493, len: 101 +Insert lsn: 431, time: 1338903440.221518, len: 101 +Insert lsn: 432, time: 1338903440.221605, len: 101 +Insert lsn: 433, time: 1338903440.221638, len: 101 +Insert lsn: 434, time: 1338903440.221663, len: 101 +Insert lsn: 435, time: 1338903440.221688, len: 101 +Insert lsn: 436, time: 1338903440.221714, len: 101 +Insert lsn: 437, time: 1338903440.221739, len: 101 +Insert lsn: 438, time: 1338903440.221764, len: 101 +Insert lsn: 439, time: 1338903440.221788, len: 101 +Insert lsn: 440, time: 1338903440.221814, len: 101 +Insert lsn: 441, time: 1338903440.221840, len: 101 +Insert lsn: 442, time: 1338903440.221865, len: 101 +Insert lsn: 443, time: 1338903440.221889, len: 101 +Insert lsn: 444, time: 1338903440.221914, len: 101 +Insert lsn: 445, time: 1338903440.221939, len: 101 +Insert lsn: 446, time: 1338903440.221964, len: 101 +Insert lsn: 447, time: 1338903440.221988, len: 101 +Insert lsn: 448, time: 1338903440.222013, len: 101 +Insert lsn: 449, time: 1338903440.222038, len: 101 +Insert lsn: 450, time: 1338903440.222062, len: 101 +Insert lsn: 451, time: 1338903440.222087, len: 101 +Insert lsn: 452, time: 1338903440.222111, len: 101 +Insert lsn: 453, time: 1338903440.222136, len: 101 +Insert lsn: 454, time: 1338903440.222160, len: 101 +Insert lsn: 455, time: 1338903440.222184, len: 101 +Insert lsn: 456, time: 1338903440.222211, len: 101 +Insert lsn: 457, time: 1338903440.222237, len: 101 +Insert lsn: 458, time: 1338903440.222264, len: 101 +Insert lsn: 459, time: 1338903440.222289, len: 101 +Insert lsn: 460, time: 1338903440.222314, len: 101 +Insert lsn: 461, time: 1338903440.222339, len: 101 +Insert lsn: 462, time: 1338903440.222366, len: 101 +Insert lsn: 463, time: 1338903440.222422, len: 101 +Insert lsn: 464, time: 1338903440.222450, len: 101 +Insert lsn: 465, time: 1338903440.222475, len: 101 +Insert lsn: 466, time: 1338903440.222500, len: 101 +Insert lsn: 467, time: 1338903440.222526, len: 101 +Insert lsn: 468, time: 1338903440.222562, len: 101 +Insert lsn: 469, time: 1338903440.222588, len: 101 +Insert lsn: 470, time: 1338903440.222614, len: 101 +Insert lsn: 471, time: 1338903440.222639, len: 101 +Insert lsn: 472, time: 1338903440.222664, len: 101 +Insert lsn: 473, time: 1338903440.222691, len: 101 +Insert lsn: 474, time: 1338903440.222717, len: 101 +Insert lsn: 475, time: 1338903440.222742, len: 101 +Insert lsn: 476, time: 1338903440.222767, len: 101 +Insert lsn: 477, time: 1338903440.222800, len: 101 +Insert lsn: 478, time: 1338903440.222826, len: 101 +Insert lsn: 479, time: 1338903440.222851, len: 101 +Insert lsn: 480, time: 1338903440.222876, len: 101 +Insert lsn: 481, time: 1338903440.222901, len: 101 +Insert lsn: 482, time: 1338903440.222926, len: 101 +Insert lsn: 483, time: 1338903440.222951, len: 101 +Insert lsn: 484, time: 1338903440.222976, len: 101 +Insert lsn: 485, time: 1338903440.223000, len: 101 +Insert lsn: 486, time: 1338903440.223025, len: 101 +Insert lsn: 487, time: 1338903440.223049, len: 101 +Insert lsn: 488, time: 1338903440.223074, len: 101 +Insert lsn: 489, time: 1338903440.223100, len: 101 +Insert lsn: 490, time: 1338903440.223125, len: 101 +Insert lsn: 491, time: 1338903440.223149, len: 101 +Insert lsn: 492, time: 1338903440.223174, len: 101 +Insert lsn: 493, time: 1338903440.223199, len: 101 +Insert lsn: 494, time: 1338903440.223256, len: 101 +Insert lsn: 495, time: 1338903440.223284, len: 101 +Insert lsn: 496, time: 1338903440.223311, len: 101 +Insert lsn: 497, time: 1338903440.223336, len: 101 +Insert lsn: 498, time: 1338903440.223361, len: 101 +Insert lsn: 499, time: 1338903440.223386, len: 101 +Insert lsn: 500, time: 1338903440.223410, len: 101 +Insert lsn: 501, time: 1338903440.223435, len: 101 +Insert lsn: 502, time: 1338903440.224114, len: 166 +Insert lsn: 503, time: 1338903440.224227, len: 166 +Insert lsn: 504, time: 1338903440.224259, len: 166 +Insert lsn: 505, time: 1338903440.224284, len: 166 +Insert lsn: 506, time: 1338903440.224311, len: 166 +Insert lsn: 507, time: 1338903440.224339, len: 166 +Insert lsn: 508, time: 1338903440.224365, len: 166 +Insert lsn: 509, time: 1338903440.224391, len: 166 +Insert lsn: 510, time: 1338903440.224418, len: 166 +Insert lsn: 511, time: 1338903440.224444, len: 166 +Insert lsn: 512, time: 1338903440.224471, len: 167 +Insert lsn: 513, time: 1338903440.224497, len: 167 +Insert lsn: 514, time: 1338903440.224523, len: 167 +Insert lsn: 515, time: 1338903440.224550, len: 167 +Insert lsn: 516, time: 1338903440.224576, len: 167 +Insert lsn: 517, time: 1338903440.224639, len: 167 +Insert lsn: 518, time: 1338903440.224671, len: 167 +Insert lsn: 519, time: 1338903440.224698, len: 167 +Insert lsn: 520, time: 1338903440.224725, len: 167 +Insert lsn: 521, time: 1338903440.224753, len: 167 +Insert lsn: 522, time: 1338903440.224780, len: 167 +Insert lsn: 523, time: 1338903440.224806, len: 167 +Insert lsn: 524, time: 1338903440.224833, len: 167 +Insert lsn: 525, time: 1338903440.224860, len: 167 +Insert lsn: 526, time: 1338903440.224888, len: 167 +Insert lsn: 527, time: 1338903440.224938, len: 167 +Insert lsn: 528, time: 1338903440.224967, len: 167 +Insert lsn: 529, time: 1338903440.224994, len: 167 +Insert lsn: 530, time: 1338903440.225020, len: 167 +Insert lsn: 531, time: 1338903440.225047, len: 167 +Insert lsn: 532, time: 1338903440.225073, len: 167 +Insert lsn: 533, time: 1338903440.225100, len: 167 +Insert lsn: 534, time: 1338903440.225126, len: 167 +Insert lsn: 535, time: 1338903440.225152, len: 167 +Insert lsn: 536, time: 1338903440.225180, len: 167 +Insert lsn: 537, time: 1338903440.225206, len: 167 +Insert lsn: 538, time: 1338903440.225260, len: 167 +Insert lsn: 539, time: 1338903440.225290, len: 167 +Insert lsn: 540, time: 1338903440.225316, len: 167 +Insert lsn: 541, time: 1338903440.225343, len: 167 +Insert lsn: 542, time: 1338903440.225369, len: 167 +Insert lsn: 543, time: 1338903440.225395, len: 167 +Insert lsn: 544, time: 1338903440.225421, len: 167 +Insert lsn: 545, time: 1338903440.225448, len: 167 +Insert lsn: 546, time: 1338903440.225474, len: 167 +Insert lsn: 547, time: 1338903440.225500, len: 167 +Insert lsn: 548, time: 1338903440.225527, len: 167 +Insert lsn: 549, time: 1338903440.225554, len: 167 +Insert lsn: 550, time: 1338903440.225580, len: 167 +Insert lsn: 551, time: 1338903440.225605, len: 167 +Insert lsn: 552, time: 1338903440.225631, len: 167 +Insert lsn: 553, time: 1338903440.225658, len: 167 +Insert lsn: 554, time: 1338903440.225685, len: 167 +Insert lsn: 555, time: 1338903440.225711, len: 167 +Insert lsn: 556, time: 1338903440.225738, len: 167 +Insert lsn: 557, time: 1338903440.225765, len: 167 +Insert lsn: 558, time: 1338903440.225792, len: 167 +Insert lsn: 559, time: 1338903440.225836, len: 167 +Insert lsn: 560, time: 1338903440.225865, len: 167 +Insert lsn: 561, time: 1338903440.225892, len: 167 +Insert lsn: 562, time: 1338903440.225919, len: 167 +Insert lsn: 563, time: 1338903440.225945, len: 167 +Insert lsn: 564, time: 1338903440.225971, len: 167 +Insert lsn: 565, time: 1338903440.225997, len: 167 +Insert lsn: 566, time: 1338903440.226024, len: 167 +Insert lsn: 567, time: 1338903440.226051, len: 167 +Insert lsn: 568, time: 1338903440.226080, len: 167 +Insert lsn: 569, time: 1338903440.226107, len: 167 +Insert lsn: 570, time: 1338903440.226134, len: 167 +Insert lsn: 571, time: 1338903440.226162, len: 167 +Insert lsn: 572, time: 1338903440.226190, len: 167 +Insert lsn: 573, time: 1338903440.226217, len: 167 +Insert lsn: 574, time: 1338903440.226244, len: 167 +Insert lsn: 575, time: 1338903440.226271, len: 167 +Insert lsn: 576, time: 1338903440.226296, len: 167 +Insert lsn: 577, time: 1338903440.226322, len: 167 +Insert lsn: 578, time: 1338903440.226348, len: 167 +Insert lsn: 579, time: 1338903440.226392, len: 167 +Insert lsn: 580, time: 1338903440.226420, len: 167 +Insert lsn: 581, time: 1338903440.226446, len: 167 +Insert lsn: 582, time: 1338903440.226471, len: 167 +Insert lsn: 583, time: 1338903440.226496, len: 167 +Insert lsn: 584, time: 1338903440.226521, len: 167 +Insert lsn: 585, time: 1338903440.226546, len: 167 +Insert lsn: 586, time: 1338903440.226571, len: 167 +Insert lsn: 587, time: 1338903440.226596, len: 167 +Insert lsn: 588, time: 1338903440.226622, len: 167 +Insert lsn: 589, time: 1338903440.226648, len: 167 +Insert lsn: 590, time: 1338903440.226674, len: 167 +Insert lsn: 591, time: 1338903440.226699, len: 167 +Insert lsn: 592, time: 1338903440.226724, len: 167 +Insert lsn: 593, time: 1338903440.226749, len: 167 +Insert lsn: 594, time: 1338903440.226774, len: 167 +Insert lsn: 595, time: 1338903440.226799, len: 167 +Insert lsn: 596, time: 1338903440.226825, len: 167 +Insert lsn: 597, time: 1338903440.226850, len: 167 +Insert lsn: 598, time: 1338903440.226882, len: 167 +Insert lsn: 599, time: 1338903440.226907, len: 167 +Insert lsn: 600, time: 1338903440.226949, len: 167 +Insert lsn: 601, time: 1338903440.226978, len: 167 +Update lsn: 602, time: 1338903440.227788, len: 77 +Update lsn: 603, time: 1338903440.227901, len: 77 +Update lsn: 604, time: 1338903440.227932, len: 77 +Update lsn: 605, time: 1338903440.227961, len: 77 +Update lsn: 606, time: 1338903440.227988, len: 77 +Update lsn: 607, time: 1338903440.228014, len: 77 +Update lsn: 608, time: 1338903440.228041, len: 77 +Update lsn: 609, time: 1338903440.228069, len: 77 +Update lsn: 610, time: 1338903440.228096, len: 77 +Update lsn: 611, time: 1338903440.228123, len: 77 +Update lsn: 612, time: 1338903440.228150, len: 78 +Update lsn: 613, time: 1338903440.228177, len: 78 +Update lsn: 614, time: 1338903440.228204, len: 78 +Update lsn: 615, time: 1338903440.228250, len: 78 +Update lsn: 616, time: 1338903440.228283, len: 78 +Update lsn: 617, time: 1338903440.228311, len: 78 +Update lsn: 618, time: 1338903440.228338, len: 78 +Update lsn: 619, time: 1338903440.228365, len: 78 +Update lsn: 620, time: 1338903440.228393, len: 78 +Update lsn: 621, time: 1338903440.228421, len: 78 +Update lsn: 622, time: 1338903440.228448, len: 78 +Update lsn: 623, time: 1338903440.228475, len: 78 +Update lsn: 624, time: 1338903440.228502, len: 78 +Update lsn: 625, time: 1338903440.228530, len: 78 +Update lsn: 626, time: 1338903440.228556, len: 78 +Update lsn: 627, time: 1338903440.228583, len: 78 +Update lsn: 628, time: 1338903440.228611, len: 78 +Update lsn: 629, time: 1338903440.228639, len: 78 +Update lsn: 630, time: 1338903440.228668, len: 78 +Update lsn: 631, time: 1338903440.228695, len: 78 +Update lsn: 632, time: 1338903440.228723, len: 78 +Update lsn: 633, time: 1338903440.228751, len: 78 +Update lsn: 634, time: 1338903440.228778, len: 78 +Update lsn: 635, time: 1338903440.228838, len: 78 +Update lsn: 636, time: 1338903440.228867, len: 78 +Update lsn: 637, time: 1338903440.228892, len: 78 +Update lsn: 638, time: 1338903440.228918, len: 78 +Update lsn: 639, time: 1338903440.228944, len: 78 +Update lsn: 640, time: 1338903440.228969, len: 78 +Update lsn: 641, time: 1338903440.228995, len: 78 +Update lsn: 642, time: 1338903440.229021, len: 78 +Update lsn: 643, time: 1338903440.229047, len: 78 +Update lsn: 644, time: 1338903440.229073, len: 78 +Update lsn: 645, time: 1338903440.229099, len: 78 +Update lsn: 646, time: 1338903440.229125, len: 78 +Update lsn: 647, time: 1338903440.229150, len: 78 +Update lsn: 648, time: 1338903440.229176, len: 78 +Update lsn: 649, time: 1338903440.229201, len: 78 +Update lsn: 650, time: 1338903440.229228, len: 78 +Update lsn: 651, time: 1338903440.229254, len: 78 +Update lsn: 652, time: 1338903440.229281, len: 78 +Update lsn: 653, time: 1338903440.229307, len: 78 +Update lsn: 654, time: 1338903440.229333, len: 78 +Update lsn: 655, time: 1338903440.229360, len: 78 +Update lsn: 656, time: 1338903440.229386, len: 78 +Update lsn: 657, time: 1338903440.229412, len: 78 +Update lsn: 658, time: 1338903440.229439, len: 78 +Update lsn: 659, time: 1338903440.229465, len: 78 +Update lsn: 660, time: 1338903440.229491, len: 78 +Update lsn: 661, time: 1338903440.229517, len: 78 +Update lsn: 662, time: 1338903440.229544, len: 78 +Update lsn: 663, time: 1338903440.229584, len: 78 +Update lsn: 664, time: 1338903440.229612, len: 78 +Update lsn: 665, time: 1338903440.229639, len: 78 +Update lsn: 666, time: 1338903440.229666, len: 78 +Update lsn: 667, time: 1338903440.229694, len: 78 +Update lsn: 668, time: 1338903440.229723, len: 78 +Update lsn: 669, time: 1338903440.229752, len: 78 +Update lsn: 670, time: 1338903440.229779, len: 78 +Update lsn: 671, time: 1338903440.229808, len: 78 +Update lsn: 672, time: 1338903440.229862, len: 78 +Update lsn: 673, time: 1338903440.229892, len: 78 +Update lsn: 674, time: 1338903440.229933, len: 78 +Update lsn: 675, time: 1338903440.229961, len: 78 +Update lsn: 676, time: 1338903440.229988, len: 78 +Update lsn: 677, time: 1338903440.230015, len: 78 +Update lsn: 678, time: 1338903440.230042, len: 78 +Update lsn: 679, time: 1338903440.230069, len: 78 +Update lsn: 680, time: 1338903440.230096, len: 78 +Update lsn: 681, time: 1338903440.230124, len: 78 +Update lsn: 682, time: 1338903440.230153, len: 78 +Update lsn: 683, time: 1338903440.230180, len: 78 +Update lsn: 684, time: 1338903440.230210, len: 78 +Update lsn: 685, time: 1338903440.230248, len: 78 +Update lsn: 686, time: 1338903440.230274, len: 78 +Update lsn: 687, time: 1338903440.230300, len: 78 +Update lsn: 688, time: 1338903440.230326, len: 78 +Update lsn: 689, time: 1338903440.230352, len: 78 +Update lsn: 690, time: 1338903440.230380, len: 78 +Update lsn: 691, time: 1338903440.230408, len: 78 +Update lsn: 692, time: 1338903440.230434, len: 78 +Update lsn: 693, time: 1338903440.230462, len: 78 +Update lsn: 694, time: 1338903440.230488, len: 78 +Update lsn: 695, time: 1338903440.230515, len: 78 +Update lsn: 696, time: 1338903440.230541, len: 78 +Update lsn: 697, time: 1338903440.230567, len: 78 +Update lsn: 698, time: 1338903440.230593, len: 78 +Update lsn: 699, time: 1338903440.230619, len: 78 +Update lsn: 700, time: 1338903440.230645, len: 78 +Update lsn: 701, time: 1338903440.230670, len: 78 +Update lsn: 702, time: 1338903440.231167, len: 109 +Update lsn: 703, time: 1338903440.231248, len: 109 +Update lsn: 704, time: 1338903440.231279, len: 109 +Update lsn: 705, time: 1338903440.231308, len: 109 +Update lsn: 706, time: 1338903440.231335, len: 109 +Update lsn: 707, time: 1338903440.231362, len: 109 +Update lsn: 708, time: 1338903440.231420, len: 109 +Update lsn: 709, time: 1338903440.231452, len: 109 +Update lsn: 710, time: 1338903440.231482, len: 109 +Update lsn: 711, time: 1338903440.231512, len: 109 +Update lsn: 712, time: 1338903440.231540, len: 110 +Update lsn: 713, time: 1338903440.231589, len: 110 +Update lsn: 714, time: 1338903440.231620, len: 110 +Update lsn: 715, time: 1338903440.231647, len: 110 +Update lsn: 716, time: 1338903440.231674, len: 110 +Update lsn: 717, time: 1338903440.231703, len: 110 +Update lsn: 718, time: 1338903440.231731, len: 110 +Update lsn: 719, time: 1338903440.231761, len: 110 +Update lsn: 720, time: 1338903440.231789, len: 110 +Update lsn: 721, time: 1338903440.231818, len: 110 +Update lsn: 722, time: 1338903440.231847, len: 110 +Update lsn: 723, time: 1338903440.231874, len: 110 +Update lsn: 724, time: 1338903440.231900, len: 110 +Update lsn: 725, time: 1338903440.231927, len: 110 +Update lsn: 726, time: 1338903440.231954, len: 110 +Update lsn: 727, time: 1338903440.231981, len: 110 +Update lsn: 728, time: 1338903440.232007, len: 110 +Update lsn: 729, time: 1338903440.232034, len: 110 +Update lsn: 730, time: 1338903440.232061, len: 110 +Update lsn: 731, time: 1338903440.232088, len: 110 +Update lsn: 732, time: 1338903440.232114, len: 110 +Update lsn: 733, time: 1338903440.232140, len: 110 +Update lsn: 734, time: 1338903440.232166, len: 110 +Update lsn: 735, time: 1338903440.232192, len: 110 +Update lsn: 736, time: 1338903440.232217, len: 110 +Update lsn: 737, time: 1338903440.232270, len: 110 +Update lsn: 738, time: 1338903440.232300, len: 110 +Update lsn: 739, time: 1338903440.232326, len: 110 +Update lsn: 740, time: 1338903440.232352, len: 110 +Update lsn: 741, time: 1338903440.232377, len: 110 +Update lsn: 742, time: 1338903440.232403, len: 110 +Update lsn: 743, time: 1338903440.232429, len: 110 +Update lsn: 744, time: 1338903440.232456, len: 110 +Update lsn: 745, time: 1338903440.232483, len: 110 +Update lsn: 746, time: 1338903440.232509, len: 110 +Update lsn: 747, time: 1338903440.232537, len: 110 +Update lsn: 748, time: 1338903440.232564, len: 110 +Update lsn: 749, time: 1338903440.232590, len: 110 +Update lsn: 750, time: 1338903440.232617, len: 110 +Update lsn: 751, time: 1338903440.232643, len: 110 +Update lsn: 752, time: 1338903440.232670, len: 110 +Update lsn: 753, time: 1338903440.232697, len: 110 +Update lsn: 754, time: 1338903440.232724, len: 110 +Update lsn: 755, time: 1338903440.232750, len: 110 +Update lsn: 756, time: 1338903440.232777, len: 110 +Update lsn: 757, time: 1338903440.232803, len: 110 +Update lsn: 758, time: 1338903440.232829, len: 110 +Update lsn: 759, time: 1338903440.232856, len: 110 +Update lsn: 760, time: 1338903440.232883, len: 110 +Update lsn: 761, time: 1338903440.232909, len: 110 +Update lsn: 762, time: 1338903440.232936, len: 110 +Update lsn: 763, time: 1338903440.232962, len: 110 +Update lsn: 764, time: 1338903440.232989, len: 110 +Update lsn: 765, time: 1338903440.233016, len: 110 +Update lsn: 766, time: 1338903440.233063, len: 110 +Update lsn: 767, time: 1338903440.233091, len: 110 +Update lsn: 768, time: 1338903440.233117, len: 110 +Update lsn: 769, time: 1338903440.233144, len: 110 +Update lsn: 770, time: 1338903440.233170, len: 110 +Update lsn: 771, time: 1338903440.233196, len: 110 +Update lsn: 772, time: 1338903440.233221, len: 110 +Update lsn: 773, time: 1338903440.233247, len: 110 +Update lsn: 774, time: 1338903440.233274, len: 110 +Update lsn: 775, time: 1338903440.233300, len: 110 +Update lsn: 776, time: 1338903440.233327, len: 110 +Update lsn: 777, time: 1338903440.233354, len: 110 +Update lsn: 778, time: 1338903440.233381, len: 110 +Update lsn: 779, time: 1338903440.233407, len: 110 +Update lsn: 780, time: 1338903440.233434, len: 110 +Update lsn: 781, time: 1338903440.233461, len: 110 +Update lsn: 782, time: 1338903440.233488, len: 110 +Update lsn: 783, time: 1338903440.233515, len: 110 +Update lsn: 784, time: 1338903440.233542, len: 110 +Update lsn: 785, time: 1338903440.233568, len: 110 +Update lsn: 786, time: 1338903440.233595, len: 110 +Update lsn: 787, time: 1338903440.233622, len: 110 +Update lsn: 788, time: 1338903440.233649, len: 110 +Update lsn: 789, time: 1338903440.233677, len: 110 +Update lsn: 790, time: 1338903440.233704, len: 110 +Update lsn: 791, time: 1338903440.233730, len: 110 +Update lsn: 792, time: 1338903440.233757, len: 110 +Update lsn: 793, time: 1338903440.233784, len: 110 +Update lsn: 794, time: 1338903440.233827, len: 110 +Update lsn: 795, time: 1338903440.233855, len: 110 +Update lsn: 796, time: 1338903440.233882, len: 110 +Update lsn: 797, time: 1338903440.233909, len: 110 +Update lsn: 798, time: 1338903440.233936, len: 110 +Update lsn: 799, time: 1338903440.233963, len: 110 +Update lsn: 800, time: 1338903440.233989, len: 110 +Update lsn: 801, time: 1338903440.234015, len: 110 +Update lsn: 802, time: 1338903440.234573, len: 175 +Update lsn: 803, time: 1338903440.234678, len: 175 +Update lsn: 804, time: 1338903440.234710, len: 175 +Update lsn: 805, time: 1338903440.234738, len: 175 +Update lsn: 806, time: 1338903440.234767, len: 175 +Update lsn: 807, time: 1338903440.234796, len: 175 +Update lsn: 808, time: 1338903440.234823, len: 175 +Update lsn: 809, time: 1338903440.234851, len: 175 +Update lsn: 810, time: 1338903440.234878, len: 175 +Update lsn: 811, time: 1338903440.234923, len: 175 +Update lsn: 812, time: 1338903440.234954, len: 176 +Update lsn: 813, time: 1338903440.234984, len: 176 +Update lsn: 814, time: 1338903440.235012, len: 176 +Update lsn: 815, time: 1338903440.235040, len: 176 +Update lsn: 816, time: 1338903440.235068, len: 176 +Update lsn: 817, time: 1338903440.235132, len: 176 +Update lsn: 818, time: 1338903440.235167, len: 176 +Update lsn: 819, time: 1338903440.235196, len: 176 +Update lsn: 820, time: 1338903440.235224, len: 176 +Update lsn: 821, time: 1338903440.235254, len: 176 +Update lsn: 822, time: 1338903440.235282, len: 176 +Update lsn: 823, time: 1338903440.235310, len: 176 +Update lsn: 824, time: 1338903440.235339, len: 176 +Update lsn: 825, time: 1338903440.235368, len: 176 +Update lsn: 826, time: 1338903440.235395, len: 176 +Update lsn: 827, time: 1338903440.235422, len: 176 +Update lsn: 828, time: 1338903440.235449, len: 176 +Update lsn: 829, time: 1338903440.235476, len: 176 +Update lsn: 830, time: 1338903440.235503, len: 176 +Update lsn: 831, time: 1338903440.235530, len: 176 +Update lsn: 832, time: 1338903440.235556, len: 176 +Update lsn: 833, time: 1338903440.235583, len: 176 +Update lsn: 834, time: 1338903440.235609, len: 176 +Update lsn: 835, time: 1338903440.235635, len: 176 +Update lsn: 836, time: 1338903440.235682, len: 176 +Update lsn: 837, time: 1338903440.235711, len: 176 +Update lsn: 838, time: 1338903440.235738, len: 176 +Update lsn: 839, time: 1338903440.235764, len: 176 +Update lsn: 840, time: 1338903440.235790, len: 176 +Update lsn: 841, time: 1338903440.235817, len: 176 +Update lsn: 842, time: 1338903440.235843, len: 176 +Update lsn: 843, time: 1338903440.235869, len: 176 +Update lsn: 844, time: 1338903440.235896, len: 176 +Update lsn: 845, time: 1338903440.235923, len: 176 +Update lsn: 846, time: 1338903440.235949, len: 176 +Update lsn: 847, time: 1338903440.235977, len: 176 +Update lsn: 848, time: 1338903440.236004, len: 176 +Update lsn: 849, time: 1338903440.236031, len: 176 +Update lsn: 850, time: 1338903440.236057, len: 176 +Update lsn: 851, time: 1338903440.236084, len: 176 +Update lsn: 852, time: 1338903440.236110, len: 176 +Update lsn: 853, time: 1338903440.236136, len: 176 +Update lsn: 854, time: 1338903440.236163, len: 176 +Update lsn: 855, time: 1338903440.236189, len: 176 +Update lsn: 856, time: 1338903440.236233, len: 176 +Update lsn: 857, time: 1338903440.236262, len: 176 +Update lsn: 858, time: 1338903440.236289, len: 176 +Update lsn: 859, time: 1338903440.236315, len: 176 +Update lsn: 860, time: 1338903440.236341, len: 176 +Update lsn: 861, time: 1338903440.236368, len: 176 +Update lsn: 862, time: 1338903440.236394, len: 176 +Update lsn: 863, time: 1338903440.236421, len: 176 +Update lsn: 864, time: 1338903440.236448, len: 176 +Update lsn: 865, time: 1338903440.236475, len: 176 +Update lsn: 866, time: 1338903440.236501, len: 176 +Update lsn: 867, time: 1338903440.236527, len: 176 +Update lsn: 868, time: 1338903440.236554, len: 176 +Update lsn: 869, time: 1338903440.236581, len: 176 +Update lsn: 870, time: 1338903440.236608, len: 176 +Update lsn: 871, time: 1338903440.236634, len: 176 +Update lsn: 872, time: 1338903440.236660, len: 176 +Update lsn: 873, time: 1338903440.236687, len: 176 +Update lsn: 874, time: 1338903440.236713, len: 176 +Update lsn: 875, time: 1338903440.236739, len: 176 +Update lsn: 876, time: 1338903440.236782, len: 176 +Update lsn: 877, time: 1338903440.236810, len: 176 +Update lsn: 878, time: 1338903440.236837, len: 176 +Update lsn: 879, time: 1338903440.236864, len: 176 +Update lsn: 880, time: 1338903440.236892, len: 176 +Update lsn: 881, time: 1338903440.236919, len: 176 +Update lsn: 882, time: 1338903440.236945, len: 176 +Update lsn: 883, time: 1338903440.236972, len: 176 +Update lsn: 884, time: 1338903440.236998, len: 176 +Update lsn: 885, time: 1338903440.237024, len: 176 +Update lsn: 886, time: 1338903440.237050, len: 176 +Update lsn: 887, time: 1338903440.237077, len: 176 +Update lsn: 888, time: 1338903440.237103, len: 176 +Update lsn: 889, time: 1338903440.237131, len: 176 +Update lsn: 890, time: 1338903440.237158, len: 176 +Update lsn: 891, time: 1338903440.237184, len: 176 +Update lsn: 892, time: 1338903440.237211, len: 176 +Update lsn: 893, time: 1338903440.237236, len: 176 +Update lsn: 894, time: 1338903440.237262, len: 176 +Update lsn: 895, time: 1338903440.237289, len: 176 +Update lsn: 896, time: 1338903440.237339, len: 176 +Update lsn: 897, time: 1338903440.237368, len: 176 +Update lsn: 898, time: 1338903440.237395, len: 176 +Update lsn: 899, time: 1338903440.237421, len: 176 +Update lsn: 900, time: 1338903440.237448, len: 176 +Update lsn: 901, time: 1338903440.237475, len: 176 +Update lsn: 902, time: 1338903440.238040, len: 77 +Update lsn: 903, time: 1338903440.238124, len: 77 +Update lsn: 904, time: 1338903440.238156, len: 77 +Update lsn: 905, time: 1338903440.238183, len: 77 +Update lsn: 906, time: 1338903440.238212, len: 77 +Update lsn: 907, time: 1338903440.238899, len: 77 +Update lsn: 908, time: 1338903440.238960, len: 77 +Update lsn: 909, time: 1338903440.238989, len: 77 +Update lsn: 910, time: 1338903440.239016, len: 77 +Update lsn: 911, time: 1338903440.239043, len: 77 +Update lsn: 912, time: 1338903440.239070, len: 78 +Update lsn: 913, time: 1338903440.239097, len: 78 +Update lsn: 914, time: 1338903440.239125, len: 78 +Update lsn: 915, time: 1338903440.239153, len: 78 +Update lsn: 916, time: 1338903440.239180, len: 78 +Update lsn: 917, time: 1338903440.239207, len: 78 +Update lsn: 918, time: 1338903440.239234, len: 78 +Update lsn: 919, time: 1338903440.239261, len: 78 +Update lsn: 920, time: 1338903440.239290, len: 78 +Update lsn: 921, time: 1338903440.240279, len: 78 +Update lsn: 922, time: 1338903440.240328, len: 78 +Update lsn: 923, time: 1338903440.240355, len: 78 +Update lsn: 924, time: 1338903440.240382, len: 78 +Update lsn: 925, time: 1338903440.240409, len: 78 +Update lsn: 926, time: 1338903440.240436, len: 78 +Update lsn: 927, time: 1338903440.240494, len: 78 +Update lsn: 928, time: 1338903440.240522, len: 78 +Update lsn: 929, time: 1338903440.240548, len: 78 +Update lsn: 930, time: 1338903440.240575, len: 78 +Update lsn: 931, time: 1338903440.240604, len: 78 +Update lsn: 932, time: 1338903440.240632, len: 78 +Update lsn: 933, time: 1338903440.240660, len: 78 +Update lsn: 934, time: 1338903440.240687, len: 78 +Update lsn: 935, time: 1338903440.240714, len: 78 +Update lsn: 936, time: 1338903440.240742, len: 78 +Update lsn: 937, time: 1338903440.240770, len: 78 +Update lsn: 938, time: 1338903440.240797, len: 78 +Update lsn: 939, time: 1338903440.240823, len: 78 +Update lsn: 940, time: 1338903440.240851, len: 78 +Update lsn: 941, time: 1338903440.240879, len: 78 +Update lsn: 942, time: 1338903440.240906, len: 78 +Update lsn: 943, time: 1338903440.240934, len: 78 +Update lsn: 944, time: 1338903440.240961, len: 78 +Update lsn: 945, time: 1338903440.240988, len: 78 +Update lsn: 946, time: 1338903440.241016, len: 78 +Update lsn: 947, time: 1338903440.241044, len: 78 +Update lsn: 948, time: 1338903440.241071, len: 78 +Update lsn: 949, time: 1338903440.241097, len: 78 +Update lsn: 950, time: 1338903440.241124, len: 78 +Update lsn: 951, time: 1338903440.241152, len: 78 +Update lsn: 952, time: 1338903440.241179, len: 78 +Update lsn: 953, time: 1338903440.241206, len: 78 +Update lsn: 954, time: 1338903440.241233, len: 78 +Update lsn: 955, time: 1338903440.241260, len: 78 +Update lsn: 956, time: 1338903440.241287, len: 78 +Update lsn: 957, time: 1338903440.241314, len: 78 +Update lsn: 958, time: 1338903440.241341, len: 78 +Update lsn: 959, time: 1338903440.241369, len: 78 +Update lsn: 960, time: 1338903440.241396, len: 78 +Update lsn: 961, time: 1338903440.241424, len: 78 +Update lsn: 962, time: 1338903440.241451, len: 78 +Update lsn: 963, time: 1338903440.241478, len: 78 +Update lsn: 964, time: 1338903440.241524, len: 78 +Update lsn: 965, time: 1338903440.241552, len: 78 +Update lsn: 966, time: 1338903440.241604, len: 78 +Update lsn: 967, time: 1338903440.241632, len: 78 +Update lsn: 968, time: 1338903440.241661, len: 78 +Update lsn: 969, time: 1338903440.241688, len: 78 +Update lsn: 970, time: 1338903440.241715, len: 78 +Update lsn: 971, time: 1338903440.241741, len: 78 +Update lsn: 972, time: 1338903440.241769, len: 78 +Update lsn: 973, time: 1338903440.241796, len: 78 +Update lsn: 974, time: 1338903440.241823, len: 78 +Update lsn: 975, time: 1338903440.241851, len: 78 +Update lsn: 976, time: 1338903440.241879, len: 78 +Update lsn: 977, time: 1338903440.241909, len: 78 +Update lsn: 978, time: 1338903440.241935, len: 78 +Update lsn: 979, time: 1338903440.241962, len: 78 +Update lsn: 980, time: 1338903440.241990, len: 78 +Update lsn: 981, time: 1338903440.242017, len: 78 +Update lsn: 982, time: 1338903440.242044, len: 78 +Update lsn: 983, time: 1338903440.242071, len: 78 +Update lsn: 984, time: 1338903440.242099, len: 78 +Update lsn: 985, time: 1338903440.242126, len: 78 +Update lsn: 986, time: 1338903440.242154, len: 78 +Update lsn: 987, time: 1338903440.242181, len: 78 +Update lsn: 988, time: 1338903440.242208, len: 78 +Update lsn: 989, time: 1338903440.242236, len: 78 +Update lsn: 990, time: 1338903440.242263, len: 78 +Update lsn: 991, time: 1338903440.242290, len: 78 +Update lsn: 992, time: 1338903440.242317, len: 78 +Update lsn: 993, time: 1338903440.242343, len: 78 +Update lsn: 994, time: 1338903440.242370, len: 78 +Update lsn: 995, time: 1338903440.242398, len: 78 +Update lsn: 996, time: 1338903440.242425, len: 78 +Update lsn: 997, time: 1338903440.242452, len: 78 +Update lsn: 998, time: 1338903440.242479, len: 78 +Update lsn: 999, time: 1338903440.242506, len: 78 +Update lsn: 1000, time: 1338903440.242534, len: 78 +Update lsn: 1001, time: 1338903440.242582, len: 78 +Update lsn: 1002, time: 1338903440.243265, len: 109 +Update lsn: 1003, time: 1338903440.243367, len: 109 +Update lsn: 1004, time: 1338903440.243399, len: 109 +Update lsn: 1005, time: 1338903440.243427, len: 109 +Update lsn: 1006, time: 1338903440.243455, len: 109 +Update lsn: 1007, time: 1338903440.243484, len: 109 +Update lsn: 1008, time: 1338903440.243512, len: 109 +Update lsn: 1009, time: 1338903440.243540, len: 109 +Update lsn: 1010, time: 1338903440.243569, len: 109 +Update lsn: 1011, time: 1338903440.243598, len: 109 +Update lsn: 1012, time: 1338903440.243626, len: 110 +Update lsn: 1013, time: 1338903440.243654, len: 110 +Update lsn: 1014, time: 1338903440.243681, len: 110 +Update lsn: 1015, time: 1338903440.243710, len: 110 +Update lsn: 1016, time: 1338903440.243738, len: 110 +Update lsn: 1017, time: 1338903440.243767, len: 110 +Update lsn: 1018, time: 1338903440.243796, len: 110 +Update lsn: 1019, time: 1338903440.243826, len: 110 +Update lsn: 1020, time: 1338903440.243855, len: 110 +Update lsn: 1021, time: 1338903440.243883, len: 110 +Update lsn: 1022, time: 1338903440.243913, len: 110 +Update lsn: 1023, time: 1338903440.243941, len: 110 +Update lsn: 1024, time: 1338903440.243968, len: 110 +Update lsn: 1025, time: 1338903440.243996, len: 110 +Update lsn: 1026, time: 1338903440.244023, len: 110 +Update lsn: 1027, time: 1338903440.244049, len: 110 +Update lsn: 1028, time: 1338903440.244076, len: 110 +Update lsn: 1029, time: 1338903440.244103, len: 110 +Update lsn: 1030, time: 1338903440.244164, len: 110 +Update lsn: 1031, time: 1338903440.244193, len: 110 +Update lsn: 1032, time: 1338903440.244220, len: 110 +Update lsn: 1033, time: 1338903440.244246, len: 110 +Update lsn: 1034, time: 1338903440.244272, len: 110 +Update lsn: 1035, time: 1338903440.244299, len: 110 +Update lsn: 1036, time: 1338903440.244325, len: 110 +Update lsn: 1037, time: 1338903440.244351, len: 110 +Update lsn: 1038, time: 1338903440.244378, len: 110 +Update lsn: 1039, time: 1338903440.244404, len: 110 +Update lsn: 1040, time: 1338903440.244431, len: 110 +Update lsn: 1041, time: 1338903440.244457, len: 110 +Update lsn: 1042, time: 1338903440.244483, len: 110 +Update lsn: 1043, time: 1338903440.244509, len: 110 +Update lsn: 1044, time: 1338903440.244535, len: 110 +Update lsn: 1045, time: 1338903440.244561, len: 110 +Update lsn: 1046, time: 1338903440.244587, len: 110 +Update lsn: 1047, time: 1338903440.244613, len: 110 +Update lsn: 1048, time: 1338903440.244640, len: 110 +Update lsn: 1049, time: 1338903440.244666, len: 110 +Update lsn: 1050, time: 1338903440.244692, len: 110 +Update lsn: 1051, time: 1338903440.244718, len: 110 +Update lsn: 1052, time: 1338903440.244744, len: 110 +Update lsn: 1053, time: 1338903440.244771, len: 110 +Update lsn: 1054, time: 1338903440.244798, len: 110 +Update lsn: 1055, time: 1338903440.244827, len: 110 +Update lsn: 1056, time: 1338903440.244854, len: 110 +Update lsn: 1057, time: 1338903440.244881, len: 110 +Update lsn: 1058, time: 1338903440.244936, len: 110 +Update lsn: 1059, time: 1338903440.244995, len: 110 +Update lsn: 1060, time: 1338903440.245028, len: 110 +Update lsn: 1061, time: 1338903440.245057, len: 110 +Update lsn: 1062, time: 1338903440.245086, len: 110 +Update lsn: 1063, time: 1338903440.245115, len: 110 +Update lsn: 1064, time: 1338903440.245142, len: 110 +Update lsn: 1065, time: 1338903440.245169, len: 110 +Update lsn: 1066, time: 1338903440.245196, len: 110 +Update lsn: 1067, time: 1338903440.245222, len: 110 +Update lsn: 1068, time: 1338903440.245248, len: 110 +Update lsn: 1069, time: 1338903440.245275, len: 110 +Update lsn: 1070, time: 1338903440.245302, len: 110 +Update lsn: 1071, time: 1338903440.245329, len: 110 +Update lsn: 1072, time: 1338903440.245355, len: 110 +Update lsn: 1073, time: 1338903440.245382, len: 110 +Update lsn: 1074, time: 1338903440.245408, len: 110 +Update lsn: 1075, time: 1338903440.245435, len: 110 +Update lsn: 1076, time: 1338903440.245462, len: 110 +Update lsn: 1077, time: 1338903440.245491, len: 110 +Update lsn: 1078, time: 1338903440.245518, len: 110 +Update lsn: 1079, time: 1338903440.245545, len: 110 +Update lsn: 1080, time: 1338903440.245572, len: 110 +Update lsn: 1081, time: 1338903440.245600, len: 110 +Update lsn: 1082, time: 1338903440.245628, len: 110 +Update lsn: 1083, time: 1338903440.245656, len: 110 +Update lsn: 1084, time: 1338903440.245683, len: 110 +Update lsn: 1085, time: 1338903440.245709, len: 110 +Update lsn: 1086, time: 1338903440.245736, len: 110 +Update lsn: 1087, time: 1338903440.245763, len: 110 +Update lsn: 1088, time: 1338903440.245815, len: 110 +Update lsn: 1089, time: 1338903440.245847, len: 110 +Update lsn: 1090, time: 1338903440.245874, len: 110 +Update lsn: 1091, time: 1338903440.245900, len: 110 +Update lsn: 1092, time: 1338903440.245928, len: 110 +Update lsn: 1093, time: 1338903440.245955, len: 110 +Update lsn: 1094, time: 1338903440.245983, len: 110 +Update lsn: 1095, time: 1338903440.246011, len: 110 +Update lsn: 1096, time: 1338903440.246040, len: 110 +Update lsn: 1097, time: 1338903440.246068, len: 110 +Update lsn: 1098, time: 1338903440.246097, len: 110 +Update lsn: 1099, time: 1338903440.246124, len: 110 +Update lsn: 1100, time: 1338903440.246151, len: 110 +Update lsn: 1101, time: 1338903440.246177, len: 110 +Update lsn: 1102, time: 1338903440.246866, len: 175 +Update lsn: 1103, time: 1338903440.246967, len: 175 +Update lsn: 1104, time: 1338903440.247000, len: 175 +Update lsn: 1105, time: 1338903440.247028, len: 175 +Update lsn: 1106, time: 1338903440.247058, len: 175 +Update lsn: 1107, time: 1338903440.247086, len: 175 +Update lsn: 1108, time: 1338903440.247115, len: 175 +Update lsn: 1109, time: 1338903440.247144, len: 175 +Update lsn: 1110, time: 1338903440.247173, len: 175 +Update lsn: 1111, time: 1338903440.247202, len: 175 +Update lsn: 1112, time: 1338903440.247263, len: 176 +Update lsn: 1113, time: 1338903440.247297, len: 176 +Update lsn: 1114, time: 1338903440.247326, len: 176 +Update lsn: 1115, time: 1338903440.247355, len: 176 +Update lsn: 1116, time: 1338903440.247384, len: 176 +Update lsn: 1117, time: 1338903440.247415, len: 176 +Update lsn: 1118, time: 1338903440.247444, len: 176 +Update lsn: 1119, time: 1338903440.247473, len: 176 +Update lsn: 1120, time: 1338903440.247503, len: 176 +Update lsn: 1121, time: 1338903440.247531, len: 176 +Update lsn: 1122, time: 1338903440.247559, len: 176 +Update lsn: 1123, time: 1338903440.247586, len: 176 +Update lsn: 1124, time: 1338903440.247614, len: 176 +Update lsn: 1125, time: 1338903440.247641, len: 176 +Update lsn: 1126, time: 1338903440.247668, len: 176 +Update lsn: 1127, time: 1338903440.247695, len: 176 +Update lsn: 1128, time: 1338903440.247722, len: 176 +Update lsn: 1129, time: 1338903440.247749, len: 176 +Update lsn: 1130, time: 1338903440.247775, len: 176 +Update lsn: 1131, time: 1338903440.247801, len: 176 +Update lsn: 1132, time: 1338903440.247851, len: 176 +Update lsn: 1133, time: 1338903440.247880, len: 176 +Update lsn: 1134, time: 1338903440.247906, len: 176 +Update lsn: 1135, time: 1338903440.247932, len: 176 +Update lsn: 1136, time: 1338903440.247960, len: 176 +Update lsn: 1137, time: 1338903440.247986, len: 176 +Update lsn: 1138, time: 1338903440.248012, len: 176 +Update lsn: 1139, time: 1338903440.248039, len: 176 +Update lsn: 1140, time: 1338903440.248065, len: 176 +Update lsn: 1141, time: 1338903440.248092, len: 176 +Update lsn: 1142, time: 1338903440.248118, len: 176 +Update lsn: 1143, time: 1338903440.248146, len: 176 +Update lsn: 1144, time: 1338903440.248173, len: 176 +Update lsn: 1145, time: 1338903440.248201, len: 176 +Update lsn: 1146, time: 1338903440.248250, len: 176 +Update lsn: 1147, time: 1338903440.248282, len: 176 +Update lsn: 1148, time: 1338903440.248311, len: 176 +Update lsn: 1149, time: 1338903440.248339, len: 176 +Update lsn: 1150, time: 1338903440.248367, len: 176 +Update lsn: 1151, time: 1338903440.248394, len: 176 +Update lsn: 1152, time: 1338903440.248443, len: 176 +Update lsn: 1153, time: 1338903440.248471, len: 176 +Update lsn: 1154, time: 1338903440.248498, len: 176 +Update lsn: 1155, time: 1338903440.248525, len: 176 +Update lsn: 1156, time: 1338903440.248553, len: 176 +Update lsn: 1157, time: 1338903440.248579, len: 176 +Update lsn: 1158, time: 1338903440.248606, len: 176 +Update lsn: 1159, time: 1338903440.248633, len: 176 +Update lsn: 1160, time: 1338903440.248659, len: 176 +Update lsn: 1161, time: 1338903440.248686, len: 176 +Update lsn: 1162, time: 1338903440.248713, len: 176 +Update lsn: 1163, time: 1338903440.248740, len: 176 +Update lsn: 1164, time: 1338903440.248767, len: 176 +Update lsn: 1165, time: 1338903440.248794, len: 176 +Update lsn: 1166, time: 1338903440.248821, len: 176 +Update lsn: 1167, time: 1338903440.248849, len: 176 +Update lsn: 1168, time: 1338903440.248876, len: 176 +Update lsn: 1169, time: 1338903440.248904, len: 176 +Update lsn: 1170, time: 1338903440.248932, len: 176 +Update lsn: 1171, time: 1338903440.248982, len: 176 +Update lsn: 1172, time: 1338903440.249012, len: 176 +Update lsn: 1173, time: 1338903440.249038, len: 176 +Update lsn: 1174, time: 1338903440.249064, len: 176 +Update lsn: 1175, time: 1338903440.249091, len: 176 +Update lsn: 1176, time: 1338903440.249120, len: 176 +Update lsn: 1177, time: 1338903440.249149, len: 176 +Update lsn: 1178, time: 1338903440.249179, len: 176 +Update lsn: 1179, time: 1338903440.249208, len: 176 +Update lsn: 1180, time: 1338903440.249237, len: 176 +Update lsn: 1181, time: 1338903440.249265, len: 176 +Update lsn: 1182, time: 1338903440.249292, len: 176 +Update lsn: 1183, time: 1338903440.249320, len: 176 +Update lsn: 1184, time: 1338903440.249347, len: 176 +Update lsn: 1185, time: 1338903440.249375, len: 176 +Update lsn: 1186, time: 1338903440.249404, len: 176 +Update lsn: 1187, time: 1338903440.249431, len: 176 +Update lsn: 1188, time: 1338903440.249460, len: 176 +Update lsn: 1189, time: 1338903440.249490, len: 176 +Update lsn: 1190, time: 1338903440.249517, len: 176 +Update lsn: 1191, time: 1338903440.249563, len: 176 +Update lsn: 1192, time: 1338903440.249593, len: 176 +Update lsn: 1193, time: 1338903440.249621, len: 176 +Update lsn: 1194, time: 1338903440.249648, len: 176 +Update lsn: 1195, time: 1338903440.249676, len: 176 +Update lsn: 1196, time: 1338903440.249705, len: 176 +Update lsn: 1197, time: 1338903440.249733, len: 176 +Update lsn: 1198, time: 1338903440.249761, len: 176 +Update lsn: 1199, time: 1338903440.249789, len: 176 +Update lsn: 1200, time: 1338903440.249816, len: 176 +Update lsn: 1201, time: 1338903440.249846, len: 176 diff --git a/test/connector_c/xlog_rpl.test b/test/connector_c/xlog_rpl.test new file mode 100644 index 0000000000000000000000000000000000000000..82f23ddcd3a656521bca13400f6e8ce91712df96 --- /dev/null +++ b/test/connector_c/xlog_rpl.test @@ -0,0 +1,35 @@ +import subprocess +import sys +import os + +from lib.tarantool_box_server import TarantoolBoxServer + +p = subprocess.Popen([os.path.join(builddir, "test/connector_c/xlog"), + os.path.join(builddir, "test/connector_c/connector.xlog")], + stdout=subprocess.PIPE) +p.wait() +for line in p.stdout.readlines(): + sys.stdout.write(line) + +server.stop() +server.deploy("connector_c/cfg/master.cfg") +server.stop() + +current_xlog = os.path.join(vardir, "00000000000000000002.xlog") +os.symlink(os.path.abspath("connector_c/connector.xlog"), current_xlog) + +server.start() + +print "" + +p = subprocess.Popen([os.path.join(builddir, "test/connector_c/rpl"), + "127.0.0.1", "33016", "1200"], + stdout=subprocess.PIPE) +p.wait() +for line in p.stdout.readlines(): + sys.stdout.write(line) + +server.stop() +server.deploy() + +# vim: syntax=python