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

CETS backend for mod_jingle_sip #4076

Merged
merged 6 commits into from
Aug 4, 2023
Merged

CETS backend for mod_jingle_sip #4076

merged 6 commits into from
Aug 4, 2023

Conversation

arcusfelis
Copy link
Contributor

This PR addresses "MIM-1934 CETS backend for mod_jingle_sip_backend"

Proposed changes include:

  • Simple implementation of CETS backend
  • Use mongoose_backend module
  • Make backends configurable for mod_jingle_sip

@arcusfelis arcusfelis marked this pull request as draft August 3, 2023 16:26
@mongoose-im
Copy link
Collaborator

mongoose-im commented Aug 3, 2023

elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 1609279
Reports root/ big
OK: 369 / Failed: 0 / User-skipped: 38 / Auto-skipped: 0


small_tests_24 / small_tests / 1609279
Reports root / small


small_tests_25_arm64 / small_tests / 1609279
Reports root / small


small_tests_25 / small_tests / 1609279
Reports root / small


ldap_mnesia_24 / ldap_mnesia / 1609279
Reports root/ big
OK: 2258 / Failed: 0 / User-skipped: 830 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 1609279
Reports root/ big
OK: 4220 / Failed: 0 / User-skipped: 84 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / 1609279
Reports root/ big
OK: 2258 / Failed: 0 / User-skipped: 830 / Auto-skipped: 0


dynamic_domains_mysql_redis_25 / mysql_redis / 1609279
Reports root/ big
OK: 4194 / Failed: 0 / User-skipped: 110 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 1609279
Reports root/ big
OK: 4220 / Failed: 0 / User-skipped: 84 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / 1609279
Reports root/ big
OK: 4217 / Failed: 0 / User-skipped: 87 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 1609279
Reports root/ big
OK: 4605 / Failed: 0 / User-skipped: 91 / Auto-skipped: 0


internal_mnesia_25 / internal_mnesia / 1609279
Reports root/ big
OK: 2404 / Failed: 0 / User-skipped: 684 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / 1609279
Reports root/ big
OK: 4605 / Failed: 0 / User-skipped: 91 / Auto-skipped: 0


pgsql_cets_25 / pgsql_cets / 1609279
Reports root/ big
OK: 4581 / Failed: 0 / User-skipped: 115 / Auto-skipped: 0


mysql_redis_25 / mysql_redis / 1609279
Reports root/ big
OK: 4591 / Failed: 0 / User-skipped: 105 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / 1609279
Reports root/ big
OK: 4602 / Failed: 0 / User-skipped: 94 / Auto-skipped: 0

mam_SUITE:rdbms_async_pool_muc_all:muc06:muc_message_with_stanzaid
{failed,
  {mam_SUITE,end_per_testcase,
    {'EXIT',
      {{room_archive_size,0,[{times,200,1}],ok},
       [{mongoose_helper,do_wait_until,2,
          [{file,
             "/home/circleci/project/big_tests/tests/mongoose_helper.erl"},
           {line,358}]},
        {mam_helper,wait_for_room_archive_size,3,
          [{file,
             "/home/circleci/project/big_tests/tests/mam_helper.erl"},
           {line,789}]},
        {mam_helper,clean_room_archive,1,
          [{file,
             "/home/circleci/project/big_tests/tests/mam_helper.erl"},
           {line,733}]},
        {mam_helper,destroy_room,1,
          [{file,
             "/home/circleci/project/big_tests/tests/mam_helper.erl"},
           {line,726}]},
        {mam_SUITE,end_per_testcase,2,
          [{file,
             "/home/circleci/project/big_tests/tests/mam_SUITE.erl"},
           {line,954}]},
        {test_server,do_end_per_testcase,4,
          [{file,"test_server.erl"},{line,1626}]},
        {test_server,run_test_case_eval1,6,
          [{file,"test_server.erl"},{line,1334}]},
        {test_server,run_test_case_eval,9,
          [{file,"test_server.erl"},{line,1223}]}]}}}}

Report log

@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Patch coverage: 82.29% and project coverage change: +0.34% 🎉

Comparison is base (167297d) 83.65% compared to head (eac044b) 83.99%.

Additional details and impacted files
@@               Coverage Diff                @@
##           feature/cets    #4076      +/-   ##
================================================
+ Coverage         83.65%   83.99%   +0.34%     
================================================
  Files               546      549       +3     
  Lines             33519    33544      +25     
================================================
+ Hits              28040    28176     +136     
+ Misses             5479     5368     -111     
Files Changed Coverage Δ
src/jingle_sip/mod_jingle_sip_cets.erl 71.42% <71.42%> (ø)
src/jingle_sip/mod_jingle_sip_mnesia.erl 76.47% <76.47%> (ø)
src/jingle_sip/mod_jingle_sip_session.erl 80.00% <80.00%> (ø)
src/jingle_sip/mod_jingle_sip.erl 79.92% <85.71%> (ø)
src/jingle_sip/jingle_sip_callbacks.erl 92.66% <100.00%> (+0.14%) ⬆️
src/jingle_sip/mod_jingle_sip_backend.erl 100.00% <100.00%> (+20.00%) ⬆️

... and 21 files with indirect coverage changes

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

@arcusfelis arcusfelis marked this pull request as ready for review August 3, 2023 17:33
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.

Code looks good, but I see a lot of literal code duplication between mod_jingle_sip_mnesia and mod_jingle_sip_cets - records, types, entire functions etc. This would make maintenance more difficult. Wouldn't it be better to extract common code to another module? The common functions could even be left in mod_jingle_sip_backend or a helper module could be created. Record definitions could be placed in an included header file.

src/jingle_sip/mod_jingle_sip_backend.erl Outdated Show resolved Hide resolved
src/jingle_sip/mod_jingle_sip_cets.erl Outdated Show resolved Hide resolved
src/jingle_sip/mod_jingle_sip_cets.erl Outdated Show resolved Hide resolved

-spec init(mongooseim:host_type(), gen_mod:module_opts()) -> ok.
init(_Host, _Opts) ->
cets:start(?TABLE, #{keypos => 2}),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
cets:start(?TABLE, #{keypos => 2}),
cets:start(?TABLE, #{keypos => #jingle_sip_session.sid}),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I've moved record definition into a header file.
CETS backend is written in a way, it does not know format of the record now.
So, we just use the keypos=2 (i.e. keypos for generic records).

Copy link
Member

@chrzaszcz chrzaszcz Aug 4, 2023

Choose a reason for hiding this comment

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

I just prefer to reference a particular field, so I don't have to check the record definition to see which field it is. If someone moves sid or adds a field before it (I don't know why, but if), then my version would remain valid. Plus, it would be self-descriptive without the need for a comment.

Add only basic functions to mod_jingle_sip_backend
Define record type for jingle_sip_session
@arcusfelis
Copy link
Contributor Author

Made a separation of mod_jingle_sip_backend and mod_jingle_sip_sessions.
Because I prefer backend modules to be a proxy to the backend module (i.e. the same logic when we had it dynamically compiled. It is just for proxy calls).

@mongoose-im
Copy link
Collaborator

mongoose-im commented Aug 4, 2023

elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / eac044b
Reports root/ big
OK: 369 / Failed: 0 / User-skipped: 38 / Auto-skipped: 0


small_tests_24 / small_tests / eac044b
Reports root / small


small_tests_25_arm64 / small_tests / eac044b
Reports root / small


ldap_mnesia_24 / ldap_mnesia / eac044b
Reports root/ big
OK: 2258 / Failed: 0 / User-skipped: 830 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / eac044b
Reports root/ big
OK: 4220 / Failed: 0 / User-skipped: 84 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / eac044b
Reports root/ big
OK: 2257 / Failed: 1 / User-skipped: 830 / Auto-skipped: 0

mod_global_distrib_SUITE:hosts_refresher:test_host_refreshing
{error,
  {{trees_for_connections_present,true,[{times,50,false}],ok},
   [{mongoose_helper,do_wait_until,2,
      [{file,"/home/circleci/project/big_tests/tests/mongoose_helper.erl"},
       {line,358}]},
    {mod_global_distrib_SUITE,test_host_refreshing,1,
      [{file,
         "/home/circleci/project/big_tests/tests/mod_global_distrib_SUITE.erl"},
       {line,384}]},
    {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


dynamic_domains_mysql_redis_25 / mysql_redis / eac044b
Reports root/ big
OK: 4194 / Failed: 0 / User-skipped: 110 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / eac044b
Reports root/ big
OK: 4217 / Failed: 0 / User-skipped: 87 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / eac044b
Reports root/ big
OK: 4220 / Failed: 0 / User-skipped: 84 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / eac044b
Reports root/ big
OK: 4604 / Failed: 1 / User-skipped: 91 / Auto-skipped: 0

service_domain_db_SUITE:db:db_keeps_syncing_after_cluster_join
{error,{test_case_failed,{[<<"example1.com">>,<<"example2.com">>,
               <<"example3.com">>],
              [<<"example1.com">>,<<"example2.com">>,
               <<"example3.com">>,<<"example4.com">>]}}}

Report log


pgsql_cets_25 / pgsql_cets / eac044b
Reports root/ big
OK: 4581 / Failed: 0 / User-skipped: 115 / Auto-skipped: 0


internal_mnesia_25 / internal_mnesia / eac044b
Reports root/ big
OK: 2404 / Failed: 0 / User-skipped: 684 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / eac044b
Reports root/ big
OK: 4604 / Failed: 1 / User-skipped: 91 / Auto-skipped: 0

mod_global_distrib_SUITE:hosts_refresher:test_host_refreshing
{error,
  {{trees_for_connections_present,true,[{times,50,false}],ok},
   [{mongoose_helper,do_wait_until,2,
      [{file,"/home/circleci/project/big_tests/tests/mongoose_helper.erl"},
       {line,358}]},
    {mod_global_distrib_SUITE,test_host_refreshing,1,
      [{file,
         "/home/circleci/project/big_tests/tests/mod_global_distrib_SUITE.erl"},
       {line,384}]},
    {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


mysql_redis_25 / mysql_redis / eac044b
Reports root/ big
OK: 4591 / Failed: 0 / User-skipped: 105 / Auto-skipped: 0


mssql_mnesia_25 / odbc_mssql_mnesia / eac044b
Reports root/ big
OK: 4602 / Failed: 0 / User-skipped: 94 / Auto-skipped: 0


ldap_mnesia_25 / ldap_mnesia / eac044b
Reports root/ big
OK: 2258 / Failed: 0 / User-skipped: 830 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / eac044b
Reports root/ big
OK: 4605 / Failed: 0 / User-skipped: 91 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / eac044b
Reports root/ big
OK: 4604 / Failed: 1 / User-skipped: 91 / Auto-skipped: 0

mod_global_distrib_SUITE:hosts_refresher:test_host_refreshing
{error,
  {{trees_for_connections_present,true,[{times,50,false}],ok},
   [{mongoose_helper,do_wait_until,2,
      [{file,"/home/circleci/project/big_tests/tests/mongoose_helper.erl"},
       {line,358}]},
    {mod_global_distrib_SUITE,test_host_refreshing,1,
      [{file,
         "/home/circleci/project/big_tests/tests/mod_global_distrib_SUITE.erl"},
       {line,384}]},
    {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


ldap_mnesia_25 / ldap_mnesia / eac044b
Reports root/ big
OK: 2258 / Failed: 0 / User-skipped: 830 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / eac044b
Reports root/ big
OK: 4605 / Failed: 0 / User-skipped: 91 / Auto-skipped: 0


pgsql_mnesia_25 / pgsql_mnesia / eac044b
Reports root/ big
OK: 4605 / Failed: 0 / User-skipped: 91 / Auto-skipped: 0

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 👍

@chrzaszcz chrzaszcz merged commit fd37e0c into feature/cets Aug 4, 2023
3 of 4 checks passed
@chrzaszcz chrzaszcz deleted the cets-for-sip branch August 4, 2023 14:10
@chrzaszcz chrzaszcz added this to the 6.2.0 milestone Dec 11, 2023
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