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

Multi tenancy init #3061

Merged
merged 18 commits into from
Mar 27, 2021
Merged

Multi tenancy init #3061

merged 18 commits into from
Mar 27, 2021

Conversation

DenysGonchar
Copy link
Collaborator

@DenysGonchar DenysGonchar commented Mar 23, 2021

this PR introduces the next changes:

  • solves race condition at check_for_updates/2 function
  • eliminates the need to restart mongoose_domain_core if service_domain_db crashes on initial loading
  • eliminates the need to halt the node if service_domain_db goes out of sync
  • ensures proper init of the mongoose_domain_core
  • introduces 2 dummy test suites for the future development.

Also now it's possible to implement "hooks" for domains adding/removing if there's such a need

@DenysGonchar DenysGonchar requested a review from chrzaszcz March 23, 2021 03:03
@codecov
Copy link

codecov bot commented Mar 23, 2021

Codecov Report

Merging #3061 (194e07a) into multi-tenancy-phase-1 (f991ee2) will increase coverage by 0.59%.
The diff coverage is 89.80%.

Impacted file tree graph

@@                    Coverage Diff                    @@
##           multi-tenancy-phase-1    #3061      +/-   ##
=========================================================
+ Coverage                  78.09%   78.69%   +0.59%     
=========================================================
  Files                        374      386      +12     
  Lines                      31219    31610     +391     
=========================================================
+ Hits                       24382    24877     +495     
+ Misses                      6837     6733     -104     
Impacted Files Coverage Δ
src/admin_extra/service_admin_extra.erl 100.00% <ø> (ø)
src/auth/ejabberd_auth_anonymous.erl 48.75% <0.00%> (-1.25%) ⬇️
src/ejabberd_gen_sm.erl 90.90% <ø> (ø)
src/ejabberd_local.erl 62.68% <0.00%> (-1.50%) ⬇️
src/muc_light/mod_muc_light_db_mnesia.erl 89.47% <ø> (+4.47%) ⬆️
src/offline/mod_offline_mnesia.erl 51.47% <0.00%> (ø)
src/pubsub/pubsub_form_utils.erl 56.60% <0.00%> (+1.04%) ⬆️
src/rdbms/rdbms_queries_mssql.erl 100.00% <ø> (ø)
src/rdbms/mongoose_rdbms_odbc.erl 75.78% <45.45%> (-1.86%) ⬇️
src/mam/mod_mam_rdbms_arch.erl 48.45% <47.14%> (+9.18%) ⬆️
... and 91 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bfc788d...194e07a. Read the comment docs.

@DenysGonchar DenysGonchar requested a review from arcusfelis March 23, 2021 08:20
Copy link
Contributor

@arcusfelis arcusfelis left a comment

Choose a reason for hiding this comment

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

added some comments

State = #{last_event_id => LastEventId,
check_for_updates_interval => 30000},
{ok, handle_check_for_updates(State)}.
gen_server:cast(self(),initial_loading),
Copy link
Contributor

Choose a reason for hiding this comment

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

It will unblock execution, introducing new set of errors (i.e. domain is not on the node yet).
I highly recommend to not continue execution, unless every domain is on MongooseIM side.

We even don't allow that when syncing mnesia.

TLDR: you will have issues here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was thinking about unblocking initialisation of other modules/services.
Mostly like we will have to introduce some REST API check to ensure that node is ready for adding to load balancer.

Anyway it's relatively easy to roll back that change if required later.

src/domain/service_domain_db.erl Outdated Show resolved Hide resolved
src/domain/mongoose_domain_sql.erl Outdated Show resolved Hide resolved
src/domain/mongoose_domain_loader.erl Outdated Show resolved Hide resolved
src/domain/mongoose_domain_core.erl Outdated Show resolved Hide resolved
big_tests/tests/service_domain_db_SUITE.erl Show resolved Hide resolved
src/domain/mongoose_domain_sql.erl Outdated Show resolved Hide resolved
Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

Good changes! Just a few comments from me.

big_tests/tests/dynamic_domains_pm_SUITE.erl Outdated Show resolved Hide resolved
rel/files/mongooseim.toml Outdated Show resolved Hide resolved
big_tests/tests/service_domain_db_SUITE.erl Outdated Show resolved Hide resolved
big_tests/tests/service_domain_db_SUITE.erl Outdated Show resolved Hide resolved
src/domain/mongoose_domain_api.erl Outdated Show resolved Hide resolved
src/domain/mongoose_domain_sql.erl Outdated Show resolved Hide resolved
src/domain/mongoose_domain_sql.erl Outdated Show resolved Hide resolved
src/domain/mongoose_domain_sql.erl Outdated Show resolved Hide resolved
src/domain/mongoose_domain_loader.erl Outdated Show resolved Hide resolved
src/domain/mongoose_domain_loader.erl Show resolved Hide resolved
@arcusfelis arcusfelis merged commit b5ad312 into multi-tenancy-phase-1 Mar 27, 2021
@arcusfelis arcusfelis deleted the multi-tenancy-init branch March 27, 2021 20:40
Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

I also had a quick look, it seems good!

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