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

MAM config in maps #3559

Merged
merged 10 commits into from
Mar 2, 2022
Merged

MAM config in maps #3559

merged 10 commits into from
Mar 2, 2022

Conversation

chrzaszcz
Copy link
Member

@chrzaszcz chrzaszcz commented Feb 23, 2022

Use maps for configuration of all MAM modules.

Main changes:

  • Use maps with defaults for MAM options, and pass selected options to the backends.
  • The low-level message-format options are the only ones that have different default values per backend, so their defaults are not included in the spec.
  • Removed some unused code, e.g. handling of async Cassandra workers, that don't exist.

Other changes:

  • Elasticsearch tests were skipped in mam_SUITE, this is fixed now.
  • Some MUC tests were enabled only for RDBMS, they support other backends now.
  • Use dynamic_modules to set up mod_mam_meta for all MAM big tests (instead of starting backend modules separately). Supply defaults with new helpers in mam_helper.

@chrzaszcz chrzaszcz force-pushed the mod_mam-map branch 2 times, most recently from b427b4a to 620a09e Compare February 23, 2022 13:46
@codecov
Copy link

codecov bot commented Feb 23, 2022

Codecov Report

Merging #3559 (920e113) into master (a151c29) will increase coverage by 1.57%.
The diff coverage is 98.43%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3559      +/-   ##
==========================================
+ Coverage   79.49%   81.07%   +1.57%     
==========================================
  Files         421      421              
  Lines       32307    32207     -100     
==========================================
+ Hits        25683    26111     +428     
+ Misses       6624     6096     -528     
Impacted Files Coverage Δ
src/mam/mod_mam_rdbms_user.erl 81.08% <ø> (ø)
src/mam/mod_mam_meta.erl 97.29% <96.72%> (+1.64%) ⬆️
src/mam/mod_mam.erl 88.57% <100.00%> (ø)
src/mam/mod_mam_cache_user.erl 100.00% <100.00%> (ø)
src/mam/mod_mam_cassandra_arch.erl 84.46% <100.00%> (-0.15%) ⬇️
src/mam/mod_mam_cassandra_prefs.erl 95.23% <100.00%> (+4.46%) ⬆️
src/mam/mod_mam_elasticsearch_arch.erl 86.84% <100.00%> (+1.75%) ⬆️
src/mam/mod_mam_mnesia_prefs.erl 92.42% <100.00%> (-2.09%) ⬇️
src/mam/mod_mam_muc.erl 74.01% <100.00%> (ø)
src/mam/mod_mam_muc_cassandra_arch.erl 84.79% <100.00%> (+0.24%) ⬆️
... and 30 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 a151c29...920e113. Read the comment docs.

@chrzaszcz chrzaszcz force-pushed the mod_mam-map branch 5 times, most recently from 2b317e8 to eefdd9d Compare February 28, 2022 15:05
@esl esl deleted a comment from mongoose-im Feb 28, 2022
@esl esl deleted a comment from mongoose-im Feb 28, 2022
@esl esl deleted a comment from mongoose-im Feb 28, 2022
@esl esl deleted a comment from mongoose-im Feb 28, 2022
@esl esl deleted a comment from mongoose-im Feb 28, 2022
@esl esl deleted a comment from mongoose-im Feb 28, 2022
@esl esl deleted a comment from mongoose-im Feb 28, 2022
@esl esl deleted a comment from mongoose-im Feb 28, 2022
@esl esl deleted a comment from mongoose-im Feb 28, 2022
@esl esl deleted a comment from mongoose-im Feb 28, 2022
@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

@mongoose-im

This comment was marked as outdated.

@chrzaszcz chrzaszcz changed the title Mod mam map MAM config in maps Feb 28, 2022
@mongoose-im
Copy link
Collaborator

mongoose-im commented Feb 28, 2022

small_tests_24 / small_tests / f4a34a9
Reports root / small


small_tests_23 / small_tests / f4a34a9
Reports root / small


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / f4a34a9
Reports root/ big
OK: 2672 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_mysql_redis_24 / mysql_redis / f4a34a9
Reports root/ big
OK: 2654 / Failed: 1 / User-skipped: 150 / Auto-skipped: 0

