Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w2NTD-000EfK-0v for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2026 05:59:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2NTA-00GIRS-2j for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2026 05:59:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w2NTA-00GIRJ-1j for pgsql-hackers@lists.postgresql.org; Tue, 17 Mar 2026 05:59:56 +0000 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w2NT7-00000000YPb-3QhN for pgsql-hackers@postgresql.org; Tue, 17 Mar 2026 05:59:56 +0000 Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-3878de20527so45509481fa.3 for ; Mon, 16 Mar 2026 22:59:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773727192; cv=none; d=google.com; s=arc-20240605; b=UrTTQB1oHxiL26yVqE+bzpAC2q5SRsm8dAcZL30G+0cxHGmdDpG0XA0oWZhkd5K/5k jasyA2eovRxhcDlEjD6z0ggSStH52tSQoJOcnTx+eVrI6BM9HIRx3NkFh5Ky4CfCZ3Oy MLTy3rTzd5sf9NowNvm94lXAGk6jmc50J4deRHZBq7EeP+Xrkgh7BDRlJSzJ4noKEsXa s/V1zT4jJUQF80h3fmDfkGM7mTKykDGhRh4e21S9YG/fxk6BBCZAEQEzH8lmn9vcXuMI O4NrJa5FL/5DWTfh9CV67R/6KSkBtSu851wqYZwV+cAF2nt9kqPCxhnBhzdQTv9bOFgy NFXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=SQjt9CiyuCtAShLmeoTWvzbfz0amwicekwyp1gKAAew=; fh=cxxOfkvSNwU7dQEiQrNH182xYoQAXyouufPM4TawM+8=; b=LaGI9zCPhUllqo4aq6qlElDeZqPMXBvZaCiXWldB3YJvl7fyS1YlcqnZozIq+qfmXZ L18HmA9m0JIskItajubX7gIH09HldfCisbtsGWfEmuj4E+RFl/alygEr4fa+vNlmxUde aCFnf72dZvFe0GzMEdPaHhLDCldno9zza87YXrDheMzKtUICDx36IYZIujbz0UDJDCnO pLzgB4oGpYnjM2D1ofQMNDj3P4RhiEobfOxdIiJ0fToPGnh3hyzPd3g3j9sGLRMy/eDe 1CHf5qgaknKBaipWJQiq9T/Z20ZgoLu3ZDmzOFWpOoR0gYlAbT0pucaPrpDvIlNXW349 wYgA==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773727192; x=1774331992; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=SQjt9CiyuCtAShLmeoTWvzbfz0amwicekwyp1gKAAew=; b=mfkSaz36KQEM1IGgeQUiDpkY0xVKXthBqZlX6dJGU6hVphllBFdG2lUXQF19F8lY9a 3RhLPLRAyFz+RRPI0Uzssd5AGVZbR+UMIduVRB+5sQq7T22PK5I8Vu5dYEWz8zGDTKyT 7rzK0ueQ6FEq4ht+VII+LDXGeZjKWi8qfqpMhg0YE1itc2JBSrM976OPG6xd6YcQ85SZ QV/J3GhtJtZwxzIzQDxmZ1npkm/UfyLZNg64DcCVCT5hZGMsLItKL0zJMi8CaGG/od50 0wMZKfMBoNU0NSb8xdb6X62oYiUjHlVGdMugY0rS4L7cgxFAOYtVqCKQb8YsujsNW4VH ZoMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773727192; x=1774331992; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=SQjt9CiyuCtAShLmeoTWvzbfz0amwicekwyp1gKAAew=; b=EpuYBHrU3fGhId1pRdrA0+fvP6x5fXhSRMIFvQtoCz7rjYcDoGlzWWXcUQss0XoDCb 8x1ADDPnf+N9LJMvuCuZL6tQMgRYZke2vD8uNS/x8QaB5PkW68IYSxC963jID94nL0Th xI3SmkGS0Goyse5ubNNy+9hO5EmHytA2jgbV0D3NAJHXGtuiDwf8CzPCh8bffdGYEB88 ESIW3lT8FJ38vHwn/ykH2ES/GcTKUZvCFGATRkZfR6PN6fRniKS934hHaXHVc94/nSTA rnWxOXidGMW+tziN0JgIK6bwOIYGtzMoNU/YdVQ7sMGzwa+e6Y31etoOsev3OGe3fTm1 vpRQ== X-Forwarded-Encrypted: i=1; AJvYcCWtEjuEeIw5bySzEtc6I9i/j7x95YUEd2ys+QuAgZojEX5OhCFuejHlhdSDVa1LqR5/EGZPD/bExOvsjc+/@postgresql.org X-Gm-Message-State: AOJu0YzRtTux3FA+3sF8L8y8J0AIxhvcqV1zKClFyFtaUOMFXX9hsDOv 7HgAmBZMkCJ0KClRmpW3CEJZ8hB1t3uiAtT/UnO+3X5yPbX9uXzEtI4ILRkyuOUrRRCmW2Eof0O e+arqLvSVIhS+1VG4+SPkEf7KGISrgGQ= X-Gm-Gg: ATEYQzxNssQiROmh6ej2kiNgIFohJ4bGkvAGY+nvPy+rZHxJtooUmtuaYY4Ys+3mRX/ 6kIufHuJp6q863RO/uw5Stpuwz36czlZJ0cBe8fyrZ0hozT+qkxhzHpCUS3mQBpK1a/jE4G+Phh Ba67h/qiDuIHQzjckpgTRD+7QqBLanl4fxDKid1mtcHcd/n5w0U3BDvOIaf7xWjpqUYWjMpkB+B JIAy5y2v+3cPf26GCU8nDH4JsX+a5Lb8jX9P8KKYNiglbDGFOVzNNlhPi9UWHeo0qvGZec0jFJL +SybivGBmKAbwZw9zLIuJo82+d53frhJoHfQ5LzT8y+k/INeqBb3xXsgkICW2jCpm+n6eJXxV6O 9pgKd/ok= X-Received: by 2002:a05:651c:210e:b0:38a:27e:b904 with SMTP id 38308e7fff4ca-38a8965822cmr53351231fa.4.1773727191860; Mon, 16 Mar 2026 22:59:51 -0700 (PDT) MIME-Version: 1.0 References: <149ff9264db27cdf724b65709fbbaee4bf316835.camel@j-davis.com> <830a2bc6cbbb2e6e01c6c0d9f31f320822e10603.camel@j-davis.com> <433d0845248e86c0317d9d396926182cfe157340.camel@j-davis.com> <05ae37abb207cd6bf6b126780024692d91402b0b.camel@j-davis.com> <93392ffa941ab0d436e19e0ab5d04d0e42c02d3f.camel@j-davis.com> <26be917cb07b6aa3ef5dd15f6b59d1b375ece6e8.camel@j-davis.com> <55201bd916e748acfc754c8f95880dae8e4e5ed0.camel@j-davis.com> <2a89b14a2b1622bffb8b137ca1f9ab7866f2d2b9.camel@j-davis.com> <61831790a0a937038f78ce09f8dd4cef7de7456a.camel@j-davis.com> <0910b47040406c1d24ec0150dafb5bae6b910ed7.camel@j-davis.com> <7338f22c4534322a08ab6ce9f879e2e308eb5e5d.camel@j-davis.com> <34fd5885b8245d1014f4426ea22af61229d42e3e.camel@j-davis.com> <7a5df376fffb273430aec9e89f88c31d52dcf295.camel@j-davis.com> <5dfe845221db2e7d38fc7c2a18a4ba5ea29cdfc0.camel@j-davis.com> <60ff024706fe1beab62a89ac07eb6a721856de2e.camel@j-davis.com> <80303af653a3da2a94e32ff91d6538675e921bf0.camel@j-davis.com> <7eb0c03b4312b32cb76d340023b39a751745a1f9.camel@j-davis.com> <25e841738fba648755cb3882327f4744f4c8cfe9.camel@j-davis.com> In-Reply-To: <25e841738fba648755cb3882327f4744f4c8cfe9.camel@j-davis.com> From: Amit Kapila Date: Tue, 17 Mar 2026 11:29:40 +0530 X-Gm-Features: AaiRm51MAgA49NQsK56Q0GR6KdV7gMA_8E5_b2g3EoC8-somm7EPW0ZPqodiQek Message-ID: Subject: Re: [19] CREATE SUBSCRIPTION ... SERVER To: Jeff Davis Cc: Ashutosh Bapat , Masahiko Sawada , Shlok Kyal , Bharath Rupireddy , Joe Conway , pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Mar 16, 2026 at 9:56=E2=80=AFPM Jeff Davis wrot= e: > > On Mon, 2026-03-16 at 11:08 +0530, Amit Kapila wrote: > > Won't it be sufficient if we just reset MySubscriptionCtx here or in > > callback subscription_change_cb()? > > The old and new subscriptions are compared against eachother (to see > whether to restart the worker or not), so they both have to exist at > the same time. If we put them in the same context, then we can't reset > it. > > I suppose we could have just two contexts and switch back and forth > between them, resetting the last one. But that doesn't seem to be worth > the trouble. > Yeah, or the other possibility could be to let the newsub information get allocated in the current transaction context and reset the subscription context if we decide not to exit from the worker. Then copy/get the subscription info in subscription context but not sure if that is worth it. The minor oddity in the proposed approach is that the worker will exit in many cases after allocating the new context but that may be the best we can do here. --=20 With Regards, Amit Kapila.