From d3bb958de67ef22304f24641661261a1c2df684d Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 16 Apr 2020 11:58:40 -0500 Subject: [PATCH] remove old logging --- lib/cluster_kv/db.ex | 16 +++++----------- lib/cluster_kv/ring.ex | 7 +------ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/lib/cluster_kv/db.ex b/lib/cluster_kv/db.ex index e803e41..a73c156 100644 --- a/lib/cluster_kv/db.ex +++ b/lib/cluster_kv/db.ex @@ -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 diff --git a/lib/cluster_kv/ring.ex b/lib/cluster_kv/ring.ex index e51787a..2a3d82b 100644 --- a/lib/cluster_kv/ring.ex +++ b/lib/cluster_kv/ring.ex @@ -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 -- 2.45.3