service_domain_db_SUITE:db:db_domains_with_unknown_host_type_are_ignored_by_core
{error,
  {{badmatch,{error,not_found}},
   [{service_domain_db_SUITE,
      db_domains_with_unknown_host_type_are_ignored_by_core,1,
      [{file,
         "/home/circleci/project/big_tests/tests/service_domain_db_SUITE.erl"},
       {line,465}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_server.erl"},{line,1292}]},
    {test_server,run_test_case_eval,9,
      [{file,"test_server.erl"},{line,1224}]}]}}

Report log


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / f4a34a9
Reports root/ big
OK: 2672 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / f4a34a9
Reports root/ big
OK: 2672 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


ldap_mnesia_23 / ldap_mnesia / f4a34a9
Reports root/ big
OK: 1504 / Failed: 0 / User-skipped: 396 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / f4a34a9
Reports root/ big
OK: 1504 / Failed: 0 / User-skipped: 396 / Auto-skipped: 0


internal_mnesia_24 / internal_mnesia / f4a34a9
Reports root/ big
OK: 1545 / Failed: 0 / User-skipped: 355 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / f4a34a9
Reports root/ big
OK: 3046 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / f4a34a9
Reports root/ big
OK: 1846 / Failed: 0 / User-skipped: 363 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / f4a34a9
Reports root/ big
OK: 3041 / Failed: 0 / User-skipped: 147 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / f4a34a9
Reports root/ big
OK: 3046 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / f4a34a9
Reports root/ big
OK: 3046 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / f4a34a9
Reports root/ big
OK: 1692 / Failed: 0 / User-skipped: 362 / Auto-skipped: 0


dynamic_domains_mysql_redis_24 / mysql_redis / f4a34a9
Reports root/ big
OK: 2655 / Failed: 0 / User-skipped: 150 / Auto-skipped: 0

@mongoose-im
Copy link
Collaborator

mongoose-im commented Mar 1, 2022

small_tests_24 / small_tests / 4abdd21
Reports root / small


small_tests_23 / small_tests / 4abdd21
Reports root / small


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 4abdd21
Reports root/ big
OK: 2672 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_mysql_redis_24 / mysql_redis / 4abdd21
Reports root/ big
OK: 2655 / Failed: 0 / User-skipped: 150 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / 4abdd21
Reports root/ big
OK: 2672 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / 4abdd21
Reports root/ big
OK: 2672 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


ldap_mnesia_23 / ldap_mnesia / 4abdd21
Reports root/ big
OK: 1504 / Failed: 0 / User-skipped: 396 / Auto-skipped: 0


internal_mnesia_24 / internal_mnesia / 4abdd21
Reports root/ big
OK: 1545 / Failed: 0 / User-skipped: 355 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / 4abdd21
Reports root/ big
OK: 1504 / Failed: 0 / User-skipped: 396 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / 4abdd21
Reports root/ big
OK: 3046 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 4abdd21
Reports root/ big
OK: 3046 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / 4abdd21
Reports root/ big
OK: 1846 / Failed: 0 / User-skipped: 363 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / 4abdd21
Reports root/ big
OK: 3041 / Failed: 0 / User-skipped: 147 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / 4abdd21
Reports root/ big
OK: 3046 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 4abdd21
Reports root/ big
OK: 1692 / Failed: 0 / User-skipped: 362 / Auto-skipped: 0

@mongoose-im
Copy link
Collaborator

mongoose-im commented Mar 1, 2022

small_tests_24 / small_tests / 0746ec6
Reports root / small


small_tests_23 / small_tests / 0746ec6
Reports root / small


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / 0746ec6
Reports root/ big
OK: 2672 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 0746ec6
Reports root/ big
OK: 2672 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_mysql_redis_24 / mysql_redis / 0746ec6
Reports root/ big
OK: 2655 / Failed: 0 / User-skipped: 150 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / 0746ec6
Reports root/ big
OK: 2672 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


ldap_mnesia_23 / ldap_mnesia / 0746ec6
Reports root/ big
OK: 1504 / Failed: 0 / User-skipped: 396 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / 0746ec6
Reports root/ big
OK: 1504 / Failed: 0 / User-skipped: 396 / Auto-skipped: 0


internal_mnesia_24 / internal_mnesia / 0746ec6
Reports root/ big
OK: 1545 / Failed: 0 / User-skipped: 355 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / 0746ec6
Reports root/ big
OK: 3046 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / 0746ec6
Reports root/ big
OK: 3041 / Failed: 0 / User-skipped: 147 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / 0746ec6
Reports root/ big
OK: 1846 / Failed: 0 / User-skipped: 363 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 0746ec6
Reports root/ big
OK: 3046 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / 0746ec6
Reports root/ big
OK: 3046 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 0746ec6
Reports root/ big
OK: 1692 / Failed: 0 / User-skipped: 362 / Auto-skipped: 0

@chrzaszcz chrzaszcz changed the base branch from master to fix-async-pools March 1, 2022 09:20
@chrzaszcz chrzaszcz marked this pull request as ready for review March 1, 2022 09:20
Base automatically changed from fix-async-pools to master March 1, 2022 09:45
- Supply defaults for all options
  - db_jid_format and db_message_format have their own default logic,
    as these options have backend-specific defaults
- Make Riak section included only when the backend is 'riak'
  - In the future we might inroduce similar subsection for other
    backends.
- Remove redundant options: 'rdbms_message_format' and 'simple',
  which unnecessarily complicated the logic.
- Allow to specify 'cache' only at the root level
  as it would not work for 'pm' or 'muc' anyway.
- Remove hardcoded defaults
- Simplify 'is_archivable_message' - function name should be constant
- Refactor hook handlers
- Cassandra pool is not configurable and there is no async writer,
  so the code can be simplified
- There were two different sets of defaults in mongoose_async_pools,
  now there is only one.
If there is a need, we could make a more generic one later (not
module-specific).

Also: fix type spec
- Use 'mod_mam_meta' in test setup for consistency, easier
  maintenance, and bringing the tests closer to the real
  configurations.
- Simplify test groups. 'rdbms_mnesia_muc_cache' was identical
  to 'rdbms_mnesia_cache'.
  Groups are simplified to make cache enabled for both pm and muc,
  just like in the default configuration.
- Skip MAM tests when there is no backend available
- Test MAM for backends other than RDBMS
@mongoose-im
Copy link
Collaborator

mongoose-im commented Mar 1, 2022

small_tests_24 / small_tests / 93fc431
Reports root / small


small_tests_23 / small_tests / 93fc431
Reports root / small


dynamic_domains_mysql_redis_24 / mysql_redis / 93fc431
Reports root/ big
OK: 2661 / Failed: 0 / User-skipped: 150 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 93fc431
Reports root/ big
OK: 2678 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / 93fc431
Reports root/ big
OK: 2678 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / 93fc431
Reports root/ big
OK: 2678 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / 93fc431
Reports root/ big
OK: 1504 / Failed: 0 / User-skipped: 398 / Auto-skipped: 0


ldap_mnesia_23 / ldap_mnesia / 93fc431
Reports root/ big
OK: 1504 / Failed: 0 / User-skipped: 398 / Auto-skipped: 0


internal_mnesia_24 / internal_mnesia / 93fc431
Reports root/ big
OK: 1545 / Failed: 0 / User-skipped: 357 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / 93fc431
Reports root/ big
OK: 3052 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 93fc431
Reports root/ big
OK: 3052 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / 93fc431
Reports root/ big
OK: 1846 / Failed: 0 / User-skipped: 365 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / 93fc431
Reports root/ big
OK: 3052 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / 93fc431
Reports root/ big
OK: 3047 / Failed: 0 / User-skipped: 147 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 93fc431
Reports root/ big
OK: 1692 / Failed: 0 / User-skipped: 364 / Auto-skipped: 0

@mongoose-im
Copy link
Collaborator

mongoose-im commented Mar 1, 2022

small_tests_24 / small_tests / 920e113
Reports root / small


small_tests_23 / small_tests / 920e113
Reports root / small


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / 920e113
Reports root/ big
OK: 2678 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 920e113
Reports root/ big
OK: 2678 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


ldap_mnesia_23 / ldap_mnesia / 920e113
Reports root/ big
OK: 1504 / Failed: 0 / User-skipped: 398 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / 920e113
Reports root/ big
OK: 2678 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / 920e113
Reports root/ big
OK: 1504 / Failed: 0 / User-skipped: 398 / Auto-skipped: 0


internal_mnesia_24 / internal_mnesia / 920e113
Reports root/ big
OK: 1545 / Failed: 0 / User-skipped: 357 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / 920e113
Reports root/ big
OK: 3052 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / 920e113
Reports root/ big
OK: 1846 / Failed: 0 / User-skipped: 365 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 920e113
Reports root/ big
OK: 3052 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / 920e113
Reports root/ big
OK: 3052 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / 920e113
Reports root/ big
OK: 3047 / Failed: 0 / User-skipped: 147 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 920e113
Reports root/ big
OK: 1692 / Failed: 0 / User-skipped: 364 / Auto-skipped: 0

Copy link
Collaborator

@NelsonVides NelsonVides left a comment

Choose a reason for hiding this comment

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

I've reviewed more or less everything, but I've mostly focused on reviewing mod_mam_meta and mam_SUITE, which I knew to be very very convoluted. This is an amazing improvement. It is still not obvious, but for the complexity inherently involved in such pieces of code we can only move incrementally and this is a great step forwards, thanks 👌🏽

@gustawlippa gustawlippa merged commit edcbcb2 into master Mar 2, 2022
@gustawlippa gustawlippa deleted the mod_mam-map branch March 2, 2022 08:13
@Premwoik Premwoik added this to the 5.1.0 milestone May 25, 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.

5 participants