Skip to content

Calls bypass vshard's checks  #448

@Serpentian

Description

@Serpentian

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:

crud/crud/replace.lua

Lines 102 to 105 in 419296e

local storage_result, err = call.single(vshard_router,
sharding_data.bucket_id, CRUD_REPLACE_FUNC_NAME,
{space_name, tuple, replace_on_storage_opts},
call_opts

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

return replicaset[method](replicaset, ...)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions