Merge pull request #12783 from zhongwencool/fix-bpapi-error-1

fix: bpapi undef abort on old node
This commit is contained in:
zhongwencool 2024-03-26 13:59:14 +08:00 committed by GitHub
commit be609e051a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 5 deletions

View File

@ -88,11 +88,10 @@ announce(Node, App) ->
{ok, Data} = file:consult(?MODULE:versions_file(App)),
%% replicant(5.6.0) will call old core(<5.6.0) announce_fun/2 is undef on old core
%% so we just use anonymous function to update.
try
{atomic, ok} = mria:transaction(?COMMON_SHARD, fun ?MODULE:announce_fun/2, [Node, Data]),
ok
catch
error:undef ->
case mria:transaction(?COMMON_SHARD, fun ?MODULE:announce_fun/2, [Node, Data]) of
{atomic, ok} ->
ok;
{aborted, {undef, [{?MODULE, announce_fun, _, _} | _]}} ->
{atomic, ok} = mria:transaction(
?COMMON_SHARD,
fun() ->