mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Check for Mnesia node name mismatches
Log a proper error message if the node running ejabberd doesn't own the Mnesia database.
This commit is contained in:
parent
4b82a38cf7
commit
1ef2dd45f3
@ -107,6 +107,18 @@ loop() ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
db_init() ->
|
db_init() ->
|
||||||
|
MyNode = node(),
|
||||||
|
DbNodes = mnesia:system_info(db_nodes),
|
||||||
|
case lists:member(MyNode, DbNodes) of
|
||||||
|
true ->
|
||||||
|
ok;
|
||||||
|
false ->
|
||||||
|
?CRITICAL_MSG("Node name mismatch: I'm [~s], "
|
||||||
|
"the database is owned by ~p", [MyNode, DbNodes]),
|
||||||
|
?CRITICAL_MSG("Either set ERLANG_NODE in ejabberdctl.cfg "
|
||||||
|
"or change node name in Mnesia", []),
|
||||||
|
erlang:error(node_name_mismatch)
|
||||||
|
end,
|
||||||
case mnesia:system_info(extra_db_nodes) of
|
case mnesia:system_info(extra_db_nodes) of
|
||||||
[] ->
|
[] ->
|
||||||
mnesia:create_schema([node()]);
|
mnesia:create_schema([node()]);
|
||||||
|
Loading…
Reference in New Issue
Block a user