You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2017/04/09 05:16:05 UTC

[couchdb] branch 63012-scheduler updated: [fixup] relinquish -> release in connection pool

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch 63012-scheduler
in repository https://gitbox.apache.org/repos/asf/couchdb.git

The following commit(s) were added to refs/heads/63012-scheduler by this push:
       new  264c8e5   [fixup] relinquish -> release in connection pool
264c8e5 is described below

commit 264c8e5552a0fd1c63a3497f624adcda60d13112
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Sun Apr 9 01:15:59 2017 -0400

    [fixup] relinquish -> release in connection pool
---
 src/couch_replicator/priv/stats_descriptions.cfg             |  4 ++--
 src/couch_replicator/src/couch_replicator_connection.erl     | 10 +++++-----
 src/couch_replicator/src/couch_replicator_httpc_pool.erl     |  2 +-
 .../test/couch_replicator_connection_tests.erl               | 12 ++++++------
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/couch_replicator/priv/stats_descriptions.cfg b/src/couch_replicator/priv/stats_descriptions.cfg
index c009cc9..777b290 100644
--- a/src/couch_replicator/priv/stats_descriptions.cfg
+++ b/src/couch_replicator/priv/stats_descriptions.cfg
@@ -146,9 +146,9 @@
     {type, counter},
     {desc, <<"number of connections created">>}
 ]}.
-{[couch_replicator, connection, relinquishes], [
+{[couch_replicator, connection, releasees], [
     {type, counter},
-    {desc, <<"number of times ownership of a connection is relinquished">>}
+    {desc, <<"number of times ownership of a connection is released">>}
 ]}.
 {[couch_replicator, connection, owner_crashes], [
     {type, counter},
diff --git a/src/couch_replicator/src/couch_replicator_connection.erl b/src/couch_replicator/src/couch_replicator_connection.erl
index 61dcff3..64ec2b7 100644
--- a/src/couch_replicator/src/couch_replicator_connection.erl
+++ b/src/couch_replicator/src/couch_replicator_connection.erl
@@ -19,7 +19,7 @@
 -export([init/1, handle_call/3, handle_cast/2, handle_info/2]).
 -export([code_change/3, terminate/2]).
 
--export([acquire/1, relinquish/1]).
+-export([acquire/1, release/1]).
 
 -export([handle_config_change/5, handle_config_terminate/3]).
 
@@ -73,9 +73,9 @@ acquire(URL0) ->
     end.
 
 
-relinquish(Worker) ->
+release(Worker) ->
     unlink(Worker),
-    gen_server:cast(?MODULE, {relinquish, Worker}).
+    gen_server:cast(?MODULE, {release, Worker}).
 
 
 handle_call({acquire, URL}, From, State) ->
@@ -108,8 +108,8 @@ handle_call({create, URL, Worker}, From, State) ->
     end.
 
 
-handle_cast({relinquish, WorkerPid}, State) ->
-    couch_stats:increment_counter([couch_replicator, connection, relinquishes]),
+handle_cast({release, WorkerPid}, State) ->
+    couch_stats:increment_counter([couch_replicator, connection, releasees]),
     case ets:lookup(?MODULE, WorkerPid) of
         [Worker] ->
             case Worker#connection.mref of
diff --git a/src/couch_replicator/src/couch_replicator_httpc_pool.erl b/src/couch_replicator/src/couch_replicator_httpc_pool.erl
index f2dd7ad..abdf1c5 100644
--- a/src/couch_replicator/src/couch_replicator_httpc_pool.erl
+++ b/src/couch_replicator/src/couch_replicator_httpc_pool.erl
@@ -158,7 +158,7 @@ release_worker_internal(Worker, State) ->
         Workers = case queue:out(Waiting) of
         {empty, Waiting2} ->
             NewCallers1 = NewCallers0,
-            couch_replicator_connection:relinquish(Worker),
+            couch_replicator_connection:release(Worker),
             State#state.workers -- [Worker];
         {{value, From}, Waiting2} ->
             NewCallers1 = monitor_client(NewCallers0, Worker, From),
diff --git a/src/couch_replicator/test/couch_replicator_connection_tests.erl b/src/couch_replicator/test/couch_replicator_connection_tests.erl
index 323a7de..00fbad9 100644
--- a/src/couch_replicator/test/couch_replicator_connection_tests.erl
+++ b/src/couch_replicator/test/couch_replicator_connection_tests.erl
@@ -37,7 +37,7 @@ httpc_pool_test_() ->
                 foreach,
                 fun setup/0, fun teardown/1,
                 [
-                    fun connections_shared_after_relinquish/1,
+                    fun connections_shared_after_release/1,
                     fun connections_not_shared_after_owner_death/1,
                     fun idle_connections_closed/1,
                     fun test_owner_monitors/1
@@ -47,12 +47,12 @@ httpc_pool_test_() ->
     }.
 
 
-connections_shared_after_relinquish({Host, Port}) ->
+connections_shared_after_release({Host, Port}) ->
     ?_test(begin
         URL = "http://" ++ Host ++ ":" ++ Port,
         Self = self(),
         {ok, Pid} = couch_replicator_connection:acquire(URL),
-        couch_replicator_connection:relinquish(Pid),
+        couch_replicator_connection:release(Pid),
         spawn(fun() ->
             Self ! couch_replicator_connection:acquire(URL)
         end),
@@ -92,7 +92,7 @@ idle_connections_closed({Host, Port}) ->
         ?assert(ets:member(couch_replicator_connection, Pid)),
         % block until idle connections have closed
         sys:get_status(couch_replicator_connection),
-        couch_replicator_connection:relinquish(Pid),
+        couch_replicator_connection:release(Pid),
         couch_replicator_connection ! close_idle_connections,
         % block until idle connections have closed
         sys:get_status(couch_replicator_connection),
@@ -105,7 +105,7 @@ test_owner_monitors({Host, Port}) ->
         URL = "http://" ++ Host ++ ":" ++ Port,
         {ok, Worker0} = couch_replicator_connection:acquire(URL),
         assert_monitors_equal([{process, self()}]),
-        couch_replicator_connection:relinquish(Worker0),
+        couch_replicator_connection:release(Worker0),
         assert_monitors_equal([]),
         {Workers, Monitors}  = lists:foldl(fun(_, {WAcc, MAcc}) ->
             {ok, Worker1} = couch_replicator_connection:acquire(URL),
@@ -115,7 +115,7 @@ test_owner_monitors({Host, Port}) ->
         end, {[], []}, lists:seq(1,5)),
         lists:foldl(fun(Worker2, Acc) ->
             [_ | NewAcc] = Acc,
-            couch_replicator_connection:relinquish(Worker2),
+            couch_replicator_connection:release(Worker2),
             assert_monitors_equal(NewAcc),
             NewAcc
         end, Monitors, Workers)

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