From 51fbe064ee56c2951d778a564f7c6e34a5bde541 Mon Sep 17 00:00:00 2001 From: Christopher Date: Fri, 6 Mar 2020 17:56:24 -0600 Subject: [PATCH] add some logging for get requests --- lib/cluster_kv/ring.ex | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/cluster_kv/ring.ex b/lib/cluster_kv/ring.ex index 2192fca..02a4ee7 100644 --- a/lib/cluster_kv/ring.ex +++ b/lib/cluster_kv/ring.ex @@ -101,6 +101,7 @@ defmodule ClusterKV.Ring do sl ) do nodes = HashRing.key_to_nodes(r, key, repls) + Logger.info("Picking node #{inspect(nodes)} - #{inspect(node)}") node = case node in nodes do @@ -113,7 +114,7 @@ defmodule ClusterKV.Ring do {:ok, %SL{sl | data: %Ring{data | requests: [{ref, from} | reqs]}}, []} end - def handle_call({:get, key}, from, _, sl), do: {:ok, sl, [{:reply, from, :no_quorum}]} + def handle_call({:get, _key}, from, _, sl), do: {:ok, sl, [{:reply, from, :no_quorum}]} def handle_cast( {:put, key, value}, @@ -125,7 +126,7 @@ defmodule ClusterKV.Ring do {:ok, sl, []} end - def handle_cast({:put, key, value}, _, sl), do: {:ok, sl, []} + def handle_cast({:put, _key, _value}, _, sl), do: {:ok, sl, []} def handle_cast({:sync, keys}, @ready, %SL{data: %Ring{db: db}} = sl) do Enum.each(keys, fn {key, value} -> @@ -135,7 +136,7 @@ defmodule ClusterKV.Ring do {:ok, sl, []} end - def handle_cast({:sync, keys}, _, sl), do: {:ok, sl, []} + def handle_cast({:sync, _keys}, _, sl), do: {:ok, sl, []} def handle_info({:get_key, key, ref, node}, @ready, %SL{data: %Ring{name: n, db: db}} = sl) do val = DB.get(db, key) -- 2.45.3