Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Serge Petrenko <sergepetrenko@tarantool.org>
Cc: georgy@tarantool.org, tarantool-patches@freelists.org
Subject: Re: [PATCH v2 1/2] iproto: update readahead in existing connections
Date: Mon, 25 Feb 2019 11:40:02 +0300	[thread overview]
Message-ID: <20190225084002.2amkmg3qojy672vo@esperanza> (raw)
In-Reply-To: <ecbb32e035da0f3d62ffb04e8a947bc9a7f6e701.1550771940.git.sergepetrenko@tarantool.org>

On Thu, Feb 21, 2019 at 09:02:35PM +0300, Serge Petrenko wrote:
> diff --git a/test/box/net.box.result b/test/box/net.box.result
> index 6351898b3..d143f98f6 100644
> --- a/test/box/net.box.result
> +++ b/test/box/net.box.result
> @@ -3452,3 +3452,65 @@ box.schema.user.revoke('guest', 'read,write', 'space', '_space')
>  box.schema.user.revoke('guest', 'create', 'space')
>  ---
>  ...
> +--
> +-- gh-3958 updating box.cfg.readahead doesn't affect existing connections.
> +--
> +-- purge old 'readahead limit is reached' messages from the log.
> +test_run:cmd("restart server default")

Please avoid restarting the default instance in tests when you can avoid
it - it increases the test runtime. I removed it and instead decreased
the wait_log buffer size down to 1024 bytes.

> +netbox = require('net.box')
> +---
> +...
> +readahead = box.cfg.readahead
> +---
> +...
> +box.cfg{readahead = 128}
> +---
> +...
> +s = box.schema.space.create("test")
> +---
> +...
> +_ = s:create_index("pk")
> +---
> +...
> +box.schema.user.grant("guest", "read,write", "space", "test")
> +---
> +...
> +-- connection is created with small readahead value,
> +-- make sure it is updated if box.cfg.readahead is changed.
> +c = netbox.connect(box.cfg.listen)
> +---
> +...
> +box.cfg{readahead = 100 * 1024}
> +---
> +...
> +box.error.injection.set("ERRINJ_WAL_DELAY", true)
> +---
> +- ok
> +...
> +test_run:cmd('setopt delimiter ";"')
> +---
> +- true
> +...
> +local pad = string.rep('x', 8192)
> +for i = 1,5 do
> +        c.space.test:replace({i, pad}, {is_async=true})


> +end;
> +---
> +...
> +test_run:cmd('setopt delimiter ""');

Could be written in one line without hurting readability.

> +---
> +- true
> +...
> +box.error.injection.set("ERRINJ_WAL_DELAY", false)
> +---
> +- ok
> +...
> +test_run:wait_log('default', 'readahead limit is reached', nil, 1.0)

0.1 timeout is enough.

> +---
> +...
> +s:drop()
> +---
> +...
> +box.cfg{readahead = readahead}
> +---
> +...

Pushed to 2.1 and 1.10 with the following incremental changes:

diff --git a/test/box/net.box.result b/test/box/net.box.result
index d143f98f..b800531b 100644
--- a/test/box/net.box.result
+++ b/test/box/net.box.result
@@ -3455,11 +3455,6 @@ box.schema.user.revoke('guest', 'create', 'space')
 --
 -- gh-3958 updating box.cfg.readahead doesn't affect existing connections.
 --
--- purge old 'readahead limit is reached' messages from the log.
-test_run:cmd("restart server default")
-netbox = require('net.box')
----
-...
 readahead = box.cfg.readahead
 ---
 ...
@@ -3477,7 +3472,7 @@ box.schema.user.grant("guest", "read,write", "space", "test")
 ...
 -- connection is created with small readahead value,
 -- make sure it is updated if box.cfg.readahead is changed.
-c = netbox.connect(box.cfg.listen)
+c = net.connect(box.cfg.listen)
 ---
 ...
 box.cfg{readahead = 100 * 1024}
@@ -3487,25 +3482,17 @@ box.error.injection.set("ERRINJ_WAL_DELAY", true)
 ---
 - ok
 ...
-test_run:cmd('setopt delimiter ";"')
+pad = string.rep('x', 8192)
 ---
-- true
 ...
-local pad = string.rep('x', 8192)
-for i = 1,5 do
-        c.space.test:replace({i, pad}, {is_async=true})
-end;
+for i = 1, 5 do c.space.test:replace({i, pad}, {is_async = true}) end
 ---
 ...
-test_run:cmd('setopt delimiter ""');
----
-- true
-...
 box.error.injection.set("ERRINJ_WAL_DELAY", false)
 ---
 - ok
 ...
-test_run:wait_log('default', 'readahead limit is reached', nil, 1.0)
+test_run:wait_log('default', 'readahead limit is reached', 1024, 0.1)
 ---
 ...
 s:drop()
diff --git a/test/box/net.box.test.lua b/test/box/net.box.test.lua
index d69a4ee7..9e5ecfa0 100644
--- a/test/box/net.box.test.lua
+++ b/test/box/net.box.test.lua
@@ -1401,10 +1401,6 @@ box.schema.user.revoke('guest', 'create', 'space')
 --
 -- gh-3958 updating box.cfg.readahead doesn't affect existing connections.
 --
--- purge old 'readahead limit is reached' messages from the log.
-test_run:cmd("restart server default")
-netbox = require('net.box')
-
 readahead = box.cfg.readahead
 
 box.cfg{readahead = 128}
@@ -1415,22 +1411,16 @@ box.schema.user.grant("guest", "read,write", "space", "test")
 
 -- connection is created with small readahead value,
 -- make sure it is updated if box.cfg.readahead is changed.
-c = netbox.connect(box.cfg.listen)
+c = net.connect(box.cfg.listen)
 
 box.cfg{readahead = 100 * 1024}
 
 box.error.injection.set("ERRINJ_WAL_DELAY", true)
-
-test_run:cmd('setopt delimiter ";"')
-local pad = string.rep('x', 8192)
-for i = 1,5 do
-        c.space.test:replace({i, pad}, {is_async=true})
-end;
-test_run:cmd('setopt delimiter ""');
-
+pad = string.rep('x', 8192)
+for i = 1, 5 do c.space.test:replace({i, pad}, {is_async = true}) end
 box.error.injection.set("ERRINJ_WAL_DELAY", false)
 
-test_run:wait_log('default', 'readahead limit is reached', nil, 1.0)
+test_run:wait_log('default', 'readahead limit is reached', 1024, 0.1)
 
 s:drop()
 box.cfg{readahead = readahead}

  reply	other threads:[~2019-02-25  8:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-21 18:02 [PATCH v2 0/2] " Serge Petrenko
2019-02-21 18:02 ` [PATCH v2 1/2] " Serge Petrenko
2019-02-25  8:40   ` Vladimir Davydov [this message]
2019-02-21 18:02 ` [PATCH v2 2/2] box: set readahead before replicaset sync Serge Petrenko
2019-02-25  8:40   ` Vladimir Davydov

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=20190225084002.2amkmg3qojy672vo@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=georgy@tarantool.org \
    --cc=sergepetrenko@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH v2 1/2] iproto: update readahead in existing connections' \
    /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