diff --git a/client/tarantool/tc_print.c b/client/tarantool/tc_print.c index 512cb6b811c4e740e1389b4ed37b162272870a60..c512c35699c7474e63bdffc6ff4e35b4d04fcc86 100644 --- a/client/tarantool/tc_print.c +++ b/client/tarantool/tc_print.c @@ -194,7 +194,6 @@ void tc_print_fields(struct tnt_tuple *tu) while (tnt_next(&ifl)) { if (TNT_IFIELD_IDX(&ifl) != 0) tc_printf(", "); - tc_printf("'"); char *data = TNT_IFIELD_DATA(&ifl); uint32_t size = TNT_IFIELD_SIZE(&ifl); switch (size) { @@ -205,9 +204,10 @@ void tc_print_fields(struct tnt_tuple *tu) tc_printf("%"PRIu64, *((uint64_t*)data)); break; default: + tc_printf("'"); tc_print_string(data, size, 0); + tc_printf("'"); } - tc_printf("'"); } if (ifl.status == TNT_ITER_FAIL) tc_printf("<parsing error>"); diff --git a/client/tarantool/tc_print_snap.c b/client/tarantool/tc_print_snap.c index 41dd902845f48f63ffd23fe94c9329c73d0db804..f16735cafe0bdbbef959bc9ae2852669634c7d58 100644 --- a/client/tarantool/tc_print_snap.c +++ b/client/tarantool/tc_print_snap.c @@ -20,30 +20,30 @@ extern struct tc tc; static void -tc_printer_snap_raw( struct tnt_log_row_snap_v11 *row, +tc_printer_snap_raw( struct tnt_log_row *row, struct tnt_tuple *tu) { if (tc.opt.raw_with_headers) { fwrite(&tnt_log_marker_v11, sizeof(tnt_log_marker_v11), 1, stdout); } - fwrite(row, sizeof(row), 1, stdout); + fwrite(&(row->row_snap), sizeof(row->row_snap), 1, stdout); fwrite(tu->data, tu->size, 1, stdout); } static void -tc_printer_snap_tarantool( struct tnt_log_row_snap_v11 *row, +tc_printer_snap_tarantool( struct tnt_log_row *row, struct tnt_tuple *tu) { tc_printf("space: %"PRIu32" ", - row->space); + row->row_snap.space); tc_print_tuple(tu); } static void -tc_printer_snap_lua( struct tnt_log_row_snap_v11 *row, +tc_printer_snap_lua( struct tnt_log_row *row, struct tnt_tuple *tu) { - tc_printf("lua box.insert(%"PRIu32", ", row->space); + tc_printf("lua box.insert(%"PRIu32", ", row->row_snap.space); tc_print_lua_fields(tu); tc_printf(")"); if (tc.opt.delim_len > 0) diff --git a/client/tarantool/tc_print_snap.h b/client/tarantool/tc_print_snap.h index 9bf467a2bc062be0b8e9c8cfe55dec5bc5d99250..2a661700cba45b70a36227f2be0366b770d21f44 100644 --- a/client/tarantool/tc_print_snap.h +++ b/client/tarantool/tc_print_snap.h @@ -29,7 +29,7 @@ * SUCH DAMAGE. */ -typedef void (*tc_printerf_snap_t)(struct tnt_log_row_snap_v11 *row, +typedef void (*tc_printerf_snap_t)(struct tnt_log_row *row, struct tnt_tuple *tu); tc_printerf_snap_t tc_print_getsnapcb(const char *name); diff --git a/client/tarantool/tc_print_xlog.c b/client/tarantool/tc_print_xlog.c index 542f3952854c4769d6aff3e5094a875736f5d8c1..601e1a876e407c9c3e78f86c1c3308d126388133 100644 --- a/client/tarantool/tc_print_xlog.c +++ b/client/tarantool/tc_print_xlog.c @@ -32,6 +32,7 @@ #include <stdio.h> #include <inttypes.h> #include <strings.h> +#include <arpa/inet.h> #include <connector/c/include/tarantool/tnt.h> #include <connector/c/include/tarantool/tnt_xlog.h> @@ -48,28 +49,31 @@ extern struct tc tc; static void -tc_printer_xlog_raw(struct tnt_log_header_v11 *hdr, +tc_printer_xlog_raw(struct tnt_log_row *row, struct tnt_request *r) { if (tc.opt.raw_with_headers) { fwrite(&tnt_log_marker_v11, sizeof(tnt_log_marker_v11), 1, stdout); } - fwrite(hdr, sizeof(*hdr), 1, stdout); + fwrite(&(row->hdr), sizeof(row->hdr), 1, stdout); fwrite(r->origin, r->origin_size, 1, stdout); } static void -tc_printer_xlog_tarantool(struct tnt_log_header_v11 *hdr, +tc_printer_xlog_tarantool(struct tnt_log_row *row, struct tnt_request *r) { + struct sockaddr_in *peer = (void *)&row->row.cookie; tc_printf("%s, lsn: %"PRIu64", time: %lf, len: %"PRIu32", space: " - "%"PRIu32" ", + "%"PRIu32", cookie: %s:%d ", tc_query_type(r->h.type), - hdr->lsn, - hdr->tm, - hdr->len, - r->r.insert.h.ns + row->hdr.lsn, + row->hdr.tm, + row->hdr.len, + r->r.insert.h.ns, + inet_ntoa(peer->sin_addr), + ntohs(peer->sin_port) ); switch (r->h.type) { case TNT_OP_INSERT: @@ -85,7 +89,7 @@ tc_printer_xlog_tarantool(struct tnt_log_header_v11 *hdr, } static void -tc_printer_xlog_lua(struct tnt_log_header_v11 *hdr, +tc_printer_xlog_lua(struct tnt_log_row *row, struct tnt_request *r) { tc_printf("lua box."); @@ -179,7 +183,7 @@ tc_printer_xlog_lua(struct tnt_log_header_v11 *hdr, } break; } - tc_printf(") -- %"PRIu64, hdr->lsn); + tc_printf(") -- %"PRIu64, row->hdr.lsn); if (tc.opt.delim_len > 0) tc_printf("%s\n", tc.opt.delim); else diff --git a/client/tarantool/tc_print_xlog.h b/client/tarantool/tc_print_xlog.h index e9918606ee7d3278b3d3206f0aa23b404410c7d2..bc48fc989130e1f6c32c55764428e3848d1dd39b 100644 --- a/client/tarantool/tc_print_xlog.h +++ b/client/tarantool/tc_print_xlog.h @@ -29,7 +29,7 @@ * SUCH DAMAGE. */ -typedef void (*tc_printerf_xlog_t)(struct tnt_log_header_v11 *hdr, +typedef void (*tc_printerf_xlog_t)(struct tnt_log_row *row, struct tnt_request *r); tc_printerf_xlog_t tc_print_getxlogcb(const char *name); diff --git a/client/tarantool/tc_store.c b/client/tarantool/tc_store.c index 0fbea373d5e93d835594e5004b9260be226c34cd..17228fe2c7245a6af7d2d74ddbc4643817225946 100644 --- a/client/tarantool/tc_store.c +++ b/client/tarantool/tc_store.c @@ -130,7 +130,7 @@ static int tc_store_xlog_printer(struct tnt_iter *i) { return 0; struct tnt_stream_xlog *s = TNT_SXLOG_CAST(TNT_IREQUEST_STREAM(i)); - ((tc_printerf_xlog_t)tc.opt.xlog_printer)(&s->log.current.hdr, r); + ((tc_printerf_xlog_t)tc.opt.xlog_printer)(&s->log.current, r); return 0; } @@ -142,7 +142,7 @@ static int tc_store_snap_printer(struct tnt_iter *i) { if (ss->log.current.row_snap.space != tc.opt.space) return 0; } - ((tc_printerf_snap_t)tc.opt.snap_printer)(&ss->log.current.row_snap, tu); + ((tc_printerf_snap_t)tc.opt.snap_printer)(&ss->log.current, tu); return 0; }