@@ -1107,14 +1107,23 @@ collect_payloads(Props, Acc0) when is_map(Props) andalso is_list(Acc0) ->
1107
1107
Acc
1108
1108
end , Acc0 , Props ).
1109
1109
1110
- -spec unregister_all_projections () -> Ret when
1110
+ -spec unregister_legacy_projections () -> Ret when
1111
1111
Ret :: ok | timeout_error ().
1112
+ % % @doc Unregisters any projections which were registered in RabbitMQ 3.13.x
1113
+ % % versions.
1114
+ % %
1115
+ % % In 3.13.x until 3.13.8 we mistakenly registered these projections even if
1116
+ % % Khepri was not enabled. This function is used by the `khepri_db' enable
1117
+ % % callback to remove those projections before we register the ones necessary
1118
+ % % for 4.0.x.
1119
+ % %
1120
+ % % @private
1112
1121
1113
- unregister_all_projections () ->
1122
+ unregister_legacy_projections () ->
1114
1123
% % Note that we don't use `all' since `khepri_mnesia_migration' also
1115
1124
% % creates a projection table which we don't want to unregister. Instead
1116
- % % we list all of the currently used projection names:
1117
- Names = [
1125
+ % % we list all of the legacy projection names:
1126
+ LegacyNames = [
1118
1127
rabbit_khepri_exchange ,
1119
1128
rabbit_khepri_queue ,
1120
1129
rabbit_khepri_vhost ,
@@ -1126,7 +1135,7 @@ unregister_all_projections() ->
1126
1135
rabbit_khepri_index_route ,
1127
1136
rabbit_khepri_topic_trie
1128
1137
],
1129
- khepri :unregister_projections (? STORE_ID , Names ).
1138
+ khepri :unregister_projections (? STORE_ID , LegacyNames ).
1130
1139
1131
1140
register_projections () ->
1132
1141
RegFuns = [fun register_rabbit_exchange_projection /0 ,
@@ -1543,7 +1552,7 @@ get_feature_state(Node) ->
1543
1552
khepri_db_migration_enable (#{feature_name := FeatureName }) ->
1544
1553
maybe
1545
1554
ok ?= sync_cluster_membership_from_mnesia (FeatureName ),
1546
- ok ?= unregister_all_projections (),
1555
+ ok ?= unregister_legacy_projections (),
1547
1556
ok ?= register_projections (),
1548
1557
migrate_mnesia_tables (FeatureName )
1549
1558
end .
0 commit comments