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

Send discovered_nodes in bulk from control connection #299

Conversation

harunzengin
Copy link
Contributor

Introduces a new message {:discovered_hosts, [Host.t()]}. I wasn't so sure about whether we should introduce a new telemetry event for this, like :host_discovered. Not sure how useful it would be to be able to distinguish between a :host_added (from cassandra gossip) and :host_discovered (from peers table).

Closes #296

@whatyouhide
Copy link
Owner

@harunzengin no need for a new Telemetry event. Let't just fire a bunch of :host_up events instead.

@@ -627,6 +627,20 @@ defmodule Xandra.Cluster do
{:noreply, state}
end

def handle_info({:discovered_hosts, hosts}, %__MODULE__{} = state) when is_list(hosts) do
Logger.debug(
"Discovered hosts: #{Enum.map(hosts, &Host.format_address/1) |> Enum.join(", ")}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick:

Suggested change
"Discovered hosts: #{Enum.map(hosts, &Host.format_address/1) |> Enum.join(", ")}"
"Discovered hosts: #{Enum.map_join(hosts, ", ", &Host.format_address/1)}"

Comment on lines 452 to 453
discovered_hosts =
Map.values(discovered_peers) |> Enum.map(fn %{host: %Host{} = host} -> host end)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't care about the :status, why don't we store the discovered peers as a list of %Host{} directly

@harunzengin
Copy link
Contributor Author

@harunzengin no need for a new Telemetry event. Let't just fire a bunch of :host_up events instead.

Shouldn't we fire :host_added as it is now? From :host_up I understand that the node was down and is up now.

@whatyouhide
Copy link
Owner

Sorry yes that's what I meant @harunzengin

@harunzengin
Copy link
Contributor Author

@whatyouhide Done!

@whatyouhide whatyouhide merged commit 4dbbd84 into whatyouhide:main Apr 15, 2023
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.

Initial connection pool inconsistent with parameters
2 participants