couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Qiu <>
Subject [CouchDB 1.6] Use symlinks for database files?
Date Mon, 28 Nov 2016 18:04:27 GMT
Hi all,

I have a question regarding using symbolic links for {db}.couch file and
.{db}_design folder. First off, this is my usecase: we use couchdb 1.6.1,
and our data size has been growing rapidly to the point we have to archive
old data. We chose to use the filtered replication approach. We setup a
replication task from db A to db A' with a filter function that weeds out
documents older than X months (we have a metadata field that records the
document create date).

We would also like to seamlessly having our application start using the
filtered database (A') without having to change our application db
configuration to point to A'. Here's the question, is it possible to use
symbolic links to achieve this? i.e., have a symbolic link L ( (both .couch
file and _design folder) to point to A initially, and after the filtered
replication is done, re-point L to A'.

>From my own experiments, it looks like this is possible, not without
caveats however. E.g., when L already exists, it works when I unlink L and
then do `ln -s A' L`. Everything seems to be fine. However, if I do `ln -s
A' L_tmp && mv -Tf L_tmp L` (atomic switch), it appears that couchdb fails
to recognize L being a pointer to another couchdb file, and shows that the
db contains 0 documents.

Any input is appreciated!


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message