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 3187ba1
Date Wed, 19 Mar 2014 11:31:03 GMT
Repository: couchdb
Updated Branches:
  refs/heads/1592-follow-symlinks-for-space-check 76a56ccc4 -> 3187ba1b2 (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/3187ba1b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/3187ba1b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/3187ba1b

Branch: refs/heads/1592-follow-symlinks-for-space-check
Commit: 3187ba1b24bad2e3889c1d8e66c355bb423f2fa4
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 11:30:47 2014 +0000

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


http://git-wip-us.apache.org/repos/asf/couchdb/blob/3187ba1b/src/couchdb/couch_compaction_daemon.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_compaction_daemon.erl b/src/couchdb/couch_compaction_daemon.erl
index 18a51a4..d68d716 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_path(Path);
+        _ ->
+            abs_path2(Path0)
+    end.
+
+abs_path2(Path0) ->
     Path = filename:absname(Path0),
     case lists:last(Path) of
     $/ ->


Mime
View raw message