From: Serge Petrenko <sergepetrenko@tarantool.org> To: vdavydov.dev@gmail.com Cc: georgy@tarantool.org, tarantool-patches@freelists.org, Serge Petrenko <sergepetrenko@tarantool.org> Subject: [PATCH v2 1/2] iproto: update readahead in existing connections Date: Thu, 21 Feb 2019 21:02:35 +0300 [thread overview] Message-ID: <ecbb32e035da0f3d62ffb04e8a947bc9a7f6e701.1550771940.git.sergepetrenko@tarantool.org> (raw) In-Reply-To: <cover.1550771940.git.sergepetrenko@tarantool.org> In-Reply-To: <cover.1550771940.git.sergepetrenko@tarantool.org> Iproto connections keep old readahead values for input buffers even after box.cfg.readahead reconfiguration. This means that for the changes to take place for the old clients, they have to reconnect. Otherwise tarantool log will be spammed with 'readahead limit is reached' errors. To fix this, start updating input buffer size for iproto connections if needed every time the buffer is empty. Closes: #3958 --- src/box/iproto.cc | 5 ++++ test/box/net.box.result | 62 +++++++++++++++++++++++++++++++++++++++ test/box/net.box.test.lua | 37 +++++++++++++++++++++++ 3 files changed, 104 insertions(+) diff --git a/src/box/iproto.cc b/src/box/iproto.cc index a08c8c5cb..7a1d3bfd0 100644 --- a/src/box/iproto.cc +++ b/src/box/iproto.cc @@ -670,6 +670,11 @@ iproto_connection_input_buffer(struct iproto_connection *con) */ return NULL; } + /* Update buffer size if readahead has changed. */ + if (new_ibuf->start_capacity != iproto_readahead) { + ibuf_destroy(new_ibuf); + ibuf_create(new_ibuf, cord_slab_cache(), iproto_readahead); + } ibuf_reserve_xc(new_ibuf, to_read + con->parse_size); /* 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") +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 ""'); +--- +- true +... +box.error.injection.set("ERRINJ_WAL_DELAY", false) +--- +- ok +... +test_run:wait_log('default', 'readahead limit is reached', nil, 1.0) +--- +... +s:drop() +--- +... +box.cfg{readahead = readahead} +--- +... diff --git a/test/box/net.box.test.lua b/test/box/net.box.test.lua index 6c527f506..d69a4ee73 100644 --- a/test/box/net.box.test.lua +++ b/test/box/net.box.test.lua @@ -1397,3 +1397,40 @@ box.schema.func.drop('do_long') box.schema.user.revoke('guest', 'write', 'space', '_schema') 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") +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) + +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 ""'); + +box.error.injection.set("ERRINJ_WAL_DELAY", false) + +test_run:wait_log('default', 'readahead limit is reached', nil, 1.0) + +s:drop() +box.cfg{readahead = readahead} -- 2.17.2 (Apple Git-113)
next prev parent reply other threads:[~2019-02-21 18:02 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 ` Serge Petrenko [this message] 2019-02-25 8:40 ` [PATCH v2 1/2] " Vladimir Davydov 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=ecbb32e035da0f3d62ffb04e8a947bc9a7f6e701.1550771940.git.sergepetrenko@tarantool.org \ --to=sergepetrenko@tarantool.org \ --cc=georgy@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=vdavydov.dev@gmail.com \ --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