Skip to content

Commit

Permalink
Log choose node result
Browse files Browse the repository at this point in the history
  • Loading branch information
studzien committed Oct 15, 2024
1 parent 7dbbb9d commit e8d7ec4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/horde/dynamic_supervisor_impl.ex
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ defmodule Horde.DynamicSupervisorImpl do
# signal to the rest of the nodes that this process has been relinquished
# (to the Horde!) by its parent

Logger.error("Relinquishing #{inspect child_id}")
Logger.error("Relinquishing #{inspect(child_id)}")

with {_, child, _} <- get_item(state.processes_by_id, child_id) do
DeltaCrdt.put(
crdt_name(state.name),
Expand Down Expand Up @@ -348,7 +349,8 @@ defmodule Horde.DynamicSupervisorImpl do
end

defp mark_dead(state, name) do
Logger.error("marking dead #{inspect name}")
Logger.error("marking dead #{inspect(name)}")

DeltaCrdt.put(
crdt_name(state.name),
{:member_node_info, name},
Expand Down Expand Up @@ -397,7 +399,8 @@ defmodule Horde.DynamicSupervisorImpl do
end

def handle_info({:crdt_update, diffs}, state) do
Logger.error("CRDT update: #{inspect diffs, pretty: true}")
Logger.error("CRDT update: #{inspect(diffs, pretty: true)}")

new_state =
update_members(state, diffs)
|> update_processes(diffs)
Expand Down Expand Up @@ -458,7 +461,7 @@ defmodule Horde.DynamicSupervisorImpl do

case current_member do
%{status: :dead} ->
Logger.error("migrating process here #{inspect child_spec}")
Logger.error("migrating process here #{inspect(child_spec)}")
DeltaCrdt.delete(crdt_name(state.name), {:process, child_spec.id}, :infinity)
{_response, state} = add_child(randomize_child_id(child_spec), state)

Expand Down
6 changes: 6 additions & 0 deletions lib/horde/uniform_distribution.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Horde.UniformDistribution do
require Logger
@behaviour Horde.DistributionStrategy

@moduledoc """
Expand Down Expand Up @@ -26,6 +27,11 @@ defmodule Horde.UniformDistribution do

{:ok, Map.get(members, chosen_member)}
end
|> tap(fn value ->
Logger.error(
"Choose node spec: #{inspect(child_spec)}, members: #{inspect(members)}, value: #{inspect(value)}"
)
end)
end

def has_quorum?(_members), do: true
Expand Down

0 comments on commit e8d7ec4

Please sign in to comment.