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 1er3wP-0005jp-Kr for pgsql-admin@arkaria.postgresql.org; Wed, 28 Feb 2018 15:46:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1er3wN-0003ZW-M6 for pgsql-admin@arkaria.postgresql.org; Wed, 28 Feb 2018 15:46:47 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1er3wN-0003ZN-BM for pgsql-admin@lists.postgresql.org; Wed, 28 Feb 2018 15:46:47 +0000 Received: from shopzeus.com ([87.229.70.149]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1er3wK-000430-Og for pgsql-admin@lists.postgresql.org; Wed, 28 Feb 2018 15:46:46 +0000 Received: from [127.127.127.127] (localhost [127.127.127.127]) (Authenticated sender: gandalf) by shopzeus.com (Postfix) with ESMTPSA id C8AE0889B83C for ; Wed, 28 Feb 2018 09:44:11 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopzeus.com; s=shopzeus_com; t=1519829051; bh=Ra58rACYu6dc8srbAXxVUocVIPCg7ejiPtzhX+iNL0Y=; h=Subject:To:References:From:Date:In-Reply-To:From; b=Rm/1PzUhytxdMNJXTAPN6QagQyRGOqhg5yv2u7SXCX7q/41dLKyggL4TrzVtibhAY cAGcqebjWW1LzrtnvzhHh+eQX6xPyFaxruib9XAyYQFyeX+3hSHaH44NbqjRHnz0es sLLqQo4YVnQTnahoRSnEsr3IIitXibG4AEL6pyYK44E61cOTrHK47H3qKlQy0DNXpL 3scqCCWm+2wk6TlR4gYMafJlhm/f7NQFRPo4EsMPpwNIRogNPf6iefbGmSbjnXc1rB iJgG00+wiqhVNVSvXmZ5/75GswHN+MeHVJY81N0UK6BkBm4khSyFc4SbkZllDQEUj+ jp75c79yDHpKg== Subject: Re: Reliable WAL file shipping over unreliable network To: pgsql-admin@lists.postgresql.org References: <400AC9CD-1E43-422C-A689-70BDBAFF231E@elevated-dev.com> From: =?UTF-8?Q?Nagy_L=c3=a1szl=c3=b3_Zsolt?= Message-ID: Date: Wed, 28 Feb 2018 16:46:42 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>> Is there a utility that is widely used for WAL file shipping, and >>> addresses these problems? >> rsync > Should I use rsync with --remove-source-files option? Will that solve > all problems with unreliable networks? Another problem with rsync might be that it does not know if a WAL file on the source side is growing (e.g. being written) and it might start copy that before it is fully flushed to disk. I see this as a big problem, but I don't have experience. My first idea to address this is to execute an archive command something like this: test ! -f /pg_wal/%f && cp %p /volume/pg_wal_tmp/%f && mv /volume/pg_wal_tmp/%f /volume/pg_wal/%f E.g. move the file into the archive dir only after it has been fully copied to the destination volume. But then we still have the problem of partially written files on the slave side. I can come up with other ideas, but I do not want to reinvent the wheel. Can somebody please tell me how to deal with partially written WAL files?= Thanks, =C2=A0 Laszlo