File tree Expand file tree Collapse file tree 7 files changed +28
-28
lines changed
Expand file tree Collapse file tree 7 files changed +28
-28
lines changed Original file line number Diff line number Diff line change 1+ local fiber = require (' fiber' )
2+
3+ local router_metadata_cache = {}
4+
5+ router_metadata_cache .SHARDING_KEY_MAP_NAME = " sharding_key_as_index_obj_map"
6+ router_metadata_cache .SHARDING_FUNC_MAP_NAME = " sharding_func_map"
7+ router_metadata_cache [router_metadata_cache .SHARDING_KEY_MAP_NAME ] = nil
8+ router_metadata_cache [router_metadata_cache .SHARDING_FUNC_MAP_NAME ] = nil
9+ router_metadata_cache .fetch_lock = fiber .channel (1 )
10+ router_metadata_cache .is_part_of_pk = {}
11+
12+ function router_metadata_cache .drop_caches ()
13+ router_metadata_cache [router_metadata_cache .SHARDING_KEY_MAP_NAME ] = nil
14+ router_metadata_cache [router_metadata_cache .SHARDING_FUNC_MAP_NAME ] = nil
15+ if router_metadata_cache .fetch_lock ~= nil then
16+ router_metadata_cache .fetch_lock :close ()
17+ end
18+ router_metadata_cache .fetch_lock = fiber .channel (1 )
19+ router_metadata_cache .is_part_of_pk = {}
20+ end
21+
22+ return router_metadata_cache
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ local errors = require('errors')
22local log = require (' log' )
33
44local dev_checks = require (' crud.common.dev_checks' )
5- local cache = require (' crud.common.sharding.sharding_metadata_cache ' )
5+ local cache = require (' crud.common.sharding.router_metadata_cache ' )
66local utils = require (' crud.common.utils' )
77
88local ShardingFuncError = errors .new_class (' ShardingFuncError' , {capture_stack = false })
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ local errors = require('errors')
22local log = require (' log' )
33
44local dev_checks = require (' crud.common.dev_checks' )
5- local cache = require (' crud.common.sharding.sharding_metadata_cache ' )
5+ local cache = require (' crud.common.sharding.router_metadata_cache ' )
66local utils = require (' crud.common.utils' )
77
88local ShardingKeyError = errors .new_class (" ShardingKeyError" , {capture_stack = false })
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ local errors = require('errors')
44local call = require (' crud.common.call' )
55local const = require (' crud.common.const' )
66local dev_checks = require (' crud.common.dev_checks' )
7- local cache = require (' crud.common.sharding.sharding_metadata_cache ' )
7+ local cache = require (' crud.common.sharding.router_metadata_cache ' )
88local storage_cache = require (' crud.common.sharding.storage_metadata_cache' )
99local sharding_func = require (' crud.common.sharding.sharding_func' )
1010local sharding_key = require (' crud.common.sharding.sharding_key' )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 334334
335335function helpers .get_sharding_key_cache (cluster )
336336 return cluster .main_server .net_box :eval ([[
337- local sharding_metadata_cache = require('crud.common.sharding.sharding_metadata_cache ')
337+ local sharding_metadata_cache = require('crud.common.sharding.router_metadata_cache ')
338338
339339 return sharding_metadata_cache[sharding_metadata_cache.SHARDING_KEY_MAP_NAME]
340340 ]] )
362362-- but not the cache itself
363363function helpers .get_sharding_func_cache_size (cluster )
364364 return cluster .main_server .net_box :eval ([[
365- local sharding_metadata_cache = require('crud.common.sharding.sharding_metadata_cache ')
365+ local sharding_metadata_cache = require('crud.common.sharding.router_metadata_cache ')
366366
367367 local cache, err = sharding_metadata_cache[sharding_metadata_cache.SHARDING_FUNC_MAP_NAME]
368368 if cache == nil then
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ local ffi = require('ffi')
33local sharding_metadata_module = require (' crud.common.sharding.sharding_metadata' )
44local sharding_key_module = require (' crud.common.sharding.sharding_key' )
55local sharding_func_module = require (' crud.common.sharding.sharding_func' )
6- local cache = require (' crud.common.sharding.sharding_metadata_cache ' )
6+ local cache = require (' crud.common.sharding.router_metadata_cache ' )
77local utils = require (' crud.common.utils' )
88
99local helpers = require (' test.helper' )
You can’t perform that action at this time.
0 commit comments