-
Notifications
You must be signed in to change notification settings - Fork 4
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
Improved discovery backend #24
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #24 +/- ##
==========================================
+ Coverage 91.01% 95.88% +4.86%
==========================================
Files 8 8
Lines 434 510 +76
==========================================
+ Hits 395 489 +94
+ Misses 39 21 -18
☔ View full report in Codecov by Sentry. |
47a5f01
to
dd79960
Compare
Fixed dialyzer Fixed a race condition in test_disco_add_two_tables testcase
peer:rpc is pretty cool: it allows to apply code on nodes without touching erlang distribution protocol Which means we can actually setup discovery tests
658f1a5
to
acef28e
Compare
Add insert_returns_when_netsplit/inserts_after_netsplit_reconnects testcases Add cets_seq group for netsplits
acef28e
to
e0e9570
Compare
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.
Just a few very small comments
src/cets_join.erl
Outdated
local_servers => LocSet, | ||
remote_servers => RemSet, |
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.
Won't these be more unreadable in the logs than a list? I'd say it depends on whether the list had duplicates. If ordsets are simply ordering the list into a data structure that is faster to read or calculate intersections then I'd prefer we print the list, it's just more readable 🤔
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.
oh yea, I did the change for logs to make logs easier to read.
get_pids() does return [Server | ordeset()]
. So, I can just force to use ordsets everywhere, no need to allow non-sorted lists.
src/cets_discovery.erl
Outdated
AvailableNodes = nodes(), | ||
spawn_link(fun() -> | ||
%% We only care about connected nodes here | ||
%% We do not wanna try to connect here - we do it in ping_not_connected_nodes/1 |
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 do not wanna try to connect here - we do it in ping_not_connected_nodes/1 | |
%% We do not want to try to connect here - we do it in ping_not_connected_nodes/1 |
src/cets_discovery.erl
Outdated
%% Returns timeout in milliseconds to retry calling the get_nodes function. | ||
%% get_nodes is called after add_table without waiting. | ||
%% It is also would be retried without waiting if should_retry_get_nodes set to true. | ||
-spec retry_type_to_timeout(retry_type()) -> 5000 | 1000 | 180000. | ||
retry_type_to_timeout(initial) -> 5000; | ||
retry_type_to_timeout(after_error) -> 1000; | ||
retry_type_to_timeout(regular) -> 180000. |
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 don't know from the top of my mind how many minutes 180000
ms is, so maybe at a comment, 180000ms = 5min
, or, call timer:minutes(5)
, to make it more readable (comment and direct value might be "more performant though" xD)
1d99195
to
12b7b70
Compare
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.
LGTM 🔥
Adresses MIM-2018.
Make cets_discovery module more async and better tested.
This should avoid long locking time at startup in some cases (for example, there are a lot of dead nodes returned by the discovery backend).
Changes:
You can find MIM branch that uses this code here: esl/MongooseIM#4111 (for testing)
Command to test helm (ensure you use k8s from Docker Desktop and having helm installed):