-
Notifications
You must be signed in to change notification settings - Fork 428
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
Introduce pool names to mongoose_rdbms #4231
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4231 +/- ##
==========================================
- Coverage 84.37% 84.35% -0.03%
==========================================
Files 552 552
Lines 33484 33497 +13
==========================================
+ Hits 28251 28255 +4
- Misses 5233 5242 +9 ☔ View full report in Codecov by Sentry. |
486e295
to
4ff34bc
Compare
This comment was marked as outdated.
This comment was marked as outdated.
00d883c
to
e1f6ee8
Compare
This comment was marked as outdated.
This comment was marked as outdated.
e1f6ee8
to
3d20474
Compare
This comment was marked as outdated.
This comment was marked as outdated.
big_tests/tests/rdbms_SUITE.erl
Outdated
|
||
sql_execute_cast(_Config, Name, Parameters) -> | ||
slow_rpc(mongoose_rdbms, execute_cast, [host_type(), Name, Parameters]). | ||
slow_rpc(mongoose_rdbms, execute_cast, [host_type(), tag(), Name, Parameters]). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it doesn't test version without a tag now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every other test suite is still testing the old way indirectly so I thought no need to duplicate test time here 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think it would be nice to check both, but it's not a must for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general. I added some comments - it's still ok for me without addressing them, but I wanted to share these.
@@ -30,6 +30,10 @@ This allows you to create multiple dedicated pools of the same type. | |||
* `host` - the pool will be started for each XMPP host or host type served by MongooseIM | |||
* `single_host` - the pool will be started for the selected host or host type only (you must provide the name). | |||
|
|||
!!! Note | |||
A global pool with name `default` is used by services that are not configured by host_type, like `service_domain_db` or `service_mongoose_system_metrics`, or by modules that don't support dynamic domains, like `mod_pubsub`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't define "name" here, so maybe instead of "name default
" whe should say "tag default
"?
src/rdbms/mongoose_rdbms.erl
Outdated
-ignore_xref([sql_query_cast/2, sql_query_request/2, | ||
execute_cast/3, execute_request/3, | ||
-ignore_xref([ | ||
sql_query_cast/2, sql_query_request/2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to put them in the same order as in exports?
src/rdbms/mongoose_rdbms.erl
Outdated
execute(HostType, Name, Parameters) -> | ||
execute(HostType, ?DEFAULT_POOL_NAME, Name, Parameters). | ||
|
||
-spec execute(HostType :: server(), PoolName :: atom(), Name :: atom(), Parameters :: [term()]) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What we call Name
in this module, is called Tag
in mongoose_wpool
, and there is a type mongoose_wpool:tag()
as well. So for me it should be:
-spec execute(HostType :: server(), PoolName :: atom(), Name :: atom(), Parameters :: [term()]) -> | |
-spec execute(HostType :: server(), PoolName :: atom(), Tag :: mongoose_wpool:tag(), Parameters :: [term()]) -> |
This way it would be more consistent. AFAIR, I think we chose Tag
instead of Name
to avoid confusion with PoolName
.
big_tests/tests/rdbms_SUITE.erl
Outdated
|
||
sql_execute_cast(_Config, Name, Parameters) -> | ||
slow_rpc(mongoose_rdbms, execute_cast, [host_type(), Name, Parameters]). | ||
slow_rpc(mongoose_rdbms, execute_cast, [host_type(), tag(), Name, Parameters]). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think it would be nice to check both, but it's not a must for me.
This comment was marked as outdated.
This comment was marked as outdated.
907a32a
to
070ad29
Compare
elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / 070ad29 small_tests_25 / small_tests / 070ad29 small_tests_26 / small_tests / 070ad29 small_tests_26_arm64 / small_tests / 070ad29 ldap_mnesia_25 / ldap_mnesia / 070ad29 dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 070ad29 dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 070ad29 ldap_mnesia_26 / ldap_mnesia / 070ad29 internal_mnesia_26 / internal_mnesia / 070ad29 pgsql_cets_26 / pgsql_cets / 070ad29 dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / 070ad29 pgsql_mnesia_25 / pgsql_mnesia / 070ad29 pgsql_mnesia_26 / pgsql_mnesia / 070ad29 mysql_redis_26 / mysql_redis / 070ad29 mssql_mnesia_26 / odbc_mssql_mnesia / 070ad29 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks correct, so I approved, but personally I would change the naming as in the comments. If you don't have time, I could fix it as well.
070ad29
to
7cdbf55
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
9445cc3
to
6597730
Compare
6597730
to
03a4175
Compare
elasticsearch_and_cassandra_26 / elasticsearch_and_cassandra_mnesia / 03a4175 small_tests_25 / small_tests / 03a4175 small_tests_26 / small_tests / 03a4175 small_tests_26_arm64 / small_tests / 03a4175 ldap_mnesia_25 / ldap_mnesia / 03a4175 dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 03a4175 ldap_mnesia_26 / ldap_mnesia / 03a4175 dynamic_domains_mysql_redis_26 / mysql_redis / 03a4175 carboncopy_SUITE:one2one:dropped_client_doesnt_create_duplicate_carbons{error,
{{badmatch,
[{xmlel,<<"message">>,
[{<<"from">>,
<<"alice_dropped_client_doesnt_create_duplicate_carbons_615@domain.example.com">>},
{<<"to">>,
<<"alice_dropped_client_doesnt_create_duplicate_carbons_615@domain.example.com/res2">>},
{<<"xmlns">>,<<"jabber:client">>},
{<<"type">>,<<"chat">>}],
[{xmlel,<<"sent">>,
[{<<"xmlns">>,<<"urn:xmpp:carbons:2">>}],
[{xmlel,<<"forwarded">>,
[{<<"xmlns">>,<<"urn:xmpp:forward:0">>}],
[{xmlel,<<"message">>,
[{<<"from">>,
<<"alice_dropped_client_doesnt_create_duplicate_carbons_615@domain.example.com/res1">>},
{<<"type">>,<<"chat">>},
{<<"to">>,
<<"bob_dropped_client_doesnt_create_duplicate_carbons_615@domain.example.com/res1">>},
{<<"xmlns">>,<<"jabber:client">>}],
[{xmlel,<<"body">>,[],
[{xmlcdata,
<<"And pious action">>}]}]}]}]}]}]},
[{carboncopy_SUITE,
'-dropped_client_doesnt_create_duplicate_carbons/1-fun-0-',4,
[{file,
"/home/circleci/project/big_tests/tests/carboncopy_SUITE.erl"},
{line,189}]},
{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_c... internal_mnesia_26 / internal_mnesia / 03a4175 dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 03a4175 pgsql_cets_26 / pgsql_cets / 03a4175 pgsql_mnesia_25 / pgsql_mnesia / 03a4175 dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / 03a4175 metrics_c2s_SUITE:single:stanza_one{error,
{{xmppStanzaReceived,
{value,20194},
[{times,25,
{error,
{badmatch,{value,20195}},
[{metrics_helper,assert_counter,3,
[{file,
"/home/circleci/project/big_tests/tests/metrics_helper.erl"},
{line,36}]},
{mongoose_helper,do_wait_until,2,
[{file,
"/home/circleci/project/big_tests/../test/common/mongoose_helper.erl"},
{line,362}]},
{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}]}]}}],
ok},
[{mongoose_helper,do_wait_until,2,
[{file,
"/home/circleci/project/big_tests/../test/common/mongoose_helper.erl"},
{line,359}]},
{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}]}]}} mysql_redis_26 / mysql_redis / 03a4175 pgsql_mnesia_26 / pgsql_mnesia / 03a4175 mssql_mnesia_26 / odbc_mssql_mnesia / 03a4175 dynamic_domains_mysql_redis_26 / mysql_redis / 03a4175 dynamic_domains_mssql_mnesia_26 / odbc_mssql_mnesia / 03a4175 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great now 👍
Solves MIM-2182
Currently the API for mongoose_rdbms allows only for providing the host-type, but not the pool tag. Change all APIs to look approximately like the following: