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 1pClkE-0005pu-VS for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Jan 2023 18:10: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 1pClkD-0003PR-Rc for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Jan 2023 18:10: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 1pClkD-0003PI-GZ for pgsql-hackers@lists.postgresql.org; Tue, 03 Jan 2023 18:10:37 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pClkB-000682-2u for pgsql-hackers@postgresql.org; Tue, 03 Jan 2023 18:10:36 +0000 Received: by mail-pj1-x1030.google.com with SMTP id n12so20791003pjp.1 for ; Tue, 03 Jan 2023 10:10:34 -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=x/KgvY5bTaJb995CeUmOz4wOEm6KP/v8eRTnJroGqrM=; b=P603Ja68I+5S7kOkSg9IlQvVBIFkD8o3+7yglhDzPnKyij69E9lxPbQYtsa5x+AIHx hJFYBsUZLLjXKDW+D2357mgU8G+DJuhkv3YIg23KahaZiN7YtI7eoweVLlYSFq+0/4A7 03AbSKZjaAgDtuvGZ6gUf5T2Rg2xVX1L3Rtf0goPD+abEcMkqGTdhb39/6lg1eP8SZhY WOx30xBpTFykZU4TOw7KGHCPxLXDeLOhN4Z6n/V6c7IMKeXQxTOfQMjXNbrXwaqnfpnV INVzUTp9XtCeIeFrgL0jvzjtHs6kG+Qsj2JEEFetiapIt/lH1eWUi7WIYK8dF/apzT7+ JbpQ== 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=x/KgvY5bTaJb995CeUmOz4wOEm6KP/v8eRTnJroGqrM=; b=sDgqqSD8iKZI+mfTLvDnvjKuL9tiDcEEc2j4r7NfhSurGod8Tm5byabhVEufa/teIa 9DG5ed7SbzrOfK8RDAHuX9cg+x0UkQX/8EGSJUErTLF30nZ3bW58b29VfaKcMQL2rSnv SN1kOAwo6NV4PbJSXH1Y3LsGeMh/mNUW5YCGGFPdPe656Fz3JjXIyYVA2T4hwiLeBuZy 63vt44uZFqet8EbS9pQV/W7tPa76/LA/tpPlF1+lB3RJDWuigJfIZU038nvrViFuHBi8 FwSphuhCcN4ap1hF8NbQwsrQoChmX5Lh3C9St2DY8JATo7Egr5g5Zfuv/2PvXqMYTwIO OODQ== X-Gm-Message-State: AFqh2koYdze+TgCMVrA6F3j2Ou4FdlrtB9jTRFi27X5PeAsLU5+Db2Ez lsgUzxPcbBLom3FsdiCo77Jl8OGO/zA= X-Google-Smtp-Source: AMrXdXvOLiA7mK0hI1IzoN/K6JnHq1/ucUETK0v6LqIW5Um3fqmSzTJYXWBVWMawIyk39TDAVORLNQ== X-Received: by 2002:a17:902:c106:b0:192:d4ba:98f4 with SMTP id 6-20020a170902c10600b00192d4ba98f4mr5759445pli.25.1672769434106; Tue, 03 Jan 2023 10:10:34 -0800 (PST) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id c9-20020a170902d48900b001891a17bd93sm1835002plg.43.2023.01.03.10.10.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 10:10:33 -0800 (PST) Date: Tue, 3 Jan 2023 10:10:31 -0800 From: Nathan Bossart To: Amit Kapila Cc: Tom Lane , Melih Mutlu , Thomas Munro , "Hayato Kuroda (Fujitsu)" , "pgsql-hackers@postgresql.org" Subject: Re: wake up logical workers after ALTER SUBSCRIPTION Message-ID: <20230103181031.GB204418@nathanxps13> References: <2561155.1670977214@sss.pgh.pa.us> <20221214004105.GA669835@nathanxps13> <20221214171023.GA689106@nathanxps13> <2707695.1671039752@sss.pgh.pa.us> <20221214174535.GA773264@nathanxps13> <2783450.1671042198@sss.pgh.pa.us> <20221214183759.GC773264@nathanxps13> <2787771.1671044578@sss.pgh.pa.us> <20221214231727.GA828014@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, Jan 03, 2023 at 11:03:32AM +0530, Amit Kapila wrote: > On Thu, Dec 15, 2022 at 4:47 AM Nathan Bossart wrote: >> On Wed, Dec 14, 2022 at 02:02:58PM -0500, Tom Lane wrote: >> > Maybe we could have workers that are exiting for that reason set a >> > flag saying "please restart me without delay"? >> >> That helps a bit, but there are still delays when starting workers for new >> subscriptions. I think we'd need to create a new array in shared memory >> for subscription OIDs that need their workers started immediately. > > That would be tricky because the list of subscription OIDs can be > longer than the workers. Can't we set a boolean variable > (check_immediate or something like that) in LogicalRepCtxStruct and > use that to traverse the subscriptions? So, when any worker will > restart because of a parameter change, we can set the variable and > send a signal to the launcher. The launcher can then check this > variable to decide whether to start the missing workers for enabled > subscriptions. My approach was to add a variable to LogicalRepWorker that indicated whether a worker needed to be restarted immediately. While this is a little weird because the workers array is treated as slots, it worked nicely for ALTER SUBSCRIPTION. However, this doesn't help at all for CREATE SUBSCRIPTION. IIUC you are suggesting just one variable that would bypass wal_retrieve_retry_interval for all subscriptions, not just those newly altered or created. This definitely seems like it would prevent delays, but it would also cause wal_retrieve_retry_interval to be incorrectly bypassed for the other workers in some cases. Is this acceptable? -- Nathan Bossart Amazon Web Services: https://aws.amazon.com