11local errors = require (' errors' )
2+ local log = require (' log' )
23
34local call_cache = require (' crud.common.call_cache' )
45local dev_checks = require (' crud.common.dev_checks' )
@@ -19,13 +20,13 @@ local CRUD_CALL_FUNC_NAME = utils.get_storage_call(CALL_FUNC_NAME)
1920
2021-- Methods that can continue execution in fast mode when rebalance starts
2122local safe_mode_allowed_fast_methods = {
22- CRUD_CALL_FUNC_NAME .. ' /fast/' .. utils .get_storage_call (' readview_open_on_storage' ),
23- CRUD_CALL_FUNC_NAME .. ' /fast/' .. utils .get_storage_call (' readview_close_on_storage' ),
24- CRUD_CALL_FUNC_NAME .. ' /fast/' .. utils .get_storage_call (' select_readview_on_storage' ),
25- CRUD_CALL_FUNC_NAME .. ' /fast/' .. utils .get_storage_call (' truncate_on_storage' ),
26- CRUD_CALL_FUNC_NAME .. ' /fast/' .. utils .get_storage_call (' len_on_storage' ),
27- CRUD_CALL_FUNC_NAME .. ' /fast/' .. utils .get_storage_call (' count_on_storage' ),
28- CRUD_CALL_FUNC_NAME .. ' /fast/' .. utils .get_storage_call (' get_border_on_storage' ),
23+ [ CRUD_CALL_FUNC_NAME .. ' /fast/' .. utils .get_storage_call (' readview_open_on_storage' )] = true ,
24+ [ CRUD_CALL_FUNC_NAME .. ' /fast/' .. utils .get_storage_call (' readview_close_on_storage' )] = true ,
25+ [ CRUD_CALL_FUNC_NAME .. ' /fast/' .. utils .get_storage_call (' select_readview_on_storage' )] = true ,
26+ [ CRUD_CALL_FUNC_NAME .. ' /fast/' .. utils .get_storage_call (' truncate_on_storage' )] = true ,
27+ [ CRUD_CALL_FUNC_NAME .. ' /fast/' .. utils .get_storage_call (' len_on_storage' )] = true ,
28+ [ CRUD_CALL_FUNC_NAME .. ' /fast/' .. utils .get_storage_call (' count_on_storage' )] = true ,
29+ [ CRUD_CALL_FUNC_NAME .. ' /fast/' .. utils .get_storage_call (' get_border_on_storage' )] = true ,
2930}
3031
3132local call = {}
@@ -46,18 +47,12 @@ local function safe_mode_enable()
4647 call_on_storage = call_on_storage_safe
4748
4849 for fb_id , fb in pairs (fiber .info ()) do
49- if string.find (fb .name , CRUD_CALL_FUNC_NAME .. ' /fast/' ) then
50- local do_kill = true
51- for _ , allowed_method in ipairs (safe_mode_allowed_fast_methods ) do
52- if fb .name == allowed_method then
53- do_kill = false
54- break
55- end
56- end
57- if do_kill then
58- fiber .kill (fb_id )
59- end
50+ local fibers_killed = 0
51+ if fb .name :startswith (CRUD_CALL_FUNC_NAME .. ' /fast/' ) and not safe_mode_allowed_fast_methods [fb .name ] then
52+ fiber .kill (fb_id )
53+ fibers_killed = fibers_killed + 1
6054 end
55+ log .debug (' Killed %d fibers with fast-mode crud requests.' , fibers_killed )
6156 end
6257end
6358
0 commit comments