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 1hiysu-0004Mj-4K for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jul 2019 10:22: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 1hiyst-0005aT-02 for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jul 2019 10:22: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 1hiyss-0005SL-Hp for pgsql-hackers@lists.postgresql.org; Thu, 04 Jul 2019 10:22:34 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hiysp-0007w7-M0 for pgsql-hackers@postgresql.org; Thu, 04 Jul 2019 10:22:33 +0000 Received: by mail-pf1-x443.google.com with SMTP id p184so2733629pfp.7 for ; Thu, 04 Jul 2019 03:22:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=KgBRqa2sZUJZ1fOK+Pm98WQnP73VkDOH1HuJllCGB3M=; b=waFC4CLxNDwOeY9rfWFnkU9hT+VUZTVQezr+VdWlUiLLZY0S8i0xRpJRbzVMArYQeW kzzFiqJgSHiHJLMRJrlvj/OAVt8fDOvfnwiyy+utDKBbNPBfFCp3mRqBaJnTRBz/71TD +0B5ip/R1m+PACGHxKvzVO83DiVrZCemVk2aA1Az2VnvKH53gNjSiLSQx6qEnpMPoBQr 1Gbs1vhDx4GLTXVlpmA6dPpSrww4PjwS34ufHXAPWaaVbmIU8I3oDqnl9wOhI5aeVd2+ Rsnrz/ahXmq8/yrDiowu/ixZx0STeCdpYN7t1mQYEgPZg0+ajxSLkTdJqFITX4Akq2Q5 UQJw== 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=KgBRqa2sZUJZ1fOK+Pm98WQnP73VkDOH1HuJllCGB3M=; b=uZBVmu7OpcnZ27bDDfN/X+VdBTUN0ljHDznXgSShdLts3waM0J9QJbxAS53JubnN+j EYczVf62/3ETWHkwqQ8+/YdglnhcoQuOXEArAMm4iji2pAi4YJRu2/aJwq6j0v3goW/k payjtBE8pUn99In1k9PwYyhNC7GQP3EE0zeqQJ8T2CDTtJRSEg83ASsqVGx1futNga92 2mGLB0VC8r/6wemQzohpqTi2Ogbil1K2WfqnLeobq6Jlp8x9nMUChUA6TdKCSa98hBKN SHatNeC1VqZflSDk/Ri8RwZ0C41bxttzV95+UC729j9AwjbXeD7L74DDs/hiESg5METW NMQw== X-Gm-Message-State: APjAAAW+NxpKir4bTKt6Ya5PiuDMrLNUhU7jcyK4YbP3cspQmbqozG2d 7TjxY4q6A1uRV317+q0oJlpQQQsaUMrlrqfy6Uhe9/dmjiYlf2QnGAUAuqEC1qpW5CJFrFOjWSj /XBnHdQCZxn+4gfnW/kXmcAQRZtvzckRfgDKcaAmtUW81jsK5e24/QHRDQ3ikX0roHk6hY31EN4 GHJLEZwNhtJA== X-Google-Smtp-Source: APXvYqz/jXPEAjoKT9C8XydhhCiG2KOgbFshij46UfG2NunUQyll0wv73ogttf9SbTgXcsIgH07vLg== X-Received: by 2002:a63:724f:: with SMTP id c15mr14402946pgn.257.1562235749449; Thu, 04 Jul 2019 03:22:29 -0700 (PDT) Received: from localhost.localdomain ([114.143.109.178]) by smtp.gmail.com with ESMTPSA id c98sm5834690pje.1.2019.07.04.03.22.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jul 2019 03:22:28 -0700 (PDT) Subject: Re: Minimal logical decoding on standbys To: Amit Khandekar , Robert Haas Cc: Andres Freund , Petr Jelinek , Craig Ringer , Petr Jelinek , pgsql-hackers References: <20190527135602.dw6cp5vttbdb76i7@alap3.anarazel.de> <20190530141723.ox5y4wda6alvo4uj@alap3.anarazel.de> <20190604155853.6oiirwpbvcpubr5s@alap3.anarazel.de> <20190619190138.rufzsld5xgcgshmh@alap3.anarazel.de> From: tushar Message-ID: <4447fb6d-b308-3914-0f6b-d2eb5f7ca56d@enterprisedb.com> Date: Thu, 4 Jul 2019 15:52:21 +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: Content-Type: multipart/alternative; boundary="------------DEA66640FBAAB50751232DA4" 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. --------------DEA66640FBAAB50751232DA4 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 07/01/2019 11:04 AM, Amit Khandekar wrote: > Also, in the updated patch (v11), I have added some scenarios that > verify that slot is dropped when either master wal_level is > insufficient, or when slot is conflicting. Also organized the test > file a bit. One scenario where replication slot removed even after fixing the problem (which Error message suggested to do) Please refer this below scenario Master cluster- postgresql,conf file wal_level=logical hot_standby_feedback = on port=5432 Standby cluster- postgresql,conf file wal_level=logical hot_standby_feedback = on port=5433 both Master/Slave cluster are up and running and are in SYNC with each other Create a logical replication slot on SLAVE ( SELECT * from pg_create_logical_replication_slot('m', 'test_decoding'); ) change wal_level='hot_standby' on Master postgresql.conf file / restart the server Run get_changes function on Standby - postgres=# select * from pg_logical_slot_get_changes('m',null,null); ERROR:  logical decoding on standby requires wal_level >= logical on master Correct it on Master postgresql.conf file ,i.e set wal_level='logical'  again / restart the server and again fire  get_changes function on Standby - postgres=# select * from pg_logical_slot_get_changes('m',null,null); *ERROR:  replication slot "m" does not exist *This looks little weird as slot got dropped/removed internally . i guess it should get invalid rather than removed automatically. Lets user's  delete the slot themself rather than automatically removed  as a surprise. -- regards,tushar EnterpriseDB https://www.enterprisedb.com/ The Enterprise PostgreSQL Company --------------DEA66640FBAAB50751232DA4 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 07/01/2019 11:04 AM, Amit Khandekar wrote:
Also, in the updated patch (v11), I have added some scenarios that
verify that slot is dropped when either master wal_level is
insufficient, or when slot is conflicting. Also organized the test
file a bit.

One scenario where replication slot removed even after fixing the problem (which Error message suggested to do)

Please refer this below scenario

Master cluster-
postgresql,conf file
wal_level=logical
hot_standby_feedback = on
port=5432

Standby cluster-
postgresql,conf file
wal_level=logical
hot_standby_feedback = on
port=5433

both Master/Slave cluster are up and running and are in SYNC with each other
Create a logical replication slot on SLAVE ( SELECT * from   pg_create_logical_replication_slot('m', 'test_decoding'); )

change wal_level='hot_standby' on Master postgresql.conf file / restart the server
Run get_changes function on Standby -
postgres=# select * from pg_logical_slot_get_changes('m',null,null);
ERROR:  logical decoding on standby requires wal_level >= logical on master

Correct it on Master postgresql.conf file ,i.e set  wal_level='logical'  again / restart the server
and again fire  get_changes function on Standby -
postgres=# select * from pg_logical_slot_get_changes('m',null,null);
ERROR:  replication slot "m" does not exist

This looks little weird as slot got dropped/removed internally . i guess it should get invalid rather than removed automatically.
Lets user's  delete the slot themself rather than automatically removed  as a surprise.
-- 
regards,tushar
EnterpriseDB  https://www.enterprisedb.com/
The Enterprise PostgreSQL Company
--------------DEA66640FBAAB50751232DA4--