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/03/18 19:26:08 UTC

couchdb commit: updated refs/heads/1592-follow-symlinks-for-space-check to 521ca49

Repository: couchdb
Updated Branches:
  refs/heads/1592-follow-symlinks-for-space-check [created] 521ca49b9


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/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/521ca49b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/521ca49b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/521ca49b

Branch: refs/heads/1592-follow-symlinks-for-space-check
Commit: 521ca49b90f05f6078fe544571d329d2bde7050c
Parents: 3508a90
Author: Robert Newson <rn...@apache.org>
Authored: Tue Mar 18 18:25:15 2014 +0000
Committer: Robert Newson <rn...@apache.org>
Committed: Tue Mar 18 18:25:15 2014 +0000

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


http://git-wip-us.apache.org/repos/asf/couchdb/blob/521ca49b/src/couchdb/couch_compaction_daemon.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_compaction_daemon.erl b/src/couchdb/couch_compaction_daemon.erl
index 18a51a4..52deaba 100644
--- a/src/couchdb/couch_compaction_daemon.erl
+++ b/src/couchdb/couch_compaction_daemon.erl
@@ -21,6 +21,7 @@
 -export([code_change/3, terminate/2]).
 
 -include("couch_db.hrl").
+-include_lib("kernel/include/file.hrl").
 
 -define(CONFIG_ETS, couch_compaction_daemon_config).
 
@@ -495,6 +496,16 @@ free_space_rec(Path, [{MountPoint0, Total, Usage} | Rest]) ->
     end.
 
 abs_path(Path0) ->
+    {ok, Info} = file:read_file_info(Path0),
+    case Info#file_info.type of
+        symlink ->
+            {ok, Path} = file:read_link(Path0),
+            abs_path2(Path);
+        _ ->
+            abs_path2(Path0)
+    end.
+
+abs_path2(Path0) ->
     Path = filename:absname(Path0),
     case lists:last(Path) of
     $/ ->