Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XGxxR-0007SP-Rg for pgsql-docs@arkaria.postgresql.org; Mon, 11 Aug 2014 22:20:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XGxxR-0007rC-BT for pgsql-docs@arkaria.postgresql.org; Mon, 11 Aug 2014 22:20:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XGxxQ-0007qx-Ol for pgsql-docs@postgresql.org; Mon, 11 Aug 2014 22:20:48 +0000 Received: from mail-pa0-x233.google.com ([2607:f8b0:400e:c03::233]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XGxxN-0006wn-C7 for pgsql-docs@postgresql.org; Mon, 11 Aug 2014 22:20:47 +0000 Received: by mail-pa0-f51.google.com with SMTP id ey11so11730990pad.24 for ; Mon, 11 Aug 2014 15:20:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:references:in-reply-to:subject:date:mime-version :content-type:content-transfer-encoding; bh=sKYVqSNEPzKSODt2uSeiiTkElVHEi23gI0gQQrOuidU=; b=xOm0Qa0m0Q3aR+uMNTAKtFuMpEV5MqvMFPF6WCMC33LM6EImtxviw7gb8AUS57oCuk YVWdVNEgKuXiAe8NyuMue1BnSI+gagkxSg4qkCh2RklVGd/sf5kEWD8yt4xTjX/8yiwU VQhesluxcTBGOd9mUY96KzxFzxuNcGuZeg/d+Z0XEOorF2YeXHk12cvwUxM06dEFM5HD sYMVBN1Y04DCQ+Ive+RUOzu33t3me+/NAELT0PzPh8f7bKnQL6Wp8zCMUwan56dgjfVM bILCbRO0U3hg9JIywf5/4iinCGKt85gNtIafulLb6duoR445Eh7y+5jPdTdr93TtUq4J Jn4Q== X-Received: by 10.69.20.97 with SMTP id hb1mr575083pbd.150.1407795641901; Mon, 11 Aug 2014 15:20:41 -0700 (PDT) Received: from maumau (p23196-ipngn100307sizuokaden.shizuoka.ocn.ne.jp. [153.131.144.196]) by mx.google.com with ESMTPSA id kt2sm12431932pbc.83.2014.08.11.15.20.39 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Aug 2014 15:20:40 -0700 (PDT) Message-ID: <0F73426A2EA544878BCAC33BB989D671@maumau> From: "MauMau" To: "Kevin Grittner" , "Josh Berkus" , References: <53E5603B.5040102@agliodbs.com> <1407777686.41146.YahooMailNeo@web122306.mail.ne1.yahoo.com> In-Reply-To: <1407777686.41146.YahooMailNeo@web122306.mail.ne1.yahoo.com> Subject: Re: Sample archive_command is still problematic Date: Tue, 12 Aug 2014 07:23:41 +0900 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Windows Mail 6.0.6002.18197 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18463 X-Pg-Spam-Score: -1.3 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org From: "Kevin Grittner" The problem with the recommended command is that cp is not atomic. The file can be read before the contents are materialized, causing early end to recovery. I have seen it happen. The right way to do this is to copy to a different name or directory and mv the file into place once it is complete -- or use software which does that automatically, like rsync does. I submitted a patch a patch for this a few months ago, which is pg_copy listed in the current CF. The patch also addresses the problem that the archived file can get lost after power failure because it is not flushed to disk. The patch consists of a program called pg_copy which can be used instead of cp/copy, and a doc fix to suggest using mv. I made it following the favorable suggestions from people. Regards MauMau -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs