Merge remote-tracking branch 'cloudant/3232-all-docs-ctx'
diff --git a/priv/stats_descriptions.cfg b/priv/stats_descriptions.cfg
index 0c2351b..d12aa0c 100644
--- a/priv/stats_descriptions.cfg
+++ b/priv/stats_descriptions.cfg
@@ -2,6 +2,10 @@
{type, counter},
{desc, <<"number of worker timeouts">>}
]}.
+{[fabric, open_shard, timeouts], [
+ {type, counter},
+ {desc, <<"number of open shard timeouts">>}
+]}.
{[fabric, read_repairs, success], [
{type, counter},
{desc, <<"number of successful read repair operations">>}
diff --git a/src/fabric_rpc.erl b/src/fabric_rpc.erl
index 3a21d83..9c7d518 100644
--- a/src/fabric_rpc.erl
+++ b/src/fabric_rpc.erl
@@ -253,7 +253,11 @@
open_shard(Name, Opts) ->
set_io_priority(Name, Opts),
- rexi:reply(couch_db:open(Name, Opts)).
+ try
+ rexi:reply(couch_db:open(Name, Opts))
+ catch exit:{timeout, _} ->
+ couch_stats:increment_counter([fabric, open_shard, timeouts])
+ end.
compact(DbName) ->
with_db(DbName, [], {couch_db, start_compact, []}).