]> Entropealabs - cluster_kv.git/commitdiff
remove old logging
authorChristopher <chris@entropealabs.com>
Thu, 16 Apr 2020 16:58:40 +0000 (11:58 -0500)
committerChristopher <chris@entropealabs.com>
Thu, 16 Apr 2020 16:58:40 +0000 (11:58 -0500)
lib/cluster_kv/db.ex
lib/cluster_kv/ring.ex

index e803e4179ef49e1887f7ac08545c92437fae2f6a..a73c1561f086dbc9e3bc90dabccae96222281c2d 100644 (file)
@@ -21,7 +21,6 @@ defmodule ClusterKV.DB do
           element() | :not_found
   def get(name, key, timeout \\ :infinity) do
     :poolboy.transaction(name, fn w ->
-      Logger.info("GET: #{inspect(key)}")
       GenServer.call(w, {:get, key}, timeout)
     end)
   end
@@ -82,7 +81,7 @@ defmodule ClusterKV.DB do
   end
 
   def handle_call({:get, key}, _from, %DB{db: db} = state) do
-    Logger.info("DB handling GET #{key}")
+    Logger.debug("DB handling GET #{key}")
     {:reply, do_get(db, key), state}
   end
 
@@ -137,15 +136,13 @@ defmodule ClusterKV.DB do
           last_batch :: integer(),
           fun :: fun()
         ) :: {[element()], integer(), reference()}
-  defp handle_next_batch_chunk(db, batch, chunk, last_batch, _fun) do
+  defp handle_next_batch_chunk(db, batch, chunk, last_batch, fun) do
     Logger.debug("processing batch of #{length(batch)} from #{last_batch} with chunk of #{chunk}")
 
     batch
     |> Enum.slice(last_batch, chunk)
-    |> Enum.each(fn {_k, _v} = v ->
-      Logger.info("Batch processing: #{inspect(v)}")
-      :ets.insert_new(db, v)
-      # do_upsert(db, k, v, fun)
+    |> Enum.each(fn {k, v} ->
+      do_upsert(db, k, v, fun)
     end)
 
     case last_batch + chunk do
@@ -177,8 +174,7 @@ defmodule ClusterKV.DB do
         new = fun.(old, value)
         :ets.insert(db, new)
 
-      [{_, v}] ->
-        Logger.info("Exising value is not a list: #{inspect(v)} writing #{inspect(value)}")
+      [_] ->
         :ets.insert(db, {key, [value]})
     end
 
@@ -223,8 +219,6 @@ defmodule ClusterKV.DB do
 
   @spec do_get(db :: module(), key :: String.t()) :: element() | :not_found
   defp do_get(db, key) do
-    Logger.info("Lookup: #{inspect(key)}")
-
     case :ets.lookup(db, key) do
       [] -> :not_found
       [other] -> other
index e51787a0fa1f93d1ac8ee660fbf282a806812806..2a3d82bfcec047189806934c289e381a101259a5 100644 (file)
@@ -172,8 +172,6 @@ defmodule ClusterKV.Ring do
         @ready,
         sl
       ) do
-    Logger.info("Ready")
-
     {:ok, sl, []}
   end
 
@@ -338,7 +336,6 @@ 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
@@ -381,7 +378,6 @@ 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
@@ -421,13 +417,12 @@ defmodule ClusterKV.Ring do
   end
 
   def handle_info({:handle_batch, batch}, _, %SL{data: %Ring{db: db}} = sl) do
-    Logger.info("Handling Batch")
     DB.batch(db, batch)
     {:ok, sl, []}
   end
 
   def handle_info(e, s, sl) do
-    Logger.info("Unknown Info Event: #{inspect(e)} in state #{s} with data #{inspect(sl)}")
+    Logger.warn("Unknown Info Event: #{inspect(e)} in state #{s} with data #{inspect(sl)}")
     {:ok, sl, []}
   end