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

Make CETS node cleanup consistent #4250

Merged
merged 3 commits into from Mar 27, 2024
Merged

Make CETS node cleanup consistent #4250

merged 3 commits into from Mar 27, 2024

Conversation

chrzaszcz
Copy link
Member

@chrzaszcz chrzaszcz commented Mar 26, 2024

Previously, during node cleanup for CETS:

  • Some modules removed only local content
  • Others performed cluster-wide CETS operations

It is not possible to always remove local content because of session_cleanup and the need for insertions - see e.g. stream management. Meanwhile, Mnesia cleanup consistently removes all content across the cluster.

After this change, CETS does the same. An immediate benefit is that after the first global:trans/2 finishes in mongoose_cleaner:run_node_cleanup/1, cluster state is consistent. Previously, cleanup would need to succeed on all nodes (sequentially), and before that the cluster would be in an inconsistent state.

Also:

  • Refactor cleanup tests to make them more maintainable.
  • Improve test coverage for CETS cleanup.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Mar 26, 2024

elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / ddc48ec
Reports root/ big
OK: 437 / Failed: 0 / User-skipped: 43 / Auto-skipped: 0


small_tests_25 / small_tests / ddc48ec
Reports root / small


small_tests_26 / small_tests / ddc48ec
Reports root / small


small_tests_26_arm64 / small_tests / ddc48ec
Reports root / small


ldap_mnesia_25 / ldap_mnesia / ddc48ec
Reports root/ big
OK: 2284 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / ddc48ec
Reports root/ big
OK: 2284 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / ddc48ec
Reports root/ big
OK: 4539 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


dynamic_domains_mysql_redis_26 / mysql_redis / ddc48ec
Reports root/ big
OK: 4506 / Failed: 0 / User-skipped: 144 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / ddc48ec
Reports root/ big
OK: 4539 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


internal_mnesia_26 / internal_mnesia / ddc48ec
Reports root/ big
OK: 2424 / Failed: 0 / User-skipped: 755 / Auto-skipped: 0


pgsql_cets_26 / pgsql_cets / ddc48ec
Reports root/ big
OK: 4454 / Failed: 0 / User-skipped: 178 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / ddc48ec
Reports root/ big
OK: 4928 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / ddc48ec
Reports root/ big
OK: 4536 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


mysql_redis_26 / mysql_redis / ddc48ec
Reports root/ big
OK: 4907 / Failed: 0 / User-skipped: 139 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / ddc48ec
Reports root/ big
OK: 4928 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0


mssql_mnesia_26 / odbc_mssql_mnesia / ddc48ec
Reports root/ big
OK: 4925 / Failed: 0 / User-skipped: 121 / Auto-skipped: 0

Copy link

codecov bot commented Mar 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.44%. Comparing base (0273b50) to head (e284af4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4250      +/-   ##
==========================================
+ Coverage   84.31%   84.44%   +0.12%     
==========================================
  Files         552      552              
  Lines       33549    33549              
==========================================
+ Hits        28288    28331      +43     
+ Misses       5261     5218      -43     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Previously, during node cleanup for CETS:
- Some modules removed only local content
- Others performed cluster-wide CETS operations

It is not possible to always remove local content because of
session_cleanup and the need for insertions - see e.g. stream management.

Meanwhile, Mnesia cleanup consistently removed all content across the
cluster.

After this change, CETS does the same.

An immediate benefit is that after the first global:trans/2 finishes
in mongoose_cleaner:run_node_cleanup/1, cluster state is consistent.

Previously cleanup would need to succeed on all nodes (sequentially),
and before that the cluster would be in an inconsistent state.
Simplify setup of modules and meck.
The goal is to easily test more modules for CETS and Mnesia.
@chrzaszcz chrzaszcz force-pushed the consistent-node-cleanup branch 2 times, most recently from 5a009d1 to b033d54 Compare March 26, 2024 19:20
@mongoose-im
Copy link
Collaborator

mongoose-im commented Mar 26, 2024

elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / 5a009d1
Reports root/ big
OK: 437 / Failed: 0 / User-skipped: 43 / Auto-skipped: 0


small_tests_25 / small_tests / 5a009d1
Reports root / small


small_tests_26 / small_tests / 5a009d1
Reports root / small


small_tests_26_arm64 / small_tests / 5a009d1
Reports root / small


dynamic_domains_mysql_redis_26 / mysql_redis / 5a009d1
Reports root/ big
OK: 4506 / Failed: 0 / User-skipped: 144 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 5a009d1
Reports root/ big
OK: 4539 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


internal_mnesia_26 / internal_mnesia / 5a009d1
Reports root/ big
OK: 2424 / Failed: 0 / User-skipped: 755 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / 5a009d1
Reports root/ big
OK: 2284 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 5a009d1
Reports root/ big
OK: 4539 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


pgsql_cets_26 / pgsql_cets / 5a009d1
Reports root/ big
OK: 4454 / Failed: 0 / User-skipped: 178 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / 5a009d1
Reports root/ big
OK: 4536 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 5a009d1
Reports root/ big
OK: 4928 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0


mysql_redis_26 / mysql_redis / 5a009d1
Reports root/ big
OK: 4907 / Failed: 0 / User-skipped: 139 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / 5a009d1
Reports root/ big
OK: 4928 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0


mssql_mnesia_26 / odbc_mssql_mnesia / 5a009d1
Reports root/ big
OK: 4925 / Failed: 0 / User-skipped: 121 / Auto-skipped: 0

@mongoose-im
Copy link
Collaborator

mongoose-im commented Mar 26, 2024

elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / b033d54
Reports root/ big
OK: 437 / Failed: 0 / User-skipped: 43 / Auto-skipped: 0


small_tests_25 / small_tests / b033d54
Reports root / small


small_tests_26 / small_tests / b033d54
Reports root / small


small_tests_26_arm64 / small_tests / b033d54
Reports root / small


ldap_mnesia_25 / ldap_mnesia / b033d54
Reports root/ big
OK: 2284 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / b033d54
Reports root/ big
OK: 2282 / Failed: 2 / User-skipped: 895 / Auto-skipped: 0

graphql_SUITE:tls_enabled:tls_connect_user_unknown_certificate
{error,{{assertMatch,[{module,graphql_SUITE},
            {line,228},
            {expression,"Result"},
            {pattern,"{ error , { tls_alert , { unknown_ca , _ } } }"},
            {value,{error,connection_closed}}]},
    [{graphql_SUITE,tls_connect_user_unknown_certificate,1,
            [{file,"/home/circleci/project/big_tests/tests/graphql_SUITE.erl"},
             {line,228}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1793}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1302}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1234}]}]}}

