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 1qPFrX-00ASnk-RB for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Jul 2023 05:18:03 +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 1qPFrV-00DYnf-DP for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Jul 2023 05:18:01 +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 1qPFrU-00DYnX-UC for pgsql-hackers@lists.postgresql.org; Fri, 28 Jul 2023 05:18:01 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qPFrO-001ykG-V0 for pgsql-hackers@lists.postgresql.org; Fri, 28 Jul 2023 05:17:59 +0000 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2b701e1ca63so26559871fa.1 for ; Thu, 27 Jul 2023 22:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690521472; x=1691126272; 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=Y7ZAOAyjKfqBfjmoXvsWPWetUS0PXlwnGEmdTddiwEg=; b=TOeb+KXqosvOPDs1vXksLqIWHaXvhqgfG3BiGRghE3tQ8XwVGMH3wQPMyFDylGdrf9 4IiVQ9lC02q+pVli+PDWQYAdrhPjL0rrq60HGFJdlgP9xKHWmImcv79D8rRdhj9uOx3r zEOMlrLQmqOxgqBjPViZ6QjhODvXijzAOgEF0cGaToebya8VDfnAy4RAyssAVxCfHDlY /VuQGc/QFV3XfpCO55HQmn8pBTfuOdA8fuUbgqs7ZdJW1nswNG77zO5+LLTiPxtaKW3T pk5PH2Jluag4OReNzlCqo5RL1q3oZmUpe2+nVzToAzUGUNTdglUZ4ajpwM3As2BvalAB pTQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690521472; x=1691126272; 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=Y7ZAOAyjKfqBfjmoXvsWPWetUS0PXlwnGEmdTddiwEg=; b=KseMUJuXLRnowJzSQOAcA6WL+I10D50ZVIqbBohSUhXyX84UNfBaDr9Di65tUNccru srpLCxgRimd33YTtAvbyY5yFpWTCpzQrbS90UgtkbQRcsLFi8FIFLbNWpCniY7Ywhz8B GX4iXWLJmIhkmj3zMVWKYQbxO7NhXx3JY9/a3SL4/Ts2bQvtFE+/8ui5tYKqxqViT7mP u+ff/CPUuAsrpaj93kO4hzdwvYufKPhP2XoulSTN8VLwzUfJSuGh72CJRzyOsux/M7CK Cz133RCLTaNGElCHGsTrhzob2+QpFfmzTaUThbFaSzSR1WMtcZJNs2+y/mtiJu1fDjqj tGSQ== X-Gm-Message-State: ABy/qLb5UeVW751BH9s2JdyZti4//SRJ4DP9ZuAahADia0IGNqDMdJQR 6XRJuDAUS6u94XjnF1/4TzHEjQrLMTPcLmwLzpypG4CH7do= X-Google-Smtp-Source: APBJJlGyITVmSVPwUC1SH5wrhTVZz5gf/91nfmWZHRFDE41JsyVrtDHSPDewgl3F5Xb1XeL1HfRAde9VmaibVEEhaEY= X-Received: by 2002:a2e:7a05:0:b0:2b6:a763:5d13 with SMTP id v5-20020a2e7a05000000b002b6a7635d13mr816364ljc.27.1690521471389; Thu, 27 Jul 2023 22:17:51 -0700 (PDT) MIME-Version: 1.0 References: <46e53055d8d1c92704d3cd2709c722e7@oss.nttdata.com> <20230728022332.egqzobhskmlf6ntr@awork3.anarazel.de> In-Reply-To: From: Bharath Rupireddy Date: Fri, 28 Jul 2023 10:47:39 +0530 Message-ID: Subject: Re: Support worker_spi to execute the function dynamically. To: Michael Paquier Cc: Andres Freund , Masahiro Ikeda , pgsql-hackers@lists.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 Fri, Jul 28, 2023 at 10:15=E2=80=AFAM Michael Paquier wrote: > > Having each bgworker on its own schema would be enough to prevent > conflicts, but I'd like to add a second thing: a check on > pg_stat_activity.wait_event after starting the workers. I have added > something like that in the patch I have posted today for the custom > wait events at [1] and it enforces the startup sequences of the > workers in a stricter way. > > Does the attached take care of your issue? +# check their existence. Use IDs that do not overlap with the schemas cre= ated +# by the previous workers. While using different IDs in tests is a simple fix, -1 for it. I'd prefer if worker_spi uses different schema prefixes for static and dynamic bg workers to avoid conflicts. We can either look at MyBgworkerEntry->bgw_type in worker_spi_main and have schema name as '{static, dyamic}_worker_schema_%d', id or pass schema name in bgw_extra. --=20 Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com