@@ -16,17 +16,27 @@ local CallError = errors.new_class('CallError')
1616
1717local CALL_FUNC_NAME = ' call_on_storage'
1818local CRUD_CALL_FUNC_NAME = utils .get_storage_call (CALL_FUNC_NAME )
19- local CRUD_CALL_FIBER_NAME = CRUD_CALL_FUNC_NAME .. ' /'
19+
20+ -- Methods that can continue execution in fast mode when rebalance starts
21+ local 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' ),
29+ }
2030
2131local call = {}
2232
2333local function call_on_storage_safe (run_as_user , func_name , ...)
24- fiber .name (CRUD_CALL_FIBER_NAME .. ' safe/' .. func_name )
34+ fiber .name (CRUD_CALL_FUNC_NAME .. ' / safe/' .. func_name )
2535 return box .session .su (run_as_user , call_cache .func_name_to_func (func_name ), ... )
2636end
2737
2838local function call_on_storage_fast (run_as_user , func_name , ...)
29- fiber .name (CRUD_CALL_FIBER_NAME .. ' fast/' .. func_name )
39+ fiber .name (CRUD_CALL_FUNC_NAME .. ' / fast/' .. func_name )
3040 return box .session .su (run_as_user , call_cache .func_name_to_func (func_name ), ... )
3141end
3242
@@ -36,8 +46,17 @@ local function safe_mode_enable()
3646 call_on_storage = call_on_storage_safe
3747
3848 for fb_id , fb in pairs (fiber .info ()) do
39- if string.find (fb .name , CRUD_CALL_FIBER_NAME ) then
40- fiber .kill (fb_id )
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
4160 end
4261 end
4362end
0 commit comments