From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp38.i.mail.ru (smtp38.i.mail.ru [94.100.177.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 83205469719 for ; Fri, 14 Feb 2020 00:44:54 +0300 (MSK) References: <1581359737.397395198@f221.i.mail.ru> From: Vladislav Shpilevoy Message-ID: Date: Thu, 13 Feb 2020 22:44:52 +0100 MIME-Version: 1.0 In-Reply-To: <1581359737.397395198@f221.i.mail.ru> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Tarantool-patches] [PATCH] box: sql prepare and execute statistics should be reflected in box.stat() List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Maria Khaydich , tarantool-patches , Alexander Turenko Hi! Thanks for the patch! On 10/02/2020 19:35, Maria Khaydich wrote: > Calling prepare and execute did not update corresponding request statistics > in the box.stat table. This happened because methods that collect stats were > never called where they should have been. >   > Closes #4756 > > --- > Issue: > https://github.com/tarantool/tarantool/issues/4756 > Branch: > https://github.com/tarantool/tarantool/compare/eljashm/gh-4756-box-stat-execute-and-prepare-not-updated Something is broken with the links. When I click on them, all the links are pasted into the address string of my browser concatenated. And this is what I see in the source: https://github.com/tarantool/tarantool/compare/eljashm/gh-4756-box-stat-execute-and-prepare-not-updated So everything is a one huge line. This does not happen with other emails and links. See 2 comments below. >  src/box/execute.c         |  4 ++++ >  test/box-tap/cfg.test.lua | 16 +++++++++++++--- >  2 files changed, 17 insertions(+), 3 deletions(-) > diff --git a/src/box/execute.c b/src/box/execute.c > index dc8dce81c..e775055b4 100644 > --- a/src/box/execute.c > +++ b/src/box/execute.c > @@ -732,6 +735,7 @@ sql_prepare_and_execute(const char *sql, int len, const struct sql_bind *bind, >      if (sql_stmt_compile(sql, len, NULL, &stmt, NULL) != 0) >          return -1; >      assert(stmt != NULL); > +    rmean_collect(rmean_box, IPROTO_PREPARE, 1); 1. Nikita is right, this is called when IPROTO_EXECUTE arrives. You can see that in iproto.cc. This is a separate question, why do we collect IPROTO_* statistics out of iproto. For now lets just use IPROTO_EXECUTE here. >      enum sql_serialization_format format = sql_column_count(stmt) > 0 ? >                         DQL_EXECUTE : DML_EXECUTE; >      port_sql_create(port, stmt, format, true); > diff --git a/test/box-tap/cfg.test.lua b/test/box-tap/cfg.test.lua > index d529447bb..d367aab07 100755 > --- a/test/box-tap/cfg.test.lua > +++ b/test/box-tap/cfg.test.lua > @@ -6,7 +6,7 @@ local socket = require('socket') >  local fio = require('fio') >  local uuid = require('uuid') >  local msgpack = require('msgpack') > -test:plan(104) > +test:plan(106) 2. Here Nikita is also right. This file is for box.cfg() function tests. For iproto statistics, indeed, sql/iproto.test.lua would fit well.