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 1vrwNN-00DzeP-34 for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Feb 2026 11:02:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vrwNM-001kba-1H for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Feb 2026 11:02:48 +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.96) (envelope-from ) id 1vrwNM-001kbR-06 for pgsql-hackers@lists.postgresql.org; Mon, 16 Feb 2026 11:02:48 +0000 Received: from mail-yw1-x1129.google.com ([2607:f8b0:4864:20::1129]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vrwNJ-00000000sRt-0wUG for pgsql-hackers@postgresql.org; Mon, 16 Feb 2026 11:02:46 +0000 Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-797d3864d89so3916847b3.1 for ; Mon, 16 Feb 2026 03:02:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771239765; cv=none; d=google.com; s=arc-20240605; b=JmuG2AWaS2dnIJR5/iOXWFcLLMNKEsqreOz23Ws72cOWVxgEi5TRqns78093xqmQG8 M8Ngd+Q5SYiPdpsCyLnR3L8UIi8FOE8SV6a6IrlWOKLG52Z0V7YxFvN1B5LhmkDyRk9n Zp1xLMP9/ZOc3LxLJbxEXksdIjrPFrplnTXVVXk1EZd+dfYP0p+qZCraabAeT1Qvp0n0 200BzuPPX773hybGGZ1HV20FI5gX10aAYpAE+1lFOzfMoH8cl8/xoyLOByFSBpIJ0sqs OdkhJjKaCeUGlhq8VbOWfp+zBLXK8JsQFV9oIYHlcXMTnhmhMqPQJYHGH6ylJ1Xv2FeW Wr3Q== 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=XMh2OeFZeaUenZXYxba0bc0CcRU4Bcb1onqdza3d6d0=; fh=2kcFYnOq3WdYgx/SApfYX1kHtvuIpyd+J3zgLdafLq0=; b=N0C4IcPbTY3/Fn7d9XsO5jQUOHlsiyKUmkB6EhBZoQtOSOvujT6Z81LqqO2q5YYYFo SKdN7PLDTGMiqDOW7RpBGpNp8S2eWdko8gzlOWrcpRWxpc9OxfL0ZBlikLLxjEbNt0BA MAl2oxWcmTPNDdOmNEM8T+z3Crj1am4EQLykuMCvFA5aoqr0+Vsn6quU+OhJ5lmYYYan wO6QQyyeoSozLqW11FkXkPRVWxQM1Tj9+6uVERv4agwODvrEJRzkgXAKisJxeBqg8FES fCz+NlM+qW9GurFdtytuj4xFpnIypbnwYEcfLk37QPzMWoyicHwpK2vxTmiEiwtIm8Yn 5bZw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; t=1771239765; x=1771844565; 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=XMh2OeFZeaUenZXYxba0bc0CcRU4Bcb1onqdza3d6d0=; b=aPDKNelW/upU1Kle8TYbr/rhwSthGb/L648Ay/woaNCY4wm/G7S6UPicBWibRE1qFs H7DKAJ/nhwXjl4cZeLR4X4Fcv+Q9zqgoUxLbtXMouD8cu6QaonHuX/FUDE1gKLuTavPU fl60q0pY4Tkd4ReDOHH+igcs6MkwU1pVoAHqU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771239765; x=1771844565; 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=XMh2OeFZeaUenZXYxba0bc0CcRU4Bcb1onqdza3d6d0=; b=YAkGbs699is/odjVVV5XHduElRemsfL3kXihn2cBY6t9DgzSK1KuUgQiWpUjCGdLGU MSup7diKeXi1r3sGzJBkcFSBBffG1IjBR/MTxa9ERn0pEqwELf5p8jWzgAkYtDT+9msr SW8OXmLXaO1KCAGkmEaf858Y54hBYtvW6Pq6kzFifVKXKovn7iQ1IHRSArEuMTOA8e7S zAHuDesxqS3DjglGc6eGbYHKBoLr0hkvIJSsQsVOUl4CGc7P3dy3po5lsEcBH2sW9W+P yVMfnn2zIc8/9qUSQy4cgjq+OzILw3JbwgxeV4kRmzDl1ClcokGdu6VWadNpyybMojJO Q4gA== X-Forwarded-Encrypted: i=1; AJvYcCUxLI04ipsGcCcGjFTZV1D4EbxzWnmhGqCq0XPHYx5iODAUCXRicl4B3LesLahFxj2hPfwYKF7xU0RrV6Yf@postgresql.org X-Gm-Message-State: AOJu0YxJGanO7jlJ5WYxdN6J0P9Jv401/Ru8Wxx9F9PhdHXeTqrxEizW B4mHPmhnXrRXRcF4wFbgVR9FI/HKfhgPO4e2wHROtv5WPF/UC8ZoXjcOWZ7sSQqGdnWErayPWmM tqbp+p4cH0gVmPsEBnT+za8Dy/DmodBpk+/C6cB1BTw== X-Gm-Gg: AZuq6aL09LwGgeBV0LTo7p8fBvP95A6oEAOWetsRk5gz5oWnY1obCrfYCmY1jqLVTVh BghdiaZq15Udwuw5hVSN4iz8QP28t5zXrvSbYSMgVFcoWKw4CuHrIBJaNXSiuiFaq729O9/zPrV 4q/uIk1IYXWJCEYcc2WYpj6vjjg0w7zy/SAmI8h5Y8qPn1aZBL4jyvBB5KX61Kt3Uh1tq/KzXKx uZYDW8s4rid5v9v8MeMHgKvgVnqUxCEf1F5E08R6XrRkXUkXjzwS+uysHsrg2Hw6x5mb/UJQbkC 8sNWyA== X-Received: by 2002:a05:690c:c0b:b0:794:fc73:5d2e with SMTP id 00721157ae682-797ac613d09mr60806777b3.54.1771239764693; Mon, 16 Feb 2026 03:02:44 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Anthonin Bonnefoy Date: Mon, 16 Feb 2026 12:02:33 +0100 X-Gm-Features: AaiRm52EMGkodb2p-q6Hvb5tZkeXr4FTTJ8NFlYP6HAJcxSakWX0MHVNH92IFVk Message-ID: Subject: Re: Fix uninitialized xl_running_xacts padding To: Bertrand Drouvot Cc: Michael Paquier , Thomas Munro , 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 Fri, Feb 13, 2026 at 11:08=E2=80=AFAM Bertrand Drouvot wrote: > It's not as important as when a struct which is used as an hash key has p= adding > bytes uninitialized (and byte comparisons are done on the key) but I'm al= so > +1 to make it "cleaner". Yeah, there's no direct issue of having those uninitialized. The only impact I can think of is reducing compression efficiency of the WAL due to the random padding bytes. On Mon, Feb 16, 2026 at 8:29=E2=80=AFAM Bertrand Drouvot wrote: > > My memory on the matter may be fuzzy, of course, but the initializer > > does not guarantee that the padding bytes are initialized to zero > > because the padding bytes are not associated to a member in the > > structure. A memset(0), however, makes sure that the padding bytes > > are full of zeros by taking into account the full size of the > > structure. > > That's also what I recall, and what we followed in [1]. I think that depends on the C standard used. With C99, there's no rule for the padding bytes initialization. With C11, in 6.7.9 Initialization of the standard: "the remainder of the aggregate shall be initialized implicitly the same as objects that have static storage duration", and with static storage will "every member is initialized (recursively) according to these rules, and any padding is initialized to zero bits". So if I read this correctly, '{0}' will set padding bytes to 0 when using C11. But given Postgres is using C99, that's not something we can rely on? > > True about the initialization part, mostly I guess, still we tend to > > worry about eliminating padding because these are wasted bytes in the > > WAL records. For example, xlhp_freeze_plans has two bytes of padding, > > that we eliminate while inserting its record by splitting the > > FLEXIBLE_ARRAY_MEMBER part. > > But in the case of this thread it's in the middle of the struct, so I'm n= ot > sure the "wasted" bytes would be elminated, would it? Moving subxid_overflow before xids, wouldn't you have 3 bytes of padding at the end of the struct for the whole struct alignment?