Skip to content

Сan't initialize storage/router if no UUIDs #407

Closed
@askalt

Description

@askalt

Assume, we have cluster config:

credentials:
  users:
    replicator:
      password: a
      roles: [replication]
    storage:
      password: a
      roles: [sharding]

iproto:
  advertise:
    peer:
      login: replicator
    sharding:
      login: storage

sharding:
  bucket_count: 1000

groups:
  storages:
    app:
      module: storage
    sharding:
      roles: [storage]
    replication:
      failover: manual
    replicasets:
      storage-a:
        leader: storage-a-001
        instances:
          storage-a-001:
            iproto:
              listen:
              - uri: 'localhost:3301'
          storage-a-002:
            iproto:
              listen:
              - uri: 'localhost:3302'
      storage-b:
        leader: storage-b-001
        instances:
          storage-b-001:
            iproto:
              listen:
              - uri: 'localhost:3303'
          storage-b-002:
            iproto:
              listen:
              - uri: 'localhost:3304'
  routers:
    app:
      module: router
    sharding:
      roles: [router]
    replicasets:
      router-a:
        instances:
          router-a-001:
            iproto:
              listen:
              - uri: 'localhost:3305'

router.lua:

local vshard = require('vshard')
local crud   = require('crud')

vshard.router.bootstrap()
crud.init_router()

storage.lua:

local crud = require('crud')
local vshard = require('vshard')

crud.init_storage()

instances.yml (is required to start with tt):

storage-a-001:
storage-a-002:
storage-b-001:
storage-b-002:
router-a-001:
$ tt start myapp
   • Starting an instance [myapp:storage-a-001]...
   • Starting an instance [myapp:storage-a-002]...
   • Starting an instance [myapp:storage-b-001]...
   • Starting an instance [myapp:storage-b-002]...
   • Starting an instance [myapp:router-a-001]...
$ tt status myapp
INSTANCE                STATUS          PID
myapp:storage-b-002     RUNNING         222904
myapp:router-a-001      RUNNING         222905
myapp:storage-a-001     NOT RUNNING     
myapp:storage-a-002     RUNNING         222902
myapp:storage-b-001     NOT RUNNING   

Check in logs, what happened with stopped instances:

2023-12-28 12:14:25.959 [222951] main utils.c:679 E> LuajitError: .../myapp/.rocks/share/tarantool/crud.lua:179: Failed to find a vshard configuration for  replicaset with replicaset_uuid f2469bba-0e1f-46b0-af0b-a3491f1e8519.

vshard config (which was applied by tarantool itself):

---
...
sharding:
  storage-a:
    master: auto
    replicas:
      storage-a-002:
        uuid: null
        uri:
          password: a
          uri: localhost:3302
          login: storage
      storage-a-001:
        uuid: null
        uri:
          password: a
          uri: localhost:3301
          login: storage
    uuid: null
  storage-b:
    master: auto
    replicas:
      storage-b-002:
        uuid: null
        uri:
          password: a
          uri: localhost:3304
          login: storage
      storage-b-001:
        uuid: null
        uri:
          password: a
          uri: localhost:3303
...

Here is how tarantool builds vshard config: https://github.com/tarantool/tarantool/blob/57c1f625ffb280aea950030962cff104b3f3a47d/src/box/lua/config/configdata.lua#L144-L231

Metadata

Metadata

Labels

2spbugSomething isn't workingteamE

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions