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
Showing
- src/box/box.cc 8 additions, 0 deletionssrc/box/box.cc
- src/box/iproto.cc 19 additions, 0 deletionssrc/box/iproto.cc
- src/box/lua/load_cfg.lua 4 additions, 3 deletionssrc/box/lua/load_cfg.lua
- src/box/memtx_engine.cc 2 additions, 1 deletionsrc/box/memtx_engine.cc
- src/box/replication.cc 6 additions, 0 deletionssrc/box/replication.cc
- src/box/replication.h 5 additions, 0 deletionssrc/box/replication.h
Loading
Please register or sign in to comment