Skip to content

Do not wait for ?rlog_sync table - #199

Merged
ieQu1 merged 2 commits into
mainfrom
dev/force-load-rlog_sync-table
Feb 9, 2026
Merged

Do not wait for ?rlog_sync table#199
ieQu1 merged 2 commits into
mainfrom
dev/force-load-rlog_sync-table

Conversation

@ieQu1

@ieQu1 ieQu1 commented Feb 9, 2026

Copy link
Copy Markdown
Member

Speed up cluster restart by not waiting for the master of ?rlog_sync table. It's a null_copies table used solely for the events, its contents are irrelevant.

@ieQu1
ieQu1 force-pushed the dev/force-load-rlog_sync-table branch from 4aa0640 to 6a58a49 Compare February 9, 2026 12:46
[ {mria, db_backend, rlog}
, {mria, rlog_startup_shards, [test_shard]}
, {mria, strict_mode, true}
, {mria, rpc_module, gen_rpc}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: we no longer use gen_rpc as a transport in production.

@ieQu1
ieQu1 force-pushed the dev/force-load-rlog_sync-table branch 2 times, most recently from f73ad61 to 8865d60 Compare February 9, 2026 12:49
@ieQu1
ieQu1 requested a review from Copilot February 9, 2026 12:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts Mria startup/schema bootstrap behavior to avoid getting stuck waiting on the ?rlog_sync table, and adds/updates CT coverage to exercise full cluster restart scenarios.

Changes:

  • Remove blocking waits for ?rlog_sync during schema bootstrap and introduce a local force-load step instead.
  • Reduce mria_mnesia:wait_for_tables/1 per-iteration wait timeout (30s → 5s) before retry/diagnostics.
  • Update/add CT suites to better simulate realistic cluster conditions and validate full cluster restart behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/mria_mnesia_test_util.erl Removes an unused/ineffective env setting from common test env.
test/mria_autoclean_SUITE.erl Makes autoclean test run with a replicant and adds more “realistic” setup steps.
test/mria_SUITE.erl Adds a new full-cluster-restart testcase and updates copyright year.
src/mria_schema.erl Stops waiting on ?rlog_sync and adds a force_load/1 helper during bootstrap.
src/mria_mnesia.erl Lowers the wait timeout used by wait_for_tables/1 retry loop.
Comments suppressed due to low confidence (1)

src/mria_mnesia.erl:280

  • Reducing the mnesia:wait_for_tables/2 timeout from 30s to 5s increases the frequency of the timeout path, which logs a warning, runs diagnostics, and calls mnesia_controller:connect_nodes/1 before retrying. This can significantly increase log volume and connection churn in slow/large clusters. Consider keeping a larger default, adding a backoff, or making the timeout configurable.
    case mnesia:wait_for_tables(Tables, 5_000) of
        ok ->
            ?tp(mria_wait_for_tables_done, #{result => ok}),
            ok;
        {error, Reason} ->
            ?tp(mria_wait_for_tables_done, #{result => {error, Reason}}),
            {error, Reason};
        {timeout, BadTables} ->
            logger:warning("~p: still waiting for table(s): ~p", [?MODULE, BadTables]),
            catch diagnosis(BadTables),
            %% lets try to force reconnect all the db_nodes to get schema merged,
            %% mnesia_controller is smart enough to not force reconnect the node that is already connected.
            mnesia_controller:connect_nodes(mnesia:system_info(db_nodes)),
            wait_for_tables(BadTables)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/mria_autoclean_SUITE.erl
Comment thread test/mria_SUITE.erl Outdated
Comment thread src/mria_schema.erl
Comment thread src/mria_schema.erl
@ieQu1
ieQu1 force-pushed the dev/force-load-rlog_sync-table branch from 8865d60 to ce270d6 Compare February 9, 2026 13:48
@ieQu1
ieQu1 force-pushed the dev/force-load-rlog_sync-table branch from ce270d6 to e2c382f Compare February 9, 2026 14:40
@ieQu1
ieQu1 merged commit 493285a into main Feb 9, 2026
2 checks passed
@ieQu1
ieQu1 deleted the dev/force-load-rlog_sync-table branch February 9, 2026 15:52
Comment thread src/mria_schema.erl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants