tarantool / crud

Easy assess to data stored in vshard cluster
BSD 2-Clause "Simplified" License
40 stars 14 forks source link

`_many` operations fail to work with bucket specified #437

Closed DifferentialOrange closed 1 month ago

DifferentialOrange commented 1 month ago

Start a cluster from tt create cartridge template.

Upload the following schema migration:

return {
  up = function()
    local utils = require('migrator.utils')
    box.schema.space.create('test_space', {if_not_exists = true})
    box.space.test_space:format({
        { name = 'id', type = 'unsigned' },
        { name = 'bucket_id', type = 'unsigned' },
        { name = 'ip_address', type = 'string' },
        { name = 'data', type = 'map' },
    })
    box.space.test_space:create_index('primary', {type = 'TREE',parts = {1, 'unsigned'},if_not_exists = true})
    box.space.test_space:create_index('bucket_id', { parts = {'bucket_id'}, unique = false, if_not_exists = true})
    utils.register_sharding_key('test_space', {'id'})
    return true
  end
}

Run the following operations:

tarantooldb:router> crud.insert_many("test_space", {{1, 12477, "ip", {age=34}}})
---
- null
- - line: 18
    class_name: ShardingHashMismatchError
    err: 'crud: Sharding hash mismatch for space test_space. Sharding info will be
      refreshed after receiving this error. Please retry your request.'
    file: '...db/.rocks/share/tarantool/crud/common/batching_utils.lua'
    operation_data: [1, 12477, 'ip', {'age':34}]
    str: 'ShardingHashMismatchError: crud: Sharding hash mismatch for space test_space.
      Sharding info will be refreshed after receiving this error. Please retry your
      request.'
...

tarantooldb:router> crud.replace_many("test_space", {{1, 12477, "ip", {age=34}}})
---
- null
- - line: 18
    class_name: ShardingHashMismatchError
    err: 'crud: Sharding hash mismatch for space test_space. Sharding info will be
      refreshed after receiving this error. Please retry your request.'
    file: '...db/.rocks/share/tarantool/crud/common/batching_utils.lua'
    operation_data: [1, 12477, 'ip', {'age':34}]
    str: 'ShardingHashMismatchError: crud: Sharding hash mismatch for space test_space.
      Sharding info will be refreshed after receiving this error. Please retry your
      request.'
...

tarantooldb:router> crud.upsert_many("test_space", {{{1, 12477, "ip",  {age=34}}, {}}})
---
- null
- - line: 18
    class_name: ShardingHashMismatchError
    err: 'crud: Sharding hash mismatch for space test_space. Sharding info will be
      refreshed after receiving this error. Please retry your request.'
    file: '...db/.rocks/share/tarantool/crud/common/batching_utils.lua'
    operation_data: [1, 12477, 'ip', {'age':34}]
    str: 'ShardingHashMismatchError: crud: Sharding hash mismatch for space test_space.
      Sharding info will be refreshed after receiving this error. Please retry your
      request.'
...