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

Remove domain/retries #3774

Merged
merged 3 commits into from
Sep 27, 2022
Merged

Remove domain/retries #3774

merged 3 commits into from
Sep 27, 2022

Conversation

NelsonVides
Copy link
Collaborator

Current logic for domain deletion first checks that the domain exists,
then removes the domain, and then runs the remove_domain hook. But this
is a problem, because if any of the hooks fails, then retrying the
domain removal won’t work, because it will be stopped at the first check
for domain existence.

Here we instead mark the domain as "in progress for deletion", which
will already disable it, and only finally delete it _after_ all hook
handlers have run hopefully successfully.

@mongoose-im

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Sep 23, 2022

Codecov Report

Base: 82.82% // Head: 82.81% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (471d300) compared to base (6c3819f).
Patch coverage: 90.47% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3774      +/-   ##
==========================================
- Coverage   82.82%   82.81%   -0.01%     
==========================================
  Files         531      531              
  Lines       34083    34095      +12     
==========================================
+ Hits        28228    28236       +8     
- Misses       5855     5859       +4     
Impacted Files Coverage Δ
src/graphql/mongoose_graphql_enum.erl 85.71% <50.00%> (-1.52%) ⬇️
src/domain/mongoose_domain_api.erl 96.92% <85.71%> (-1.49%) ⬇️
src/domain/mongoose_domain_sql.erl 93.91% <92.85%> (-0.37%) ⬇️
...l/admin/mongoose_graphql_domain_admin_mutation.erl 92.30% <100.00%> (ø)
...phql/admin/mongoose_graphql_domain_admin_query.erl 100.00% <100.00%> (ø)
src/graphql/mongoose_graphql_domain.erl 100.00% <100.00%> (ø)
src/mongoose_hooks.erl 95.75% <100.00%> (ø)
src/rdbms/mongoose_rdbms_pgsql_codec_boolean.erl 77.77% <0.00%> (-22.23%) ⬇️
...rc/smart_markers/mod_smart_markers_rdbms_async.erl 91.66% <0.00%> (-4.17%) ⬇️
src/mam/mod_mam_muc_rdbms_arch_async.erl 82.85% <0.00%> (-2.86%) ⬇️
... and 12 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

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 think it's going in the right direction, but I added some comments regarding GraphQL. Also, I think we shouldn't allow re-enabling of the domains that are in deletion. I think the current code does not prevent this, and there is no test for it (I would like to have one).

priv/migrations/mssql_5.2.0_6.0.0.sql Outdated Show resolved Hide resolved
priv/migrations/mysql_5.2.0_6.0.0.sql Outdated Show resolved Hide resolved
priv/migrations/pgsql_5.2.0_6.0.0.sql Outdated Show resolved Hide resolved
src/domain/mongoose_domain_sql.erl Show resolved Hide resolved
src/graphql/admin/mongoose_graphql_domain_admin_query.erl Outdated Show resolved Hide resolved
Current logic for domain deletion first checks that the domain exists,
then removes the domain, and then runs the remove_domain hook. But this
is a problem, because if any of the hooks fails, then retrying the
domain removal won’t work, because it will be stopped at the first check
for domain existence.

Here we instead mark the domain as "in progress for deletion", which
will already disable it, and only finally delete it _after_ all hook
handlers have run hopefully successfully.
@mongoose-im

This comment was marked as outdated.

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.

Looks good 👍

src/graphql/mongoose_graphql_domain.erl Outdated Show resolved Hide resolved
@mongoose-im
Copy link
Collaborator

mongoose-im commented Sep 26, 2022

small_tests_24 / small_tests / 471d300
Reports root / small


small_tests_25 / small_tests / 471d300
Reports root / small


ldap_mnesia_24 / ldap_mnesia / 471d300
Reports root/ big
OK: 1992 / Failed: 0 / User-skipped: 742 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 471d300
Reports root/ big
OK: 3826 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 471d300
Reports root/ big
OK: 3826 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 471d300
Reports root/ big
OK: 3826 / Failed: 0 / User-skipped: 88 / Auto-skipped: 0


dynamic_domains_mysql_redis_25 / mysql_redis / 471d300
Reports root/ big
OK: 3800 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / 471d300
Reports root/ big
OK: 1992 / Failed: 0 / User-skipped: 742 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 471d300
Reports root/ big
OK: 4200 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0


elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 471d300
Reports root/ big
OK: 2453 / Failed: 0 / User-skipped: 616 / Auto-skipped: 0


mysql_redis_25 / mysql_redis / 471d300
Reports root/ big
OK: 4186 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 471d300
Reports root/ big
OK: 4200 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 471d300
Reports root/ big
OK: 2292 / Failed: 0 / User-skipped: 609 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / 471d300
Reports root/ big
OK: 4199 / Failed: 1 / User-skipped: 97 / Auto-skipped: 0

push_integration_SUITE:pubsub_ful:pm_notifications_with_inbox:inbox_msg_unread_count_apns
{error,
  {{assertMatch,
     [{module,push_integration_SUITE},
      {line,662},
      {expression,"Data"},
      {pattern,"# { << \"message-count\" >> := ExpectedCount }"},
      {value,
        #{<<"last-message-body">> => <<"Private message">>,
        <<"last-message-sender">> =>
          <<"alice_inbox_msg_unread_count_apns_2722@localhost">>,
        <<"message-count">> => 1}}]},
   [{push_integration_SUITE,check_notification,2,
      [{file,
         "/home/circleci/project/big_tests/tests/push_integration_SUITE.erl"},
       {line,662}]},
    {push_integration_SUITE,'-inbox_msg_unread_count/3-fun-0-',6,
      [{file,
         "/home/circleci/project/big_tests/tests/push_integration_SUITE.erl"},
       {line,578}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1782}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1291}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1223}]}]}}

Report log


mssql_mnesia_25 / odbc_mssql_mnesia / 471d300
Reports root/ big
OK: 4200 / Failed: 0 / User-skipped: 97 / Auto-skipped: 0

@chrzaszcz chrzaszcz merged commit e79f084 into master Sep 27, 2022
@chrzaszcz chrzaszcz deleted the remove_domain/retries branch September 27, 2022 05:55
@chrzaszcz chrzaszcz added this to the 6.0.0 milestone Dec 12, 2022
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.

None yet

3 participants