-
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
Cleaning logic for discovery_nodes table - using database timestamp #4049
Cleaning logic for discovery_nodes table - using database timestamp #4049
Conversation
small_tests_24 / small_tests / 4c7ee8e small_tests_25_arm64 / small_tests / 4c7ee8e small_tests_25 / small_tests / 4c7ee8e ldap_mnesia_24 / ldap_mnesia / 4c7ee8e dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 4c7ee8e ldap_mnesia_25 / ldap_mnesia / 4c7ee8e dynamic_domains_mysql_redis_25 / mysql_redis / 4c7ee8e dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / 4c7ee8e internal_mnesia_25 / internal_mnesia / 4c7ee8e pgsql_mnesia_24 / pgsql_mnesia / 4c7ee8e pgsql_mnesia_25 / pgsql_mnesia / 4c7ee8e elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / 4c7ee8e pgsql_cets_25 / pgsql_cets / 4c7ee8e mysql_redis_25 / mysql_redis / 4c7ee8e mssql_mnesia_25 / odbc_mssql_mnesia / 4c7ee8e |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #4049 +/- ##
==========================================
+ Coverage 83.89% 83.91% +0.01%
==========================================
Files 551 552 +1
Lines 33596 33624 +28
==========================================
+ Hits 28187 28215 +28
Misses 5409 5409
☔ View full report in Codecov by Sentry. |
4c7ee8e
to
d6223aa
Compare
elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / d6223aa small_tests_24 / small_tests / d6223aa small_tests_25 / small_tests / d6223aa small_tests_25_arm64 / small_tests / d6223aa dynamic_domains_mysql_redis_25 / mysql_redis / d6223aa ldap_mnesia_24 / ldap_mnesia / d6223aa dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / d6223aa ldap_mnesia_25 / ldap_mnesia / d6223aa dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / d6223aa dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / d6223aa pgsql_mnesia_24 / pgsql_mnesia / d6223aa internal_mnesia_25 / internal_mnesia / d6223aa pgsql_cets_25 / pgsql_cets / d6223aa pgsql_mnesia_25 / pgsql_mnesia / d6223aa mssql_mnesia_25 / odbc_mssql_mnesia / d6223aa |
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 good in general. I added some comments.
elasticsearch_and_cassandra_25 / elasticsearch_and_cassandra_mnesia / d1dade1 small_tests_24 / small_tests / d1dade1 small_tests_25 / small_tests / d1dade1 small_tests_25_arm64 / small_tests / d1dade1 ldap_mnesia_24 / ldap_mnesia / d1dade1 dynamic_domains_mysql_redis_25 / mysql_redis / d1dade1 dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / d1dade1 ldap_mnesia_25 / ldap_mnesia / d1dade1 internal_mnesia_25 / internal_mnesia / d1dade1 dynamic_domains_pgsql_mnesia_25 / pgsql_mnesia / d1dade1 dynamic_domains_mssql_mnesia_25 / odbc_mssql_mnesia / d1dade1 mysql_redis_25 / mysql_redis / d1dade1 pgsql_mnesia_24 / pgsql_mnesia / d1dade1 pgsql_mnesia_25 / pgsql_mnesia / d1dade1 pgsql_cets_25 / pgsql_cets / d1dade1 mssql_mnesia_25 / odbc_mssql_mnesia / d1dade1 |
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.
One comment from me.
EnsureMocked = fun() -> | ||
Timestamp = rpc(Node, mongoose_rdbms_timestamp, select, []) | ||
end, | ||
EnsureMocked(), |
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.
Why execute and ignore result? Seems to do nothing.
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 am matching Timestamp variable here.
So, EnsureMocked will crash if select() returns something different.
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.e. if meck fails to mock for some reason, we would get:
=== ERROR! init_per_testcase crashed!
Location: [{cets_disco_SUITE,'-mock_timestamp/2-fun-0-',[127](file:///Users/mikhailuvarov/erlang/esl/MongooseIM/big_tests/ct_report/[email protected]_17.25.22/big_tests.tests.cets_disco_SUITE.logs/run.2023-09-01_17.25.23/cets_disco_suite.src.html#127)},
{cets_disco_SUITE,mock_timestamp,[129](file:///Users/mikhailuvarov/erlang/esl/MongooseIM/big_tests/ct_report/[email protected]_17.25.22/big_tests.tests.cets_disco_SUITE.logs/run.2023-09-01_17.25.23/cets_disco_suite.src.html#129)},
{cets_disco_SUITE,init_per_testcase,[50](file:///Users/mikhailuvarov/erlang/esl/MongooseIM/big_tests/ct_report/[email protected]_17.25.22/big_tests.tests.cets_disco_SUITE.logs/run.2023-09-01_17.25.23/cets_disco_suite.src.html#50)},
{test_server,do_init_per_testcase,1552},
{test_server,run_test_case_eval1,1253},
{test_server,run_test_case_eval,1223}]
Reason: {{badmatch,1693581924},
[{cets_disco_SUITE,'-mock_timestamp/2-fun-0-',2,
[{file,"cets_disco_SUITE.erl"},{line,127}]},
{cets_disco_SUITE,mock_timestamp,2,
[{file,"cets_disco_SUITE.erl"},{line,129}]},
{cets_disco_SUITE,init_per_testcase,2,
[{file,"cets_disco_SUITE.erl"},{line,50}]},
{test_server,do_init_per_testcase,2,[{file,"test_server.erl"},{line,1552}]},
{test_server,run_test_case_eval1,6,[{file,"test_server.erl"},{line,1253}]},
{test_server,run_test_case_eval,9,[{file,"test_server.erl"},{line,1223}]}]}
I could remove EnsureMocked though, it is just to verify and mocking is working.
Adds logic to remove nodes from the disco table, so we don't try to contact them if they are not available.
This also requires a way to signal that the node is still alive (we update timestamp column for that).
Proposed changes include:
mongoose_rdbms_timestamp.erl
to get timestamp from the RDBMS server.This PR addresses MIM-1942:
Alternative PR #4045 that uses just timestamp from Erlang node (but we have to ensure that all nodes have the correct timestamp. Using DB in this PR is better, because DB is already available, if we want to remove something from DB).
Test with Helm: