Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_many operations fail to work with bucket specified #437

Closed
DifferentialOrange opened this issue May 17, 2024 · 0 comments · Fixed by #438
Closed

_many operations fail to work with bucket specified #437

DifferentialOrange opened this issue May 17, 2024 · 0 comments · Fixed by #438
Assignees
Labels
bug Something isn't working

Comments

@DifferentialOrange
Copy link
Member

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.'
...
@DifferentialOrange DifferentialOrange added the bug Something isn't working label May 17, 2024
@DifferentialOrange DifferentialOrange self-assigned this May 17, 2024
DifferentialOrange added a commit that referenced this issue May 17, 2024
In case `insert_many`, `insert_object_many`, `replace_many`,
`replace_object_many`, `upsert_many` or `upsert_object_many` has been
called on a space with custom sharding info and every tuple/object
in the request had `bucket_id`, `ShardingHashMismatchError` has been
returned even though there are no issues with sharding info. For
example, some users met this issue while working with tt-ee
`tt crud import` command.

The reason is as follows. To ensure sharding info consistency between
the storage and the router, some metainfo is calculated for a request
in case bucket_id is generated. In case no bucket_id is generated, no
sharding info is passed and consistency check is skipped (since it is
not needed). Before this patch, `*_many` operations haven't skipped
consistency check when it was expected due to improper
`skip_sharding_hash_check` flag setup.

Closes #437
DifferentialOrange added a commit that referenced this issue May 17, 2024
In case `insert_many`, `insert_object_many`, `replace_many`,
`replace_object_many`, `upsert_many` or `upsert_object_many` has been
called on a space with custom sharding info and every tuple/object
in the request had `bucket_id`, `ShardingHashMismatchError` has been
returned even though there are no issues with sharding info. For
example, some users met this issue while working with tt-ee
`tt crud import` command.

The reason is as follows. To ensure sharding info consistency between
the storage and the router, some metainfo is calculated for a request
in case bucket_id is generated. In case no bucket_id is generated, no
sharding info is passed and consistency check is skipped (since it is
not needed). Before this patch, `*_many` operations haven't skipped
consistency check when it was expected due to improper
`skip_sharding_hash_check` flag setup.

Closes #437
DifferentialOrange added a commit that referenced this issue May 20, 2024
In case `insert_many`, `insert_object_many`, `replace_many`,
`replace_object_many`, `upsert_many` or `upsert_object_many` has been
called on a space with custom sharding info and every tuple/object
in the request had `bucket_id`, `ShardingHashMismatchError` has been
returned even though there are no issues with sharding info. For
example, some users met this issue while working with tt-ee
`tt crud import` command.

The reason is as follows. To ensure sharding info consistency between
the storage and the router, some metainfo is calculated for a request
in case bucket_id is generated. In case no bucket_id is generated, no
sharding info is passed and consistency check is skipped (since it is
not needed). Before this patch, `*_many` operations haven't skipped
consistency check when it was expected due to improper
`skip_sharding_hash_check` flag setup.

Closes #437
DifferentialOrange added a commit that referenced this issue May 20, 2024
Overview

  This release fixes the bug that was discovered while working with
  `tt crud export` and `tt crud import` tools.

Fixed
* `insert_many`, `insert_object_many`, `replace_many`,
  `replace_object_many`, `upsert_many`, `upsert_object_many`
  operations no longer fail with `ShardingHashMismatchError` if
  a space has custom sharding info and every tuple/object
  in the request has `bucket_id` set (#437).
DifferentialOrange added a commit that referenced this issue May 20, 2024
Overview

  This release fixes the bug that was discovered while working with
  `tt crud export` and `tt crud import` tools.

Fixed
* `insert_many`, `insert_object_many`, `replace_many`,
  `replace_object_many`, `upsert_many`, `upsert_object_many`
  operations no longer fail with `ShardingHashMismatchError` if
  a space has custom sharding info and every tuple/object
  in the request has `bucket_id` set (#437).
DifferentialOrange added a commit that referenced this issue May 20, 2024
Overview

  This release fixes the bug that was discovered while working with
  `tt crud export` and `tt crud import` tools.

Fixed
* `insert_many`, `insert_object_many`, `replace_many`,
  `replace_object_many`, `upsert_many`, `upsert_object_many`
  operations no longer fail with `ShardingHashMismatchError` if
  a space has custom sharding info and every tuple/object
  in the request has `bucket_id` set (#437).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant