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 dynamically compiled modules #3394

Merged
merged 105 commits into from
Nov 15, 2021
Merged

Conversation

gustawlippa
Copy link
Contributor

@gustawlippa gustawlippa commented Nov 9, 2021

This PR removes dynamically compiled _backend modules and adds real proxy modules instead.
It also removes some dynamically compiled modules that were not backends.

mod_bosh, mod_global_distrib and mod_pubsub are left for later.

arcusfelis and others added 30 commits October 11, 2021 13:42
Also, made mod_private_backend module
Move new code into mongoose_backend, just to keep it away from the old backend_module
Align args correctly
mod_private without dynamic modules
Co-authored-by: Paweł Chrząszcz <pawel.chrzaszcz@erlang-solutions.com>
It returns the atom describing the backend, like `mssql`, `pgsql`, etc.
This is analogous to `backend_name` function that was exposed by the
dynamically compiled modules in `backend_module.erl`. It is used by
some tests and `mongoose_rdbms`.
Because backends can be running per host type. This also fixes an
issue of suites logging that they finished dirty, after having
dynamically compiled backends removed.

The old interface is called for the time being, but will be removed when
all modules will have dynamic backends converted.
Add `mod_event_pusher_push_backend`
Add mongoose_backend:get_backend_name
arcusfelis and others added 10 commits November 5, 2021 10:48
With the changes done in #3386, this turned out to be really easy. Before that, I tried to make mongoose_rdbms_backend expose its API with HostTypes, but it was a bit messy. I think it's better to do it in a separate PR (after the whole without-dynamic-backend-modules branch is merged), to keep this already big diff smaller and more focused.

Other issue is that mongoose_rdbms has many functions exported, which seem to be not used, mainly for escaping different types. This could be revisited, but, in similar fashion, I left this as is for now.
What's left to do is remove dynamic mongoose_rdbms_type, but it will be done in a separate PR.
Get rid of ejabberd_rdbms because all it did was compile mongoose_rdbms_type. In turn, all it did was get an option from the config.

The functionality is left as it was. From what I understand, one can (in theory) use ODBC with different databases, so maybe the rdbms_server_type option is needed, but it could at least be moved from the general section to the RDBMS pool options. This could be done after dynamically compiled modules are merged.
@codecov
Copy link

codecov bot commented Nov 9, 2021

Codecov Report

Merging #3394 (f71b7f0) into master (8f92708) will increase coverage by 1.90%.
The diff coverage is 95.24%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3394      +/-   ##
==========================================
+ Coverage   79.00%   80.90%   +1.90%     
==========================================
  Files         397      414      +17     
  Lines       32199    32422     +223     
==========================================
+ Hits        25438    26232     +794     
+ Misses       6761     6190     -571     
Impacted Files Coverage Δ
src/ejabberd_app.erl 95.34% <ø> (-0.06%) ⬇️
src/ejabberd_sm_mnesia.erl 96.55% <ø> (ø)
src/ejabberd_sm_redis.erl 94.64% <ø> (ø)
src/event_pusher/mod_event_pusher.erl 87.50% <ø> (ø)
src/event_pusher/mod_event_pusher_push_mnesia.erl 90.62% <ø> (ø)
src/event_pusher/mod_event_pusher_push_plugin.erl 100.00% <ø> (ø)
src/event_pusher/mod_event_pusher_push_rdbms.erl 97.43% <ø> (ø)
src/http_upload/mod_http_upload_s3.erl 100.00% <ø> (ø)
src/inbox/mod_inbox.erl 88.08% <ø> (-0.13%) ⬇️
src/inbox/mod_inbox_rdbms.erl 93.67% <ø> (ø)
... and 119 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 8f92708...f71b7f0. Read the comment docs.

@gustawlippa gustawlippa force-pushed the without-dynamic-backend-modules branch from 94b2e30 to 5543482 Compare November 9, 2021 15:09
@esl esl deleted a comment from mongoose-im Nov 9, 2021
@mongoose-im

This comment has been minimized.

@mongoose-im

This comment has been minimized.

@gustawlippa gustawlippa force-pushed the without-dynamic-backend-modules branch from 5543482 to 5e3aa4c Compare November 9, 2021 16:04
@mongoose-im

This comment has been minimized.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Nov 9, 2021

small_tests_24 / small_tests / f71b7f0
Reports root / small


internal_mnesia_24 / internal_mnesia / f71b7f0
Reports root/ big
OK: 1587 / Failed: 0 / User-skipped: 297 / Auto-skipped: 0


small_tests_23 / small_tests / f71b7f0
Reports root / small


