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 effed12
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/mongoose_internal_databases.erl
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ 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);

Check warning on line 53 in src/mongoose_internal_databases.erl

View check run for this annotation

Codecov / codecov/patch

src/mongoose_internal_databases.erl#L51-L53

Added lines #L51 - L53 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 effed12

Please sign in to comment.