Michal/mnesia/add_tests_for_compare_storage_type #9444
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.
Those tests are related to #9311.
When investigating problem during schema merge it was found that when some nodes in the cluster are down, it's still possible to call
mnesia:change_table_copy_type/3
for 2 special cases:The cause of this is that
mnesia_schema:compare_storage_types/3
does not consider the two (mentioned above) conversions as incompatible, this can be seen here:otp/lib/mnesia/src/mnesia_schema.erl
Lines 3661 to 3664 in 5dab31e
The cause is in
mnesia_schema:make_change_table_copy_type/3
, one can see that only when storage type isincompatible
, it callsensure_active(Cs)
otp/lib/mnesia/src/mnesia_schema.erl
Lines 1891 to 1898 in 5dab31e
In addition to that:
is used for merging a schema after it's removal (when node rejoins the cluster), this can be seen in
mnesia_config_test:dynamic_basic/1
when doing following operations:otp/lib/mnesia/test/mnesia_config_test.erl
Lines 1114 to 1120 in 5dab31e
The cause of that is when we remove node's schema it restarts with
ram_copies
schema, and later has to join a cluster and convert it's schema todisc_copies
.This is mentioned in the documentation: https://www.erlang.org/doc/apps/mnesia/mnesia.html#module-configuration-parameters
but
is not covered by any tests, so add tests for both of those cases.