From: Christopher Date: Sun, 8 Mar 2020 14:39:47 +0000 (-0500) Subject: add logging arounf node choice and batching X-Git-Url: http://git.entropealabs.com/?a=commitdiff_plain;h=fd7d3487cee8930bc885cf367bdbcc6bb9385452;p=cluster_kv.git add logging arounf node choice and batching --- diff --git a/lib/cluster_kv/ring.ex b/lib/cluster_kv/ring.ex index 90d9da1..f5e7a3a 100644 --- a/lib/cluster_kv/ring.ex +++ b/lib/cluster_kv/ring.ex @@ -314,7 +314,7 @@ defmodule ClusterKV.Ring do end def send_batch(name, batches) do - Logger.debug("Sending batches: #{inspect(batches)}") + Logger.info("Sending batches to: #{inspect(Map.keys(batches))}") Enum.each(batches, fn {node, batch} -> send({name, node}, {:handle_batch, batch}) @@ -408,10 +408,15 @@ defmodule ClusterKV.Ring do defp get_node(key, r, node, repls) do nodes = HashRing.key_to_nodes(r, key, repls) + Logger.info("Possible Nodes: #{inspect(nodes)}") - case node in nodes do - true -> node - false -> Enum.random(nodes) - end + n = + case node in nodes do + true -> node + false -> Enum.random(nodes) + end + + Logger.info("Chose #{inspect(n)}") + n end end