replication: split anon cfg and actual 'is anon'
To tell whether the instance is anon there used to be just one flag in C code: replication_anon. Having one flag both for cfg and for the actual state is bad because if cfg is updated, then there is a moment when that flag can't be safely used to check the actual state. For example, when replication_anon had been true and was set to false, it took time to register the instance. In the meantime the C flag replication_anon was already false, although the instance is still anon (not present in _cluster). In the existing code it could lead to insignificant errors like when an anon instance was being registered, it could already accept IPROTO_REGISTER requests. It would fail on ER_READONLY instead of ER_UNSUPPORTED. It wasn't a critical problem, but still it wasn't correct to use cfg flag for checking the actual state. Now there is a separate cfg flag and a function for checking the real state. This patch is done because soon there will be a new option which also takes time to change: instance name. This commit sets a pattern how to deal with such options. In scope of #5029 NO_DOC=refactoring NO_CHANGELOG=refactoring NO_TEST=already covered
Showing
- src/box/applier.cc 5 additions, 7 deletionssrc/box/applier.cc
- src/box/box.cc 31 additions, 24 deletionssrc/box/box.cc
- src/box/box.h 4 additions, 0 deletionssrc/box/box.h
- src/box/lua/info.c 4 additions, 2 deletionssrc/box/lua/info.c
- src/box/replication.cc 2 additions, 2 deletionssrc/box/replication.cc
- src/box/replication.h 6 additions, 6 deletionssrc/box/replication.h
Loading
Please register or sign in to comment