rabbit_db_*: Wrap ets
calls to projections in whereis/1
checks (backport #11667) (backport #11677)
#11678
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Projections might not be available in a mixed-version scenario where a cluster has nodes which are all blank/uninitialized and the majority of nodes run a version of Khepri with a new machine version while the minority does not have the new machine version's code.
In this case, the cluster's effective machine version will be set to the newer version as the majority of members have access to the new code. The older version members will be unable to apply commands including the
register_projection
commands that set up these ETS tables. When these ETS tables don't exist, calls likeets:tab2list/1
orets:lookup/2
causebadarg
errors.We use default empty values when
ets:whereis/1
returnsundefined
for a projection table name. Instead we could use local queries or leader queries. Writing equivalent queries is a fair amount more work and the code would be hard to test.ets:whereis/1
should only returnundefined
in the above scenario which should only be a problem in our mixed-version testing - not in practice.This is an automatic backport of pull request #11667 done by Mergify.
This is an automatic backport of pull request #11677 done by Mergify.