Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rabbit_db: Add init/0, is_virgin_node/0, dir/0 and ensure_dir_exists/0 functions #6866

Merged
merged 3 commits into from
Jan 13, 2023

Conversation

dumbbell
Copy link
Member

@dumbbell dumbbell commented Jan 12, 2023

These functions sit on top of their equivalent in rabbit_mnesia. In the future, they will take care of picking the right database layer, whatever it is.

The start of mnesia_sync is now part of this initialization instead of a separate boot step in rabbit because it is specific to our use of Mnesia.

In addition, rabbit_db provides is_virgin_node/1 to query the state of a remote node. This is used by rabbit_ff_controller in the feature flags subsystem.

At this point, the underlying equivalent functions in rabbit_mnesia become private to this module (and other modules implementing the interaction with Mnesia). Other parts of RabbitMQ, including plugins, should now use rabbit_db, not rabbit_mnesia.

This is a follow-up to #6430. It is a preparation step to be able to change the database layer.

@dumbbell dumbbell added this to the 3.12.0 milestone Jan 12, 2023
@dumbbell dumbbell self-assigned this Jan 12, 2023
@dumbbell dumbbell force-pushed the init-db-from-rabbit_db branch 2 times, most recently from db51669 to 60203bc Compare January 12, 2023 16:50
Here is an example:

    ?LOG_DEBUG(
      "DB: initialization successeful",
      #{domain => ?RMQLOG_DOMAIN_DB}),
…exists/0` functions

These functions sit on top of their equivalent in `rabbit_mnesia`. In
the future, they will take care of picking the right database layer,
whatever it is.

The start of `mnesia_sync` is now part of this initialization instead of
a separate boot step in `rabbit` because it is specific to our use of
Mnesia.

In addition, `rabbit_db` provides `is_virgin_node/1` to query the state
of a remote node. This is used by `rabbit_ff_controller` in the feature
flags subsystem.

At this point, the underlying equivalent functions in `rabbit_mnesia`
become private to this module (and other modules implementing the
interaction with Mnesia). Other parts of RabbitMQ, including plugins,
should now use `rabbit_db`, not `rabbit_mnesia`.
…es sense

Some testcases are interested in RabbitMQ data directory, not Mnesia
directory per se. In this case, call `rabbit:data_dir/0` instead.
@dumbbell dumbbell force-pushed the init-db-from-rabbit_db branch from 60203bc to 950c4ef Compare January 13, 2023 10:56
@dumbbell dumbbell changed the title Initialize database from rabbit_db rabbit_db: Add init/0, is_virgin_node/0, dir/0 and ensure_dir_exists/0 functions Jan 13, 2023
@dumbbell dumbbell marked this pull request as ready for review January 13, 2023 11:56
@dumbbell dumbbell merged commit 4840ca9 into main Jan 13, 2023
@dumbbell dumbbell deleted the init-db-from-rabbit_db branch January 13, 2023 15:26
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.

3 participants