diff options
author | Robert Newson <rnewson@apache.org> | 2014-03-18 18:25:15 +0000 |
---|---|---|
committer | Robert Newson <rnewson@apache.org> | 2014-03-19 13:11:13 +0000 |
commit | fc907c52f4c3ec21b1e3a130c130ab0ef944c64e (patch) | |
tree | f19377caaf76fb3f7a2f60074ce458e8b637f761 | |
parent | 3508a90f8f1956d8084d23768610ab37569cfa91 (diff) | |
download | couchdb-1592-follow-symlinks-for-space-check.tar.gz |
Follow symlinks for space check1592-follow-symlinks-for-space-check
Follow symlinks when the compaction daemon checks for available space.
closes COUCHDB-1592
-rw-r--r-- | src/couchdb/couch_compaction_daemon.erl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/couchdb/couch_compaction_daemon.erl b/src/couchdb/couch_compaction_daemon.erl index 18a51a412..6e76cf110 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 $/ -> |