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

Hot reload is broken if name is key #464

Closed
DifferentialOrange opened this issue Dec 28, 2023 · 0 comments · Fixed by #466
Closed

Hot reload is broken if name is key #464

DifferentialOrange opened this issue Dec 28, 2023 · 0 comments · Fixed by #466
Assignees
Labels
bug Something isn't working

Comments

@DifferentialOrange
Copy link
Member

Tarantool Enterprise 3.0.0-0-gf58f7d82a-r23-gc64
vshard 0.1.25

Code hot reload fails in case identification_mode = 'name_as_key' is used.

Reproducer (no UUID):

-- init.lua

-- Setup cluster.
local vshard = require('vshard')

local replicaset_name = 'rs-1'
local replica_name = 'r-1'

local listen = 'localhost:3301'

box.cfg({
    replicaset_name = replicaset_name,
    instance_name = replica_name,
})

local cfg = {
    bucket_count = 3000,
    sharding = {
        [replicaset_name] = {
            replicas = {
                [replica_name] = {
                    uri = 'guest@' .. listen,
                    master = true,
                },
            },
        },
    },
    identification_mode = 'name_as_key',
}
vshard.storage.cfg(cfg, replica_name)
vshard.router.cfg(cfg)
vshard.router.bootstrap()

-- Reload code.
package.loaded['vshard.storage'] = nil
package.loaded['vshard'] = nil

require('vshard')
tarantool init.lua
main utils.c:679 E> LuajitError: .rocks/share/tarantool/vshard/storage/init.lua:3733: .rocks/share/tarantool/vshard/storage/init.lua:3582: Usage: cfg(configuration, this_replica_id)

Reproducer (with UUID):

-- init.lua

-- Setup cluster.
local vshard = require('vshard')

local replicaset_name = 'rs-1'
local replica_name = 'r-1'

local uuid = 'fcbb2a69-7cab-4307-94cd-dc85699f941b'

local listen = 'localhost:3301'

box.cfg({
    replicaset_name = replicaset_name,
    instance_name = replica_name,
    instance_uuid = uuid,
})

local cfg = {
    bucket_count = 3000,
    sharding = {
        [replicaset_name] = {
            replicas = {
                [replica_name] = {
                    uri = 'guest@' .. listen,
                    uuid = uuid,
                    master = true,
                },
            },
        },
    },
    identification_mode = 'name_as_key',
}
vshard.storage.cfg(cfg, replica_name)
vshard.router.cfg(cfg)
vshard.router.bootstrap()

-- Reload code.
package.loaded['vshard.storage'] = nil
package.loaded['vshard'] = nil

require('vshard')
tarantool init.lua
main utils.c:679 E> LuajitError: .rocks/share/tarantool/vshard/storage/init.lua:3733: .rocks/share/tarantool/vshard/storage/init.lua:3595: Local replica fcbb2a69-7cab-4307-94cd-dc85699f941b wasn't found in config

The reason is likely to be this line of code

storage_cfg(M.current_cfg, M.this_replica.uuid, true)

which always uses uuid as key.

@DifferentialOrange DifferentialOrange added the bug Something isn't working label Dec 28, 2023
@Serpentian Serpentian self-assigned this Dec 28, 2023
Serpentian added a commit to Serpentian/vshard that referenced this issue Dec 29, 2023
Currently hot reload failes, when named identification is used.
It is cause by the fact, that we still pass uuid in storage.cfg
during reload.

Let's pass id instead of UUID. It's either uuid or name, depeding on
identification_mode. If reload is done from the old version, where no
replica.id exists, we fall back to replica.uuid.

Closes tarantool#464

NO_DOC=bugfix
Serpentian added a commit to Serpentian/vshard that referenced this issue Dec 29, 2023
Currently hot reload failes, when named identification is used.
It is cause by the fact, that we still pass uuid in storage.cfg
during reload.

Let's pass id instead of UUID. It's either uuid or name, depending on
identification_mode. If reload is done from the old version, where no
replica.id exists, we fall back to replica.uuid.

Closes tarantool#464

NO_DOC=bugfix
Gerold103 pushed a commit that referenced this issue Jan 10, 2024
Currently hot reload failes, when named identification is used.
It is cause by the fact, that we still pass uuid in storage.cfg
during reload.

Let's pass id instead of UUID. It's either uuid or name, depending on
identification_mode. If reload is done from the old version, where no
replica.id exists, we fall back to replica.uuid.

Closes #464

NO_DOC=bugfix
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.

2 participants