You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/23 13:17:37 UTC

couch commit: updated refs/heads/master to e696e43

Repository: couchdb-couch
Updated Branches:
  refs/heads/master 9d90ee9c3 -> e696e4399


Follow symlinks for space check

Follow symlinks when the compaction daemon checks for available space.

closes COUCHDB-1592


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

Branch: refs/heads/master
Commit: e696e4399a2cabeac0d77b50f663be4379670164
Parents: 9d90ee9
Author: Robert Newson <rn...@apache.org>
Authored: Sat Aug 23 12:16:52 2014 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Sat Aug 23 12:16:52 2014 +0100

----------------------------------------------------------------------
 src/couch_compaction_daemon.erl | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/e696e439/src/couch_compaction_daemon.erl
----------------------------------------------------------------------
diff --git a/src/couch_compaction_daemon.erl b/src/couch_compaction_daemon.erl
index 3251d5f..684a9b0 100644
--- a/src/couch_compaction_daemon.erl
+++ b/src/couch_compaction_daemon.erl
@@ -25,6 +25,7 @@
 -export([handle_config_change/5]).
 
 -include_lib("couch/include/couch_db.hrl").
+-include_lib("kernel/include/file.hrl").
 
 -define(CONFIG_ETS, couch_compaction_daemon_config).
 
@@ -505,6 +506,16 @@ free_space_rec(Path, [{MountPoint0, Total, Usage} | Rest]) ->
     end.
 
 abs_path(Path0) ->
+    {ok, Info} = file:read_link_info(Path0),
+    case Info#file_info.type of
+        symlink ->
+            {ok, Path} = file:read_link(Path0),
+            abs_path(Path);
+        _ ->
+            abs_path2(Path0)
+    end.
+
+abs_path2(Path0) ->
     Path = filename:absname(Path0),
     case lists:last(Path) of
     $/ ->