Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: Maria Khaydich <maria.khaydich@tarantool.org>
Cc: tarantool-patches <tarantool-patches@dev.tarantool.org>,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH] box: sql prepare and execute statistics should be reflected in box.stat()
Date: Wed, 19 Feb 2020 20:16:02 +0300	[thread overview]
Message-ID: <20200219171602.GB40100@tarantool.org> (raw)
In-Reply-To: <1582130253.193228635@f540.i.mail.ru>

On 19 Feb 19:37, Maria Khaydich wrote:
> 
> Thank you for the review!
> Proposed fixes are done.
>  
> ----------------------------------------------------------------------
> 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

Please also add @ChangeLog according to our new sop guide. For instance,
see: https://lists.tarantool.org/pipermail/tarantool-patches/2020-February/014301.html
 
>  space = nil
>  ---
>  ...
> +--
> +-- gh-4756: PREPARE and EXECUTE statistics should be present in box.stat()
> +--
> +p = box.stat().PREPARE.total
> +---
> +...
> +e = box.stat().EXECUTE.total
> +---
> +...
> +s = box.prepare([[ SELECT ?; ]])
> +---
> +...
> +s:execute({42})
> +---
> +- metadata:
> +  - name: '?'
> +    type: integer
> +  rows:
> +  - [42]
> +...
> +box.stat().PREPARE.total == p + 1
> +---
> +- true
> +...
> +box.stat().EXECUTE.total == e + 1
> +---
> +- true
> +...
>  -- Cleanup xlog
>  box.snapshot()
>  ---
>  
> diff --git a/test/sql/iproto.test.lua b/test/sql/iproto.test.lua
> index 4019fb7a4..1417aa32b 100644
> --- a/test/sql/iproto.test.lua
> +++ b/test/sql/iproto.test.lua
> @@ -242,5 +242,17 @@ box.schema.user.revoke('guest', 'read,write,execute', 'universe')
>  box.schema.user.revoke('guest', 'create', 'space')
>  space = nil
>  
> +--
> +-- gh-4756: PREPARE and EXECUTE statistics should be present in box.stat()
> +--
> +p = box.stat().PREPARE.total
> +e = box.stat().EXECUTE.total
> +
> +s = box.prepare([[ SELECT ?; ]])
> +s:execute({42})

You also have to unprepare statement. Otherwise it gets stuck in
cache and sql/prepare.test.lua may fail since at the start of
execution it checks cahce size:
https://travis-ci.org/tarantool/tarantool/jobs/652552114?utm_medium=notification&utm_source=github_status

It is sort of basic clean-up which is provided for any schema object
(spaces, triggers etc).

> +box.stat().PREPARE.total == p + 1
> +box.stat().EXECUTE.total == e + 1
> +

Nit: I'd better wrap these statements into asssertions:

assert(box.stat().PREPARE.total == p + 1)

  reply	other threads:[~2020-02-19 17:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10 18:35 Maria Khaydich
2020-02-10 23:06 ` Nikita Pettik
2020-02-13 21:44 ` Vladislav Shpilevoy
2020-02-19 16:37   ` Maria Khaydich
2020-02-19 17:16     ` Nikita Pettik [this message]
2020-02-25 11:08       ` Maria Khaydich
2020-02-25 13:02         ` Nikita Pettik
2020-02-25 20:29           ` Vladislav Shpilevoy
2020-02-26 15:50             ` Maria Khaydich
2020-02-27  0:08               ` Vladislav Shpilevoy
2020-02-27 13:21                 ` Nikita Pettik
2020-03-03 16:42                   ` Maria Khaydich
2020-03-03 22:39                     ` Vladislav Shpilevoy
2020-03-06 11:34                       ` Maria Khaydich
2020-03-06 14:32                         ` Nikita Pettik
2020-03-06 15:09                           ` Nikita Pettik
2020-03-04 13:47                     ` Nikita Pettik
2020-02-25 22:26 ` Kirill Yukhin
2020-02-25 23:30   ` Nikita Pettik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200219171602.GB40100@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=maria.khaydich@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] box: sql prepare and execute statistics should be reflected in box.stat()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox