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 1gwt4t-00071b-Q8 for pgsql-bugs@arkaria.postgresql.org; Thu, 21 Feb 2019 18:28:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gwt4s-0002j4-8S for pgsql-bugs@arkaria.postgresql.org; Thu, 21 Feb 2019 18:28:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gwt4r-0002fJ-Ut for pgsql-bugs@lists.postgresql.org; Thu, 21 Feb 2019 18:28:10 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gwt4p-0003hj-3R for pgsql-bugs@lists.postgresql.org; Thu, 21 Feb 2019 18:28:08 +0000 Received: by mail-lj1-x244.google.com with SMTP id z20so23821891ljj.10 for ; Thu, 21 Feb 2019 10:28:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=I90VH2GTpeYNTYY/kFsY4f/JnXtpCqZg9aauZc+XA/w=; b=PcK9oefJ4XGZLy5JWQ+POU9oFLFmcNWlruyLVYFd6bHN6bFhheeBanKoNom0bvPs1n Xn0oklJNC1c3lITAlE0Iv4bt+N4CqAb4m1c2RZ9ReHIqyWo3YWVT+5uoEWFfYyb3nCUb q3h8b5cura1OfnSC0qGRK927588JUscjY5xjCxaF4TgPLT7SkVe9QscyZiSQSiihadQ7 EU9MCXBvN6jGA0vkWyy6pWUyhHwnxKIVHdb9UFXVI5eKoN2J8+HQS5o1KDLrAxf5IgDy mkSRZKqb5Vu+xenaVUHt799+E+424rdK6MaHhgrnEE7FHCgMXF163Ikk3HJ/fOgx8zi6 0ezQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=I90VH2GTpeYNTYY/kFsY4f/JnXtpCqZg9aauZc+XA/w=; b=rPeUaYMLiwoWQ4WuPKkY04aV9pHf+ehYH4Avsuh/QfxYyS/nzGBRCn4do0/A+yg/h4 XCoxQOxiuCZRIoDdnt5bOouGcRewp2nlWaULgQtp2sC2NR3Hmwwxuzqqm+9nAyzS64gG NdKjgViK5LUVM2jF4liMK44cGKw3+gOvCiKuzBTHSIyzPnafzzurCrawvtVA3CbotV2T /0ws+JXH6WOHQqgUZ6GBXfH1uLjcWoGHJdTPOI0vuihsXI7LR1zwKUrkaUoXsUCldnsG pOKW5CbOzGVOzXRg+N+ZgTiN+6Rv7SMSxAnfLKzA5xXyfuSJPQpbJdArSmu4L0V6SarQ 6jKw== X-Gm-Message-State: AHQUAubvUSzhfoApDO7cUY9q8uwdefb4bvy/I53WwLcUWsDUoqH6yGm8 1BFhDcajmKMQ3EJqyieJbAdejLQy X-Google-Smtp-Source: AHgI3IZGL+ZDcwlQpCXXZlkZ3FrYLMtGsQqGFRcOcwkx/O4b5k2B6kJMWI5aX975sWjkAB1sXC/KRw== X-Received: by 2002:a2e:12da:: with SMTP id 87mr16372611ljs.181.1550773685003; Thu, 21 Feb 2019 10:28:05 -0800 (PST) Received: from [192.168.27.213] ([93.174.131.141]) by smtp.gmail.com with ESMTPSA id v7sm4788657ljk.7.2019.02.21.10.28.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 10:28:04 -0800 (PST) Subject: Re: BUG #15638: pg_basebackup with --wal-method=stream incorrectly generates WAL segment created during backup To: Andre Piwoni Cc: Michael Paquier , pgsql-bugs@lists.postgresql.org References: <15638-426547bdd97938dd@postgresql.org> <20190216152503.GK2240@paquier.xyz> From: Maksim Milyutin Message-ID: Date: Thu, 21 Feb 2019 21:28:03 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------61EFE43B881FB4FFA2EF9BB1" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------61EFE43B881FB4FFA2EF9BB1 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 2/19/19 9:08 PM, Andre Piwoni wrote: > By the way, you can assert this structure, including now explained > diff in WAL segment taken during backup, for fetch vs stream WAL > method by creating master and then creating new slave by taking base > backup using both methods: > > pg_basebackup -h new_slave -D /var/lib/pgsql/10/data -v -P -R -U > replication --wal-method=stream > pg_basebackup -h new_slave -D /var/lib/pgsql/10/data -v -P -R -U > replication --wal-method=fetch I have verified on different versions of PostgreSQL the identity of conflict segments received from master node and from pg_basebackup --wal-method=stream. On PG11+ they are binary identical. However on PG10 and lower the segments are binary different. The logical content are the same while meaningless tails differ. In case of pg_basebackup --wal-method=fetch the segments are entirely the same. And this case doesn't produce any problem in archiving. I think the backup tools as well as custom archive scripts have to take account of these points. -- Regards, Maksim Milyutin --------------61EFE43B881FB4FFA2EF9BB1 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

On 2/19/19 9:08 PM, Andre Piwoni wrote:

By the way, you can assert this structure, including now explained diff in WAL segment taken during backup, for fetch vs stream WAL method by creating master and then creating new slave by taking base backup using both methods:

pg_basebackup -h new_slave -D /var/lib/pgsql/10/data -v -P -R -U replication --wal-method=stream
pg_basebackup -h new_slave -D /var/lib/pgsql/10/data -v -P -R -U replication --wal-method=fetch


I have verified on different versions of PostgreSQL the identity of conflict segments received from master node and from pg_basebackup --wal-method=stream. On PG11+ they are binary identical. However on PG10 and lower the segments are binary different. The logical content are the same while meaningless tails differ.

In case of pg_basebackup --wal-method=fetch the segments are entirely the same. And this case doesn't produce any problem in archiving.

I think the backup tools as well as custom archive scripts have to take account of these points.

-- 
Regards,
Maksim Milyutin
--------------61EFE43B881FB4FFA2EF9BB1--