From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 25 Feb 2019 11:40:02 +0300 From: Vladimir Davydov Subject: Re: [PATCH v2 1/2] iproto: update readahead in existing connections Message-ID: <20190225084002.2amkmg3qojy672vo@esperanza> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: To: Serge Petrenko Cc: georgy@tarantool.org, tarantool-patches@freelists.org List-ID: 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}