ldap_mnesia_23 / ldap_mnesia / f71b7f0
Reports root/ big
OK: 1484 / Failed: 0 / User-skipped: 400 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / f71b7f0
Reports root/ big
OK: 1484 / Failed: 0 / User-skipped: 400 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / f71b7f0
Reports root/ big
OK: 2721 / Failed: 1 / User-skipped: 186 / 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


dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / f71b7f0
Reports root/ big
OK: 2722 / Failed: 0 / User-skipped: 186 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / f71b7f0
Reports root/ big
OK: 2722 / Failed: 0 / User-skipped: 186 / Auto-skipped: 0


dynamic_domains_mysql_redis_24 / mysql_redis / f71b7f0
Reports root/ big
OK: 2705 / Failed: 0 / User-skipped: 203 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / f71b7f0
Reports root/ big
OK: 1864 / Failed: 1 / User-skipped: 327 / Auto-skipped: 0

sm_SUITE:unacknowledged_message_hook:unacknowledged_message_hook_offline
{error,{{badmatch,false},
    [{escalus_session,stream_resumption,2,
              [{file,"/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_session.erl"},
               {line,259}]},
     {escalus_connection,connection_step,2,
               [{file,"/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_connection.erl"},
                {line,160}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1267}]},
     {escalus_connection,start,2,
               [{file,"/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_connection.erl"},
                {line,144}]},
     {sm_SUITE,unacknowledged_message_hook_offline,4,
           [{file,"/home/circleci/app/big_tests/tests/sm_SUITE.erl"},
          {line,826}]},
     {sm_SUITE,unacknowledged_message_hook_common,2,
           [{file,"/home/circleci/app/big_tests/tests/sm_SUITE.erl"},
          {line,878}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]},
     {test_server,run_test_case_eval1,6,
            [{file,"test_server.erl"},{line,1292}]}]}}

Report log


mysql_redis_24 / mysql_redis / f71b7f0
Reports root/ big
OK: 3085 / Failed: 3 / User-skipped: 230 / Auto-skipped: 0

mam_SUITE:rdbms_prefs_cases:prefs_set_request
{error,{test_case_failed,"ASSERT EQUAL\n\tExpected {prefs_result_iq,<<\"roster\">>,\n                  [<<\"romeo@montague.net\">>],\n                  [<<\"montague@montague.net\">>]}\n\tValue {prefs_result_iq,<<\"always\">>,\n                 [<<\"romeo@montague.net\">>],\n                 [<<\"montague@montague.net\">>]}\n"}}

Report log

mam_SUITE:rdbms_async_pool_prefs_cases:messages_filtered_when_prefs_default_policy_is_never
{error,{test_case_failed,"ASSERT EQUAL\n\tExpected []\n\tValue [ok]\n"}}

Report log

