diff --git a/src/mongoose_cets_discovery_rdbms.erl b/src/mongoose_cets_discovery_rdbms.erl index 3e0042e81db..b6342bd0741 100644 --- a/src/mongoose_cets_discovery_rdbms.erl +++ b/src/mongoose_cets_discovery_rdbms.erl @@ -25,8 +25,14 @@ -spec init(opts()) -> state(). init(Opts = #{cluster_name := ClusterName, node_name_to_insert := Node}) when is_binary(ClusterName), is_binary(Node) -> - Keys = [cluster_name, node_name_to_insert, last_query_info, expire_time, node_ip_binary], - maps:with(Keys, maps:merge(defaults(), Opts)). + Keys = [node_name_to_insert, expire_time, last_query_info, node_ip_binary], + StateOpts = maps:merge(defaults(), maps:with(Keys, Opts)), + StateOpts#{cluster_name => cluster_name_with_vsn(ClusterName)}. + +cluster_name_with_vsn(ClusterName) -> + {ok, CetsVsn} = application:get_key(cets, vsn), + [MajorVsn, MinorVsn | _] = string:tokens(CetsVsn, "."), + iolist_to_binary([ClusterName, $-, MajorVsn, $., MinorVsn]). defaults() -> #{expire_time => 60 * 60 * 1, %% 1 hour in seconds