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 2018/10/03 22:18:07 UTC

[couchdb] branch erlang-21-support created (now 2ec046a)

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

vatamane pushed a change to branch erlang-21-support
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at 2ec046a  Fix rebar deps to point to mochiweb with Erlang 21 support

This branch includes the following new commits:

     new a30c1aa  Fix couch_log eunit tests
     new 764fff3  Enable parameterized module calls
     new 0fef9c0  Fix use of process_info(Pid, monitored_by)
     new 2d12cbf  TMP: fix rebar.config.script Erlang versions
     new eedda07  A better fix for handling node local 413 responses
     new 4d002a3  Run tests on Erlang 21.0
     new 2ec046a  Fix rebar deps to point to mochiweb with Erlang 21 support

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 07/07: Fix rebar deps to point to mochiweb with Erlang 21 support

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2ec046acdd535668e51fc823d99327d1e23ab61c
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Wed Oct 3 17:56:33 2018 -0400

    Fix rebar deps to point to mochiweb with Erlang 21 support
---
 rebar.config.script | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rebar.config.script b/rebar.config.script
index 8cdb608..3bb1a58 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -65,7 +65,7 @@ DepDescs = [
 {hyper,            "hyper",            {tag, "CouchDB-2.2.0-4"}},
 {ibrowse,          "ibrowse",          {tag, "CouchDB-4.0.1"}},
 {jiffy,            "jiffy",            {tag, "CouchDB-0.14.11-2"}},
-{mochiweb,         "mochiweb",         {tag, "v2.17.0"}},
+{mochiweb,         "mochiweb",         {tag, "CouchDB-v2.18.0-1"}},
 {meck,             "meck",             {tag, "0.8.8"}}
 ],
 


[couchdb] 05/07: A better fix for handling node local 413 responses

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit eedda07e05f53e1838dc03fda8ed46fac1468f17
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Fri Jun 22 11:12:40 2018 -0400

    A better fix for handling node local 413 responses
    
    During 21.0 testing, the hack to read extra data from the socket to give the
    client a better chance of detecting a 413 response ended up failing. Either
    process scheduling or IO scheduling was different enough that the test started
    failing fairly consistently.
    
    Apply a better fix that's more in-line with the intent -- after responding to
    the client with a 413, read a limited amount of data off the socket (1MB).
    Limit the maximum time spent doing it to less than 1 second.
    
    Issue #1396
---
 src/couch/src/couch_httpd.erl | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/couch/src/couch_httpd.erl b/src/couch/src/couch_httpd.erl
index ec397c2..e66a78e 100644
--- a/src/couch/src/couch_httpd.erl
+++ b/src/couch/src/couch_httpd.erl
@@ -40,6 +40,8 @@
 
 
 -define(HANDLER_NAME_IN_MODULE_POS, 6).
+-define(MAX_DRAIN_BYTES, 1048576).
+-define(MAX_DRAIN_TIME_MSEC, 1000).
 
 start_link() ->
     start_link(http).
