Skip to content

Commit

Permalink
util: truncate too long fiber name
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Gerold103 committed Aug 3, 2021
1 parent 551b106 commit c910cd5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions test/unit/util.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
Expand Down
5 changes: 5 additions & 0 deletions test/unit/util.test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion vshard/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c910cd5

Please sign in to comment.