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 1mvN7a-00036v-2y for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Dec 2021 17:22:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mvN7Y-0001b2-Hg for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Dec 2021 17:22:16 +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 1mvN7X-0001as-Sb for pgsql-hackers@lists.postgresql.org; Thu, 09 Dec 2021 17:22:16 +0000 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mvN7T-0001xy-Nm for pgsql-hackers@postgresql.org; Thu, 09 Dec 2021 17:22:15 +0000 Received: by mail-pg1-x52f.google.com with SMTP id k4so5657708pgb.8 for ; Thu, 09 Dec 2021 09:22:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=/7GP7I0Qh0wY73JWDp1mmUejTe7/gQiq6hlV7S4HGW4=; b=ZUDcMV9+bt1dU5S+xnVp4vM5pvQThEznrDnQCjArC3Rj1s6Bes4nKhZpt4WMkfbs9C 5G+qs9dedkwkcrlYp8wDDmpqVSkrgmHS9yN8B8NXHbjCxNpQeom0EMdhPEe8d49/2qYT Cyw3dT+DuALeQIiPFbj9SkbehtNfE8LqcdwXV0NDkyCRWD7EkP06z3vKaajlEsLr5TNU DZ3A0bzC9h5HfG6T6UEIkFMxrquOSTNycFvQZ6sP7J9v9SYq/TTRbUkMUUOHf8drZkpd jIHDyeroAYHNprzLNpDwtgW/m+SoYNoyKTgQpTIKj52+t66Kz1ecNIilWvGH2GaO1gej 9AYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=/7GP7I0Qh0wY73JWDp1mmUejTe7/gQiq6hlV7S4HGW4=; b=vsOzfdKAy9lHDln0B6S9Nt8Thru9auscs4Bln32apz15uAXQ4Cz2Z7qbfyFJrMxzWo EZdo95klh1/WErp1BN+YfP8RID6k8j/8mvizpiw97FhmWw68hfGuYPHgxJ+5qCP8WYwk b1ozAHLSztZYPuhbEXSfVoKIiOP4/H2lfZM3YDjNUr0cng9BuOGNC6s7/AJ+X2XOBz1I vPLFIOWayIz1tVHXB83RuGE/q4gbTl4VKOzmOsK1BoQXHUhjGPYfZNkF9ly0Td0zitmb 45jiPYD88jEHJxc8GQrRZz/6sL7czyVTRW19jmkIBeiPdo/HTJT6Verovo3JXD/Xu6hm tBfQ== X-Gm-Message-State: AOAM531f2DJpFOOgARCw2SDkPFuRCYTk3z0lLf8pdCjdTc+1uv/1onBB NRyZJ4GXuK9hC7OHl610uTdXGx84HOiynejmIHFXNQf8HLRYbw7zCAacGYjpohOb3QfpyuvDzEp F9nzWk8SVILpaZVZ10wevX15bJL4SiqfAmZjMV1zbtf0t8VGLW7O3q4yHKBSlN7swkhMEJkeww2 wqJMhayBN5pI82IayqD2D7I1hu/54QqPxRq7ID X-Google-Smtp-Source: ABdhPJyPzzFN9ldi1Pgq6lG4qfVjgv5A6fMGGDBAPGkaBfyWxy1zCyjLCnlXAZcf+IrKQdU9ti/uJA== X-Received: by 2002:a05:6a00:1409:b0:4a7:e94c:9309 with SMTP id l9-20020a056a00140900b004a7e94c9309mr12891589pfu.40.1639070529259; Thu, 09 Dec 2021 09:22:09 -0800 (PST) Received: from laptop280-ma-us.hitronhub.home (24-113-193-150.wavecable.com. [24.113.193.150]) by smtp.gmail.com with ESMTPSA id r11sm288204pff.81.2021.12.09.09.22.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Dec 2021 09:22:08 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: Non-superuser subscription owners From: Mark Dilger In-Reply-To: Date: Thu, 9 Dec 2021 09:22:07 -0800 Cc: Amit Kapila , Jeff Davis , Andrew Dunstan , PostgreSQL-development Content-Transfer-Encoding: quoted-printable Message-Id: <7C8B9FA7-FECA-4C1C-9D0D-FCFE68C93EC3@enterprisedb.com> References: <9DFC88D3-1300-4DE8-ACBC-4CEF84399A53@enterprisedb.com> <6BB4451E-7B1B-474C-BD1F-DB7531E720C6@enterprisedb.com> <6A2B0FF6-CC86-48CE-B0D3-5401AA5CFEA9@enterprisedb.com> <1BB0A553-3FE9-4A91-A975-6F9D8C157FBD@enterprisedb.com> <7C62876F-5D19-4B5C-96AC-5590B10A49B2@enterprisedb.com> <66f55a6b9ff7bdd6bfd0d05e8fd8351690e69e23.camel@j-davis.com> <18b267939a9d1ae27e9b3643d53395f4e29ea6ce.camel@j-davis.com> <785e8b8ab06f123cf754862557bd3171aeba4d65.camel@j-davis.com> To: Robert Haas X-Mailer: Apple Mail (2.3608.120.23.2.7) X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Dec 9, 2021, at 7:41 AM, Robert Haas wrote: >=20 > On Tue, Nov 30, 2021 at 6:55 AM Amit Kapila = wrote: >>> This patch does detect ownership changes more quickly (at the >>> transaction boundary) than the current code (only when it reloads = for >>> some other reason). Transaction boundary seems like a reasonable = time >>> to detect the change to me. >>>=20 >>> Detecting faster might be nice, but I don't have a strong opinion = about >>> it and I don't see why it necessarily needs to happen before this = patch >>> goes in. >>=20 >> I think it would be better to do it before we allow subscription >> owners to be non-superusers. >=20 > I think it would be better not to ever do it at any time. >=20 > It seems like a really bad idea to me to change the run-as user in the > middle of a transaction. I agree. We allow SET ROLE inside transactions, but faking one on the = subscriber seems odd. No such role change was performed on the = publisher side, nor is there a principled reason for assuming the old = run-as role has membership in the new run-as role, so we'd be pretending = to do something that might otherwise be impossible. There was some discussion off-list about having the apply worker take = out a lock on its subscription, thereby blocking ownership changes = mid-transaction. I coded that and it seems to work fine, but I have a = hard time seeing how the lock traffic would be worth expending. Between = (a) changing roles mid-transaction, and (b) locking the subscription for = each transaction, I'd prefer to do neither, but (b) seems far better = than (a). Thoughts? =E2=80=94 Mark Dilger EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company