From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 821236EC55; Mon, 26 Jul 2021 13:58:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 821236EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1627297110; bh=9LMitewTuv4jXhHpRf3tWiM2wisBk0ac9w5VRUzc3Bg=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=mi7qAs8D73vAmYtfUBtrdraWxLliFwHO5dxc4gmAWVGFIvMqF8esb0etwJ7GPEjuT 4IZdTlrLd8/3zJp1bBUAogErog2e0PYxjJNAFh3Wmv4BxxguPbs7waIlFTpWTPsoos orjnNq5YmVUm7vTCQ+kkGgJvgBB6RMjZk/L/Jsrw= Received: from smtpng2.i.mail.ru (smtpng2.i.mail.ru [94.100.179.3]) (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 4A37D6EC55 for ; Mon, 26 Jul 2021 13:58:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4A37D6EC55 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1m7yJY-0000jR-MW; Mon, 26 Jul 2021 13:58:29 +0300 To: tarantool-patches@dev.tarantool.org Date: Mon, 26 Jul 2021 13:58:28 +0300 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-174C08C4: 5188C02AEC42908C481ED7ADC579193296BBA28369E3F2D2713F3D5F7D406D31BCF678C7329BA986 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD941C43E597735A9C3FDAB68B812060C77E621B90589399EB5182A05F53808504078E9D10C6BC54FA0790BAE8B682312484BF09E0FD2BDF0A08F11D2316E6BEA59 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE74E9055D3307A84CAEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006371D26D2A8652661258638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8521CFBB9048B74BDFE0A67BDC1350BCB117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18C26CFBAC0749D213D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B682BBBAF5DF00056E089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 8BD88D57C5CADBC8B2710865C386751094C72BDDC9A8ED5CA3B1A56EE2B804F6B226C914C996894645FD9D8A29397D6EFF55FE49A3C2BFCFC8C84E951CD0BE2F296C473AB1E14218EA052B563B0B06C67866D6147AF826D8521CFBB9048B74BDFE0A67BDC1350BCBF972CCD2F8FE1EF1CFC4036BBF6A4EA905F09C493AC525ACC5C67F257BE79497DA5036C42366A8A05E440A8D8C3A31F6 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34411AA3F52B5778B6AD5E9E506631FFEFFBDA832748FC0F1BB2A57B0B553E288188957B66F1E34B001D7E09C32AA3244C430B1F9AB92230838CA62F58AE2CA317E646F07CC2D4F3D8729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXhWb6c3s1oE0k2sZv2PW9vR X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D4A58BAF5F038BC4E1D215E8114748CD8274CEFED1673C562683ABF942079399BFB559BB5D741EB966A65DFF43FF7BE03240331F90058701C67EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH] net.box: drop conn:timeout() X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladimir Davydov via Tarantool-patches Reply-To: Vladimir Davydov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" conn:timeout(timeout) writes (now + timeout) to conn._deadlines table keyed by fiber.self(). The deadline will then be used by all conn methods unless specified explicitly in the options argument. Usage of fiber.self() degrades net.box performance by about 15% in case timeout is not specified, because it is a C call and so interferes with JIT. See the ticket for the test details. Since the feature is unusable and was deprecated more than four years ago (in 1.7.4) in favor of specifying timeout in the options argument (see commit 58da206c33197), it should be fine to drop it. Closes #6242 --- .../gh-6242-net-box-drop-conn-timeout.md | 9 ++++ src/box/lua/net_box.lua | 26 ---------- .../net.box_count_inconsistent_gh-3262.result | 49 ------------------- ...et.box_count_inconsistent_gh-3262.test.lua | 20 -------- 4 files changed, 9 insertions(+), 95 deletions(-) create mode 100644 changelogs/unreleased/gh-6242-net-box-drop-conn-timeout.md diff --git a/changelogs/unreleased/gh-6242-net-box-drop-conn-timeout.md b/changelogs/unreleased/gh-6242-net-box-drop-conn-timeout.md new file mode 100644 index 000000000000..69d12fb858e5 --- /dev/null +++ b/changelogs/unreleased/gh-6242-net-box-drop-conn-timeout.md @@ -0,0 +1,9 @@ +## feature/core + +* **[Breaking change]** timeout() method of net.box connection, which was + marked deprecated more than four years ago (in 1.7.4) was dropped, because + it negatively affected performance of hot net.box methods, like call() and + select(), in case those are called without specifying a timeout. + +--- +Breaking change: timeout() method of net.box connection was dropped. diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua index 3878abf21914..15e6c093cc15 100644 --- a/src/box/lua/net_box.lua +++ b/src/box/lua/net_box.lua @@ -1047,9 +1047,6 @@ local function new_sm(host, port, opts, connection, greeting) setmetatable(remote, console_mt) else setmetatable(remote, remote_mt) - -- @deprecated since 1.7.4 - remote._deadlines = setmetatable({}, {__mode = 'k'}) - remote._space_mt = space_metatable(remote) remote._index_mt = index_metatable(remote) if opts.call_16 then @@ -1176,17 +1173,11 @@ function remote_methods:_request(method, opts, request_ctx, ...) return res end if opts.timeout then - -- conn.space:request(, { timeout = timeout }) deadline = fiber_clock() + opts.timeout - else - -- conn:timeout(timeout).space:request() - -- @deprecated since 1.7.4 - deadline = self._deadlines[fiber_self()] end on_push = opts.on_push or on_push_sync_default on_push_ctx = opts.on_push_ctx else - deadline = self._deadlines[fiber_self()] on_push = on_push_sync_default end -- Execute synchronous request. @@ -1289,28 +1280,11 @@ end function remote_methods:wait_state(state, timeout) check_remote_arg(self, 'wait_state') - if timeout == nil then - local deadline = self._deadlines[fiber_self()] - timeout = deadline and max(0, deadline - fiber_clock()) - end return self._transport.wait_state(state, timeout) end local compat_warning_said = false --- @deprecated since 1.7.4 -function remote_methods:timeout(timeout) - check_remote_arg(self, 'timeout') - if not compat_warning_said then - compat_warning_said = true - log.warn("netbox:timeout(timeout) is deprecated since 1.7.4, ".. - "please use space:(..., {timeout = t}) instead.") - end - -- Sic: this is broken by design - self._deadlines[fiber_self()] = (timeout and fiber_clock() + timeout) - return self -end - function remote_methods:_install_schema(schema_version, spaces, indices, collations) local sl, space_mt, index_mt = {}, self._space_mt, self._index_mt diff --git a/test/box/net.box_count_inconsistent_gh-3262.result b/test/box/net.box_count_inconsistent_gh-3262.result index c77677625d97..286f9ded8aea 100644 --- a/test/box/net.box_count_inconsistent_gh-3262.result +++ b/test/box/net.box_count_inconsistent_gh-3262.result @@ -427,55 +427,6 @@ cn:eval('return ret_after(...)', {1.00}, { timeout = 1e-9 }) --- - error: Timeout exceeded ... --- --- :timeout() --- @deprecated since 1.7.4 --- -cn:timeout(1).space.net_box_test_space.index.primary:select{234} ---- -- - [234, 1, 2, 3] -... -cn:call('ret_after', {.01}) ---- -- [[0.01]] -... -cn:timeout(1):call('ret_after', {.01}) ---- -- [[0.01]] -... -cn:timeout(.01):call('ret_after', {1}) ---- -- error: Timeout exceeded -... -cn = remote:timeout(0.0000000001):connect(LISTEN.host, LISTEN.service, { user = 'netbox', password = '123' }) ---- -... -cn:close() ---- -... -cn = remote:timeout(1):connect(LISTEN.host, LISTEN.service, { user = 'netbox', password = '123' }) ---- -... -remote.self:ping() ---- -- true -... -remote.self.space.net_box_test_space:select{234} ---- -- - [234, 1, 2, 3] -... -remote.self:timeout(123).space.net_box_test_space:select{234} ---- -- - [234, 1, 2, 3] -... -remote.self:is_connected() ---- -- true -... -remote.self:wait_connected() ---- -- true -... cn:close() --- ... diff --git a/test/box/net.box_count_inconsistent_gh-3262.test.lua b/test/box/net.box_count_inconsistent_gh-3262.test.lua index e84e85cf3829..a6d87cdcc830 100644 --- a/test/box/net.box_count_inconsistent_gh-3262.test.lua +++ b/test/box/net.box_count_inconsistent_gh-3262.test.lua @@ -155,26 +155,6 @@ cn:call('ret_after', {1.00}, { timeout = 1e-9 }) cn:eval('return ret_after(...)', {0.01}, { timeout = 1.00 }) cn:eval('return ret_after(...)', {1.00}, { timeout = 1e-9 }) --- --- :timeout() --- @deprecated since 1.7.4 --- - -cn:timeout(1).space.net_box_test_space.index.primary:select{234} -cn:call('ret_after', {.01}) -cn:timeout(1):call('ret_after', {.01}) -cn:timeout(.01):call('ret_after', {1}) - -cn = remote:timeout(0.0000000001):connect(LISTEN.host, LISTEN.service, { user = 'netbox', password = '123' }) -cn:close() -cn = remote:timeout(1):connect(LISTEN.host, LISTEN.service, { user = 'netbox', password = '123' }) - -remote.self:ping() -remote.self.space.net_box_test_space:select{234} -remote.self:timeout(123).space.net_box_test_space:select{234} -remote.self:is_connected() -remote.self:wait_connected() - cn:close() -- cleanup database after tests space:drop() -- 2.25.1