Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1er7In-0004TR-VR for pgsql-admin@arkaria.postgresql.org; Wed, 28 Feb 2018 19:22:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1er7Im-00016n-R3 for pgsql-admin@arkaria.postgresql.org; Wed, 28 Feb 2018 19:22:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1er7Im-00016e-Gj for pgsql-admin@lists.postgresql.org; Wed, 28 Feb 2018 19:22:08 +0000 Received: from www.ipv6.roaringpenguin.com ([2607:f748:1200:fb:70:38:112:54] helo=colo3.roaringpenguin.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1er7Ij-0008E4-Si for pgsql-admin@lists.postgresql.org; Wed, 28 Feb 2018 19:22:08 +0000 Received: from vanadium.roaringpenguin.com ([192.168.10.23]) by colo3.roaringpenguin.com (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id w1SJM2KX031506 for ; Wed, 28 Feb 2018 14:22:03 -0500 Received: from hydrogen.roaringpenguin.com (dfs@hydrogen.roaringpenguin.com [192.168.10.1]) by vanadium.roaringpenguin.com (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id w1SJM2I6004076 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Feb 2018 14:22:02 -0500 Date: Wed, 28 Feb 2018 14:22:02 -0500 From: Dianne Skoll To: pgsql-admin@lists.postgresql.org Subject: Re: Reliable WAL file shipping over unreliable network Message-ID: <20180228142202.427f459a@hydrogen.roaringpenguin.com> In-Reply-To: References: <400AC9CD-1E43-422C-A689-70BDBAFF231E@elevated-dev.com> <37C5A42B-4CDD-4F01-8F1E-1B185C1819B9@icloud.com> <20180228132620.2c882f84@hydrogen.roaringpenguin.com> <33220469-5BB2-4A40-8F56-8F4F392C95B3@icloud.com> <20180228135220.1cd46347@hydrogen.roaringpenguin.com> Organization: Roaring Penguin Software Inc. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: CanIt (www . roaringpenguin . com) X-Scanned-By: MIMEDefang 2.80 on 192.168.10.23 X-Spam-Score: undef - relay 192.168.10.23 marked with skip_spam_scan X-CanIt-Geo: No geolocation information available for 192.168.10.23 X-CanItPRO-Stream: outgoing (inherits from default) X-CanIt-Archive-Cluster: SQVyZJxqklY5buiWXYCN4T/BjiM X-CanIt-Archived-As: base/20180228 / 01Vgjm2Mr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=roaringpenguin.com; h= date:from:to:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=canit; bh=fGvYV13nYTvpGVufqxXEygJCTWZmblWbImJ7AFhxwNY=; b=rLWUnnfwCOA/ AVXhdiwU/zONcBTacoqVxHk+tC5MtGeL3rjPi3PH+rF7Cr6mNuugdkJRIbU5R5tl JnMTfF4r+SzKgNHGNMsZ2Bnt2UGvEQJqfvYdSpZACZrYuRC9clq3NkeumWvznFSs lVzefBSEbjsJAPSRgIh9X/3QScIS7ocBsGejzv4cdWX5NzNuin6kYAGpwDLC1Khq /CxlSyzTNHaQpYwWnKjCamfvyy8wGKqdFrixYZQJPvgoUOIHxoFCMkyawXOWeD8P m6vEK+CeEfLS1HbyIFi6l1sRtplHxPL6lBE+HlPkmoXOga/CtGQQ9zUmmvODBgKQ bEFL5f0hmA== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, 28 Feb 2018 14:12:39 -0500 Rui DeSousa wrote: > You are dealing with a race condition. Postgres will continually > attempt to archive the same file over and over until rsync foolishly > returns success. What do you mean by "rsync foolishly returns success"? > You are making the assumption that rsync removed the file? Rsync does not create the file with the final name until it has successfully transferred it completely. It copies it to a temporary file and then if (and only if) the transfer succeeded, then it atomically renames the temporary file to the final filename. The only failure mode if metadata updates are lost is that the file will appear not to exist when it really should, not the other way around. You can never, ever have the file existing with the proper filename until a transfer has succeeded. However, see my other post about a test. The -c option doesn't actually help if a file changes while rsync is running. Regards, Dianne.