couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [couchdb] branch COUCHDB-3287-pluggable-storage-engines updated: DEBUG: More logging to mem3_shards
Date Wed, 12 Apr 2017 20:55:00 GMT
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch COUCHDB-3287-pluggable-storage-engines
in repository https://gitbox.apache.org/repos/asf/couchdb.git

The following commit(s) were added to refs/heads/COUCHDB-3287-pluggable-storage-engines by
this push:
       new  8a23691   DEBUG: More logging to mem3_shards
8a23691 is described below

commit 8a236911de12c5461faa56ef624f9a2581b1a479
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
AuthorDate: Wed Apr 12 15:54:41 2017 -0500

    DEBUG: More logging to mem3_shards
---
 src/mem3/src/mem3_shards.erl | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/mem3/src/mem3_shards.erl b/src/mem3/src/mem3_shards.erl
index f7e7962..621bdaf 100644
--- a/src/mem3/src/mem3_shards.erl
+++ b/src/mem3/src/mem3_shards.erl
@@ -48,11 +48,13 @@ for_db(DbName) ->
 for_db(DbName, Options) ->
     Shards = try ets:lookup(?SHARDS, DbName) of
         [] ->
+            couch_log:notice("~p ~p for_db miss ~s :: ~p", [?MODULE, process_info(self(),
registered_name), DbName, Options]),
             load_shards_from_disk(DbName);
         Else ->
             gen_server:cast(?MODULE, {cache_hit, DbName}),
             Else
     catch error:badarg ->
+        couch_log:notice("~p ~p for_db NO TABLE? ~s :: ~p", [?MODULE, process_info(self(),
registered_name), DbName, Options]),
         load_shards_from_disk(DbName)
     end,
     case lists:member(ordered, Options) of
@@ -80,11 +82,13 @@ for_docid(DbName, DocId, Options) ->
     OrderedShardSpec = {OrderedShardHead, Conditions, ['$_']},
     Shards = try ets:select(?SHARDS, [ShardSpec, OrderedShardSpec]) of
         [] ->
+            couch_log:notice("~p ~p for_docid miss ~s/~s (~p) :: ~p", [?MODULE, process_info(self(),
registered_name), DbName, DocId, HashKey, Options]),
             load_shards_from_disk(DbName, DocId);
         Else ->
             gen_server:cast(?MODULE, {cache_hit, DbName}),
             Else
     catch error:badarg ->
+        couch_log:notice("~p ~p for_docid NO TABLE? ~s/~s (~p) :: ~p :: ~p", [?MODULE, process_info(self(),
registered_name), DbName, DocId, HashKey, Options, [ShardSpec, OrderedShardSpec]]),
         load_shards_from_disk(DbName, DocId)
     end,
     case lists:member(ordered, Options) of
@@ -111,11 +115,13 @@ for_shard_name(ShardName, Options) ->
     OrderedShardSpec = {OrderedShardHead, [], ['$_']},
     Shards = try ets:select(?SHARDS, [ShardSpec, OrderedShardSpec]) of
         [] ->
+            couch_log:notice("~p ~p for_shard_name miss ~s - ~s :: ~p", [?MODULE, process_info(self(),
registered_name), DbName, ShardName, Options]),
             filter_shards_by_name(ShardName, load_shards_from_disk(DbName));
         Else ->
             gen_server:cast(?MODULE, {cache_hit, DbName}),
             Else
     catch error:badarg ->
+        couch_log:notice("~p ~p for_shard_name NO TABLE? ~s - ~s :: ~p :: ~p", [?MODULE,
process_info(self(), registered_name), DbName, ShardName, Options, [ShardSpec, OrderedShardSpec]]),
         filter_shards_by_name(ShardName, load_shards_from_disk(DbName))
     end,
     case lists:member(ordered, Options) of
@@ -203,11 +209,14 @@ handle_cast({cache_hit, DbName}, St) ->
     cache_hit(DbName),
     {noreply, St};
 handle_cast({cache_insert, DbName, Shards, UpdateSeq}, St) ->
-    couch_log:notice("~p maybe adding ~s ~p ~p", [?MODULE, DbName, St#st.update_seq, UpdateSeq]),
     couch_stats:increment_counter([mem3, shard_cache, miss]),
     NewSt = case UpdateSeq < St#st.update_seq of
-        true -> St;
-        false -> cache_free(cache_insert(St, DbName, Shards))
+        true ->
+            couch_log:notice("~p ignoring add ~s :: ~p < ~p", [?MODULE, DbName, UpdateSeq,
St#st.update_seq]),
+            St;
+        false ->
+            couch_log:notice("~p adding ~s :: ~p >= ~p", [?MODULE, DbName, UpdateSeq,
St#st.update_seq]),
+            cache_free(cache_insert(St, DbName, Shards))
     end,
     {noreply, NewSt};
 handle_cast({cache_remove, DbName}, St) ->
@@ -447,4 +456,4 @@ filter_shards_by_name(Name, Matches, [#ordered_shard{name=Name}=S|Ss])
->
 filter_shards_by_name(Name, Matches, [#shard{name=Name}=S|Ss]) ->
     filter_shards_by_name(Name, [S|Matches], Ss);
 filter_shards_by_name(Name, Matches, [_|Ss]) ->
-    filter_shards_by_name(Name, Matches, Ss).
\ No newline at end of file
+    filter_shards_by_name(Name, Matches, Ss).

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <commits@couchdb.apache.org>'].

Mime
View raw message