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 1p2dZt-00055H-Df for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Dec 2022 19:26:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p2dZr-0000lo-Jg for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Dec 2022 19:26:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2dZr-0000k8-7J for pgsql-hackers@lists.postgresql.org; Tue, 06 Dec 2022 19:26:03 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p2dZl-0003lV-7K for pgsql-hackers@postgresql.org; Tue, 06 Dec 2022 19:26:02 +0000 Received: by mail-pg1-x529.google.com with SMTP id 136so14275099pga.1 for ; Tue, 06 Dec 2022 11:25:56 -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=f9xIJ+rHOoygUdOVZjP/hlCmSntdcX0yCt4tVvtCnjk=; b=NtrZK7xaoglMvLXewdjCImvBNiJP54SQphewyMk8GKvBQbMLECkj8cziYvnXw22qlL QcSrXXwvBsNbYAaODxAsg7ScdDCBxxfR7Lc93DZGOn7zUplalucWmN41oQkxXIavJFxO GcxCmvVaP2JXxT1BMb080vak4J+gi1BK0JM8atlrkaOjts04En1C8sxcBIdYHmOFK3R8 auUlq5OsDKuBJxaLO8QeQ5fpQkmFej8waj3C52hiqLPuktaPTlOWBrvMAPKwqpb0E17z WemB4mfsCRVUe/eifrUwuPbVZ4zl4V5u54z6nVpGzpAdQfsEbnxiEjTZOAy3Ar1ubB03 USGg== 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=f9xIJ+rHOoygUdOVZjP/hlCmSntdcX0yCt4tVvtCnjk=; b=xZvF32IAT++LdcVi+5AaK5loEATlauzEwiilGVDq90YEgyY8A7LE0jtwT+X174C/71 +UenDLw0AIQ6XqAQegxQya6T63t8lLwFQm94XIScczPOPIyRa/9mHR766BrtOH5rYyRZ IGcklawsmo11SkrfdTvp173fZFNhECHG+ThQbWKy0JdI1Vib+vjDd49WrJ4VR1pl2iPY IyCSVhQpXolXT2fiCPfomBuQKhGRUC6FmrJsSYfgZ8Hp2OgfiUrQT/LihzwSIJ8Lr1mZ eTpNSoEXOZKYTi8n5Rml4+e1CSqD2etp/RneP6yrf9R6dvJ1hWJj9nsQGgtdtP8mEQ+q gYUg== X-Gm-Message-State: ANoB5pncTpNU4ohf9KL44E6bFpM/C5Ett0gzRIeAjHpR3xeBfue1mdSw qTHndWxjPTPMEnKmJwSo+xA= X-Google-Smtp-Source: AA0mqf60ORs8ML0nDmJbKBVVN16vy3kHBPMFsaTebTJrp3JSWD4HFWsGUluekiFvtd70zA/OnRtaCw== X-Received: by 2002:a63:f241:0:b0:46f:da0:f093 with SMTP id d1-20020a63f241000000b0046f0da0f093mr61984700pgk.441.1670354754299; Tue, 06 Dec 2022 11:25:54 -0800 (PST) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id 14-20020a17090a0f8e00b002132f3e71c6sm11120923pjz.52.2022.12.06.11.25.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 11:25:53 -0800 (PST) Date: Tue, 6 Dec 2022 11:25:51 -0800 From: Nathan Bossart To: Melih Mutlu Cc: Thomas Munro , "Hayato Kuroda (Fujitsu)" , "pgsql-hackers@postgresql.org" Subject: Re: wake up logical workers after ALTER SUBSCRIPTION Message-ID: <20221206192551.GA3078082@nathanxps13> References: <20221123205027.GA368966@nathanxps13> <20221127234528.GB878043@nathanxps13> <20221130041028.GA1604177@nathanxps13> <20221130050441.GA1677223@nathanxps13> <20221202002130.GA2124877@nathanxps13> <20221202192101.GB2277157@nathanxps13> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Thanks for reviewing! On Tue, Dec 06, 2022 at 07:44:46PM +0300, Melih Mutlu wrote: > Is it really necessary to wake logical workers up when renaming other than > subscription or publication? address.objectId will be a valid subid only > when renaming a subscription. Oops, that is a mistake. I only meant to wake up the workers for ALTER SUBSCRIPTION RENAME. I think I've fixed this in v6. > - When the state is SYNCDONE and the apply worker has to wake up to change > the state to READY. > > I think we already call logicalrep_worker_wakeup_ptr wherever it's needed > for the above cases? What am I missing here? IIUC we must restart all the apply workers for a subscription to enable two_phase mode. It looks like finish_sync_worker() only wakes up its own apply worker. I moved this logic to where the sync worker marks the state as SYNCDONE and added a check that two_phase mode is pending. Even so, there can still be unnecessary wakeups, but this adjustment should limit them. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com --LZvS9be/3tNcYl/X Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v6-0001-wake-up-logical-workers-as-needed-instead-of-rely.patch"