You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2018/03/09 12:47:38 UTC

[couchdb] branch master updated (3c26bc3 -> 6f294c1)

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

jan pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


    from 3c26bc3  Fix dialyzer warning for couch_att:from_disk_term
     new 1b21587  feat: allow eunit to run without setup or make all
     new 6f294c1  fix: compaction daemon symlink resolution and log level #1097

The 2 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.


Summary of changes:
 Makefile                                  | 11 ++++++++
 src/couch/src/couch_compaction_daemon.erl | 44 ++++++++++++++++++++++++++-----
 2 files changed, 48 insertions(+), 7 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.

[couchdb] 02/02: fix: compaction daemon symlink resolution and log level #1097

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

jan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 6f294c1645e1a8b28258a98ee401f06101990da3
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Fri Mar 9 11:37:26 2018 +0100

    fix: compaction daemon symlink resolution and log level #1097
---
 src/couch/src/couch_compaction_daemon.erl | 44 ++++++++++++++++++++++++++-----
 1 file changed, 37 insertions(+), 7 deletions(-)

diff --git a/src/couch/src/couch_compaction_daemon.erl b/src/couch/src/couch_compaction_daemon.erl
index 200c3fd..5c278aa 100644
--- a/src/couch/src/couch_compaction_daemon.erl
+++ b/src/couch/src/couch_compaction_daemon.erl
@@ -519,9 +519,9 @@ free_space(Path) ->
 
 free_space_rec(_Path, []) ->
     undefined;
-free_space_rec(Path, [{MountPoint0, Total, Usage} | Rest]) ->
-    case abs_path(MountPoint0) of
-    {ok, MountPoint} ->
+free_space_rec(Path0, [{MountPoint, Total, Usage} | Rest]) ->
+    case abs_path(Path0) of
+    {ok, Path} ->
         case MountPoint =:= string:substr(Path, 1, length(MountPoint)) of
         false ->
             free_space_rec(Path, Rest);
@@ -529,10 +529,10 @@ free_space_rec(Path, [{MountPoint0, Total, Usage} | Rest]) ->
             trunc(Total - (Total * (Usage / 100))) * 1024
         end;
     {error, Reason} ->
-        couch_log:warning("Compaction daemon - unable to calculate free space"
-            " for `~s`: `~s`",
-            [MountPoint0, Reason]),
-        free_space_rec(Path, Rest)
+        couch_log:debug("Compaction daemon - unable to calculate free space"
+            " for `~s`: `~s` for mount mount `~p`",
+            [Path0, Reason, MountPoint]),
+        free_space_rec(Path0, Rest)
     end.
 
 abs_path(Path0) ->
@@ -557,3 +557,33 @@ abs_path2(Path0) ->
     _ ->
         {ok, Path ++ "/"}
     end.
+
+
+-ifdef(TEST).
+-include_lib("eunit/include/eunit.hrl").
+
+free_space_rec_test() ->
+    ?assertEqual(undefined, free_space_rec("", [])),
+    ?assertEqual(51200, free_space_rec("/tmp/", [{"/", 100, 50}])),
+    ?assertEqual(51200, free_space_rec("/tmp/", [
+        {"/floop", 200, 25},
+        {"/run", 0, 0},
+        {"/", 100, 50}
+    ])),
+    ?assertEqual(undefined, free_space_rec("/flopp/", [{"/", 300, 75}])),
+    ?assertEqual(undefined, free_space_rec("/flopp/", [
+        {"/floop", 200, 25},
+        {"/run", 0, 0},
+        {"/", 100, 50}
+    ])),
+    ok.
+
+abs_path2_test() ->
+    ?assertEqual({ok, "/a/"}, abs_path2("/a")),
+    ?assertEqual({ok, "/a/"}, abs_path2("/a/")),
+
+    ?assertEqual({ok, "/a/b/"}, abs_path2("/a/b")),
+    ?assertEqual({ok, "/a/b/"}, abs_path2("/a/b")),
+    ok.
+
+-endif.

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.

[couchdb] 01/02: feat: allow eunit to run without setup or make all

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

jan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 1b21587c16ffab621def35888cf4558defd59b06
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Fri Mar 9 11:36:33 2018 +0100

    feat: allow eunit to run without setup or make all
---
 Makefile | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Makefile b/Makefile
index ed8fc63..006ad54 100644
--- a/Makefile
+++ b/Makefile
@@ -116,6 +116,17 @@ eunit: couch
 	@$(REBAR) setup_eunit 2> /dev/null
 	@$(REBAR) -r eunit $(EUNIT_OPTS)
 
+
+setup-eunit: export BUILDDIR = $(shell pwd)
+setup-eunit: export ERL_AFLAGS = -config $(shell pwd)/rel/files/eunit.config
+setup-eunit:
+	@$(REBAR) setup_eunit 2> /dev/null
+
+just-eunit: export BUILDDIR = $(shell pwd)
+just-eunit: export ERL_AFLAGS = -config $(shell pwd)/rel/files/eunit.config
+just-eunit:
+	@$(REBAR) -r eunit $(EUNIT_OPTS)
+
 .PHONY: soak-eunit
 soak-eunit: export BUILDDIR = $(shell pwd)
 soak-eunit: export ERL_AFLAGS = -config $(shell pwd)/rel/files/eunit.config

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.