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.94.2) (envelope-from ) id 1qjveo-00Ccno-0x for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Sep 2023 05:58:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qjvek-00AJX2-OH for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Sep 2023 05:58:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qjvek-00AJWe-E8 for pgsql-hackers@lists.postgresql.org; Sat, 23 Sep 2023 05:58:18 +0000 Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qjveh-0069VA-T1 for pgsql-hackers@lists.postgresql.org; Sat, 23 Sep 2023 05:58:17 +0000 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-1dceaa7aeffso165273fac.0 for ; Fri, 22 Sep 2023 22:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695448695; x=1696053495; darn=lists.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=n9+LayQAQNzW9pBbjtx3DNXhLWLgqr9+KNLkYoih+vk=; b=f1bIsG2JwIi0Bwr+jkOIPnwzemXjN3/8AXs7eCohOZvhqoI/RcU+hrTen/5Sh3O7dw LAAHxkvASRh2C1wwmK6m5heoqJq+7tZ3+KejU2kLnr76DWYfgENlr0No5TZLx8C7Rhwz tHbXItw3Oh4AhwnnxqfTHvWCfmaEU5tPmTQJOKOJ6SV1RiGw576x+jcX6jWZYZLRUK8z T9y543uA8dlMTWjaoIwEnEgYTXQuKc5C6HIFhuGOhvBl5SoN/sJn7mzG/tHN/pyAuGU6 BTEWP2VvpvMkDjepnEeAgXe7PYxIaHpk6cPsNKHUcQIpDBTW0le+62I99LgB0B4vyMWK 0vtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695448695; x=1696053495; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n9+LayQAQNzW9pBbjtx3DNXhLWLgqr9+KNLkYoih+vk=; b=TwSNguh6GyyDGmUHr3Xv39GzdbhiGLmN5EdjGuFZPspnFrIjj//yJ4EdgP6gMrA84s BfCOHwJ4q36QuS4R08jO6TNztSaE+34tjqNt1I+ZtA2HiEE0rccom8GKtgCuEJoDG/6U OQI2dhRcPn3VrsSdQKhPrY+i9UlUYqXEOMDJ8HLtE+wftIAFEKvW+vBUDBETyd7haGfy FFJeVnkaswkXBkK76zD1PfImlKuKpd6+zVrsCRI5X3DmmBdMMyE0fotwpZWzw7QINvWN OXlJlVXkoU/clhjfzLFsn+3ZoS2w54AyUKfF8jCe/tPaHqvZ0k078YVuS3onhSuwy2k4 l0/g== X-Gm-Message-State: AOJu0YxuN/fkSokP5tltC4rySnoFQ19EbPPNBKrimtc3q49LX6s9YSSq 6mpzTjqHPP86XM9AunAczO7kb/waLL3B/bG19N8= X-Google-Smtp-Source: AGHT+IETw3MghgK/lpqgXZmEOtxWFFEmZ2HOUYaTcvWzvDwS4Cgi2ggDKzzMe0cUqbv1Hv0bXRD8/6T3PBZ7b4QqpX4= X-Received: by 2002:a05:6870:3321:b0:1ba:bef6:9d80 with SMTP id x33-20020a056870332100b001babef69d80mr991721oae.4.1695448695199; Fri, 22 Sep 2023 22:58:15 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Sat, 23 Sep 2023 11:28:04 +0530 Message-ID: Subject: Re: Invalidate the subscription worker in cases where a user loses their superuser status To: vignesh C Cc: PostgreSQL Hackers 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 Sat, Sep 23, 2023 at 1:27=E2=80=AFAM vignesh C wro= te: > > > Fixed this issue by checking if the subscription owner has changed > from superuser to non-superuser in case the pg_authid rows changes. > The attached patch has the changes for the same. > @@ -3952,7 +3953,9 @@ maybe_reread_subscription(void) newsub->passwordrequired !=3D MySubscription->passwordrequired || strcmp(newsub->origin, MySubscription->origin) !=3D 0 || newsub->owner !=3D MySubscription->owner || - !equal(newsub->publications, MySubscription->publications)) + !equal(newsub->publications, MySubscription->publications) || + (!superuser_arg(MySubscription->owner) && + MySubscription->isownersuperuser)) { if (am_parallel_apply_worker()) ereport(LOG, @@ -4605,6 +4608,13 @@ InitializeLogRepWorker(void) proc_exit(0); } + /* + * Fetch subscription owner is a superuser. This value will be later + * checked to see when there is any change with this role and the worker + * will be restarted if required. + */ + MySubscription->isownersuperuser =3D superuser_arg(MySubscription->owner)= ; Why didn't you filled this parameter in GetSubscription() like other parameters? If we do that then the comparison of first change in your patch will look similar to all other comparisons. --=20 With Regards, Amit Kapila.