Skip to content

Commit

Permalink
Restart mnesia if wait_for_tables hangs
Browse files Browse the repository at this point in the history
  • Loading branch information
chrzaszcz committed Dec 17, 2024
1 parent b129abc commit 41aa276
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/mongoose_internal_databases.erl
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,15 @@ wait_for_tables_loop(Tables, Interval, Total) ->
ok;
{timeout, Tables} ->
%% If the tables don't change, mnesia is most likely stuck
error(#{what => mnesia_wait_for_tables_timeout,
waiting_for_tables => Tables,
waiting_time => Total + Interval});
?LOG_WARNING(#{what => mnesia_wait_for_tables_timeout,

Check warning on line 49 in src/mongoose_internal_databases.erl

View check run for this annotation

Codecov / codecov/patch

src/mongoose_internal_databases.erl#L49

Added line #L49 was not covered by tests
waiting_for_tables => Tables,
waiting_time => Total + Interval}),
mnesia:stop(),
application:start(mnesia, permanent),
wait_for_mnesia();

Check warning on line 54 in src/mongoose_internal_databases.erl

View check run for this annotation

Codecov / codecov/patch

src/mongoose_internal_databases.erl#L51-L54

Added lines #L51 - L54 were not covered by tests
%% error(#{what => mnesia_wait_for_tables_timeout,
%% waiting_for_tables => Tables,
%% waiting_time => Total + Interval});
{timeout, NewTables} ->
?LOG_WARNING(#{what => mnesia_wait_for_tables_progress,
waiting_for_tables => NewTables,
Expand Down

0 comments on commit 41aa276

Please sign in to comment.