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 1gzd8q-0000YK-GS for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Mar 2019 08:03:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gzd8p-0005QB-AY for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Mar 2019 08:03:35 +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 1gzd8o-0005FY-R7 for pgsql-hackers@lists.postgresql.org; Fri, 01 Mar 2019 08:03:35 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gzd8l-0002eD-Cv for pgsql-hackers@postgresql.org; Fri, 01 Mar 2019 08:03:33 +0000 Received: by mail-pf1-x444.google.com with SMTP id s22so11067364pfh.4 for ; Fri, 01 Mar 2019 00:03:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=Onm8PcCqNwMVQDJRCRZ6tjMBQq9gCYPQFq7tjY2DEcM=; b=D2Ew4BfOOb+XocURJD3411m2iEyCwQmlFSJFH0v4yDm/W4LFYjoAElvXceMZv2dEWI FN9DwbogzlI/B/P3dcoxBtQ+C77P6z+/YifYRcnaF/P3o3cWDBquxxqzlP1yMtf+lPea V0vY5qyvSdpBWBGdN2snxutheabZxck0RXGFjif9ZNQWi0VN2QZp8LoOXAI1C5/pHgA5 cv4tm8yTikuRGau997bzjh5g7n0TglOTRWAk9AElBVLt8xSWCvzkSxt+WLkVouO4FgEr AYFaKXmlt5cpN/YYVqUhyhwToEv1a4TYcblzr+XkfFZfo9dwnIa14ebGeznpFKB1vuek n6sQ== 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=Onm8PcCqNwMVQDJRCRZ6tjMBQq9gCYPQFq7tjY2DEcM=; b=l/ZjGZfh8dRzIIyOeacwFfnCyv4s8LDdX5ciHr+pLj4CM65JizVW+71CEOqrmdtXvE uw6cDAZbhdu4/z8UxbRhrXBG0B3v5RV3oMUCrfDhxK0GNvUaFsYb68VQUk8mAX78f7SI 4hefL40sPmbp3H3tTdvBSuQuwQ0c5hNdU2T18YMwAlWpimwJKzEMje5Jobe+ZT4u3Fqn OF79WRs1xn/cf1xKhFhjB/dFz/nYZLGLvtLalhxw+87n30BMgVr5pqjyk8QK89cERLNv TTsMDf2FpxllzpHE0IajBd12croEr+1tj29jsPFoBsqTidLbYAY3mwGlLmDeYn6INW44 VEzg== X-Gm-Message-State: APjAAAWWIK0XuzP6YtEcgLtU5YizpSfkntHqGi1jr5wS8nwc79I/5o5u tE1Y/Brlx9FqcnJpFKlWb9Wyl00jNWhKtwjF6eVgKyttsQDPx2VdxlElMc0qrk/gt9SA8lXhIcm g4LwelcDj0uIpAEw8wn7+0HYyo/jmLrSORwnT+at2jdRisufIVU/+GsrcgCvJP/yxyn0FRKrJ/4 /NHdPLymvVjQ== X-Google-Smtp-Source: APXvYqyg5UbPlamawh/63jdCKVqhsnyO6HQS7Qb/vg0HA9amSxmuAQYKqfU/V4MGsVKTepC6ob7HBA== X-Received: by 2002:a65:6497:: with SMTP id e23mr3522352pgv.21.1551427409889; Fri, 01 Mar 2019 00:03:29 -0800 (PST) Received: from localhost.localdomain ([114.143.109.178]) by smtp.gmail.com with ESMTPSA id k10sm5417391pgp.91.2019.03.01.00.03.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Mar 2019 00:03:28 -0800 (PST) Subject: Re: Minimal logical decoding on standbys To: Petr Jelinek , Andres Freund , Robert Haas , Craig Ringer , Petr Jelinek , pgsql-hackers@postgresql.org References: <20181212204154.nsxf3gzqv3gesl32@alap3.anarazel.de> <7e905539-7fdc-6b29-5a56-ba48d180fef8@2ndquadrant.com> From: tushar Message-ID: Date: Fri, 1 Mar 2019 13:33:23 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <7e905539-7fdc-6b29-5a56-ba48d180fef8@2ndquadrant.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, While testing  this feature  found that - if lots of insert happened on the master cluster then pg_recvlogical is not showing the DATA information  on logical replication slot which created on SLAVE. Please refer this scenario - 1) Create a Master cluster with wal_level=logcal and create logical replication slot -  SELECT * FROM pg_create_logical_replication_slot('master_slot', 'test_decoding'); 2) Create a Standby  cluster using pg_basebackup ( ./pg_basebackup -D slave/ -v -R)  and create logical replication slot - SELECT * FROM pg_create_logical_replication_slot('standby_slot', 'test_decoding'); 3) X terminal - start  pg_recvlogical  , provide port=5555 ( slave cluster)  and specify slot=standby_slot ./pg_recvlogical -d postgres  -p 5555 -s 1 -F 1  -v --slot=standby_slot  --start -f - Y terminal - start  pg_recvlogical  , provide port=5432 ( master cluster)  and specify slot=master_slot ./pg_recvlogical -d postgres  -p 5432 -s 1 -F 1  -v --slot=master_slot  --start -f - Z terminal - run pg_bench  against Master cluster ( ./pg_bench -i -s 10 postgres) Able to see DATA information on Y terminal  but not on X. but same able to see by firing this below query on SLAVE cluster - SELECT * FROM pg_logical_slot_get_changes('standby_slot', NULL, NULL); Is it expected ? regards, tushar On 12/17/2018 10:46 PM, Petr Jelinek wrote: > 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. > -- regards,tushar EnterpriseDB https://www.enterprisedb.com/ The Enterprise PostgreSQL Company