couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject couchdb commit: updated refs/heads/1592-follow-symlinks-for-space-check to fc907c5
Date Tue, 25 Mar 2014 15:33:29 GMT
Repository: couchdb
Updated Branches:
  refs/heads/1592-follow-symlinks-for-space-check 3187ba1b2 -> fc907c52f (forced update)


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

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

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


http://git-wip-us.apache.org/repos/asf/couchdb/blob/fc907c52/src/couchdb/couch_compaction_daemon.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_compaction_daemon.erl b/src/couchdb/couch_compaction_daemon.erl
index 18a51a4..6e76cf1 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_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
     $/ ->


Mime
View raw message