Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mScSJ-0003p7-G2 for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Sep 2021 09:52:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mScSH-0008LP-Lq for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Sep 2021 09:52:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mScSH-0008LH-Br for pgsql-hackers@lists.postgresql.org; Tue, 21 Sep 2021 09:52:49 +0000 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mScS9-0006i7-NJ for pgsql-hackers@lists.postgresql.org; Tue, 21 Sep 2021 09:52:48 +0000 Received: by mail-qk1-x72f.google.com with SMTP id bk29so52254847qkb.8 for ; Tue, 21 Sep 2021 02:52:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VtI9m6rdXOry5s29BQQ90sXIhSh+mG/YMMY2qx1F9Y8=; b=ayu4drdSvFDDoV+Znvb+YY6+keIhO5nwONkEfyQXpJyOMAo7Cy9b9z7h/+kFxRoFdF c0MWUvysS1rLjvcTdLg/7SqURdegMYsd1R81HmP2BHEYOn630naJjjqhgjkAnxoCdtVL /z8jwmG9HkyytyQWNbHGPfax5J/dNACRjVtlSQVDm6ozKP1i0hM4LRpkfhjZ7BRQYHV2 KBlf7kKteWCKgCy5xNHF77WXHH2IxMeUVbW3zjx0gm+dQG/EiV8UucebyTh/jacCNAim ewzqrh7EL8uOKYkoYKVLZRIXnXjk7WJ6jfMLKHpdVLX7FoannIe8kbrWRBI0prCwGj+H h5fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VtI9m6rdXOry5s29BQQ90sXIhSh+mG/YMMY2qx1F9Y8=; b=bX4z8KKfpvJpJ1/LlVe8zdRSfytEXpU2+00kick56wO19NhE6K/8k4W2nZ95aRySaC vzSYWaosXbVxMK3rAbJ0BSVJnjezllNIgItv3DVFOnBB+VosQVt4rwH7U2VakVqFFhOX +QOyB/6TElIg+Hwx5p0TmHqpE3U9KuvGo9/2P5LYjf6IIMmfp4QbV9mB6XE7ckEZGti7 Zy9X19Rfpg85rfld7M6bFvyPl0YiVoQTQTpQSmKY+eTVFu9tqbgC79mBYHfRCPW5DAaf o+aXHQfDil8vb89gZbi0aw6O9VTd/CNjyK7Xc6RIrATisRBJ5kfxMG8YAvuMegNtQEyc keBQ== X-Gm-Message-State: AOAM533NWU5T/AN21FkN49oTOrQW0C3MdRAArJjQ5B5EW94ur0ZTtacs i8Znkq5iRcKGHyHao2Q1B84yBvB/kRAMw3ZTSu/UhDgCZodHVQ== X-Google-Smtp-Source: ABdhPJxyl69rCuV30gLsRjN0qeigdicqYKpB86th1nvq25REzZI9ObJCmL6zl/ii2iiE4V14kkIK/WrqurTtTVw6hyA= X-Received: by 2002:a25:5095:: with SMTP id e143mr38687857ybb.213.1632217960439; Tue, 21 Sep 2021 02:52:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Tue, 21 Sep 2021 15:22:29 +0530 Message-ID: Subject: Re: Logical replication timeout problem To: Fabrice Chapuis Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Sep 21, 2021 at 1:52 PM Fabrice Chapuis wrote: > > If I understand, the instruction to send keep alive by the wal sender has not been reached in the for loop, for what reason? > ... > * Check for replication timeout. */ > WalSndCheckTimeOut(); > > /* Send keepalive if the time has come */ > WalSndKeepaliveIfNecessary(); > ... > Are you sure that these functions have not been called? Or the case is that these are called but due to some reason the keep-alive is not sent? IIUC, these are called after processing each WAL record so not sure how is it possible in your case that these are not reached? > The data load is performed on a table which is not replicated, I do not understand why the whole transaction linked to an insert is copied to snap files given that table does not take part of the logical replication. > It is because we don't know till the end of the transaction (where we start sending the data) whether the table will be replicated or not. I think specifically for this purpose the new 'streaming' feature introduced in PG-14 will help us to avoid writing data of such tables to snap/spill files. See 'streaming' option in Create Subscription docs [1]. > We are going to do a test by modifying parameters wal_sender_timeout/wal_receiver_timeout from 1' to 5'. The problem is that these parameters are global and changing them will also impact the physical replication. > Do you mean you are planning to change from 1 minute to 5 minutes? I agree with the global nature of parameters and I think your approach to finding out the root cause is good here because otherwise, under some similar or more heavy workload, it might lead to the same situation. > Concerning the walsender timeout, when the worker is started again after a timeout, it will trigger a new walsender associated with it. > Right, I know that but I was curious to know if the walsender has exited before walreceiver. [1] - https://www.postgresql.org/docs/devel/sql-createsubscription.html -- With Regards, Amit Kapila.