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 1rUTyk-00BAjC-Gi for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Jan 2024 15:55:23 +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 1rUTyi-00FIAZ-JK for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Jan 2024 15:55:20 +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.94.2) (envelope-from ) id 1rUTyi-00FIAQ-8z for pgsql-hackers@lists.postgresql.org; Mon, 29 Jan 2024 15:55:20 +0000 Received: from mail-yw1-x1130.google.com ([2607:f8b0:4864:20::1130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rUTyb-004MbK-CR for pgsql-hackers@postgresql.org; Mon, 29 Jan 2024 15:55:19 +0000 Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-603e7d19725so5694297b3.0 for ; Mon, 29 Jan 2024 07:55:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crunchydata.com; s=google; t=1706543711; x=1707148511; darn=postgresql.org; h=user-agent:mime-version:date:content-transfer-encoding:references :in-reply-to:cc:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=KCBR3Ew3I2nWqFgbnZECwRi/AO97iEiE5NK4KscpbA8=; b=TRZKd0TVUofuAvkl9RrCYGe3EHv0mqppezFwtS0KX5aLNiH3R2+Uw21wWcIcpwVCWh 1ehV+ov+q7j59meDxwV6fuU7OBO7AcGzhOQKtVjV+N5sOOQ/G/6/vDoBiesnud+4tZSr O1xfAfk45Atg8/ncw9wrS5l2At8ACGoD7EPOTY+2BQMbJ9lUg/hVBnJ/gajrtG1Ccrzx JQFSXmIdoY8Rsk0/L5PHot6Cjh5S4O/S4fUSx2h8r0U2+3mWXoAByZmj5bW/0/M1K7HH fUE0eSO2u6kHuNdIaRDQs2mQaKkyaZu09sYGRiRMCDBVs32jgVmspvyS3EgXdRCPk1eu LlHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706543711; x=1707148511; h=user-agent:mime-version:date:content-transfer-encoding:references :in-reply-to:cc:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=KCBR3Ew3I2nWqFgbnZECwRi/AO97iEiE5NK4KscpbA8=; b=sR6b7bpNPqXQoDz9JPWYawFY+1Sd74LOoaBgRIR1g7W965fwJiUkvrEp9wKQlmGfWz ORykXbrm7ob9Wap861/iDdlKF/6OYzC3lL2qNkqTo1wlye+1FnbWWSTjKUUc725d/PKe CeamGONxXUfz6upBIP3TMPpe/8F/LkKjqdKacoByT2Wv14dFaIItN5EfGqylCEO5GksO 8nQQIu8WiMuA+KTthPxCVBYT+6gDktJ3K6JLHjwp/MlFW2wvft1HxEPF6URc4JJ/Dk28 3FT1DzE6zOT15/UaP1HRHX/jkyS1Tf0uqM1NBypHhGtGTZbIXH0uBW5lA6baOLg/s3B9 pKSg== X-Gm-Message-State: AOJu0YzjIlWudBhduEggqEm4gbtoPjb5hvwKdMpWnbhlMebMtp0G2g61 IboU6hbn3L73LPD91HXPYfWSgnwvsATRLZOSNCNlz6RucLxx/wCIizBz4OxB2Ps= X-Google-Smtp-Source: AGHT+IFFbFDMQBsSgztBvjVm4VGArHYDAZYO/Frm7yOhuXiFyrUMhcJhjkFnMpfSfITUZkErWBYirA== X-Received: by 2002:a81:980a:0:b0:602:9c74:2285 with SMTP id p10-20020a81980a000000b006029c742285mr5473911ywg.29.1706543711253; Mon, 29 Jan 2024 07:55:11 -0800 (PST) Received: from raker.lan (024-163-071-136.res.spectrum.com. [24.163.71.136]) by smtp.gmail.com with ESMTPSA id g129-20020a815287000000b005ffb07cd487sm2553563ywb.112.2024.01.29.07.55.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 07:55:10 -0800 (PST) Message-ID: <5997ff317a5827496537580078bcd19f4441f8d2.camel@crunchydata.com> Subject: Re: Refactoring backend fork+exec code From: reid.thompson@crunchydata.com To: Heikki Linnakangas , Andres Freund Cc: Tristan Partin , pgsql-hackers , Thomas Munro In-Reply-To: <08eff756-beeb-4a11-9eb5-d45b6af38998@iki.fi> References: <7a59b073-5b5b-151e-7ed3-8b01ff7ce9ef@iki.fi> <20230710225043.svl7fqxecwshwc7a@awork3.anarazel.de> <119551e6-60f6-49b2-ae04-a382a89f900c@iki.fi> <20231130202648.7k6agmuizdilufnv@awork3.anarazel.de> <59527c9b-c3f7-4d0c-a3f1-00d0ed5cc186@iki.fi> <20240122210740.7vq5fd4woixpwx3f@awork3.anarazel.de> <8171f1aa-496f-46a6-afc3-c46fe7a9b407@iki.fi> <20240123195009.44wtutga24p5sh3s@awork3.anarazel.de> <08eff756-beeb-4a11-9eb5-d45b6af38998@iki.fi> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Date: Mon, 29 Jan 2024 10:54:52 -0500 MIME-Version: 1.0 User-Agent: Evolution 3.44.4-0ubuntu2 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2024-01-25 at 01:51 +0200, Heikki Linnakangas wrote: >=20 > And here we go. BackendID is now a 1-based index directly into the=20 > PGPROC array. >=20 Would it be worthwhile to also note in this comment FIRST_AUX_PROC's and IsAuxProcess()'s dependency on B_ARCHIVER and it's location in the enum table? /* = =20 =C2=A6* Auxiliary processes. These have PGPROC entries, but they are = not =20 =C2=A6* attached to any particular database. There can be only one of= each of =20 =C2=A6* these running at a time. = =20 =C2=A6* = =20 =C2=A6* If you modify these, make sure to update NUM_AUXILIARY_PROCS = and the =20 =C2=A6* glossary in the docs. = =20 =C2=A6*/ = =20 B_ARCHIVER, = =20 B_BG_WRITER, = =20 B_CHECKPOINTER, = =20 B_STARTUP, = =20 B_WAL_RECEIVER, = =20 B_WAL_SUMMARIZER, = =20 B_WAL_WRITER, = =20 } BackendType; = =20 = =20 #define BACKEND_NUM_TYPES (B_WAL_WRITER + 1) =20 = =20 extern PGDLLIMPORT BackendType MyBackendType; =20 = =20 #define FIRST_AUX_PROC B_ARCHIVER =20 #define IsAuxProcess(type) (MyBackendType >=3D FIRST_AUX_PROC)