@@ -1181,10 +1183,9 @@ respond_(#httpd{mochi_req = MochiReq}, 413, Headers, Args, Type) ->
     % just increases the chances of 413 being detected correctly by the client
     % (rather than getting a brutal TCP reset).
     erlang:put(mochiweb_request_force_close, true),
-    Socket = MochiReq:get(socket),
-    mochiweb_socket:recv(Socket, 0, 0),
     Result = MochiReq:Type({413, Headers, Args}),
-    mochiweb_socket:recv(Socket, 0, 0),
+    Socket = MochiReq:get(socket),
+    mochiweb_socket:recv(Socket, ?MAX_DRAIN_BYTES, ?MAX_DRAIN_TIME_MSEC),
     Result;
 respond_(#httpd{mochi_req = MochiReq}, Code, Headers, Args, Type) ->
     MochiReq:Type({Code, Headers, Args}).


[couchdb] 01/07: Fix couch_log eunit tests

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a30c1aa19475a5d7d75b04c069e3102691c8b8c5
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Jun 21 12:44:32 2018 -0500

    Fix couch_log eunit tests
---
 src/couch_log/src/couch_log_monitor.erl    | 1 +
 src/couch_log/test/couch_log_test_util.erl | 9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/couch_log/src/couch_log_monitor.erl b/src/couch_log/src/couch_log_monitor.erl
index 236d340..ab0ae11 100644
--- a/src/couch_log/src/couch_log_monitor.erl
+++ b/src/couch_log/src/couch_log_monitor.erl
@@ -38,6 +38,7 @@ start_link() ->
 
 
 init(_) ->
+    error_logger:start(),
     ok = gen_event:add_sup_handler(error_logger, ?HANDLER_MOD, []),
     {ok, nil}.
 
diff --git a/src/couch_log/test/couch_log_test_util.erl b/src/couch_log/test/couch_log_test_util.erl
index 05d64d8..c7fd34f 100644
--- a/src/couch_log/test/couch_log_test_util.erl
+++ b/src/couch_log/test/couch_log_test_util.erl
@@ -123,9 +123,12 @@ last_log() ->
 
 
 remove_error_loggers() ->
-    lists:foreach(fun(Handler) ->
-        error_logger:delete_report_handler(Handler)
-    end, gen_event:which_handlers(error_logger)).
+    ErrorLoggerPid = whereis(error_logger),
+    if ErrorLoggerPid == undefined -> ok; true ->
+        lists:foreach(fun(Handler) ->
+            error_logger:delete_report_handler(Handler)
+        end, gen_event:which_handlers(ErrorLoggerPid))
+    end.
 
 
 config_files() ->


[couchdb] 02/07: Enable parameterized module calls

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 764fff38c8f66cf3e1482ea868eada3ae9ddb0e7
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Jun 21 17:16:33 2018 -0500

    Enable parameterized module calls
    
    This is a temporary bandaid to allow us to continue using parameterized
    modules with Erlang 21. We'll have to go back and modify every one of
    these files to avoid that as well as figuring out how to upgrade
    mochiweb to something that doesn't use parameterized modules by the time
    they are fully removed from Erlang.
---
 src/chttpd/src/chttpd.erl                     | 3 +++
 src/chttpd/src/chttpd_db.erl                  | 3 +++
 src/chttpd/src/chttpd_external.erl            | 2 ++
 src/chttpd/src/chttpd_prefer_header.erl       | 1 +
 src/chttpd/src/chttpd_rewrite.erl             | 3 +++
 src/chttpd/test/chttpd_prefer_header_test.erl | 3 +++
 src/couch/src/couch_httpd.erl                 | 3 +++
 src/couch/src/couch_httpd_auth.erl            | 3 +++
 src/couch/src/couch_httpd_db.erl              | 3 +++
 src/couch/src/couch_httpd_external.erl        | 2 ++
 src/couch/src/couch_httpd_proxy.erl           | 2 ++
 src/couch/src/couch_httpd_rewrite.erl         | 3 +++
 src/couch/src/couch_httpd_vhost.erl           | 2 ++
 src/couch/test/couchdb_http_proxy_tests.erl   | 2 ++
 src/couch/test/test_web.erl                   | 2 ++
 src/couch_index/src/couch_index.erl           | 2 ++
 src/fabric/src/fabric_doc_attachments.erl     | 2 ++
 src/fabric/src/fabric_doc_atts.erl            | 2 ++
 18 files changed, 43 insertions(+)

diff --git a/src/chttpd/src/chttpd.erl b/src/chttpd/src/chttpd.erl
index a562839..b606ad4 100644
--- a/src/chttpd/src/chttpd.erl
+++ b/src/chttpd/src/chttpd.erl
@@ -11,6 +11,9 @@
 % the License.
 
 -module(chttpd).
+
+-compile(tuple_calls).
+
 -include_lib("couch/include/couch_db.hrl").
 -include_lib("chttpd/include/chttpd.hrl").
 
diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl
index 49d7b58..9cde6d9 100644
--- a/src/chttpd/src/chttpd_db.erl
+++ b/src/chttpd/src/chttpd_db.erl
@@ -11,6 +11,9 @@
 % the License.
 
 -module(chttpd_db).
+
+-compile(tuple_calls).
+
 -include_lib("couch/include/couch_db.hrl").
 -include_lib("couch_mrview/include/couch_mrview.hrl").
 
diff --git a/src/chttpd/src/chttpd_external.erl b/src/chttpd/src/chttpd_external.erl
index 64664b9..fa35c6b 100644
--- a/src/chttpd/src/chttpd_external.erl
+++ b/src/chttpd/src/chttpd_external.erl
@@ -12,6 +12,8 @@
 
 -module(chttpd_external).
 
+-compile(tuple_calls).
+
 -export([handle_external_req/2, handle_external_req/3]).
 -export([send_external_response/2]).
 -export([json_req_obj_fields/0, json_req_obj/2, json_req_obj/3, json_req_obj/4]).
diff --git a/src/chttpd/src/chttpd_prefer_header.erl b/src/chttpd/src/chttpd_prefer_header.erl
index f550e80..1ad1443 100644
--- a/src/chttpd/src/chttpd_prefer_header.erl
+++ b/src/chttpd/src/chttpd_prefer_header.erl
@@ -12,6 +12,7 @@
 
 -module(chttpd_prefer_header).
 
+-compile(tuple_calls).
 
 -export([
     maybe_return_minimal/2
diff --git a/src/chttpd/src/chttpd_rewrite.erl b/src/chttpd/src/chttpd_rewrite.erl
index 24a4824..0196513 100644
--- a/src/chttpd/src/chttpd_rewrite.erl
+++ b/src/chttpd/src/chttpd_rewrite.erl
@@ -16,6 +16,9 @@
 %% @doc Module for URL rewriting by pattern matching.
 
 -module(chttpd_rewrite).
+
+-compile(tuple_calls).
+
 -export([handle_rewrite_req/3]).
 -include_lib("couch/include/couch_db.hrl").
 
diff --git a/src/chttpd/test/chttpd_prefer_header_test.erl b/src/chttpd/test/chttpd_prefer_header_test.erl
index a8a5b3d..0f43ba4 100644
--- a/src/chttpd/test/chttpd_prefer_header_test.erl
+++ b/src/chttpd/test/chttpd_prefer_header_test.erl
@@ -11,6 +11,9 @@
 % the License.
 
 -module(chttpd_prefer_header_test).
+
+-compile(tuple_calls).
+
 -include_lib("couch/include/couch_db.hrl").
 -include_lib("eunit/include/eunit.hrl").
 
diff --git a/src/couch/src/couch_httpd.erl b/src/couch/src/couch_httpd.erl
index a8cfca6..ec397c2 100644
--- a/src/couch/src/couch_httpd.erl
+++ b/src/couch/src/couch_httpd.erl
@@ -11,6 +11,9 @@
 % the License.
 
 -module(couch_httpd).
+
+-compile(tuple_calls).
+
 -include_lib("couch/include/couch_db.hrl").
 
 -export([start_link/0, start_link/1, stop/0, handle_request/5]).
diff --git a/src/couch/src/couch_httpd_auth.erl b/src/couch/src/couch_httpd_auth.erl
index 6ac7b75..6607271 100644
--- a/src/couch/src/couch_httpd_auth.erl
+++ b/src/couch/src/couch_httpd_auth.erl
@@ -11,6 +11,9 @@
 % the License.
 
 -module(couch_httpd_auth).
+
+-compile(tuple_calls).
+
 -include_lib("couch/include/couch_db.hrl").
 
 -export([party_mode_handler/1]).
diff --git a/src/couch/src/couch_httpd_db.erl b/src/couch/src/couch_httpd_db.erl
index 81209d9..ced146e 100644
--- a/src/couch/src/couch_httpd_db.erl
+++ b/src/couch/src/couch_httpd_db.erl
@@ -11,6 +11,9 @@
 % the License.
 
 -module(couch_httpd_db).
+
+-compile(tuple_calls).
+
 -include_lib("couch/include/couch_db.hrl").
 
 -export([handle_request/1, handle_compact_req/2, handle_design_req/2,
diff --git a/src/couch/src/couch_httpd_external.erl b/src/couch/src/couch_httpd_external.erl
index 1f2f1e8..684f900 100644
--- a/src/couch/src/couch_httpd_external.erl
+++ b/src/couch/src/couch_httpd_external.erl
@@ -12,6 +12,8 @@
 
 -module(couch_httpd_external).
 
+-compile(tuple_calls).
+
 -export([handle_external_req/2, handle_external_req/3]).
 -export([send_external_response/2, json_req_obj/2, json_req_obj/3]).
 -export([default_or_content_type/2, parse_external_response/1]).
diff --git a/src/couch/src/couch_httpd_proxy.erl b/src/couch/src/couch_httpd_proxy.erl
index 7e9aed7..d2c7acc 100644
--- a/src/couch/src/couch_httpd_proxy.erl
+++ b/src/couch/src/couch_httpd_proxy.erl
@@ -11,6 +11,8 @@
 % the License.
 -module(couch_httpd_proxy).
 
+-compile(tuple_calls).
+
 -export([handle_proxy_req/2]).
 
 -include_lib("couch/include/couch_db.hrl").
diff --git a/src/couch/src/couch_httpd_rewrite.erl b/src/couch/src/couch_httpd_rewrite.erl
index e2a2421..2845c0b 100644
--- a/src/couch/src/couch_httpd_rewrite.erl
+++ b/src/couch/src/couch_httpd_rewrite.erl
@@ -16,6 +16,9 @@
 %% @doc Module for URL rewriting by pattern matching.
 
 -module(couch_httpd_rewrite).
+
+-compile(tuple_calls).
+
 -export([handle_rewrite_req/3]).
 -include_lib("couch/include/couch_db.hrl").
 
diff --git a/src/couch/src/couch_httpd_vhost.erl b/src/couch/src/couch_httpd_vhost.erl
index f23f41d..d8f9521 100644
--- a/src/couch/src/couch_httpd_vhost.erl
+++ b/src/couch/src/couch_httpd_vhost.erl
@@ -15,6 +15,8 @@
 -vsn(1).
 -behaviour(config_listener).
 
+-compile(tuple_calls).
+
 -export([start_link/0, reload/0, get_state/0, dispatch_host/1]).
 -export([urlsplit_netloc/2, redirect_to_vhost/2]).
 -export([host/1, split_host_port/1]).
diff --git a/src/couch/test/couchdb_http_proxy_tests.erl b/src/couch/test/couchdb_http_proxy_tests.erl
index d54ff15..f60ba3b 100644
--- a/src/couch/test/couchdb_http_proxy_tests.erl
+++ b/src/couch/test/couchdb_http_proxy_tests.erl
@@ -12,6 +12,8 @@
 
 -module(couchdb_http_proxy_tests).
 
+-compile(tuple_calls).
+
 -include_lib("couch/include/couch_eunit.hrl").
 
 -record(req, {method=get, path="", headers=[], body="", opts=[]}).
diff --git a/src/couch/test/test_web.erl b/src/couch/test/test_web.erl
index d568b7e..b1b3e65 100644
--- a/src/couch/test/test_web.erl
+++ b/src/couch/test/test_web.erl
@@ -13,6 +13,8 @@
 -module(test_web).
 -behaviour(gen_server).
 
+-compile(tuple_calls).
+
 -include_lib("couch/include/couch_eunit.hrl").
 
 -export([start_link/0, stop/0, loop/1, get_port/0, set_assert/1, check_last/0]).
diff --git a/src/couch_index/src/couch_index.erl b/src/couch_index/src/couch_index.erl
index 8fba0a2..cae9577 100644
--- a/src/couch_index/src/couch_index.erl
+++ b/src/couch_index/src/couch_index.erl
@@ -13,6 +13,8 @@
 -module(couch_index).
 -behaviour(gen_server).
 
+-compile(tuple_calls).
+
 -vsn(3).
 
 %% API
diff --git a/src/fabric/src/fabric_doc_attachments.erl b/src/fabric/src/fabric_doc_attachments.erl
index 7c6ba66..723b9e8 100644
--- a/src/fabric/src/fabric_doc_attachments.erl
+++ b/src/fabric/src/fabric_doc_attachments.erl
@@ -12,6 +12,8 @@
 
 -module(fabric_doc_attachments).
 
+-compile(tuple_calls).
+
 -include_lib("fabric/include/fabric.hrl").
 -include_lib("couch/include/couch_db.hrl").
 
diff --git a/src/fabric/src/fabric_doc_atts.erl b/src/fabric/src/fabric_doc_atts.erl
index 7ef5dd8..a3aae80 100644
--- a/src/fabric/src/fabric_doc_atts.erl
+++ b/src/fabric/src/fabric_doc_atts.erl
@@ -12,6 +12,8 @@
 
 -module(fabric_doc_atts).
 
+-compile(tuple_calls).
+
 -include_lib("fabric/include/fabric.hrl").
 -include_lib("couch/include/couch_db.hrl").
 


[couchdb] 04/07: TMP: fix rebar.config.script Erlang versions

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2d12cbfb994713393315420e67707ddb877cae32
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Jun 21 16:28:56 2018 -0500

    TMP: fix rebar.config.script Erlang versions
---
 rebar.config.script | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rebar.config.script b/rebar.config.script
index 22dde7c..8cdb608 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -91,7 +91,7 @@ ErlOpts = case os:getenv("ERL_OPTS") of
 end,
 
 AddConfig = [
-    {require_otp_vsn, "17|18|19|20"},
+    {require_otp_vsn, "17|18|19|20|21"},
     {deps_dir, "src"},
     {deps, lists:map(MakeDep, DepDescs)},
     {sub_dirs, SubDirs},


[couchdb] 06/07: Run tests on Erlang 21.0

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4d002a335782945915299e7c33faa164519411f8
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Fri Jun 22 14:44:05 2018 -0500

    Run tests on Erlang 21.0
---
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.travis.yml b/.travis.yml
index acb0b51..bbcd457 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,6 +3,7 @@ sudo: false
 
 os: linux
 otp_release:
+   - 21.0
    - 20.3
    - 19.3
    - 18.3


[couchdb] 03/07: Fix use of process_info(Pid, monitored_by)

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0fef9c0ad805eff4dab169b9881da28b42f16168
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Jun 21 16:23:32 2018 -0500

    Fix use of process_info(Pid, monitored_by)
    
    This can now return references that are from NIFs monitoring the
    process. This is important for the new file IO NIFs that monitor the
    controlling process. For now we'll just take the easy way out by
    filtering the references from our returned monitor lists.
---
 src/couch/src/couch_bt_engine.erl | 2 +-
 src/couch/src/couch_file.erl      | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/couch/src/couch_bt_engine.erl b/src/couch/src/couch_bt_engine.erl
index 6d858ed..f856bde 100644
--- a/src/couch/src/couch_bt_engine.erl
+++ b/src/couch/src/couch_bt_engine.erl
@@ -196,7 +196,7 @@ decref(St) ->
 monitored_by(St) ->
     case erlang:process_info(St#st.fd, monitored_by) of
         {monitored_by, Pids} ->
-            Pids;
+            lists:filter(fun is_pid/1, Pids);
         _ ->
             []
     end.
diff --git a/src/couch/src/couch_file.erl b/src/couch/src/couch_file.erl
index 6aa8d0b..cfa07d8 100644
--- a/src/couch/src/couch_file.erl
+++ b/src/couch/src/couch_file.erl
@@ -129,7 +129,7 @@ append_term_md5(Fd, Term, Options) ->
 
 append_binary(Fd, Bin) ->
     ioq:call(Fd, {append_bin, assemble_file_chunk(Bin)}, erlang:get(io_priority)).
-    
+
 append_binary_md5(Fd, Bin) ->
     ioq:call(Fd,
         {append_bin, assemble_file_chunk(Bin, couch_hash:md5_hash(Bin))},
@@ -704,7 +704,8 @@ is_idle(#file{is_sys=true}) ->
     end;
 is_idle(#file{is_sys=false}) ->
     Tracker = whereis(couch_stats_process_tracker),
-    case process_info(self(), monitored_by) of
+    {monitored_by, PidsAndRefs} = process_info(self(), monitored_by),
+    case lists:filter(fun is_pid/1, PidsAndRefs) of
         {monitored_by, []} -> true;
         {monitored_by, [Tracker]} -> true;
         {monitored_by, [_]} -> exit(tracker_monitoring_failed);