-
Notifications
You must be signed in to change notification settings - Fork 438
Add dynamic domains support to mod_event_pusher and related modules #4629
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
base: master
Are you sure you want to change the base?
Add dynamic domains support to mod_event_pusher and related modules #4629
Conversation
- Implemented `supported_features/0` callback in mod_event_pusher, mod_event_pusher_http, mod_event_pusher_push, mod_event_pusher_rabbit, and mod_event_pusher_sns. - Added `remove_domain/2` handler in mod_event_pusher_push and its backends for domain removal. - Updated documentation to reflect compatibility with dynamic domains and removed warnings from Modules.md and mod_event_pusher.md. - Added test suites for dynamic domains in dynamic_domains.spec.
|
CircleCI results for 969a63f elasticsearch_and_cassandra_latest / elasticsearch_and_cassandra_mnesia / cf55d1c ldap_mnesia_latest / ldap_mnesia / cf55d1c small_tests_legacy / small_tests / cf55d1c small_tests_latest / small_tests / cf55d1c small_tests_latest_arm64 / small_tests / cf55d1c ldap_mnesia_legacy / ldap_mnesia / cf55d1c internal_mnesia_latest / internal_mnesia / cf55d1c dynamic_domains_pgsql_mnesia_latest / pgsql_mnesia / cf55d1c dynamic_domains_mysql_redis_latest / mysql_redis / cf55d1c pgsql_cets_latest / pgsql_cets / cf55d1c cockroachdb_cets_latest / cockroachdb_cets / cf55d1c local_iq_SUITE:iq_group:process_iq_works_across_multiple_nodes{error,{test_case_failed,timeout_waiting_for_result}}mysql_redis_latest / mysql_redis / cf55d1c pgsql_mnesia_legacy / pgsql_mnesia / cf55d1c pgsql_mnesia_latest / pgsql_mnesia / cf55d1c dynamic_domains_pgsql_mnesia_legacy / pgsql_mnesia / cf55d1c |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4629 +/- ##
==========================================
+ Coverage 86.05% 86.09% +0.04%
==========================================
Files 566 566
Lines 33926 33947 +21
==========================================
+ Hits 29195 29228 +33
+ Misses 4731 4719 -12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ed functions for dynamic domain handling
37b2015 to
8971c7b
Compare
…tart_hook_handler and rpc_stop_hook_handler
…hook_handler and rpc_stop_hook_handler
fen-pl
left a comment
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.
Some open questions plus improvement requests for tests.
| "WHERE owner_jid = ? AND node = ? AND pubsub_jid = ?">>), | ||
| mongoose_rdbms:prepare(event_pusher_push_remove_domain, event_pusher_push_subscription, | ||
| [owner_jid], | ||
| <<"DELETE FROM event_pusher_push_subscription WHERE owner_jid LIKE ?">>), |
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.
Not that happy about the potential performance implications here too but adding a new column and asking users to migrate the table might be an overkill here...
test/mod_event_pusher_push_SUITE.erl
Outdated
| {ok, Services1} = mod_event_pusher_push_mnesia:get_publish_services(?HOST_TYPE, User1), | ||
| {ok, Services2} = mod_event_pusher_push_mnesia:get_publish_services(?HOST_TYPE, User2), | ||
| ?assertEqual(1, length(Services1)), | ||
| ?assertEqual(1, length(Services2)), |
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.
Assertions on length carry virtually no debug information in case of failure.
| {ok, Services1} = mod_event_pusher_push_mnesia:get_publish_services(?HOST_TYPE, User1), | |
| {ok, Services2} = mod_event_pusher_push_mnesia:get_publish_services(?HOST_TYPE, User2), | |
| ?assertEqual(1, length(Services1)), | |
| ?assertEqual(1, length(Services2)), | |
| {ok, [_]} = mod_event_pusher_push_mnesia:get_publish_services(?HOST_TYPE, User1), | |
| {ok, [_]} = mod_event_pusher_push_mnesia:get_publish_services(?HOST_TYPE, User2), |
| ?assertEqual([], ServicesAfter1), | ||
| ?assertEqual([], ServicesAfter2). | ||
|
|
||
| mnesia_remove_domain_keeps_other_domain_subscriptions(_Config) -> |
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.
Since we care about this case here, it should be also tested for RDBMS.
test/mod_event_pusher_push_SUITE.erl
Outdated
| %% Test cases - RDBMS backend | ||
| %%-------------------------------------------------------------------- | ||
|
|
||
| rdbms_remove_domain_calls_execute_successfully(_Config) -> |
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.
This is not an RDBMS variant for _keeps_other_domain_subscriptions
|
|
||
| -spec select_domain_batch(mongooseim:host_type(), binary(), pos_integer()) -> [jid:literal_jid()]. | ||
| select_domain_batch(HostType, LikePattern, BatchSize) -> | ||
| {selected, Rows} = mongoose_rdbms:execute_successfully( |
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'm pretty sure this can be rewritten into WITH ... DELETE statement - it will significantly reduce round trips here.
| %% Users are stored as 'user@domain' in owner_jid, so we use LIKE '%@domain' | ||
| LikePattern = <<"%@", Domain/binary>>, | ||
| remove_domain_batches(HostType, LikePattern, ?REMOVE_DOMAIN_BATCH_SIZE, | ||
| fun select_domain_batch/3, |
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.
This approach seems forced only to conform with the current testing approach. I'd even consider moving this check to big tests. If not, it's better to use meck to mock mongoose_rdbms call.
supported_features/0callback in mod_event_pusher, mod_event_pusher_http, mod_event_pusher_push, mod_event_pusher_rabbit, and mod_event_pusher_sns.remove_domain/2handler in mod_event_pusher_push and its backends for domain removal.This PR addresses #
Proposed changes include: