Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iAlqU-0005iu-Ew for pgsql-general@arkaria.postgresql.org; Thu, 19 Sep 2019 02:06:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iAlqT-0004mn-67 for pgsql-general@arkaria.postgresql.org; Thu, 19 Sep 2019 02:06:57 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iAlqS-0004mg-OV for pgsql-general@lists.postgresql.org; Thu, 19 Sep 2019 02:06:56 +0000 Received: from mail-ot1-x344.google.com ([2607:f8b0:4864:20::344]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iAlqQ-0002ow-6o for pgsql-general@lists.postgresql.org; Thu, 19 Sep 2019 02:06:56 +0000 Received: by mail-ot1-x344.google.com with SMTP id c10so1670305otd.9 for ; Wed, 18 Sep 2019 19:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=jKvTdOM2tI8HsXbh4PphkiQlONiDwkVNiUbeReFiaRc=; b=Dff00WFGmLgmcp7sqnF2gNUJfbIS3HViSsoI2S30DBD1H3dyaqyHpyLIrF6dQ70mzZ Ef8jalId8APjXeuvz/gnQeskne8q/264cWmCb1gEbv9wq8SAtKjCGzuQgkifY5SQ717q BxnhkyP129jHiDJXlKoWpEyVWDn3OXfsSfAxs3oVxtmajUKyNWj+kMV7js65E/oPzH1W Gu1shZjLi8tdE1z87uvkib78y0AfNN8e13q/1fqcuXdF2kD+Gif81/FdX6ZpkFJ4xxBz qGme8rWWCAMC2LilTNe7s911KnxBa7M1aoMzsBbkb9CCexqHPnj4mB7zBJ2B7IxtHDaZ 1nDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=jKvTdOM2tI8HsXbh4PphkiQlONiDwkVNiUbeReFiaRc=; b=j3ZAdS0oYQPbPexezHVQilMzNaN69MWj9LFKRLTNdUf8bOSE/omAEjKNrXToIA7nXH /efCxhESztENSnM4T1+TqFTtIXOP/Jesf5bREB6axG3Tg42Fnza9ki3nlV4sdQ8PPhgi gwGw3NZ8QcLbNKUKx9to07EAWO4WTNDHpNLEjk3b25KLxlML/vNiQ2q8WL8qW2iTXlOU +XuO2/P007NlkPcNO7Vbq9bb1V+YAJLiNYYlXN+fqyoK8PnUccyrkmD4Ql4TXifPOISt xd7HINUvFQMEWKTdCjqWTbYH+GPHsrDVa9n8gyx/mnJI87VK81HJcVVszEK+Z+8PI+cp lJEQ== X-Gm-Message-State: APjAAAVWI9AxnAcNeHZnvtO+2kaq5jKA98jnEeooPgKWiKz5niJGu0K3 nXM9SlwyoCWYXFf1znDKVhSycvPfMArXTQ== X-Google-Smtp-Source: APXvYqwA7+VJ96c/xbSqC8/UauLr7ZP+qwLv215i6QMecP2DAxz+gUz8cV4Ynh9jfN9p+ThKJPPubg== X-Received: by 2002:a9d:e92:: with SMTP id 18mr5181316otj.321.1568858812056; Wed, 18 Sep 2019 19:06:52 -0700 (PDT) Received: from [192.168.1.10] (ip70-186-126-197.no.no.cox.net. [70.186.126.197]) by smtp.googlemail.com with ESMTPSA id b4sm2124945oiy.30.2019.09.18.19.06.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2019 19:06:51 -0700 (PDT) Subject: Re: pgbackrest - question about restoring cluster to a new cluster on same server To: pgsql-general@lists.postgresql.org References: <0c037137-9480-3afa-a4b7-1400a9879cd2@gmail.com> From: Ron Message-ID: Date: Wed, 18 Sep 2019 21:06:50 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 9/18/19 8:58 PM, David Steele wrote: > On 9/18/19 9:40 PM, Ron wrote: >> I'm concerned with one pgbackrest process stepping over another one and >> the restore (or the "pg_ctl start" recovery phase) accidentally >> corrupting the production database by writing WAL files to the original >> cluster. > This is not an issue unless you seriously game the system. When a > cluster is promoted it selects a new timeline and all WAL will be > archived to the repo on that new timeline. It's possible to promote a > cluster without a timeline switch by tricking it but this is obviously a > bad idea. What's a timeline switchover? > So, if you promote the new cluster and forget to disable archive_command > there will be no conflict because the clusters will be generating WAL on > separate timelines. No cluster promotion even contemplated. The point of the exercise would be to create an older copy of the cluster -- while the production cluster is still running, while production jobs are still pumping data into the production database -- from before the time of the data loss, and query it in an attempt to recover the records which were deleted. > In the case of a future failover a higher timeline will be selected so > there still won't be a conflict. > > Unfortunately, that dead WAL from the rogue cluster will persist in the > repo until an PostgreSQL upgrade because expire doesn't know when it can > be removed since it has no context. We're not quite sure how to handle > this but it seems a relatively minor issue, at least as far as > consistency is concerned. > > If you do have a split-brain situation where two primaries are archiving > on the same timeline then first-in wins. WAL from the losing primary > will be rejected. > > Regards, -- Angular momentum makes the world go 'round.