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 1gYwVb-00077k-Od for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Dec 2018 17:16:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gYwVZ-0003WC-26 for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Dec 2018 17:16:45 +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 1gYwVY-0003W5-R1 for pgsql-hackers@lists.postgresql.org; Mon, 17 Dec 2018 17:16:44 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gYwVW-0002g5-5y for pgsql-hackers@postgresql.org; Mon, 17 Dec 2018 17:16:44 +0000 Received: by mail-wr1-x441.google.com with SMTP id t27so13106618wra.6 for ; Mon, 17 Dec 2018 09:16:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wG2l3VIv/FdbqiB0QADuAZNwjlW43p7NuESsVFcG4W8=; b=IZf1/QdrqaqSiO6XmdJ0fw5aVnUK7WFCDekhDuePBHF/DDdvOctTrsvkoY1+JSumwp 73xBZgXnYDb87hCfhXkEoZGXCFcCZa62hRmwDALmm1ACtVajHKcIefaacnFf1/NWYn73 y2I3ajb5O/JFoDrKGwj/fFPN8R78tt9XjgTFmdIcun480kCLjtoaM5RGX+H96U60kDA/ zPrkTi14O+2yZ88czDrZVrpCAuA0+E4QRQknvKD2njcbkhK1k7m7+fqm+gpbW8k5ReY8 tERZt3vKHI1Es1+88wc880bwnxZhQrqkS4ofcYx9OWoaNe0UHnyy43dXaBUVa75uR4Jw Lttg== 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:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=wG2l3VIv/FdbqiB0QADuAZNwjlW43p7NuESsVFcG4W8=; b=dFLzzXc6hu9TRa1OS1T+E/IKxMG9sSY1aEP9SiDtZREO/6Seh+T+4PcAlxJ/YlxGz3 Dzq9Mz8QblZfgj9eWNw6XFZowvY4gNU8cfASQ0JZAHp5lzMEofAk0T4WECeUojP5xdTQ pSWw+qN3elLSAgc4MJtYnJAvdZmWLSV4L+n2Ax5B7MANBpqobBhy3dwo+IIjLG6+NtQm QrNHvqAoUnihZ+wFF3IEWIEYiQTfT1IC1NQplTnbY7P/yq9v3c0rQ0BOd6rLJb+7ELgJ HuBccYh7M6eRfjUvHSRLiTIlG5i4ARD7yLM+vP/R/C6RCFb0kl2ELVpLuSdNS3NQfeai 86pQ== X-Gm-Message-State: AA+aEWZofypDZ9g9VAlHcBpKLCVq4qTs+d38K1AifnuwAO1OHjjz2mE8 U6jQcmbNPOz9trlfpfntn/UY8WZfqfchFPfhk5z0upAEn+1dYegj49bpVtzI6eQYcPI4udiXcgK HOuUbefamTTuPQZOZcKaoyXsQ15BexiMM46rbI5yIwe+zSjekMCgxeTUVEHEZQY+pbN9RqHXEna XhtNJSWU52+U+6FQ== X-Google-Smtp-Source: AFSGD/Uxye0leX5cx3UY9Yn8GqrKomFqvti1VldWKq/tW7sdyTlmAOsBlSnIvTjxUATA62nu46u/Bw== X-Received: by 2002:a5d:6907:: with SMTP id t7mr11169593wru.226.1545066999270; Mon, 17 Dec 2018 09:16:39 -0800 (PST) Received: from [192.168.0.234] (ip-86-49-240-48.net.upcbroadband.cz. [86.49.240.48]) by smtp.gmail.com with ESMTPSA id o16sm602183wrn.11.2018.12.17.09.16.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Dec 2018 09:16:38 -0800 (PST) Subject: Re: Minimal logical decoding on standbys To: Andres Freund , Robert Haas , Craig Ringer , Petr Jelinek , pgsql-hackers@postgresql.org References: <20181212204154.nsxf3gzqv3gesl32@alap3.anarazel.de> From: Petr Jelinek Openpgp: preference=signencrypt Autocrypt: addr=petr.jelinek@2ndquadrant.com; prefer-encrypt=mutual; keydata= mQINBFawwSABEAC45Vua8rSggpM2kkMMmoOHz51a+fi3OXFfnrStVh80pM2/J9nSzjrIKQKf H5PtRnoYzSKnoUDoLOkLwDYitK3HzUUWXma+AWAqef2Y0GSZ7A3jJkD+JHOfkpS1CIpkEB/e WjA8Wqegwzc/OEE5111/l0Q1e6jxgZI86h8MMnm35Of1Y6Lz4kqWCyxHhaTJKTCkq66ICQ2C VJkbvuUoEE+Hr/I38dPHTAqIlCnycVnJPLHBQ/UYGHR/USF8qI/qJJx6tJcNAEqz69QZ/VlY 31UyJHdYe5NtBVz+rYZCOVWfpe3crbHuq9FjAPT+xcZefdxridmMKuW8eBmmXI9iZ3EG+X8J IsdLWL8QoqW0lnO1otYz1QDjdOvbEpq+u5/TAU8pgtaYH2J+6/GaQ6hMLyLBkaIAtnqlLCzq pxXcxMsFT14P5/rZA7EbBI8RS1ZIWJBlS2oO+dtVuENLJUC0SpptaRyn/uyOIopt7hSmBekL SzFnet7P9qofFJY+fQEz84v0G1gvwonHGHiCGgLpbMdPtnfPzda1aiTURvvOD7w/RmX1/ogk TqSGO4ejVNO/28QYouxmxzy8jbbIEiLCbHpLR/M/TvYHHPURxcx+MxVl3G+d/4Ihy4abxOdW pe9zLIcVMvqiUFQO28/79Gfhb7G4K+L21ORB82QYkzm3M7ebXQARAQABtCNQZXRyIEplbMOt bmVrIDxwam1vZ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xN+PmyvNUBmFEcagBX2TXqEkgnI6zOnN13mB4SihJ2lne2r 9RNiPYs/hmRxYg== Message-ID: <7e905539-7fdc-6b29-5a56-ba48d180fef8@2ndquadrant.com> Date: Mon, 17 Dec 2018 18:16:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181212204154.nsxf3gzqv3gesl32@alap3.anarazel.de> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 12/12/2018 21:41, Andres Freund wrote: > > I don't like the approach of managing the catalog horizon via those > periodically logged catalog xmin announcements. I think we instead > should build ontop of the records we already have and use to compute > snapshot conflicts. As of HEAD we don't know whether such tables are > catalog tables, but that's just a bool that we need to include in the > records, a basically immeasurable overhead given the size of those > records. IIRC I was originally advocating adding that xmin announcement to the standby snapshot message, but this seems better. > > If we were to go with this approach, there'd be at least the following > tasks: > - adapt tests from [2] > - enforce hot-standby to be enabled on the standby when logical slots > are created, and at startup if a logical slot exists > - fix issue around btree_xlog_delete_get_latestRemovedXid etc mentioned > above. > - Have a nicer conflict handling than what I implemented here. Craig's > approach deleted the slots, but I'm not sure I like that. Blocking > seems more appropriately here, after all it's likely that the > replication topology would be broken afterwards. > - get_rel_logical_catalog() shouldn't be in lsyscache.[ch], and can be > optimized (e.g. check wal_level before opening rel etc). > > > Once we have this logic, it can be used to implement something like > failover slots on-top, by having having a mechanism that occasionally > forwards slots on standbys using pg_replication_slot_advance(). > Looking at this from the failover slots perspective. Wouldn't blocking on conflict mean that we stop physical replication on catalog xmin advance when there is lagging logical replication on primary? It might not be too big deal as in that use-case it should only happen if hs_feedback was off at some point, but just wanted to point out this potential problem. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services