Report log

pubsub_SUITE:dag+basic:publish_test
{error,{{badmatch,false},
    [{pubsub_tools,check_response,2,
             [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
            {line,444}]},
     {pubsub_tools,receive_response,3,
             [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
            {line,434}]},
     {pubsub_tools,receive_and_check_response,4,
             [{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
            {line,424}]},
     {pubsub_SUITE,'-publish_test/1-fun-0-',1,
             [{file,"/home/circleci/project/big_tests/tests/pubsub_SUITE.erl"},
            {line,444}]},
     {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,1793}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1302}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1234}]}]}}

Report log


dynamic_domains_mysql_redis_26 / mysql_redis / b033d54
Reports root/ big
OK: 4506 / Failed: 0 / User-skipped: 144 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / b033d54
Reports root/ big
OK: 4539 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / b033d54
Reports root/ big
OK: 4539 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


pgsql_cets_26 / pgsql_cets / b033d54
Reports root/ big
OK: 4453 / Failed: 1 / User-skipped: 178 / Auto-skipped: 0

graphql_SUITE:tls_enabled:tls_connect_admin_selfsigned_certificate
{error,{{assertMatch,[{module,graphql_SUITE},
            {line,259},
            {expression,"Result"},
            {pattern,"{ error , { tls_alert , { bad_certificate , _ } } }"},
            {value,{error,connection_closed}}]},
    [{graphql_SUITE,tls_connect_admin_selfsigned_certificate,1,
            [{file,"/home/circleci/project/big_tests/tests/graphql_SUITE.erl"},
             {line,259}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1793}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1302}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1234}]}]}}

Report log


dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / b033d54
Reports root/ big
OK: 4536 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


internal_mnesia_26 / internal_mnesia / b033d54
Reports root/ big
OK: 2424 / Failed: 0 / User-skipped: 755 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / b033d54
Reports root/ big
OK: 4927 / Failed: 1 / User-skipped: 118 / Auto-skipped: 0

