]> Entropealabs - cluster_kv.git/commitdiff
add logging arounf node choice and batching
authorChristopher <chris@entropealabs.com>
Sun, 8 Mar 2020 14:39:47 +0000 (09:39 -0500)
committerChristopher <chris@entropealabs.com>
Sun, 8 Mar 2020 14:39:47 +0000 (09:39 -0500)
lib/cluster_kv/ring.ex

index 90d9da17e46b749d10d13ac04e4cc6087eeaf6c1..f5e7a3ab4f9b47501ee19a29c4d21ea40b6c8ef7 100644 (file)
@@ -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