From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 0CEF5469719 for ; Tue, 11 Feb 2020 02:06:02 +0300 (MSK) Date: Tue, 11 Feb 2020 02:06:01 +0300 From: Nikita Pettik Message-ID: <20200210230601.GB99436@tarantool.org> References: <1581359737.397395198@f221.i.mail.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1581359737.397395198@f221.i.mail.ru> 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 Cc: tarantool-patches , Vladislav Shpilevoy On 10 Feb 21:35, Maria Khaydich wrote: > > 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 > @@ -48,6 +48,7 @@ >  #include "box/lua/execute.h" >  #include "box/sql_stmt_cache.h" >  #include "session.h" > +#include "rmean.h" >   >  const char *sql_info_key_strs[] = { >      "row_count", > @@ -608,6 +609,7 @@ sql_prepare(const char *sql, int len, struct port *port) >  { >      uint32_t stmt_id = sql_stmt_calculate_id(sql, len); >      struct sql_stmt *stmt = sql_stmt_cache_find(stmt_id); > +    rmean_collect(rmean_box, IPROTO_PREPARE, 1); >      if (stmt == NULL) { >          if (sql_stmt_compile(sql, len, NULL, &stmt, NULL) != 0) >              return -1; > @@ -669,6 +671,7 @@ static inline int >  sql_execute(struct sql_stmt *stmt, struct port *port, struct region *region) >  { >      int rc, column_count = sql_column_count(stmt); > +    rmean_collect(rmean_box, IPROTO_EXECUTE, 1); >      if (column_count > 0) { >          /* Either ROW or DONE or ERROR. */ >          while ((rc = sql_step(stmt)) == SQL_ROW) { > @@ -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); prepare_and_execute() is supposed to handle IPROTO_EXECUTE request. >      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 box-tap/cfg.test is unlikely to be proper place for this test. Look at sql/ suite (for instance, sql/iproto.test.lua).