graphql_SUITE:tls_enabled:tls_connect_admin_selfsigned_certificate
{error,{{assertMatch,[{module,graphql_SUITE},
            {line,259},
            {expression,"Result"},
            {pattern,"{ error , { tls_alert , { bad_certificate , _ } } }"},
            {value,{error,connection_closed}}]},
    [{graphql_SUITE,tls_connect_admin_selfsigned_certificate,1,
            [{file,"/home/circleci/project/big_tests/tests/graphql_SUITE.erl"},
             {line,259}]},
     {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


pgsql_mnesia_26 / pgsql_mnesia / b033d54
Reports root/ big
OK: 4928 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0


mysql_redis_26 / mysql_redis / b033d54
Reports root/ big
OK: 4907 / Failed: 0 / User-skipped: 139 / Auto-skipped: 0


mssql_mnesia_26 / odbc_mssql_mnesia / b033d54
Reports root/ big
OK: 4925 / Failed: 0 / User-skipped: 121 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / b033d54
Reports root/ big
OK: 2284 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


pgsql_cets_26 / pgsql_cets / b033d54
Reports root/ big
OK: 4454 / Failed: 0 / User-skipped: 178 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / b033d54
Reports root/ big
OK: 4928 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0

@mongoose-im
Copy link
Collaborator

mongoose-im commented Mar 27, 2024

elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / 7fda9ef
Reports root/ big
OK: 437 / Failed: 0 / User-skipped: 43 / Auto-skipped: 0


small_tests_25 / small_tests / 7fda9ef
Reports root / small


small_tests_26 / small_tests / 7fda9ef
Reports root / small


small_tests_26_arm64 / small_tests / 7fda9ef
Reports root / small


ldap_mnesia_25 / ldap_mnesia / 7fda9ef
Reports root/ big
OK: 2284 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 7fda9ef
Reports root/ big
OK: 4539 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / 7fda9ef
Reports root/ big
OK: 2283 / Failed: 1 / User-skipped: 895 / Auto-skipped: 0

graphql_SUITE:tls_enabled:tls_connect_admin_unknown_certificate
{error,{{assertMatch,[{module,graphql_SUITE},
            {line,253},
            {expression,"Result"},
            {pattern,"{ error , { tls_alert , { unknown_ca , _ } } }"},
            {value,{error,connection_closed}}]},
    [{graphql_SUITE,tls_connect_admin_unknown_certificate,1,
            [{file,"/home/circleci/project/big_tests/tests/graphql_SUITE.erl"},
             {line,253}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1793}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1302}]},
     {test_server,run_test_case_eval,9,
            [{file,"test_server.erl"},{line,1234}]}]}}

Report log


dynamic_domains_mysql_redis_26 / mysql_redis / 7fda9ef
Reports root/ big
OK: 4506 / Failed: 0 / User-skipped: 144 / Auto-skipped: 0


internal_mnesia_26 / internal_mnesia / 7fda9ef
Reports root/ big
OK: 2424 / Failed: 0 / User-skipped: 755 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 7fda9ef
Reports root/ big
OK: 4539 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


pgsql_cets_26 / pgsql_cets / 7fda9ef
Reports root/ big
OK: 4454 / Failed: 0 / User-skipped: 178 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / 7fda9ef
Reports root/ big
OK: 4536 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 7fda9ef
Reports root/ big
OK: 4928 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0


mysql_redis_26 / mysql_redis / 7fda9ef
Reports root/ big
OK: 4907 / Failed: 0 / User-skipped: 139 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / 7fda9ef
Reports root/ big
OK: 4928 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0


mssql_mnesia_26 / odbc_mssql_mnesia / 7fda9ef
Reports root/ big
OK: 4925 / Failed: 0 / User-skipped: 121 / Auto-skipped: 0

@mongoose-im
Copy link
Collaborator

mongoose-im commented Mar 27, 2024

elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / e284af4
Reports root/ big
OK: 437 / Failed: 0 / User-skipped: 43 / Auto-skipped: 0


small_tests_25 / small_tests / e284af4
Reports root / small


small_tests_26 / small_tests / e284af4
Reports root / small


small_tests_26_arm64 / small_tests / e284af4
Reports root / small


ldap_mnesia_25 / ldap_mnesia / e284af4
Reports root/ big
OK: 2284 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


dynamic_domains_mysql_redis_26 / mysql_redis / e284af4
Reports root/ big
OK: 4506 / Failed: 0 / User-skipped: 144 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / e284af4
Reports root/ big
OK: 2284 / Failed: 0 / User-skipped: 895 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / e284af4
Reports root/ big
OK: 4539 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / e284af4
Reports root/ big
OK: 4539 / Failed: 0 / User-skipped: 111 / Auto-skipped: 0


internal_mnesia_26 / internal_mnesia / e284af4
Reports root/ big
OK: 2424 / Failed: 0 / User-skipped: 755 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / e284af4
Reports root/ big
OK: 4536 / Failed: 0 / User-skipped: 114 / Auto-skipped: 0


pgsql_cets_26 / pgsql_cets / e284af4
Reports root/ big
OK: 4454 / Failed: 0 / User-skipped: 178 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / e284af4
Reports root/ big
OK: 4928 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0


mysql_redis_26 / mysql_redis / e284af4
Reports root/ big
OK: 4907 / Failed: 0 / User-skipped: 139 / Auto-skipped: 0


pgsql_mnesia_26 / pgsql_mnesia / e284af4
Reports root/ big
OK: 4928 / Failed: 0 / User-skipped: 118 / Auto-skipped: 0


mssql_mnesia_26 / odbc_mssql_mnesia / e284af4
Reports root/ big
OK: 4925 / Failed: 0 / User-skipped: 121 / Auto-skipped: 0

@chrzaszcz chrzaszcz marked this pull request as ready for review March 27, 2024 10:04
Copy link
Member

@pawlooss1 pawlooss1 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@pawlooss1 pawlooss1 merged commit 64b8bc7 into master Mar 27, 2024
4 checks passed
@pawlooss1 pawlooss1 deleted the consistent-node-cleanup branch March 27, 2024 12:03
@chrzaszcz chrzaszcz mentioned this pull request Mar 28, 2024
@jacekwegr jacekwegr added this to the 6.2.1 milestone Apr 3, 2024
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

4 participants