Skip to content
Snippets Groups Projects
Commit 9b2b3e58 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Vladimir Davydov
Browse files

box: apply dynamic cfg even if option value is unchanged

If a configuration option value passed to `box.cfg` is the same as the
old one, the option handler isn't called. However, sometimes we might
need to do some extra work in the handler in this case. For example,
even if listen/replication URI is the same, we still need to recreate
the derived IO stream context, because a URI parameter may contain a
path to a file (for example, an SSL certificate), which could change.

So we remove the corresponding check from load_cfg.lua and instead move
it to option handlers. Most of the existing dynamic option handlers
already do nothing if the old and the new values are the same. There are
only three exceptions:

 1. box.cfg.memtx_memory. The problem is that the value is rounded up
    to a multiple of the quota unit size by the handler so even if we
    pass exactly the same value, it may mistakenly assume that the new
    value is less and fail. To avoid that, we make the handler round up
    the new value before checking it.

 2. box.cfg.replication. Even though commit 5994892c ("replication:
    fix replica disconnect upon reconfiguration") made the handler avoid
    disconnect, it still tries to connect to the new URIs and sync,
    which may pose a problem to our users. For example, resetting
    box.cfg.replication to the same value on the leader after right
    after a new cluster bootstrap (before granting access to replicas)
    would lead to a replication sync, which would obviously fail on
    timeout. To avoid that, we make the handler compare the new and old
    URIs internally and do nothing if they are the same.

 3. box.cfg.listen. Handled similarly to box.cfg.replication: to avoid
    futile rebinding of IPROTO ports, we store the last configured
    listen URIs in a C variable and do nothing on box.cfg if the
    configuration is the same.

Needed for tarantool/tarantool-ee#432

NO_DOC=refactoring
NO_TEST=refactoring
NO_CHANGELOG=refactoring
parent 2644add4
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment