schema: allow _cluster update after join
The function replica_check_id() is called on any change in _cluster: insert, delete, update. It was supposed to check if the replica ID is valid - not nil, not out of range (VCLOCK_MAX). But it was also raising an error when the ID matched this instance's ID unless the instance was joining. That happened even if a _cluster tuple was updated without changing the ID at all. For example, if one would just do _cluster:replace(_cluster:get(box.info.id)). That was a surprising side effect of the ID checker which blocked next patches. The next commits are going to introduce a new field in _cluster (replica name) which will be mutable. Such behaviour of replica_check_id() wouldn't allow to update even that new field. Better do the check in the only place where the mutation can happen - on deletion. Since replica ID is a primary key in _cluster, it can't be updated there. Only inserted or deleted. Needed for #5029 NO_DOC=bugfix and refactoring NO_CHANGELOG=couldn't happen unless user touched _cluster in a weird way NO_TEST=covered by next commits, too insignificant for an own test
Showing
- src/box/alter.cc 16 additions, 0 deletionssrc/box/alter.cc
- src/box/replication.cc 0 additions, 16 deletionssrc/box/replication.cc
- test/replication-py/cluster.result 6 additions, 2 deletionstest/replication-py/cluster.result
- test/replication-py/cluster.test.py 3 additions, 0 deletionstest/replication-py/cluster.test.py
Loading
Please register or sign in to comment