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 1jQQRo-0001gM-1c for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Apr 2020 07:02:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jQQRm-0006Uc-Bj for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Apr 2020 07:02:26 +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 1jQQRl-0006UU-Sg for pgsql-hackers@lists.postgresql.org; Mon, 20 Apr 2020 07:02:26 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jQQRf-0005rm-7G for pgsql-hackers@postgresql.org; Mon, 20 Apr 2020 07:02:24 +0000 Received: by mail-pg1-x544.google.com with SMTP id q18so1059893pgm.11 for ; Mon, 20 Apr 2020 00:02:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=L+QUZ4oM0Dxq2eYlAGdggKIs5XNMO0ulRtH+FOU7Oxk=; b=EhYF0d2u1Tt6GJAs4lCKPdjVFNANRX4DX3X1+MMZGwjCs2K0b1SyiDsFLRAG3QiYUO vGxDwfCxYWBJMTExkTvUfqYMatx5DhJh4NOaZrE+aDcpVbF0qsC5+EqsVDdzkqB2lIfQ LP7KHbRTPgNklkeLAiQ6icB8DZmo9Cd/REY6A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=L+QUZ4oM0Dxq2eYlAGdggKIs5XNMO0ulRtH+FOU7Oxk=; b=nYuCu2C0c7hOdKmRPv4rSEd5+8tdezajlTucGoU8LsSakcRqPu7ronqJ/NxAq6sMQY aGAgu3rshuLwd5drR0JhIDOIycvEwozqFNUGGL5SBMKctASifrIuA4meHrv3O1HimWVh oHU2JzL5pkapyZ2NYtBijiwaH2RbkQtlrFF6t+ol/oBIuG2yvfSUO1zxGbRQ92jhb1ig BgHfqwi5pIuRdlkm4MuI0h9gHpNUewpiP7Q6Y4CKUWP27kTtVDt67cMMAXiS0bTXDEE6 MB0ozJTFGJ7agxuOih+aanTh36R3SXX4Oust/qOo/YSpsoNgatAmCU1P825eTGsuLsiU NMOw== X-Gm-Message-State: AGi0Pua7WwfDHe4QKt4xzMMb3n4cPj9hzDhdO/gi6PUrhTDMQk31KjtV tvMUs0FJMbh9DHsLjpHETio/Kg== X-Google-Smtp-Source: APiQypKUs9OEoX7wkfOA/HLbYcIdAUMbahqnRXzCTmIojPxsfLoM6taUTPNY2IK9oMxvbETbzbV+MQ== X-Received: by 2002:a65:6704:: with SMTP id u4mr15626155pgf.263.1587366137910; Mon, 20 Apr 2020 00:02:17 -0700 (PDT) Received: from rfd.leadboat.com (108-233-125-46.lightspeed.sntcca.sbcglobal.net. [108.233.125.46]) by smtp.gmail.com with ESMTPSA id i14sm242999pgh.47.2020.04.20.00.02.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Apr 2020 00:02:17 -0700 (PDT) Date: Mon, 20 Apr 2020 00:02:15 -0700 From: Noah Misch To: Fujii Masao Cc: Kyotaro Horiguchi , Tom Lane , pgsql-hackers@postgresql.org Subject: Re: 001_rep_changes.pl stalls Message-ID: <20200420070215.GA1395671@rfd.leadboat.com> References: <20200406063649.GA3738151@rfd.leadboat.com> <20200414013849.GA886648@rfd.leadboat.com> <8807.1586828716@sss.pgh.pa.us> <20200417054146.GA1061007@rfd.leadboat.com> <20200418070142.GA1075445@rfd.leadboat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Apr 20, 2020 at 02:30:08PM +0900, Fujii Masao wrote: > + * Block if we have unsent data. XXX For logical replication, let > + * WalSndWaitForWal(), handle any other blocking; idle receivers need > + * its additional actions. For physical replication, also block if > + * caught up; its send_data does not block. > > It might be better to s/WalSndWaitForWal()/send_data()? Because not only > WalSndWaitForWal() but also WalSndWriteData() seems to handle the blocking. > WalSndWriteData() is called also under send_data, i.e., XLogSendLogical(). Thanks for reviewing. WalSndWriteData() blocks when we have unsent data, which is the same cause for blocking in WalSndLoop(). Since the comment you quote says we let WalSndWaitForWal() "handle any other blocking", I don't think your proposed change makes it more correct. Also, if someone wants to refactor this, the place to look is WalSndWaitForWal(), not any other part of send_data().