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 1pDHcV-00024Z-AU for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Jan 2023 04:12:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pDHcS-0004wx-AK for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Jan 2023 04:12:44 +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 1pDHcR-0004uW-V1 for pgsql-hackers@lists.postgresql.org; Thu, 05 Jan 2023 04:12:44 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pDHcP-0008S0-Hq for pgsql-hackers@postgresql.org; Thu, 05 Jan 2023 04:12:42 +0000 Received: by mail-pl1-x632.google.com with SMTP id c2so10640342plc.5 for ; Wed, 04 Jan 2023 20:12:41 -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=zukl2pM9YQLyV0Eixs78Exb05ql5WOrTy1DoUpk+Oac=; b=Go3F8l7f1fiEiDu/MjARd4kcfISujrhrJKClrdj6ahJDPKAmPQ4IpnqjQSycQVOLPS 7r7Fnwqvar26O0JI5Hr0jjiAtvaoRLzbd76rIoZ0SSSD9CbpjnxREORiP2sRAvmy5EkF /QkoR2ZiUcKMUa/Nw+hZ/xaKi+GVBlQjoSND0DYEUInElwfe4R73X7pTje95PcOUCyb/ sFWJ8UH/qr7WMHWLmvvFSb/qq4k8rtEFu5rgPCeWeUtuwcUwfNxDrjOx5fdCWlLh4U+O 3XMSrAqFozp02uDQ9kTwrHjCRgICN7Uus+FF5Mo0dSuydJkc3RfuHKuj8SrwaPL8pdCu KNlw== 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=zukl2pM9YQLyV0Eixs78Exb05ql5WOrTy1DoUpk+Oac=; b=NLX820zxnQ1l4qDGxbTQpc630ntaiiW8IagU+eVZhfAbLJiXp4xbgz2wb+DJss2Xnd EqAPwxxw+DpPQmigPmSXeDkaByzJAiY2FGdVDGOeWjS+NgKzXxxxUDIZ4zJtgacCpqwS 0qesjx5q9kupRsKf9gizjuh27TJ7FVH7Ur46NbNcwNeVEN9UdAsRw2lGELiJWLYuOEQZ 2Nzgq4PoCLG1tJe/xeSviIJt+IP0FgTin7BdCKSzrOI2D5rzo8RnOwiLs4JD2TdHK4kz R50jqj9rVljSeiSlnWIoZe1X/g+cWNzIP5vSYike54oWMj+3dLl7XpnKbZD/awGDEL+f eHlA== X-Gm-Message-State: AFqh2kpPD7g8IVylq1+U6PGCEKLai9DH7qMIsHMojtWHB2hWK9uKq0KI h0tD7ZWlEUV2GQgcDDBFELA= X-Google-Smtp-Source: AMrXdXswU/85OLWHGZNu7jfwWfSpotYxsoGxpSywIuZPAR5CgrTcbQyN/Ml1L7JF2TA/6maf+uY9GA== X-Received: by 2002:a17:902:eb84:b0:192:8e8b:59ab with SMTP id q4-20020a170902eb8400b001928e8b59abmr32994524plg.9.1672891960486; Wed, 04 Jan 2023 20:12:40 -0800 (PST) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id t9-20020a1709027fc900b00192721d4f2dsm20712345plb.82.2023.01.04.20.12.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 20:12:39 -0800 (PST) Date: Wed, 4 Jan 2023 20:12:37 -0800 From: Nathan Bossart To: Amit Kapila Cc: Melih Mutlu , Thomas Munro , "Hayato Kuroda (Fujitsu)" , "pgsql-hackers@postgresql.org" Subject: Re: wake up logical workers after ALTER SUBSCRIPTION Message-ID: <20230105041237.GA189619@nathanxps13> References: <20221206192551.GA3078082@nathanxps13> <20221206212954.GA3403597@nathanxps13> <20221207181145.GA3698731@nathanxps13> <20230103182155.GC204418@nathanxps13> <20230104173304.GA296349@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 Thu, Jan 05, 2023 at 09:09:12AM +0530, Amit Kapila wrote: > On Wed, Jan 4, 2023 at 11:03 PM Nathan Bossart wrote: >> On Wed, Jan 04, 2023 at 09:41:47AM +0530, Amit Kapila wrote: >> > If so, we probably also need to >> > ensure that table_states_valid is marked false probably via >> > invalidations so that we can get the latest state and then perform >> > this check. I guess if we can do that then we can directly move the >> > restart logic to the end. >> >> IMO this shows the advantage of just waking up the worker. It doesn't >> change the apply worker's behavior besides making it more responsive. > > But there doesn't appear to be any guarantee that the result for > AllTablesyncsReady() will change between the time it is invoked > earlier in the function and at the place you have it in the patch. > This is because the value of 'table_states_valid' may not have > changed. So, how is this supposed to work? The call to CommandCounterIncrement() should set table_states_valid to false if needed. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com