couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [09/50] folsom commit: updated refs/heads/import-master to 4824aec
Date Thu, 31 Jul 2014 21:24:57 GMT
Fix a race against querying the ETS/DETS tables.

There is a window from the query of, say, `ets:all()` to the point where we fetch out the
table data. The table may disappear in between. This patch fixes this problem by ignoring
such tables and returning the empty list for those where there is no data available anymore.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-folsom/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-folsom/commit/d999b679
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-folsom/tree/d999b679
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-folsom/diff/d999b679

Branch: refs/heads/import-master
Commit: d999b67944b4d2d6424f513fe4b00773f69c1c86
Parents: 154024e
Author: Jesper Louis Andersen <jesper.louis.andersen@gmail.com>
Authored: Tue May 14 11:15:31 2013 +0200
Committer: Jesper Louis Andersen <jesper.louis.andersen@gmail.com>
Committed: Tue May 14 11:15:31 2013 +0200

----------------------------------------------------------------------
 src/folsom_vm_metrics.erl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-folsom/blob/d999b679/src/folsom_vm_metrics.erl
----------------------------------------------------------------------
diff --git a/src/folsom_vm_metrics.erl b/src/folsom_vm_metrics.erl
index 4ff72d1..fab4ef0 100644
--- a/src/folsom_vm_metrics.erl
+++ b/src/folsom_vm_metrics.erl
@@ -230,7 +230,11 @@ get_socket_sockname(Socket) ->
     end.
 
 get_ets_dets_info(Type, Tab) ->
-    [{Key, pid_port_fun_to_atom(Value)} || {Key, Value} <- Type:info(Tab)].
+    case Type:info(Tab) of
+        undefined -> [];
+        Entries when is_list(Entries) ->
+            [{Key, pid_port_fun_to_atom(Value)} || {Key, Value} <- Entries]
+    end.
 
 ip_to_binary(Tuple) ->
     iolist_to_binary(string:join(lists:map(fun integer_to_list/1, tuple_to_list(Tuple)),
".")).


Mime
View raw message