]> Entropealabs - cluster_kv.git/commitdiff
more logging
authorChristopher <chris@entropealabs.com>
Thu, 16 Apr 2020 15:20:20 +0000 (10:20 -0500)
committerChristopher <chris@entropealabs.com>
Thu, 16 Apr 2020 15:20:20 +0000 (10:20 -0500)
lib/cluster_kv/db.ex
lib/cluster_kv/ring.ex

index 468235edbf136ca8672a796a23df357d46712cb2..9b0cd011370026061190ca26dd99ba0b19b59f4b 100644 (file)
@@ -143,7 +143,7 @@ defmodule ClusterKV.DB do
     batch
     |> Enum.slice(last_batch, chunk)
     |> Enum.each(fn {_k, _v} = v ->
-      :ets.insert(db, v)
+      :ets.insert_new(db, v)
       # do_upsert(db, k, v, fun)
     end)
 
index df75eb0de0f8a7baf9eaed4b342b9422cc01d824..e51787a0fa1f93d1ac8ee660fbf282a806812806 100644 (file)
@@ -338,6 +338,7 @@ defmodule ClusterKV.Ring do
   end
 
   def handle_info({:get_key, key, ref, node}, _, %SL{data: %Ring{name: n, db: db, node: me}} = sl) do
+    Logger.info("Getting value for #{inspect(key)} with ref #{inspect(ref)}")
     send({n, node}, {:reply, get_key(db, key), ref, me})
     {:ok, sl, []}
   end
@@ -380,6 +381,7 @@ defmodule ClusterKV.Ring do
   end
 
   def handle_info({:reply, val, ref, from}, _, %SL{data: %Ring{requests: reqs} = data} = sl) do
+    Logger.info("Got #{inspect(val)} with ref #{inspect(ref)}")
     {requests, actions} = maybe_reply(ref, reqs, val, from)
     {:ok, %SL{sl | data: %Ring{data | requests: requests}}, actions}
   end