domain_removal_SUITE:last_removal:last_removal
{error,{{assertion_failed,assert,is_last_result,
              {xmlel,<<"presence">>,
                 [{<<"from">>,
                   <<"alicE_last_removal_7.524044@localhost/res1">>},
                  {<<"to">>,
                   <<"alice_last_removal_7.524044@localhost/res1">>},
                  {<<"xml:lang">>,<<"en">>}],
                 []},
              "<presence from='alicE_last_removal_7.524044@localhost/res1' to='alice_last_removal_7.524044@localhost/res1' xml:lang='en'/>"},
    [{escalus_new_assert,assert_true,2,
               [{file,"/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
                {line,84}]},
     {domain_removal_SUITE,'-last_removal/1-fun-0-',2,
                 [{file,"/home/circleci/app/big_tests/tests/domain_removal_SUITE.erl"},
                {line,379}]},
     {escalus_story,story,4,
            [{file,"/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
             {line,72}]},
     {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


pgsql_mnesia_23 / pgsql_mnesia / f71b7f0
Reports root/ big
OK: 3098 / Failed: 1 / User-skipped: 213 / Auto-skipped: 0

sm_SUITE:parallel_manual_ack_freq_1:resume_session_state_send_message
{error,
  {{assertion_failed,assert_many,true,
     [#Fun<sm_SUITE.22.80356403>,#Fun<sm_SUITE.22.80356403>,
      #Fun<sm_SUITE.22.80356403>],
     [{xmlel,<<"presence">>,
        [{<<"from">>,
        <<"alicE_resume_session_state_send_message_14.413469@localhost/escalus-default-resource">>},
         {<<"to">>,
        <<"alice_resume_session_state_send_message_14.413469@localhost/escalus-default-resource">>},
         {<<"xml:lang">>,<<"en">>}],
        []},
      {xmlel,<<"message">>,
        [{<<"from">>,
        <<"bOb_resume_session_state_send_message_14.328052@localhost/escalus-default-resource">>},
         {<<"to">>,
        <<"alicE_resume_session_state_send_message_14.413469@localhost">>},
         {<<"xml:lang">>,<<"en">>},
         {<<"type">>,<<"chat">>}],
        [{xmlel,<<"body">>,[],[{xmlcdata,<<"msg-1">>}]},
         {xmlel,<<"delay">>,
           [{<<"xmlns">>,<<"urn:xmpp:delay">>},
          {<<"stamp">>,<<"2021-11-09T16:38:34.492418Z">>},
          {<<"from">>,<<"localhost">>}],
           [{xmlcdata,<<"SM Storage">>}]}]},
      {xmlel,<<"message">>,
        [{<<"from">>,
        <<"bOb_resume_session_state_send_message_14.328052@localhost/escalus-default-resource">>},
         {<<"to">>,
        <<"alicE_resume_session_state_send_message_14.413469@localhost">>},
         {<<"xml:lang">>,<<"en">>},
         {<<"type">>,<<"chat">>}],
        [{xmlel,<<"body">>,[],[{xmlcdata,<<"msg-2">>}]},
         {xmlel,<<"delay">>,
           [{<<"xmlns">>,<<"urn:xmpp:...

Report log


mssql_mnesia_24 / odbc_mssql_mnesia / f71b7f0
Reports root/ big
OK: 3109 / Failed: 1 / User-skipped: 213 / Auto-skipped: 0

jingle_SUITE:all:resp_4xx_from_sip_proxy_results_in_session_terminate
{error,
  {{assertion_failed,assert,is_iq_result,
     {xmlel,<<"iq">>,
       [{<<"from">>,<<"error.480@localhost">>},
        {<<"to">>,
         <<"alice_resp_4xx_from_sip_proxy_results_in_session_terminate_45.806081@localhost/res1">>},
        {<<"id">>,<<"cad6bb9f-6eee-47a7-90a1-5e1eceb0290f">>},
        {<<"type">>,<<"set">>}],
       [{xmlel,<<"jingle">>,
          [{<<"xmlns">>,<<"urn:xmpp:jingle:1">>},
           {<<"action">>,<<"session-terminate">>},
           {<<"sid">>,<<"3c3b9aef-ba74-4e7a-bd2e-c593309c6021">>}],
          [{xmlel,<<"reason">>,[],
             [{xmlel,<<"general-error">>,[],[]},
            {xmlel,<<"sip-error">>,
              [{<<"code">>,<<"480">>}],
              [{xmlcdata,<<"Temporarily Unavailable">>}]}]}]}]},
     "<iq from='error.480@localhost' to='alice_resp_4xx_from_sip_proxy_results_in_session_terminate_45.806081@localhost/res1' id='cad6bb9f-6eee-47a7-90a1-5e1eceb0290f' type='set'><jingle xmlns='urn:xmpp:jingle:1' action='session-terminate' sid='3c3b9aef-ba74-4e7a-bd2e-c593309c6021'><reason><general-error/><sip-error code='480'>Temporarily Unavailable</sip-error></reason></jingle></iq>"},
   [{escalus_new_assert,assert_true,2,
      [{file,
         "/home/circleci/app/big_tests/_build/default/lib/escalus/src/escalus_new_assert.erl"},
       {line,84}]},
    {jingle_SUITE,send_initiate_and_wait_for_first_iq_set,2,
      [{file,"/home/circleci/app/big_tests/tests/jingle_SUITE.erl"},
       {line,395}]},
    {jingle_SUITE,
      '-res...

Report log


pgsql_mnesia_24 / pgsql_mnesia / f71b7f0
Reports root/ big
OK: 3091 / Failed: 0 / User-skipped: 213 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / f71b7f0
Reports root/ big
OK: 1708 / Failed: 0 / User-skipped: 328 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / f71b7f0
Reports root/ big
OK: 2722 / Failed: 0 / User-skipped: 186 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / f71b7f0
Reports root/ big
OK: 3081 / Failed: 1 / User-skipped: 230 / Auto-skipped: 0

sm_SUITE:parallel_manual_ack_freq_1:resume_session_state_stop_c2s
{error,{thrown,{timeout,msg}}}

Report log

@chrzaszcz chrzaszcz marked this pull request as ready for review November 15, 2021 14:38
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.

Extensive load tests showed no difference in performance. Test were performed for:

  • One to one chat with MAM and Inbox
  • One to one chat w/MAM but w/o Inbox
  • MAM lookup
  • MUC Light w/o Inbox

@chrzaszcz chrzaszcz merged commit 64d10a0 into master Nov 15, 2021
@chrzaszcz chrzaszcz deleted the without-dynamic-backend-modules branch November 15, 2021 14:40
@Premwoik Premwoik modified the milestones: 5.1.0, 5.0.0 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.

8 participants