Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EC93610C42 for ; Tue, 18 Mar 2014 18:55:51 +0000 (UTC) Received: (qmail 8996 invoked by uid 500); 18 Mar 2014 18:55:49 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 8629 invoked by uid 500); 18 Mar 2014 18:55:46 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 8618 invoked by uid 99); 18 Mar 2014 18:55:45 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Mar 2014 18:55:45 +0000 Date: Tue, 18 Mar 2014 18:55:45 +0000 (UTC) From: "Nils Breunese (JIRA)" To: dev@couchdb.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (COUCHDB-1592) Free space check for automatic compaction doesn't follow symlinks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COUCHDB-1592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13939638#comment-13939638 ] Nils Breunese commented on COUCHDB-1592: ---------------------------------------- Thanks for the quick patch, Robert! I haven't had a change to try it out (I'll have to dig in to how to build CouchDB first), but looking at the patch it seems {{abs_path}} will resolve only one level of symlink. It might be a good idea to keep following symlinks until a regular file is found. I actually know that one of our hosters likes to use more than one 'layer' of symlinks ({{link1}} points to {{link2}}, which in turn points to {{real_location}}), so the proposed patch would probably not work in that case. Again, I don't really know Erlang myself, but I found that ec_file in Erlware Commons provides a real_dir_path function, but it's apparently based on a 'cwd hack' (https://twitter.com/ericbmerritt/status/306097346196946945) and temporarily changes the current working directory: https://github.com/erlware/erlware_commons/blob/master/src/ec_file.erl That doesn't sound like the cleanest solution. If Erlang lacks a proper equivalent of realpath(3), then I guess just recursively calling {{abs_path}} until no symlink is found would be best? It's just a one character change to your patch, but does something like this make sense? {code} 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 $/ -> {code} > Free space check for automatic compaction doesn't follow symlinks > ----------------------------------------------------------------- > > Key: COUCHDB-1592 > URL: https://issues.apache.org/jira/browse/COUCHDB-1592 > Project: CouchDB > Issue Type: Bug > Components: Database Core > Affects Versions: 1.2 > Reporter: Nils Breunese > > We've got a problem with automatic compaction not running due to low diskspace according to CouchDB. According to our system administrators there is more than enough space (more than twice the currently used space), but the data directory is a symlink to the real data storage. It seems CouchDB is checking the diskspace on the filesystem on which the symlink resides instead of the diskspace on the linked filesystem. -- This message was sent by Atlassian JIRA (v6.2#6252)