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 1tFnwR-00GBgZ-68 for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Nov 2024 05:16:51 +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 1tFnwP-003vWl-QP for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Nov 2024 05:16:49 +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 1tFnwP-003vW3-Dj for pgsql-hackers@lists.postgresql.org; Tue, 26 Nov 2024 05:16:49 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tFnvl-003p6q-7t for pgsql-hackers@postgresql.org; Tue, 26 Nov 2024 05:16:47 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-434a044dce2so18432295e9.2 for ; Mon, 25 Nov 2024 21:16:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732598167; x=1733202967; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=w+lpLHC2QN/FjMqRyYWb6cEOACdejMLBY5UGegkjg/c=; b=loR16SuW5SEe7fsoap/4GnCF4g9xp96roAbOy/Na+n3KUdTd6R+KSBsvYzmFd+IbD8 adwG6lUiwcJaK9lfvCKTNgfh/nIoiKKvug6PkUnNhHxxYj/DfGel6wQQFwgLqSzrcD5k MQUqwSwYtPFS1h/fYTkNIFkpcavmiiU6buRKvgi4TjNfenQT2DAAttGoRVwTOGFkkZAE Tgq+qPEI27dq2pb7nmPbP6KiRF7U9P/nys5zaGXqFwJ3rrA0iTbm32U7an9iVgt6NUkL 4LT3PzNqsBnHlwQdo9bsUgoRdMfJFhXwfR4HJvlv72Y6zW1TWt+Lm4Dh5nY7gBq/L+BM PNvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732598167; x=1733202967; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=w+lpLHC2QN/FjMqRyYWb6cEOACdejMLBY5UGegkjg/c=; b=aWDXQJqpveE2eXvMkE7ekhlOkoDBJwjNAUtTljPycBte0+UQEvexsqmRShmYQF31oB hVFIt72Pea2Y9addkt8+7ihqQNi7yFbuj4VhfpFHgG7dgX2Dm8KkNQm70ljoBIpFuExB tvoQxehbzi7kQ8EWTHZMRVk7Hqoa88jSnWUbJX/VVw9KEb41tx3rJ9H6KiGLTT69IE3h DorRHveuRWYEuM/lFgu32aAy3Lr0/db+id7ha0z21yDptGpGXTbe9C8ng7pEGiXJT+5P Z8w3PZYmjxvUE/aRwiza8ThmbWXdTSGyBK9cscOTFegIgFfm+/Uu+4s62/lvOHqeEnX3 2DKA== X-Forwarded-Encrypted: i=1; AJvYcCUZj0SZaPmmzeA9DNxkITmuTWJvQNw7qt/0uC0ub3fIEtA7UEsmO7Lcgc4tV89e6lK7wrtXh3PT9Kb23vdx@postgresql.org X-Gm-Message-State: AOJu0YxEsdOtIuu8wqFYy7Pa0YWbyu71RfIRtFrunUzU7g+oPjdopHiA 55//wwk0fU3JFJBqzXAIrLrLSLlOL+lYwdBPqvHosDkVLnW6dMXu X-Gm-Gg: ASbGncvNJjnNKS0gGHbiLd43qM2g28yNYHQIk5sSyT3Z7YRLl9fbkxszQa3mXiwgNI8 ZHsBAZjOzWk/rdF6VazJ7VYaJI4xA1e9xktT1/u+YlBaacoGXqwnX9yJuKJp6JWikCvDU7BCcfx QsNrdvpzwt9ItwVAF+BICQR0dzX8FVpjt8NG+1z2K52FmJiYRZjuT5o/ao1EXMsR+W0QdPvPQif 2ES/ypM73Tv1Oh1AIT8/VNk1emlhoGm7+LkLnTLee652UAWm1CFqECPAPthlCZcIOQXOIuGrBLD gE7oGR4b4ejoLdU7weowz06UeO2MNdouk+ILg69ygbqIIzW1oTbjed8+2+Vt/RcrfshqvwM/K6+ 9 X-Google-Smtp-Source: AGHT+IH0xGu6nyk4GFi6pm8XotuL8T0yFcJjO4ctSyYNPRvb5wLsbbnA+mEY899YMHd7FmfDAmV/sQ== X-Received: by 2002:a05:600c:4507:b0:432:d735:cc71 with SMTP id 5b1f17b1804b1-433ce48fe52mr140848625e9.25.1732598167354; Mon, 25 Nov 2024 21:16:07 -0800 (PST) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-236-134-5.eu-west-3.compute.amazonaws.com. [15.236.134.5]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4349d8b6da4sm76361785e9.24.2024.11.25.21.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2024 21:16:06 -0800 (PST) Date: Tue, 26 Nov 2024 05:16:05 +0000 From: Bertrand Drouvot To: Tom Lane Cc: "David E. Wheeler" , Noah Misch , Aleksander Alekseev , pgsql-hackers , Marco Slot , Alvaro Herrera , Christoph Berg , Pavan Deolasee Subject: Re: Potential ABI breakage in upcoming minor releases Message-ID: References: <2443809.1731683394@sss.pgh.pa.us> <20241115175223.68.nmisch@google.com> <2483970.1731702561@sss.pgh.pa.us> <2500050.1731705196@sss.pgh.pa.us> <900DE0C9-48C4-474C-BDC9-AD495D8D3F59@justatheory.com> <2638276.1731717056@sss.pgh.pa.us> <1576843.1732586210@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1576843.1732586210@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Mon, Nov 25, 2024 at 08:56:50PM -0500, Tom Lane wrote: > [ getting back to the document-ABI-breakage-rules-better topic ... ] > > I wrote: > > That text says exactly nothing about what specific code changes to > > make or not make. I'm not sure offhand where (or if) we have this > > documented, but there's an idea that adding fields at the end of > > a struct is safer ABI-wise than putting them in the middle. Which > > is true if you can't squeeze them into padding space. Here, that > > could have been done and probably should have. > > I remembered where that's documented: > > https://wiki.postgresql.org/wiki/Committing_checklist#Maintaining_ABI_compatibility_while_backpatching > > I propose rewriting and expanding that: > > * Don't change the contents of globally-visible structs, specifically > not the offsets of existing fields. If you must add a new field, > the very best way is to put it into existing alignment padding > between fields. (But consider both 32-bit and 64-bit cases when > deciding what is "padding".) What about providing a decision table to help considering for 32-bit, something like (proposed in [1])? 64-bit hole size | use on 32-bit? -----------------|--------------- <=3 bytes | safe to use 4 bytes | don't use 5-7 bytes | use first (hole_size - 4) bytes only [1]: https://www.postgresql.org/message-id/flat/ZzcR%2BoQmUOIm6RVF%40ip-10-97-1-34.eu-west-3.compute.internal#08182ae6a6719632acf52fe4d90e9778 Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com