Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tarantool-patches@dev.tarantool.org, olegrok@tarantool.org,
	yaroslav.dynnikov@tarantool.org
Subject: [Tarantool-patches] [PATCH vshard 7/6] util: truncate too long fiber name
Date: Fri, 2 Jul 2021 23:36:20 +0200	[thread overview]
Message-ID: <5c8f380f-845d-2373-4148-0c441ba01fab@tarantool.org> (raw)
In-Reply-To: <cover.1625177221.git.v.shpilevoy@tarantool.org>

Since tarantool's commit 008658b349264538f76327f8d60f2db5451854ea
("fiber: throw an error on too long fiber name") in version 1.7.6
fiber:name() fails if the name is too long. But the error can be
suppressed by using {truncate = true} option.

The patch makes vshard truncate too long names instead of throwing
an error.
---
 test/unit/util.result   | 10 ++++++++++
 test/unit/util.test.lua |  5 +++++
 vshard/util.lua         |  2 +-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/test/unit/util.result b/test/unit/util.result
index c83e80c..ec61e8a 100644
--- a/test/unit/util.result
+++ b/test/unit/util.result
@@ -71,6 +71,16 @@ test_run:grep_log('default', 'reloadable_function has been started', 1000)
 fib:cancel()
 ---
 ...
+-- Re-loadable fiber must truncate too long name.
+name = string.rep('a', 512)
+---
+...
+fib = util.reloadable_fiber_create(name, fake_M, 'reloadable_function')
+---
+...
+fib:cancel()
+---
+...
 -- Yielding table minus.
 minus_yield = util.table_minus_yield
 ---
diff --git a/test/unit/util.test.lua b/test/unit/util.test.lua
index 881feb4..5432c0d 100644
--- a/test/unit/util.test.lua
+++ b/test/unit/util.test.lua
@@ -28,6 +28,11 @@ while not test_run:grep_log('default', 'module is reloaded, restarting') do fibe
 test_run:grep_log('default', 'reloadable_function has been started', 1000)
 fib:cancel()
 
+-- Re-loadable fiber must truncate too long name.
+name = string.rep('a', 512)
+fib = util.reloadable_fiber_create(name, fake_M, 'reloadable_function')
+fib:cancel()
+
 -- Yielding table minus.
 minus_yield = util.table_minus_yield
 minus_yield({}, {}, 1)
diff --git a/vshard/util.lua b/vshard/util.lua
index 4d2c04e..afa658b 100644
--- a/vshard/util.lua
+++ b/vshard/util.lua
@@ -90,7 +90,7 @@ local function reloadable_fiber_create(fiber_name, module, func_name, data)
     assert(type(fiber_name) == 'string')
     local xfiber = fiber.create(reloadable_fiber_main_loop, module, func_name,
                                 data)
-    xfiber:name(fiber_name)
+    xfiber:name(fiber_name, {truncate = true})
     return xfiber
 end
 
-- 
2.24.3 (Apple Git-128)


  parent reply	other threads:[~2021-07-02 21:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-01 22:09 [Tarantool-patches] [PATCH vshard 0/6] Master discovery Vladislav Shpilevoy via Tarantool-patches
2021-07-01 22:09 ` [Tarantool-patches] [PATCH vshard 1/6] replicaset: introduce netbox_wait_connected() Vladislav Shpilevoy via Tarantool-patches
2021-07-02 11:46   ` Oleg Babin via Tarantool-patches
2021-07-01 22:09 ` [Tarantool-patches] [PATCH vshard 2/6] test: sort some table prints Vladislav Shpilevoy via Tarantool-patches
2021-07-02 11:46   ` Oleg Babin via Tarantool-patches
2021-07-01 22:09 ` [Tarantool-patches] [PATCH vshard 3/6] storage: introduce vshard.storage._call('info') Vladislav Shpilevoy via Tarantool-patches
2021-07-02 11:46   ` Oleg Babin via Tarantool-patches
2021-07-01 22:09 ` [Tarantool-patches] [PATCH vshard 4/6] config: introduce master 'auto' replicaset option Vladislav Shpilevoy via Tarantool-patches
2021-07-02 11:47   ` Oleg Babin via Tarantool-patches
2021-07-02 21:32     ` Vladislav Shpilevoy via Tarantool-patches
2021-07-05  9:23       ` Oleg Babin via Tarantool-patches
2021-07-01 22:09 ` [Tarantool-patches] [PATCH vshard 5/6] router: introduce automatic master discovery Vladislav Shpilevoy via Tarantool-patches
2021-07-02 11:48   ` Oleg Babin via Tarantool-patches
2021-07-02 21:35     ` Vladislav Shpilevoy via Tarantool-patches
2021-07-05  9:24       ` Oleg Babin via Tarantool-patches
2021-07-05 20:53         ` Vladislav Shpilevoy via Tarantool-patches
2021-07-06  8:54           ` Oleg Babin via Tarantool-patches
2021-07-06 21:19             ` Vladislav Shpilevoy via Tarantool-patches
2021-07-01 22:09 ` [Tarantool-patches] [PATCH vshard 6/6] router: update master using a hint from storage Vladislav Shpilevoy via Tarantool-patches
2021-07-02 11:49   ` Oleg Babin via Tarantool-patches
2021-07-02 21:36     ` Vladislav Shpilevoy via Tarantool-patches
2021-07-05  9:24       ` Oleg Babin via Tarantool-patches
2021-07-05 20:53         ` Vladislav Shpilevoy via Tarantool-patches
2021-07-06  8:55           ` Oleg Babin via Tarantool-patches
2021-07-02 21:36 ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-07-05  9:23   ` [Tarantool-patches] [PATCH vshard 7/6] util: truncate too long fiber name Oleg Babin via Tarantool-patches
2021-08-03 21:55 ` [Tarantool-patches] [PATCH vshard 0/6] Master discovery Vladislav Shpilevoy via Tarantool-patches

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=5c8f380f-845d-2373-4148-0c441ba01fab@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=olegrok@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --cc=yaroslav.dynnikov@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH vshard 7/6] util: truncate too long fiber name' \
    /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