crud icon indicating copy to clipboard operation
crud copied to clipboard

Calls bypass vshard's checks

Open Serpentian opened this issue 8 months ago • 1 comments
trafficstars

This is a critical issue and leads to duplication of data in cluster as described in https://jira.vk.team/browse/TNTP-2109. It may also break vshard. Crud makes call, using replicaset object, which is low-level API:

https://github.com/tarantool/crud/blob/419296e30db2144db7f6d30593124eb80ee807d1/crud/replace.lua#L102-L105

CRUD_REPLACE_FUNC_NAME is crud.replace_on_storage. It's called in retry_call_with_master_discovery:

https://github.com/tarantool/crud/blob/419296e30db2144db7f6d30593124eb80ee807d1/crud/common/call.lua#L90

So, at the end we have, that replace_on_storage is explicitly called. However, you CANNOT rely on routeall and route functions in vshard, they return cache value of the router, which may outdated. In order to figure out, whether the bucket is on the instance, explicit call must be done.

The example is about replace explicitly, however, In the scope of this issue, all requests must be checked. They should not use replicaset:call as it's now, vshard.router.call is more preferable. If replicaset:call should be preserved, then it must call vshard.storage.call with {bucket_id, mode, func, args} argument (see, how vshard.router.call is implemented: link

Serpentian avatar Mar 20 '25 15:03 Serpentian