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 1oxww6-00063Y-Lh for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Nov 2022 21:05:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oxww5-0000Rw-DP for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Nov 2022 21:05:37 +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 1oxww5-0000R4-1p for pgsql-hackers@lists.postgresql.org; Wed, 23 Nov 2022 21:05:37 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oxwvy-0000r5-Br for pgsql-hackers@postgresql.org; Wed, 23 Nov 2022 21:05:36 +0000 Received: by mail-pj1-x1032.google.com with SMTP id y14-20020a17090a2b4e00b002189a1b84d4so2917440pjc.2 for ; Wed, 23 Nov 2022 13:05:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Ahuq+DEoIpabOzAI7KWm01VE3Ljl5CWi0xbaUhwfFDM=; b=I9nO/mmXywAUzRpQpovt4w2vYanUVZZ3bNUOEavDTnFgN3rFFnY3NGt4fM4WuthwyW hahtzx/tGR3J1PXJxUFQD3I1tDifydxXIMMrO0Rq+96p0fKF18F78WkqQO032ehSmEK8 xYP2+7OnKROBItM8I8v9q7qgJISHhLaLq/Rdgd1INgrF2GG4mpcMrs5EbDyVFf1UfGP8 3ghvLwi2wwjBuGrIan1S2WUOoFTZ2BeIr8/djp1UcttRsU2ckmvnLo3S9eZDgQ4Mz4n+ vXYGpEXJs8rZvG3a+ofjZwjym1Vvzsy+qlaVXKhaoNp6A9Ilm+aCQEbgWGQ4G7Vf/YiF FPGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Ahuq+DEoIpabOzAI7KWm01VE3Ljl5CWi0xbaUhwfFDM=; b=59odnNatyVwsxGghM6ALe5SOBGX4baX/WtyPeEjZiNALDSXKT8qzgBTussZlX3svcF +dWIm+S9enqiXKHJk8NHNWC7USgORc2FIpJORTspt2VaD5Hzj0Q0+MTTjEZOMR9K+0QI 89kwzpI7cMW7fHSjaNMxrVvPJstjuT+APxbA/1IZGuIeatHLu21Qbl8uZo1yhbG+ZrVX TtpPyD2NS7HlAqfJGASwkPRhZcllifnXEIZxoSZSti4BufzDv2CsGFd+MFNzPmXY2ili avzBoR1QCN+AFFC74xKPyvLeGAUGXWxdzrqvyCUmWtfQdCkbjJhLi+WyZoOD2DhLyv+N sT2Q== X-Gm-Message-State: ANoB5pmMQI8nhDg2PMR889mI3b42jLtIES63dywjtsfzbnoiOV+YI2Me CkHRngEVfzqQqElhl4/FO5/G2tVBm0o= X-Google-Smtp-Source: AA0mqf7PkZ4EqRK+EL/hGvLjBKy+DDCWwzxh8wIVQTlyjjR4sphZWKSKueohlnJzbv8UK5U2r5eRFQ== X-Received: by 2002:a17:902:d897:b0:189:315f:1d50 with SMTP id b23-20020a170902d89700b00189315f1d50mr10208014plz.92.1669237529161; Wed, 23 Nov 2022 13:05:29 -0800 (PST) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id k14-20020aa7998e000000b00561b455267fsm13148502pfh.27.2022.11.23.13.05.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 13:05:28 -0800 (PST) Date: Wed, 23 Nov 2022 13:05:26 -0800 From: Nathan Bossart To: Amit Kapila Cc: pgsql-hackers@postgresql.org Subject: Re: wake up logical workers after ALTER SUBSCRIPTION Message-ID: <20221123210526.GB368966@nathanxps13> References: <20221122004119.GA132961@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Nov 22, 2022 at 04:59:28PM +0530, Amit Kapila wrote: > On Tue, Nov 22, 2022 at 6:11 AM Nathan Bossart wrote: >> While working on avoiding unnecessary wakeups in logical/worker.c (as was >> done for walreceiver.c in 05a7be9), I noticed that the tests began taking >> much longer. This seems to be caused by the reduced frequency of calls to >> maybe_reread_subscription() in LogicalRepApplyLoop(). > > I think it would be interesting to know why tests started taking more > time after a reduced frequency of calls to > maybe_reread_subscription(). IIRC, we anyway call > maybe_reread_subscription for each xact. At the moment, commands like ALTER SUBSCRIPTION don't wake up the logical workers for the target subscription, so the next call to maybe_reread_subscription() may not happen for a while. Presently, we'll only sleep up to a second in the apply loop, but with my new prevent-unnecessary-wakeups patch, we may sleep for much longer. This causes wait_for_subscription_sync to take more time after some ALTER SUBSCRIPTION commands. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com