Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D56381018E for ; Tue, 18 Mar 2014 15:11:23 +0000 (UTC) Received: (qmail 29025 invoked by uid 500); 18 Mar 2014 15:11:21 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 28990 invoked by uid 500); 18 Mar 2014 15:11:20 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 28982 invoked by uid 99); 18 Mar 2014 15:11:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Mar 2014 15:11:20 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [81.169.146.220] (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.220) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Mar 2014 15:11:13 +0000 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1395155452; l=8531; s=domk; d=gonvaled.com; h=Content-Type:To:Subject:Date:From:References:In-Reply-To: MIME-Version:X-RZG-CLASS-ID:X-RZG-AUTH; bh=hAZFx7TdjTZDeSzzj+xFPviST7E=; b=E8BTq0IZKmSKIO2Ex+P5dAgc6941Fkhs8QnmGa5QrsNV9Rf5D7JdcUyhtYNucbj++fO zttga5unV8NDgWHqmFSHn7V6hbusAZ8fFUy8fubq6qYotz+G00ebG+ykEE6HIsZBO73NP WgISe/y3jAh+5ae0XNl+AjEGZvdWTmW0G98= X-RZG-AUTH: :K2MKY0GkfvuAYI9OvLYEA55J0qvTZZULi9CTHjqnn8/d41Z9VA5z1TAdhRyFQPE= X-RZG-CLASS-ID: mo00 Received: from mail-oa0-f50.google.com ([209.85.219.50]) by smtp.strato.de (RZmta 32.29 AUTH) with ESMTPSA id x062e0q2IFAp21O (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) for ; Tue, 18 Mar 2014 16:10:51 +0100 (CET) Received: by mail-oa0-f50.google.com with SMTP id i7so7168819oag.37 for ; Tue, 18 Mar 2014 08:10:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=2WC/S4OJ/hxBS9tNiPKfqX3jRp9fP+Ih/0yLUxmcNNM=; b=eoDilKTYatqmS3v9h/eAwwv4KdOpyLKrApxwMhefGrirmhh7SJOhcPqxS6oRoFXtn4 YOXuebflm2XcvJbHol5fsrPdLOZcXlKCbkq80vLbalkMy55HA4DQ6d+zFNnXm4PgGXo3 WatMCVzjniFTP+sfPjZ9mJTi/HS8smCVksOkYLjSfdhKd75GxXakosf6RVeQWpzT+6vE mM0p+ubJr1ZEngr4erfWvZ/ExNEoVHvmhqSnPIYPiVYIbfwXPRZBdiG00cwwFPWpt6vG 7ZR/nYa4b/0lBu2ZcWX+tU1bPN1ojEkMbS2PpWFzV6SAGhdakUlAlV4C11L+X8Ux7Dsh Ib4A== X-Received: by 10.60.162.7 with SMTP id xw7mr27137431oeb.13.1395155450725; Tue, 18 Mar 2014 08:10:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.168.130 with HTTP; Tue, 18 Mar 2014 08:10:19 -0700 (PDT) In-Reply-To: References: From: Daniel Gonzalez Date: Tue, 18 Mar 2014 16:10:19 +0100 Message-ID: Subject: Re: Faster one-time replication doing file-system copy? To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=047d7b33cd7c0c2b6004f4e2f174 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b33cd7c0c2b6004f4e2f174 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Mar 18, 2014 at 1:48 PM, Stefan Klein wrote: > Hi, > > from my understanding which might be wrong > > 2014-03-18 13:31 GMT+01:00 Daniel Gonzalez : > > > Thanks Dave, > > > > Yes, I understand that I need to restart it. Actually, I assume that both > > source and destination must be stopped while copying: > > - source to avoid data changes while copying, which can lead to > > inconsistent data being copied > > > > A couchdb datafile is never inconsistent. > see https://wiki.apache.org/couchdb/How_to_make_filesystem_backups Mmm. But we are copying several databases / design_docs / view files, any of which can be changing while the long copy operation is running. It just seems easier to minimize any inconsistency risk to just stop the source. Even if a file is always consistent, how to guarantee that the different files are consistent with each other? I mean: 1) I copy a database 2) Just after the copy is finished, a new doc is appended 3) That doc is processed in one of the views 4) Now it is the turn to copy the view file Suddenly, the destination database has one view with one indexed document which is *not* in the database file. Maybe couchdb is going to get confused about it when I start it? > - destination to avoid that two processes (cp and couchdb) are stepping > on > > each writing on the same files. > > > > That's not how filehandles work (at least on Linux) > open 4 terminals > terminal 1: > cd /tmp > cat > file > terminal 2: > tail -f /tmp/file > terminal 1: > enter some text > terminal 3: > rm /tmp/file > cat > /tmp/file > terminal 4: > tail -f /tmp/file > terminal 1: > enter some text > terminal 3: > enter some text > > > as long the filehandle is not closed and re-opened it reads and writes to > the "old" file, although the "old" file doesn't have a directory entry > anymore. > > So it should be fine to just copy over the file and post to _restart after > the copy finished. > Fair enough, but that assumes that couchdb is not reopening files from the filesystem. How can I be sure of that, without being *intimate* familiar with the couchdb sources? Or is there any guarantee on the documentation that no file reopening is being performed? What about database / design_docs delete / create operations? It just seems *very* difficult to guarantee that, under any scenario, couchdb is not going to open a file from the filesystem, one which has just been created by the copy operation, and which makes the whole system behave badly. Stopping the destination instance (and thus not being able to use it, not even by mistake), seems like an easy way to guarantee that no problems are going to occur. We are talking about a test instance anyway, so downtime is not an issue. > regards, > Stefan > Thanks! Daniel --047d7b33cd7c0c2b6004f4e2f174--